Comments (4)
similar question. here's some findings:
- deepspeed's doc claimed in ZeRO-O3 with ZeRO.init context, params is copied(for DP) and transfered to GPU layer by layer, while O2 is not.
- i use 13B, A100 80G*8, 1TB CPU memory to test. when O2, it use about 500 GB memory. 13B*4Byte/param*DP8=416GB, reasonable.
- when using 500GB CPU memory(reduce 50% memory), CPU OOM
- changing to O3, still CPU OOM.
so maybe we use O3 zero.init incorrectly, or deepspeed has a bug around here.
to your scenario, 70*4*4=1120GB>1TB, CPU OOM. maybe you can try load half layer(40 layer instead of 80 layer)? it likely to use 560+ GB memory, which does not cause CPU OOM
however, even half layers does not OOM, there's still the bug: when loading and copying weights layer by layer, does deepspeed release the memory of former layers in O3?
from deepspeed.
similar question. here's some findings:
- deepspeed's doc claimed in ZeRO-O3 with ZeRO.init context, params is copied(for DP) and transfered to GPU layer by layer, while O2 is not.
- i use 13B, A100 80G8, 1TB CPU memory to test. when O2, it use about 500 GB memory. 13B4Byte/param*DP8=416GB, reasonable.
- when using 500GB CPU memory(reduce 50% memory), CPU OOM
- changing to O3, still CPU OOM.
so maybe we use O3 zero.init incorrectly, or deepspeed has a bug around here.
to your scenario, 7044=1120GB>1TB, CPU OOM. maybe you can try load half layer(40 layer instead of 80 layer)? it likely to use 560+ GB memory, which does not cause CPU OOM
however, even half layers does not OOM, there's still the bug: when loading and copying weights layer by layer, does deepspeed release the memory of former layers in O3?
ref: https://deepspeed.readthedocs.io/en/latest/memory.html , grep "And often, itโs not even possible to buy GPUs with a lot of RAM (112GB GPU anybody?) since they simply donโt yet exist."
from deepspeed.
similar question. here's some findings:
- deepspeed's doc claimed in ZeRO-O3 with ZeRO.init context, params is copied(for DP) and transfered to GPU layer by layer, while O2 is not.
- i use 13B, A100 80G8, 1TB CPU memory to test. when O2, it use about 500 GB memory. 13B4Byte/param*DP8=416GB, reasonable.
- when using 500GB CPU memory(reduce 50% memory), CPU OOM
- changing to O3, still CPU OOM.
so maybe we use O3 zero.init incorrectly, or deepspeed has a bug around here.
to your scenario, 7044=1120GB>1TB, CPU OOM. maybe you can try load half layer(40 layer instead of 80 layer)? it likely to use 560+ GB memory, which does not cause CPU OOM
however, even half layers does not OOM, there's still the bug: when loading and copying weights layer by layer, does deepspeed release the memory of former layers in O3?
@shh2000 hi I have some new findings. and it works. You need to use deepspeed.zero.init
to handle lager model. like
config = LlamaConfig.from_pretrained(model_name_or_path)
with deepspeed.zero.Init():
model = AutoModelForCausalLM.from_config(config, trust_remote_code=True)
from deepspeed.
And directly load model to GPU works fine. Use the device_map
parameter like
AutoModelForCausalLM.from_config(config, device_map="auto", trust_remote_code=True)
from deepspeed.
Related Issues (20)
- [REQUEST] How to finetune ONLY certain subset of the network parameters
- How to finetune certain portion of the whole parameter
- [BUG] Frozen Parameters not saved when bf16 enabled but are when fp16 enabled
- Deepspeed Ulysses HOT 2
- Content window is blocking text on deepspeed.ai HOT 1
- [BUG] Training crashes with "'Tensor' object has no attribute 'ds_id'"
- [BUG] Memory Leak in Stage 2 Optimizer
- [BUG] import deepspeed, MissingCUDAException HOT 2
- [REQUEST] Add documentation on how to run fast inference of `transformers` models with ZeRO-3
- [REQUEST] Any arguments for disabling saving global steps?
- [BUG] Jamba (Mamba+MoE) + ZeRO3 + LoRA training hangs
- [BUG] 3 GPUs is not as good as expectation compare with 2 GPUs; NV vs AMD performace; flash attention not support for AMD GPUs
- [BUG] Unexpected High Memory Usage (OOM) when finetuning Llama2-7B
- [REQUEST] Enable both CPU and NVMe for optimizer
- [BUG] Mismatch between dtype settings in model and ds_config results in NaN loss
- [REQUEST] Launcher mode with SSH bypass HOT 1
- FileNotFoundError: [Errno 2] No such file or directory: ':/usr/local/cuda/bin/nvcc' HOT 3
- [BUG] Uneven work distribution caused by get_shard_size changes
- [BUG] When initializing model_engine, if an mpu is specified, it can lead to an excessively large checkpoint size, and the checkpoint may not be convertible through the `zero_to_fp32.py` script.
- [BUG] Uneven work distribution caused by get_shard_size changes HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deepspeed.