google / google/flax

Scaling issue on CPU (X86 and arm) while using models from huffing face.

Open
#4,357 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
7.3k
Forks
833
Avg merge
5h 11m
Merged PRs (30d)
5

Description

I was inferring models like (BERT, Resnet, GPT2, etc)from Hugging face on CPU and found it performing was not good compared to Pytorch, so on observing found out that models are not scaling properly in FLAX case.

benchmarking results

BERT model
-------------------
cores | time in sec
1 | 38.05184221
4 | 30.66457105
8 | 29.46852469
16 | 28.98397946
32 | 28.95349479
64 | 28.77831054

### System information
- OS Platform : Ubuntu 20.04
- Flax : 0.10.0, jax: 0.4.35 , jaxlib: 0.4.35
- Python version: 3.10.12
- CPU: graviton 3

### Problem you have encountered:
scaling issue

script i am using:
![Image](https://github.com/user-attachments/assets/a02057ea-e6cb-4e3b-af71-c782841aa2e3)

cpu usage
![Image](https://github.com/user-attachments/assets/d6420142-daa1-4162-8deb-a6f53c11c1af)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.