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

Causal attention hard-codes lower triangular matrices as uint8 #636

Closed
2 of 4 tasks
fxmarty opened this issue Dec 22, 2022 · 4 comments
Closed
2 of 4 tasks

Causal attention hard-codes lower triangular matrices as uint8 #636

fxmarty opened this issue Dec 22, 2022 · 4 comments
Labels
onnx Related to the ONNX export

Comments

@fxmarty
Copy link
Contributor

fxmarty commented Dec 22, 2022

System Info

- `optimum` version: 1.5.3.dev0
- `transformers` version: 4.25.1
- Platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.35
- Python version: 3.9.12
- Huggingface_hub version: 0.12.0.dev0
- PyTorch version (GPU?): 1.13.1+cu117 (cuda availabe: True)
- Tensorflow version (GPU?): 2.9.1 (cuda availabe: True)

Who can help?

No response

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

Not necessarily a bug per se. Likely due to e.g. https://github.com/huggingface/transformers/blob/4d10ffd50614ebcdfe7e99c0092740f0f7234923/src/transformers/models/gpt2/modeling_gpt2.py#L196 . Similar for other models.

optimum-cli export onnx --model gpt2 --task causal-lm --for-ort gpt2_onnx

image

Expected behavior

/

@fxmarty fxmarty added the onnx Related to the ONNX export label Dec 22, 2022
@fxmarty
Copy link
Contributor Author

fxmarty commented Dec 22, 2022

Related: #627 #605

@fxmarty
Copy link
Contributor Author

fxmarty commented Dec 29, 2022

@sgugger
Copy link
Contributor

sgugger commented Dec 30, 2022

My best guess would be because it's very old code and PyTorch did not support torch.bool back then.

@fxmarty
Copy link
Contributor Author

fxmarty commented Jan 5, 2023

Closing as in any case pytorch represents torch.bool on a byte (pytorch/pytorch#41571 (comment)), and ONNX as well (checking the initializer ByteSize()).

@fxmarty fxmarty closed this as completed Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
onnx Related to the ONNX export
Projects
None yet
Development

No branches or pull requests

2 participants