Search code examples
pythonjsontvm

JSON parsing for tvm autotune output results in error


I have the result of tvm autotuning which I want to use for the inference of a resnet50 model. How ever when I run the inference with this result tuning file for choosing the best context, I get a JSON parse error -

    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 289 (char 288)

The line for which the error is being raise is the first line of the file -

{"input": ["cuda -keys=cuda,gpu -arch=sm_72 -max_num_threads=1024 -model=unknown -thread_warp_size=32", "dense_small_batch.gpu", [["TENSOR", [1, 2048], "float32"], ["TENSOR", [1000, 2048], "float32"], null, "float32"], {}], "config": {"index": 5, "code_hash": null, "entity": [["tile_k", "sp", [-1, 32]]]}, "result": [[0.00013503773753462605], 0, 3.5121700763702393, 1656911006.6791778], "version": 0.2, "tvm_version": "0.9.dev0"}

The error seems to be between ["tile_k", "sp"..], but the JSON string looks fine to me. Could someone please help me understand what the error is? Also, I have some 15000 lines in the tuning file with similar strings, so is there a way to heal this error without manually adding some backlashes or something for every line?


Solution

  • The error specifying line 1 column 289 put me off…the actual error was in the last line of the log which was filled partially, not sure why. Just removing this partial line fixed the issue