pytorch with mixed precision training is much slower than native float32?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 9k
- Forks
- 1.5k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 3
Description
My hardware is: RTX3090+AMD 3900X+128G RAM
The software is: Graphic Driver 455.23.05 with cuda 11.1, pytorch 1.7 , python 3.8 on debian 10.
I installed apex from github clone with "pip install --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./" command line.
pytorch are installed in anaconda.
I followed the toturial that add the initializing code with:
opt_level = 'O1'
model, optimizer = amp.initialize(model, optimizer, opt_level=opt_level)
and replace the loss.backward()with:
with amp.scale_loss(loss_gpu, optimizer) as scaled_loss:
scaled_loss.backward()
the code can run with a warning 'gradient overflow. skipping step loss scaler 0 reducing loss scale to', and the memory do reduce to about a half. But the training time per epochs is even longer than native float32 training with 80s in native mode and 120+s in mixed precision training.
So please tell me where doses it go run? The usage of apex or the hardware issue?
Many thanks!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No project files or tests are named. Start with the Apex tutorial's amp.initialize and amp.scale_loss entry points, reproduce the reported 80-second versus 120+-second epoch timings in the stated environment, and use the gradient-overflow warning to investigate the source of the slowdown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100