huggingface / optimum-neuron

Easy, fast and very cheap training and inference on AWS Trainium and Inferentia chips.
Apache License 2.0
176 stars 53 forks source link

Optimum-cli export regression (0.0.7->0.0.8) #158

Closed juliensimon closed 10 months ago

juliensimon commented 11 months ago

The following command runs fine on optimum-neuron 0.0.7:

optimum-cli export neuron \
  --model juliensimon/distilbert-amazon-shoe-reviews \
  --sequence_length 32 \
  --batch_size 1 \
  distilbert_neuron/

Upgrading to 0.0.8 (pip install optimum-neuron==0.0.8) causes it to fail:

/usr/lib/python3.10/runpy.py:126: RuntimeWarning: 'optimum.exporters.neuron.__main__' found in sys.modules after import of package 'optimum.exporters.neuron', but prior to execution of 'optimum.exporters.neuron.__main__'; this may result in unpredictable behaviour
  warn(RuntimeWarning(msg))
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/.local/lib/python3.10/site-packages/optimum/exporters/neuron/__main__.py", line 294, in <module>
    main()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/optimum/exporters/neuron/__main__.py", line 280, in main
    main_export(
  File "/home/ubuntu/.local/lib/python3.10/site-packages/optimum/exporters/neuron/__main__.py", line 221, in main_export
    _, neuron_outputs = export_models(
  File "/home/ubuntu/.local/lib/python3.10/site-packages/optimum/exporters/neuron/convert.py", line 293, in export_models
    output_file_names[model_name] if output_file_names is not None else Path(model_name + ".neuron")
TypeError: list indices must be integers or slices, not str
Traceback (most recent call last):
  File "/home/ubuntu/.local/bin/optimum-cli", line 8, in <module>
    sys.exit(main())
  File "/home/ubuntu/.local/lib/python3.10/site-packages/optimum/commands/optimum_cli.py", line 163, in main
    service.run()
  File "/home/ubuntu/.local/lib/python3.10/site-packages/optimum/commands/export/neuronx.py", line 137, in run
    subprocess.run(full_command, shell=True, check=True)
  File "/usr/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'python3 -m optimum.exporters.neuron --model juliensimon/distilbert-amazon-shoe-reviews --sequence_length 32 --batch_size 1 distilbert_neuron/' returned non-zero exit status 1.

Environment:

$ pip list|grep optimum
optimum                       1.11.0
optimum-neuron                0.0.8

$ python --version
Python 3.10.6
michaelbenayoun commented 10 months ago

@JingyaHuang any idea why?

JingyaHuang commented 10 months ago

The exporter was broken by the integration of stable diffusion as I moved forward for adding new features without fixing the CIs of inference. It should be good now in the dev branch #168, let's do a patch release today or Monday? @michaelbenayoun

JingyaHuang commented 10 months ago

close as completed with optimum-neuron v0.10.0.