Closed kalradivyanshu closed 8 months ago
Hey! Thanks for this, I'll add this as a feature request as the error I am getting is the following:
Framework not requested. Using torch to export to ONNX.
/Users/arthurzucker/.pyenv/versions/py310/lib/python3.10/site-packages/torch/nn/utils/weight_norm.py:30: UserWarning: torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm.
warnings.warn("torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm.")
Traceback (most recent call last):
File "/Users/arthurzucker/.pyenv/versions/3.10.13/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Users/arthurzucker/.pyenv/versions/3.10.13/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/Users/arthurzucker/Work/transformers/src/transformers/onnx/__main__.py", line 242, in <module>
main()
File "/Users/arthurzucker/Work/transformers/src/transformers/onnx/__main__.py", line 234, in main
export_with_transformers(args)
File "/Users/arthurzucker/Work/transformers/src/transformers/onnx/__main__.py", line 79, in export_with_transformers
model_kind, model_onnx_config = FeaturesManager.check_supported_model_or_raise(model, feature=args.feature)
File "/Users/arthurzucker/Work/transformers/src/transformers/onnx/features.py", line 728, in check_supported_model_or_raise
model_features = FeaturesManager.get_supported_features_for_model_type(model_type, model_name=model_name)
File "/Users/arthurzucker/Work/transformers/src/transformers/onnx/features.py", line 575, in get_supported_features_for_model_type
raise KeyError(
KeyError: "encodec is not supported yet. Only ['albert', 'bart', 'beit', 'bert', 'big-bird', 'bigbird-pegasus', 'blenderbot', 'blenderbot-small', 'bloom', 'camembert', 'clip', 'codegen', 'convbert', 'convnext', 'data2vec-text', 'data2vec-vision', 'deberta', 'deberta-v2', 'deit', 'detr', 'distilbert', 'electra', 'flaubert', 'gpt2', 'gptj', 'gpt-neo', 'groupvit', 'ibert', 'imagegpt', 'layoutlm', 'layoutlmv3', 'levit', 'longt5', 'longformer', 'marian', 'mbart', 'mobilebert', 'mobilenet-v1', 'mobilenet-v2', 'mobilevit', 'mt5', 'm2m-100', 'owlvit', 'perceiver', 'poolformer', 'rembert', 'resnet', 'roberta', 'roformer', 'segformer', 'squeezebert', 'swin', 't5', 'vision-encoder-decoder', 'vit', 'whisper', 'xlm', 'xlm-roberta', 'yolos'] are supported. If you want to support encodec please propose a PR or open up an issue."
which is expected.
I can work on this @ArthurZucker, can you guide me on how i can get started?
Hey! 🤗 I think @fxmarty will be of better help than me.
@kalradivyanshu closing as duplicate of https://github.com/huggingface/optimum/issues/1545
transformers.onnx is deprecated in favor of optimum.exporters.onnx, for reference: https://huggingface.co/docs/transformers/serialization
There is an open PR for the ONNX support for encodec: https://github.com/huggingface/optimum/pull/1620
System Info
transformers
version: 4.36.0.dev0Who can help?
@sanchit-gandhi
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
encodec24khz
python -m transformers.onnx --model=encodec24khz onnx/
Expected behavior
The encodec model should be exported to ONNX as described here: https://huggingface.co/docs/transformers/v4.17.0/en/serialization#exporting-a-model-to-onnx.
But it fails and gives the following error: