junrushao1994 commented on PR #11585:
URL: https://github.com/apache/tvm/pull/11585#issuecomment-1157965160
Script to upgrade tuning record database:
```python
import argparse
import json
def _parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--json-tuning-record",
type=str,
help="path to the json tuning record file",
required=True,
)
parser.add_argument(
"--updated-json-tuning-record",
type=str,
help="path to the new json tuning record file after upgrade",
required=True,
)
return parser.parse_args()
ARGS = _parse_args()
def main():
with open(ARGS.json_tuning_record, "r", encoding="utf-8") as i_f:
lines = [json.loads(line) for line in i_f]
for line in lines:
for inst in line[1][0][0]:
if inst[0] in ["Split", "Fuse"]:
inst[2] = [1]
with open(ARGS.updated_json_tuning_record, "w", encoding="utf-8") as o_f:
for line in lines:
o_f.write(json.dumps(line) + "\n")
if __name__ == "__main__":
main()
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]