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

Fp8 testing #446

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Fp8 testing #446

wants to merge 2 commits into from

Conversation

drisspg
Copy link
Contributor

@drisspg drisspg commented Jun 26, 2024

Summary

python scripts/hf_eval.py -q fp8

+----------+--------------------------------------------+
| Task     | Metrics                                    |
+==========+============================================+
| wikitext | +-----------------------------+----------+ |
|          | | bits_per_byte,none          | 0.538825 | |
|          | +-----------------------------+----------+ |
|          | | bits_per_byte_stderr,none   | N/A      | |
|          | +-----------------------------+----------+ |
|          | | byte_perplexity,none        | 1.452788 | |
|          | +-----------------------------+----------+ |
|          | | byte_perplexity_stderr,none | N/A      | |
|          | +-----------------------------+----------+ |
|          | | word_perplexity,none        | 7.368333 | |
|          | +-----------------------------+----------+ |
|          | | word_perplexity_stderr,none | N/A      | |
|          | +-----------------------------+----------+ |
+----------+--------------------------------------------+

Took 5 mins... but
python scripts/hf_eval.py -q fp8 --compile

+----------+--------------------------------------------+
| Task     | Metrics                                    |
+==========+============================================+
| wikitext | +-----------------------------+----------+ |
|          | | bits_per_byte,none          | 0.538654 | |
|          | +-----------------------------+----------+ |
|          | | bits_per_byte_stderr,none   | N/A      | |
|          | +-----------------------------+----------+ |
|          | | byte_perplexity,none        | 1.452617 | |
|          | +-----------------------------+----------+ |
|          | | byte_perplexity_stderr,none | N/A      | |
|          | +-----------------------------+----------+ |
|          | | word_perplexity,none        | 7.363686 | |
|          | +-----------------------------+----------+ |
|          | | word_perplexity_stderr,none | N/A      | |
|          | +-----------------------------+----------+ |
+----------+--------------------------------------------+

Copy link

pytorch-bot bot commented Jun 26, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/446

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ No Failures

As of commit 826bdaf with merge base e5548b7 (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 Jun 26, 2024
@msaroufim msaroufim self-requested a review June 26, 2024 23:35
msaroufim
msaroufim previously approved these changes Jun 26, 2024
Copy link
Member

@msaroufim msaroufim left a comment

Choose a reason for hiding this comment

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

Both PRs look fine, I'm guessing you only need to merge this one?

@drisspg
Copy link
Contributor Author

drisspg commented Jun 26, 2024

I acutallly wasnt necessarily planning on merging this one I just want to see how covering these example float8 workflows I hacking on are

drisspg added a commit to pytorch-labs/float8_experimental that referenced this pull request Jul 4, 2024
# Summary

# Performance
- Need to investigate the Rowwise dynamic case, I would think this should be faster than TensorWise dynamic
```Shell
Benchmark Results:
+--------------------------+-------------+
| Variant                  |   Time (μs) |
+==========================+=============+
| BF16                     |     2540.56 |
+--------------------------+-------------+
| FP8 Dynamic              |     1512.96 |
+--------------------------+-------------+
| FP8 Static               |     1363.75 |
+--------------------------+-------------+
| FP8 Weight Only          |     2774.22 |
+--------------------------+-------------+
| FP8 Dynamic AxisWise     |     1510.82 |
+--------------------------+-------------+
| FP8 Static AxisWise      |     1438.92 |
+--------------------------+-------------+
| FP8 Weight Only AxisWise |     2762.88 |
+--------------------------+-------------+

Comparison Results:
+--------------------------+-------------+-------------------+---------------+
| Variant                  |   Time (μs) | Speedup vs BF16   |   MAE vs BF16 |
+==========================+=============+===================+===============+
| BF16                     |     2540.56 | 1.00x             |    0          |
+--------------------------+-------------+-------------------+---------------+
| FP8 Dynamic              |     1512.96 | 1.68x             |    0.00543213 |
+--------------------------+-------------+-------------------+---------------+
| FP8 Static               |     1363.75 | 1.86x             |    0.00546265 |
+--------------------------+-------------+-------------------+---------------+
| FP8 Weight Only          |     2774.22 | 0.92x             |    0.00379944 |
+--------------------------+-------------+-------------------+---------------+
| FP8 Dynamic AxisWise     |     1510.82 | 1.68x             |    0.00543213 |
+--------------------------+-------------+-------------------+---------------+
| FP8 Static AxisWise      |     1438.92 | 1.77x             |    0.00546265 |
+--------------------------+-------------+-------------------+---------------+
| FP8 Weight Only AxisWise |     2762.88 | 0.92x             |    0.00379944 |
+--------------------------+-------------+-------------------+---------------+
```

### Numerics

Using this pytorch/ao#446
TensorWise Dynamic scaling:

``` Shell
+------------+--------------------------------------------+
| Task       | Metrics                                    |
+============+============================================+
| winogrande | +-----------------+----------+             |
|            | | acc,none        | 0.735596 |             |
|            | +-----------------+----------+             |
|            | | acc_stderr,none | 0.012395 |             |
|            | +-----------------+----------+             |
+------------+--------------------------------------------+
| wikitext   | +-----------------------------+----------+ |
|            | | bits_per_byte,none          | 0.538637 | |
|            | +-----------------------------+----------+ |
|            | | bits_per_byte_stderr,none   | N/A      | |
|            | +-----------------------------+----------+ |
|            | | byte_perplexity,none        | 1.452600 | |
|            | +-----------------------------+----------+ |
|            | | byte_perplexity_stderr,none | N/A      | |
|            | +-----------------------------+----------+ |
|            | | word_perplexity,none        | 7.363215 | |
|            | +-----------------------------+----------+ |
|            | | word_perplexity_stderr,none | N/A      | |
|            | +-----------------------------+----------+ |
+------------+--------------------------------------------+
```

AxisWise Dynamic Scaling

``` Shell
+------------+--------------------------------------------+
| Task       | Metrics                                    |
+============+============================================+
| winogrande | +-----------------+----------+             |
|            | | acc,none        | 0.735596 |             |
|            | +-----------------+----------+             |
|            | | acc_stderr,none | 0.012395 |             |
|            | +-----------------+----------+             |
+------------+--------------------------------------------+
| wikitext   | +-----------------------------+----------+ |
|            | | bits_per_byte,none          | 0.538637 | |
|            | +-----------------------------+----------+ |
|            | | bits_per_byte_stderr,none   | N/A      | |
|            | +-----------------------------+----------+ |
|            | | byte_perplexity,none        | 1.452600 | |
|            | +-----------------------------+----------+ |
|            | | byte_perplexity_stderr,none | N/A      | |
|            | +-----------------------------+----------+ |
|            | | word_perplexity,none        | 7.363215 | |
|            | +-----------------------------+----------+ |
|            | | word_perplexity_stderr,none | N/A      | |
|            | +-----------------------------+----------+ |
+------------+--------------------------------------------+

```



[ghstack-poisoned]
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants