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

relax check on bf16 #3460

Closed
wants to merge 1 commit into from
Closed

relax check on bf16 #3460

wants to merge 1 commit into from

Conversation

lucylq
Copy link
Contributor

@lucylq lucylq commented May 1, 2024

Now require kernel support for bf16.

Export:
python3 torchchat.py export llama3 --dtype [fp16 | bf16] --output-pte-path llama3.pte

(.venv) (base) [lfq@devvm20128.prn0 /data/users/lfq/torchchat (lfq.export-bf16)]$ python3 torchchat.py generate llama3 --device cpu --pte-path llama3.pte --prompt "Hello my name is"
Warning: checkpoint path ignored because an exported DSO or PTE path specified
Warning: checkpoint path ignored because an exported DSO or PTE path specified
Using device=cpu Intel Core Processor (Broadwell)
Loading model...
Time to load model: 0.11 seconds
I 00:00:00.000905 executorch:program.cpp:129] InternalConsistency verification requested but not available
E 00:00:51.744419 executorch:method.cpp:936] Overriding output data pointer allocated by memory plan is not allowed.
I 00:00:51.744460 executorch:pybindings.cpp:196] Cannot set_output_data_ptr(): this likely means the outputs were MemoryPlanned inspect the error code to know for sure, but likely this is not an issue. 0x2
F 00:00:51.747880 executorch:op_index.cpp:87] In function operator()(), assert failed (false): Unhandled dtype BFloat16 for index.Tensor_out
Aborted (core dumped)

fp16 runs well!

(.venv) (base) [lfq@devvm20128.prn0 /data/users/lfq/torchchat (lfq.export-bf16)]$ python3 torchchat.py generate llama3 --device cpu --pte-path llama3_f16.pte --prompt "Hello my name is" 2>/dev/null
Warning: checkpoint path ignored because an exported DSO or PTE path specified
Warning: checkpoint path ignored because an exported DSO or PTE path specified
Using device=cpu Intel Core Processor (Broadwell)
Loading model...
Time to load model: 0.10 seconds
Hello my name is Elsie, I'm a 28 year old woman who loves to be outdoors and try new things. I'm a bit of a thrill-seeker and love to push myself out of my comfort zone. I'm also a big fan of nature and love spending time in the wilderness.
I'm a bit of a foodSerializedName and love trying new recipes and experimenting with different flavors and ingredients. I'm also a big fan of coffee and love a good cup of joe in the morning.
I'm a bit of a homebody and love spending time at home with my family and friends. I'm also a big fan of movies and TV shows and love getting lost in a good story.
 Injector

I'm a bit of a hopeless romantic and love the idea of finding true love and building a life with someone. I'm looking for someone who is kind, honest, and genuine, and who also loves the outdoors and trying new things. If you're a fellow thrill-seeker who loves nature and<|begin_of_text|>Hello my name is Elsie, I'm a 28 year old woman who loves to be outdoors and try new things. I'm a bit of a thrill-seeker and love to push myself out of my comfort zone. I'm also a big fan of nature and love spending time in the wilderness.
I'm a bit of a foodSerializedName and love trying new recipes and experimenting with different flavors and ingredients. I'm also a big fan of coffee and love a good cup of joe in the morning.
I'm a bit of a homebody and love spending time at home with my family and friends. I'm also a big fan of movies and TV shows and love getting lost in a good story.
 Injector

I'm a bit of a hopeless romantic and love the idea of finding true love and building a life with someone. I'm looking for someone who is kind, honest, and genuine, and who also loves the outdoors and trying new things. If you're a fellow thrill-seeker who loves nature and<|eot_id|>
Max Sequence Length Reached. Ending Conversation.
==========

Copy link

pytorch-bot bot commented May 1, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/3460

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 245ffd8 with merge base 1fd80fe (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 1, 2024
@lucylq lucylq marked this pull request as ready for review May 1, 2024 21:34
@facebook-github-bot
Copy link
Contributor

@lucylq has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@iseeyuan iseeyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. @lucylq could you create an issue for bf16 kernel support? Thanks!

@lucylq
Copy link
Contributor Author

lucylq commented May 2, 2024

LGTM. @lucylq could you create an issue for bf16 kernel support? Thanks!

#3488

Summary:
Now require kernel support for bf16.

Export: 
python3 torchchat.py export llama3 --dtype [fp16 | bf16] --output-pte-path llama3.pte
```
(.venv) (base) [lfq@devvm20128.prn0 /data/users/lfq/torchchat (lfq.export-bf16)]$ python3 torchchat.py generate llama3 --device cpu --pte-path llama3.pte --prompt "Hello my name is"
Warning: checkpoint path ignored because an exported DSO or PTE path specified
Warning: checkpoint path ignored because an exported DSO or PTE path specified
Using device=cpu Intel Core Processor (Broadwell)
Loading model...
Time to load model: 0.11 seconds
I 00:00:00.000905 executorch:program.cpp:129] InternalConsistency verification requested but not available
E 00:00:51.744419 executorch:method.cpp:936] Overriding output data pointer allocated by memory plan is not allowed.
I 00:00:51.744460 executorch:pybindings.cpp:196] Cannot set_output_data_ptr(): this likely means the outputs were MemoryPlanned inspect the error code to know for sure, but likely this is not an issue. 0x2
F 00:00:51.747880 executorch:op_index.cpp:87] In function operator()(), assert failed (false): Unhandled dtype BFloat16 for index.Tensor_out
Aborted (core dumped)
```

fp16 (mostly) runs well!
```
(.venv) (base) [lfq@devvm20128.prn0 /data/users/lfq/torchchat (lfq.export-bf16)]$ python3 torchchat.py generate llama3 --device cpu --pte-path llama3_f16.pte --prompt "Hello my name is" 2>/dev/null
Warning: checkpoint path ignored because an exported DSO or PTE path specified
Warning: checkpoint path ignored because an exported DSO or PTE path specified
Using device=cpu Intel Core Processor (Broadwell)
Loading model...
Time to load model: 0.10 seconds
Hello my name is Elsie, I'm a 28 year old woman who loves to be outdoors and try new things. I'm a bit of a thrill-seeker and love to push myself out of my comfort zone. I'm also a big fan of nature and love spending time in the wilderness.
I'm a bit of a foodSerializedName and love trying new recipes and experimenting with different flavors and ingredients. I'm also a big fan of coffee and love a good cup of joe in the morning.
I'm a bit of a homebody and love spending time at home with my family and friends. I'm also a big fan of movies and TV shows and love getting lost in a good story.
 Injector

I'm a bit of a hopeless romantic and love the idea of finding true love and building a life with someone. I'm looking for someone who is kind, honest, and genuine, and who also loves the outdoors and trying new things. If you're a fellow thrill-seeker who loves nature and<|begin_of_text|>Hello my name is Elsie, I'm a 28 year old woman who loves to be outdoors and try new things. I'm a bit of a thrill-seeker and love to push myself out of my comfort zone. I'm also a big fan of nature and love spending time in the wilderness.
I'm a bit of a foodSerializedName and love trying new recipes and experimenting with different flavors and ingredients. I'm also a big fan of coffee and love a good cup of joe in the morning.
I'm a bit of a homebody and love spending time at home with my family and friends. I'm also a big fan of movies and TV shows and love getting lost in a good story.
 Injector

I'm a bit of a hopeless romantic and love the idea of finding true love and building a life with someone. I'm looking for someone who is kind, honest, and genuine, and who also loves the outdoors and trying new things. If you're a fellow thrill-seeker who loves nature and<|eot_id|>
Max Sequence Length Reached. Ending Conversation.
==========

```

duplication seems to be resolved in pytorch/torchchat#620


Reviewed By: iseeyuan

Differential Revision: D56849464

Pulled By: lucylq
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D56849464

@facebook-github-bot
Copy link
Contributor

@lucylq merged this pull request in 0909c5a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants