Update README.md
Browse files
README.md
CHANGED
@@ -198,6 +198,30 @@ pip install intel-extension-for-transformers
|
|
198 |
~~~python
|
199 |
from auto_round import AutoRoundConfig ##must import for autoround format
|
200 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
import torch
|
202 |
|
203 |
quantized_model_dir = "OPEA/DeepSeek-V3-int4-sym-gptq-inc"
|
@@ -383,7 +407,7 @@ https://github.com/intel/auto-round/blob/deepseekv3/modeling_deepseek.py
|
|
383 |
git clone https://github.com/intel/auto-round.git && cd auto-round && git checkout deepseekv3
|
384 |
```
|
385 |
|
386 |
-
torch < 2.6
|
387 |
```bash
|
388 |
python3 -m auto_round --model "/models/DeepSeek-V3-bf16/" --group_size 128 --format "auto_gptq" --iters 200 --devices 0,1,2,3,4 --nsamples 512 --batch_size 8 --seqlen 512 --low_gpu_mem_usage --output_dir "tmp_autoround" --disable_eval e 2>&1 | tee -a seekv3.txt
|
389 |
```
|
|
|
198 |
~~~python
|
199 |
from auto_round import AutoRoundConfig ##must import for autoround format
|
200 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
201 |
+
|
202 |
+
# https://github.com/huggingface/transformers/pull/35493
|
203 |
+
def set_initialized_submodules(model, state_dict_keys):
|
204 |
+
"""
|
205 |
+
Sets the `_is_hf_initialized` flag in all submodules of a given model when all its weights are in the loaded state
|
206 |
+
dict.
|
207 |
+
"""
|
208 |
+
state_dict_keys = set(state_dict_keys)
|
209 |
+
not_initialized_submodules = {}
|
210 |
+
for module_name, module in model.named_modules():
|
211 |
+
if module_name == "":
|
212 |
+
# When checking if the root module is loaded there's no need to prepend module_name.
|
213 |
+
module_keys = set(module.state_dict())
|
214 |
+
else:
|
215 |
+
module_keys = {f"{module_name}.{k}" for k in module.state_dict()}
|
216 |
+
if module_keys.issubset(state_dict_keys):
|
217 |
+
module._is_hf_initialized = True
|
218 |
+
else:
|
219 |
+
not_initialized_submodules[module_name] = module
|
220 |
+
return not_initialized_submodules
|
221 |
+
|
222 |
+
transformers.modeling_utils.set_initialized_submodules = set_initialized_submodules
|
223 |
+
|
224 |
+
|
225 |
import torch
|
226 |
|
227 |
quantized_model_dir = "OPEA/DeepSeek-V3-int4-sym-gptq-inc"
|
|
|
407 |
git clone https://github.com/intel/auto-round.git && cd auto-round && git checkout deepseekv3
|
408 |
```
|
409 |
|
410 |
+
**torch < 2.6**
|
411 |
```bash
|
412 |
python3 -m auto_round --model "/models/DeepSeek-V3-bf16/" --group_size 128 --format "auto_gptq" --iters 200 --devices 0,1,2,3,4 --nsamples 512 --batch_size 8 --seqlen 512 --low_gpu_mem_usage --output_dir "tmp_autoround" --disable_eval e 2>&1 | tee -a seekv3.txt
|
413 |
```
|