facebookresearch / facebookresearch/fairscale
Model Offloading Issues
- Dominant language
- Python
- Stars
- 3.4k
- Forks
- 293
- PR merge metrics
- No merged PRs in 30d
Description
## ❓ Questions and Help
I have some issues with using and understanding model offloading.
1. The tutorial on model offloading (.../tutorials/offload_model.html) is not functioning out-of-the-box. Directly copying in this example on line `output = model(inputs)` gives the error:
```
Expected all tensors to be on the same device, ... etc.
```
Presumably the fix is to use `output = offload_model(inputs)`? If so, this leads me to the second question:
2. How can we **see** the effect of model offloading? It would be extremely useful in the tutorial to show a quick benchmark of the model's GPU memory usage with and without model offloading. In particular, without checkpoint activation or FP16, to really zoom in on the behavior of offloading.
3. I have tried to benchmark this myself (assuming the fix `output = offload_model(inputs)`) and cannot see any improvement in memory usage. I am using `torch.cuda.max_memory_allocated()` as a proxy for when a GPU would give an OOM error, and running the example (with the model and data sizes scaled way up to see the effect) for offloaded and non-offloaded models shows no difference in `max_memory_allocated()`.
Am I missing something obvious here? Am I using `OffloadModel` correctly?
Contributor guide
Assessment
This issue has not been assessed yet.