mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-11-05 01:07:28 +00:00
[GH-ISSUE #1635] convert_gpu_weights.py crashed by CUDA out of memory, even with --force_cpu #1056
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/ktransformers#1056
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @defWorldBetter on GitHub (Nov 20, 2025).
Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/1635
Originally assigned to: @qiyuxinlin, @ovowei on GitHub.
Reminder
System Info
Intel(R) Xeon(R) Platinum 8461V + 3090 24G + 384G mem
Reproduction
1
2
3
4 def forward(self, model_layers_2, model_rotary_emb, wrapped_5, getitem_3, getitem_1):
5 model_layers_3 = getattr(self.model.layers, "3")(model_layers_2, attention_mask = wrapped_5, position_ids = getitem_3, past_key_values = None, cache_position = getitem_1, position_embeddings = model_rotary_emb); model_layers_2 = wrapped_5 = getitem_3 = getitem_1 = model_rotary_emb = None
6 return {'model_layers_3': model_layers_3}
7
Others
command: python scripts/convert_gpu_weights.py --model_id /media/data/models/GLM-4.6/ --output_dir /models/ZhipuAI/GLM-4.6-GPTQ8 --force_cpu --trust_remote_code --max_sequence_length 1024 --num_calibration_samples 1024 --quant_type W4A16
I saw that there is "# Force all modules to CPU for quantization if args.force_cpu:" ,
Does this mean enabling this parameter will make the quantization process use only memory and be unrelated to GPU memory? Otherwise, if there is enough GPU memory to loading full weight, I would't need convert as so.
@KMSorSMS commented on GitHub (Nov 22, 2025):
I also encountered this bug, and by setting
CUDA_VISIBLE_DEVICES="". I make the literal "force cpu". I think the config option for the scripts is not right and the scripts doc needs to be updated with more details. @ovowei @qiyuxinlin@CodeZ-Hao commented on GitHub (Nov 25, 2025):
@ovowei 验证此PR未解决此问题,不论是配置--max_gpu_memory参数还是--force_cpu,仍报
CUDA out of memory: