Wanting a more precise document for polygraphy arg "load-inputs"


the document is:
–load-inputs LOAD_INPUTS [LOAD_INPUTS …], --load-input-data LOAD_INPUTS [LOAD_INPUTS …]
[EXPERIMENTAL] Path(s) to load inputs. The file(s)
should be a JSON-ified List[Dict[str, numpy.ndarray]],
i.e. a list where each element is the feed_dict for a
single iteration. Other data loader options are
ignored when this option is used
but it is still opaque.
When I want to save my input from my program, and use it as input for polygraphy, What kind of json file should it be? After looking at the source code. I found a tool in the python api of polygraphy:
from polygraphy.json import save_json

But should the inputs be saved as a list or a dictionary? I’ve tried both but polygraphy gave both errors.

Please check the below link, as they might answer your concerns

The answer to the question lies somewhere in a corner of the document: Comparator — Polygraphy 0.31.1 documentation

and will be saved as a JSON List[Dict[str, numpy.ndarray]].
This works in my code:

from polygraphy.json import save_json
save_json([{'input':input}], 'inputs.json')

Still, I think it would be better to demonstrate this in the docstring of the polygraphy argument. It would help others.

1 Like