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

hf_Bert_large failed #2263

Closed
jinsong-mao opened this issue May 13, 2024 · 6 comments
Closed

hf_Bert_large failed #2263

jinsong-mao opened this issue May 13, 2024 · 6 comments

Comments

@jinsong-mao
Copy link

Hi

I can't run the hf_Bert_large model on my local site, I was running it from pytorch repo and my command is:
./benchmarks/dynamo/torchbench.py --performance --inference --bfloat16 --backend=inductor --only=hf_Bert_large --output=torchbench_inference.csv

the error message is:
image

looks something wrong with the input.

I found that this model is good to run on dashboard,
https://hud.pytorch.org/benchmark/torchbench/inductor_max_autotune?startTime=Mon,%2006%20May%202024%2010:12:38%20GMT&stopTime=Mon,%2013%20May%202024%2010:12:38%20GMT&granularity=hour&mode=training&model=hf_Bert_large&dtype=amp&lBranch=main&lCommit=02093b6c6ae1046368e2500881d0bb5880873386&rBranch=main&rCommit=68a1f787c8ce0783f39c35a91fa1e6614b974050

anybody can help to resolve this issue? many thanks.

@jinsong-mao jinsong-mao changed the title hf_Bert_large failed on my local machine hf_Bert_large failed May 14, 2024
@FindHao
Copy link
Contributor

FindHao commented May 14, 2024

Can you try this version of transformers? transformers==4.38.1

@jinsong-mao
Copy link
Author

@FindHao I checked my environment and make sure that the version of transformers is 4.38.1, and the issue is still exists.

@jinsong-mao
Copy link
Author

@FindHao BTW, I tried to build a docker with the dockerfile from the repo and ran the same test, the model hf_Bert_large still failed with the same issue, looks the environment to run the dashboard is different?

@FindHao
Copy link
Contributor

FindHao commented May 17, 2024

The torchbench in dynamo is slightly different from this repo. You can try the above PR I submitted to solve this issue. Or, you can run with this repo's run.py in your tests.

facebook-github-bot pushed a commit that referenced this issue May 21, 2024
Summary:
Fixes #2263.

According to https://github.com/pytorch/pytorch/blob/main/benchmarks/dynamo/common.py#L509, example_inputs are formatted as dictionaries for HuggingFace models. However, this forward_pass function passes all inputs to mod with *, which may only pass the input_ids key in HuggingFace model's example inputs.

To reproduce, run the following command.
```bash
python pytorch/benchmarks/dynamo/torchbench.py --performance --inference -dcuda --only=hf_Bert --output=torchbench_inference.csv
```

X-link: pytorch/pytorch#126579
Approved by: https://github.com/xuzhao9

Reviewed By: DanilBaibak

Differential Revision: D57619425

Pulled By: FindHao

fbshipit-source-id: 9074e227bab949c83768092cf019dfd590fe947b
@jinsong-mao
Copy link
Author

@FindHao Thanks for the fixing, it works for inference, there is another similar bug in pytorch benchmark repo: https://github.com/pytorch/pytorch/blob/main/benchmarks/dynamo/torchbench.py#L435
image

I think it should be "if isinstance(cloned_inputs, dict):" , which looks like a typo, and the hf model training will fail because of this.

thanks

@FindHao
Copy link
Contributor

FindHao commented May 23, 2024

Thanks for your reply! It is a typo. Fixed in pytorch/pytorch#126981

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

Successfully merging a pull request may close this issue.

2 participants