huggingface / optimum

🚀 Accelerate training and inference of 🤗 Transformers and 🤗 Diffusers with easy to use hardware optimization tools
https://huggingface.co/docs/optimum/main/
Apache License 2.0
2.57k stars 470 forks source link

HubertModel fails to convert BetterTransformer #1386

Open seastar105 opened 1 year ago

seastar105 commented 1 year ago

System Info

- `optimum` version: 1.13.1
- `transformers` version: 4.33.1
- Platform: Linux-5.4.0-151-generic-x86_64-with-glibc2.35
- Python version: 3.10.9
- Huggingface_hub version: 0.17.1
- PyTorch version (GPU?): 2.0.1 (cuda availabe: True)
- Tensorflow version (GPU?): not installed (cuda availabe: NA)

Who can help?

@younesbelkada

Information

Tasks

Reproduction (minimal, reproducible, runnable)

from optimum.bettertransformer import BetterTransformer; from transformers import HubertModel; model = HubertModel.from_pretrained("team-lucid/hubert-large-korean").cuda(); model = BetterTransformer.transform(model); Traceback (most recent call last): File "", line 1, in File "/opt/conda/lib/python3.10/contextlib.py", line 79, in inner return func(*args, **kwds) File "/opt/conda/lib/python3.10/site-packages/optimum/bettertransformer/transformation.py", line 266, in transform set_last_layer(model_fast) File "/opt/conda/lib/python3.10/site-packages/optimum/bettertransformer/transformation.py", line 166, in set_last_layer raise Exception( Exception: The transformation of the model HubertModel to BetterTransformer failed while it should not. Please fill a bug report or open a PR to support this model at https://github.com/huggingface/optimum/

Expected behavior

HubertModel is supported, but it is not transformed properly

seastar105 commented 1 year ago

take