您好,感谢您的反馈,请您按照 https://gitcode.com/Ascend/MindSpeed-LLM#版本说明 提供对应的配套软件版本信息,以及完整的训练脚本和训练日志,方便我们复现定位问题。


就是直接使用的官网A2的mindspeed-llm 2.2.0镜像跑的,又试了qwen3-8B,现象也是一样的。
训练日志:c0fa08f051f44e668e1466ed1f24c543.log
hf2mcore 脚本:
修改 ascend-toolkit 路径
export CUDA_DEVICE_MAX_CONNECTIONS=1
source /data_disk0/h3/cann/8.3/ascend-toolkit/set_env.sh
python convert_ckpt.py
--use-mcore-models
--model-type GPT
--load-model-type hf
--save-model-type mg
--target-tensor-parallel-size 1
--target-pipeline-parallel-size 2
--spec mindspeed_llm.tasks.models.spec.qwen3_spec layer_spec
--load-dir /data_disk0/h3/
--save-dir ./model_weights/Qwen3-8B_mcore/
--tokenizer-model /data_disk0/h3/Qwen3-8B/tokenizer.json
--params-dtype bf16
--model-type-hf qwen3
mcore2hf脚本:
# 修改 ascend-toolkit 路径
source /data_disk0/h3/cann/8.3/ascend-toolkit/set_env.sh
export CUDA_DEVICE_MAX_CONNECTIONS=1
python convert_ckpt.py
--use-mcore-models
--model-type GPT
--load-model-type mg
--save-model-type hf
--target-tensor-parallel-size 1
--target-pipeline-parallel-size 1
--spec mindspeed_llm.tasks.models.spec.qwen3_spec layer_spec
--lora-r 16
--lora-alpha 32
--lora-target-modules linear_qkv linear_proj linear_fc1 linear_fc2
--load-dir ./model_weights/Qwen3-8B_mcore/
--lora-load ./ckpt/Qwen3-8B_lora
--save-dir /data_disk0//h3/Qwen3-8B/
--model-type-hf qwen3 \
转换后config.json
{
"architectures": [
"Qwen3ForCausalLM"
],
"attention_bias": false,
"attention_dropout": 0.0,
"bos_token_id": 151643,
"dtype": "float16",
"eos_token_id": 151645,
"head_dim": 128,
"hidden_act": "silu",
"hidden_size": 4096,
"initializer_range": 0.02,
"intermediate_size": 12288,
"layer_types": [
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention"
],
"max_position_embeddings": 40960,
"max_window_layers": 36,
"model_type": "qwen3",
"num_attention_heads": 32,
"num_hidden_layers": 36,
"num_key_value_heads": 8,
"rms_norm_eps": 1e-06,
"rope_scaling": null,
"rope_theta": 1000000,
"sliding_window": null,
"tie_word_embeddings": false,
"transformers_version": "4.57.1",
"use_cache": true,
"use_sliding_window": false,
"vocab_size": 151936
}


您好,感谢您的反馈,请您按照 https://gitcode.com/Ascend/MindSpeed-LLM#版本说明 提供对应的配套软件版本信息,以及完整的训练脚本和训练日志,方便我们复现定位问题。
以上信息已反馈。请问下问题确认了吗


就是直接使用的官网A2的mindspeed-llm 2.2.0镜像跑的,又试了qwen3-8B,现象也是一样的。
训练日志:c0fa08f051f44e668e1466ed1f24c543.log
hf2mcore 脚本:
# 修改 ascend-toolkit 路径
export CUDA_DEVICE_MAX_CONNECTIONS=1
source /data_disk0/h3/cann/8.3/ascend-toolkit/set_env.sh
python convert_ckpt.py \
--use-mcore-models \
--model-type GPT \
--load-model-type hf \
--save-model-type mg \
--target-tensor-parallel-size 1 \
--target-pipeline-parallel-size 2 \
--spec mindspeed_llm.tasks.models.spec.qwen3_spec layer_spec \
--load-dir /data_disk0/h3/ \
--save-dir ./model_weights/Qwen3-8B_mcore/ \
--tokenizer-model /data_disk0/h3/Qwen3-8B/tokenizer.json \
--params-dtype bf16 \
--model-type-hf qwen3
mcore2hf 脚本:
# 修改 ascend-toolkit 路径
source /data_disk0/h3/cann/8.3/ascend-toolkit/set_env.sh
export CUDA_DEVICE_MAX_CONNECTIONS=1
python convert_ckpt.py \
--use-mcore-models \
--model-type GPT \
--load-model-type mg \
--save-model-type hf \
--target-tensor-parallel-size 1 \
--target-pipeline-parallel-size 1 \
--spec mindspeed_llm.tasks.models.spec.qwen3_spec layer_spec \
--lora-r 16 \
--lora-alpha 32 \
--lora-target-modules linear_qkv linear_proj linear_fc1 linear_fc2 \
--load-dir ./model_weights/Qwen3-8B_mcore/ \
--lora-load ./ckpt/Qwen3-8B_lora \
--save-dir /data_disk0//h3/Qwen3-8B/ \
--model-type-hf qwen3
转换后 config.json:
{
"architectures": [
"Qwen3ForCausalLM"
],
"attention_bias": false,
"attention_dropout": 0.0,
"bos_token_id": 151643,
"dtype": "float16",
"eos_token_id": 151645,
"head_dim": 128,
"hidden_act": "silu",
"hidden_size": 4096,
"initializer_range": 0.02,
"intermediate_size": 12288,
"layer_types": [
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention"
],
"max_position_embeddings": 40960,
"max_window_layers": 36,
"model_type": "qwen3",
"num_attention_heads": 32,
"num_hidden_layers": 36,
"num_key_value_heads": 8,
"rms_norm_eps": 1e-06,
"rope_scaling": null,
"rope_theta": 1000000,
"sliding_window": null,
"tie_word_embeddings": false,
"transformers_version": "4.57.1",
"use_cache": true,
"use_sliding_window": false,
"vocab_size": 151936
}


您好,可以使用
```
```
创建代码块来实现更好的阅读效果
关于lora微调后权重转换生成的hf权重里面的config.json,torch_dtype变成了dtype的问题,我们的lora微调过程和权重转化过程都不会改变config.json文件中的内容,可以检查一下是否是训练前使用的config.json就有误?


/label add resolved


您好,当前Issue标记为resolved且有一段时间未进一步更新,因此我们将其标记为'stale'(闲置)状态。若您认为这是误操作,可通过添加任意评论来去除'stale'标签。标记为stale的Issue在4天内无更新活动将自动关闭。


如果您目前没有其他问题,我们将根据流程关闭此 issue。
如后续有新的疑问或补充内容,欢迎随时重新打开本 issue,或另起一个新的 issue 进行提问。
感谢您的理解与支持!


您好,可以使用
```
```
创建代码块来实现更好的阅读效果
关于lora微调后权重转换生成的hf权重里面的config.json,torch_dtype变成了dtype的问题,我们的lora微调过程和权重转化过程都不会改变config.json文件中的内容,可以检查一下是否是训练前使用的config.json就有误?
问题:权重转换生成的config.json文件中,表示精度的参数是dtype,但是原始模型的config.json中,是用torch_dtype来表示的。这个差异导致使用权重转换生成的config.json无法拉起推理


V1版本的mg转hf,是调用transformers库的原生方法生成的config.json文件,原始HF权重config.json文件的transformers版本是4.51.0,环境上的transformers是4.57.0,版本差异导致torch_dtype属性命名不同。
您可以尝试将环境上的transformers版本重装为4.51.0,可以解决该问题。
如您还有其他疑问,可以继续在本issue下交流。


V1版本的mg转hf,是调用transformers库的原生方法生成的config.json文件,原始HF权重config.json文件的transformers版本是4.51.0,环境上的transformers是4.57.0,版本差异导致torch_dtype属性命名不同。
您可以尝试将环境上的transformers版本重装为4.51.0,可以解决该问题。
如您还有其他疑问,可以继续在本issue下交流。
感谢解答。但是这里有个疑问呢:4.57.1是镜像自带的,requirements.txt里就是直接写的transformers==4.57.1,如果手动将为模型config.json中要求的transformers版本,会产生其他负面影响吗,训练报错或者精度异常的


重装transformers版本为4.51.0的方法仅解答您提问的“使用权重转换生成的config.json无法拉起推理”的问题,可能会对精度产生影响。
由于不同transformers版本间存在差异,如您后续需要进行训练或推理,建议尝试手动修改config.json文件。


如果您目前没有其他问题,我们将根据流程关闭此 issue。
如后续有新的疑问或补充内容,欢迎随时重新打开本 issue,或另起一个新的 issue 进行提问。
感谢您的理解与支持!


在提交新问题之前,请确保您已经在社区中搜索过相关问题,并使用了社区中提供的资源/工具后,仍未找到满意的解决方式。
环境信息
官网A2的mindspeed-llm 2.2.0镜像
使用场景及问题
模型:deepseek-aiDeepSeek-R1-0528-Qwen3-8B
lora微调后权重转换生成的hf权重里面的config.json,torch_dtype变成了dtype,导致mindie无法正常加载。
欢迎加入社区,感谢您对社区的贡献 🎉!