fastT5 icon indicating copy to clipboard operation
fastT5 copied to clipboard

Fails to convert T0-3B

Open redthing1 opened this issue 2 years ago • 2 comments

T0-3B is just a finetune of T5v1.1_3B_LMadapt (according to their paper), and in HF it loads via just the standard T5 code.

I am able to successfully ONNX-convert other T5 models on my computer.

But when I try on T0:

❯ MODEL=~/Downloads/PT_T0_3B poetry run test1_onnx
Loading model from /home/user/Downloads/PT_T0_3B
In-place op on output of tensor.shape. See https://pytorch.org/docs/master/onnx.html#avoid-inplace-operations-when-using-tensor-shape-in-tracing-mode
In-place op on output of tensor.shape. See https://pytorch.org/docs/master/onnx.html#avoid-inplace-operations-when-using-tensor-shape-in-tracing-mode
Exporting to onnx... |################################| 3/3
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/user/Dev/Proj/codet5_tests/codet5_tests/test1_onnx.py", line 63, in main
    typer.run(bean_cli)
  File "/home/user/.cache/pypoetry/virtualenvs/codet5-tests-LNmARMSb-py3.9/lib/python3.9/site-packages/typer/main.py", line 864, in run
    app()
  File "/home/user/.cache/pypoetry/virtualenvs/codet5-tests-LNmARMSb-py3.9/lib/python3.9/site-packages/typer/main.py", line 214, in __call__
    return get_command(self)(*args, **kwargs)
  File "/home/user/.cache/pypoetry/virtualenvs/codet5-tests-LNmARMSb-py3.9/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/user/.cache/pypoetry/virtualenvs/codet5-tests-LNmARMSb-py3.9/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/user/.cache/pypoetry/virtualenvs/codet5-tests-LNmARMSb-py3.9/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/user/.cache/pypoetry/virtualenvs/codet5-tests-LNmARMSb-py3.9/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/user/.cache/pypoetry/virtualenvs/codet5-tests-LNmARMSb-py3.9/lib/python3.9/site-packages/typer/main.py", line 500, in wrapper
    return callback(**use_params)  # type: ignore
  File "/home/user/Dev/Proj/codet5_tests/codet5_tests/test1_onnx.py", line 45, in bean_cli
    models = load_torch_models(os.environ.get("MODEL"))
  File "/home/user/Dev/Proj/codet5_tests/codet5_tests/test1_onnx.py", line 17, in load_torch_models
    model = export_and_get_onnx_model(model_path, onnx_model_output_path)
  File "/home/user/.cache/pypoetry/virtualenvs/codet5-tests-LNmARMSb-py3.9/lib/python3.9/site-packages/fastT5/onnx_models.py", line 219, in export_and_get_onnx_model
    quant_model_paths = quantize(onnx_model_paths)
  File "/home/user/.cache/pypoetry/virtualenvs/codet5-tests-LNmARMSb-py3.9/lib/python3.9/site-packages/fastT5/onnx_exporter.py", line 280, in quantize
    quantize_dynamic(
  File "/home/user/.cache/pypoetry/virtualenvs/codet5-tests-LNmARMSb-py3.9/lib/python3.9/site-packages/onnxruntime/quantization/quantize.py", line 308, in quantize_dynamic
    model = load_model(Path(model_input), optimize_model)
  File "/home/user/.cache/pypoetry/virtualenvs/codet5-tests-LNmARMSb-py3.9/lib/python3.9/site-packages/onnxruntime/quantization/quantize.py", line 53, in load_model
    return onnx.load(Path(model_path))
  File "/home/user/.cache/pypoetry/virtualenvs/codet5-tests-LNmARMSb-py3.9/lib/python3.9/site-packages/onnx/__init__.py", line 127, in load_model
    load_external_data_for_model(model, base_dir)
  File "/home/user/.cache/pypoetry/virtualenvs/codet5-tests-LNmARMSb-py3.9/lib/python3.9/site-packages/onnx/external_data_helper.py", line 69, in load_external_data_for_model
    load_external_data_for_tensor(tensor, base_dir)
  File "/home/user/.cache/pypoetry/virtualenvs/codet5-tests-LNmARMSb-py3.9/lib/python3.9/site-packages/onnx/external_data_helper.py", line 48, in load_external_data_for_tensor
    with open(external_data_file_path, 'rb') as data_file:
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/Dev/Proj/codet5_tests/encoder.embed_tokens.weight'

redthing1 avatar May 11 '22 22:05 redthing1

https://github.com/Ki6an/fastT5/issues/11#issuecomment-831478858 looks related

redthing1 avatar May 11 '22 22:05 redthing1

A bit late to this, but this looks like it should be fixed by https://github.com/onnx/onnx/pull/4907.

JCRPaquin avatar Feb 23 '23 05:02 JCRPaquin