Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to convert T0-3B #56

Open
redthing1 opened this issue May 11, 2022 · 2 comments
Open

Fails to convert T0-3B #56

redthing1 opened this issue May 11, 2022 · 2 comments

Comments

@redthing1
Copy link

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
Copy link
Author

#11 (comment) looks related

@JCRPaquin
Copy link

A bit late to this, but this looks like it should be fixed by onnx/onnx#4907.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants