modelscope / modelscope/ms-swift
使用web-ui训练glm4-9b-chat报错
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 1.7k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 136
Description
Checklist / 检查清单
- I have searched existing issues, and this is a new bug report. / 我已经搜索过现有的 issues,确认这是一个新的 bug report。
Bug Description / Bug 描述
以下是运行log
swanlab_workspace=None,
system=None,
target_modules=['all-linear'],
target_parameters=None,
target_regex=None,
task_type=causal_lm,
temperature=0.0,
template=glm4,
template_backend=swift,
tf32=None,
top_k=None,
top_logprobs=None,
top_p=None,
torch_compile=False,
torch_compile_backend=None,
torch_compile_mode=None,
torch_dtype=torch.bfloat16,
torch_empty_cache_steps=None,
trackio_space_id=trackio,
train_dataloader_shuffle=True,
train_sampling_strategy=random,
train_type=None,
trainable_parameters=[],
trainable_parameters_regex=None,
truncation_strategy=delete,
tuner_backend=peft,
tuner_type=lora,
use_cache=False,
use_chat_template=True,
use_cpu=False,
use_dora=False,
use_flash_ckpt=False,
use_galore=False,
use_hf=False,
use_liger_kernel=False,
use_logits_to_keep=None,
use_ray=False,
use_rslora=False,
use_swift_lora=False,
val_dataset=[],
val_dataset_shuffle=False,
vera_d_initial=0.1,
vera_dropout=0.0,
vera_projection_prng_key=0,
vera_rank=256,
vit_gradient_checkpointing=None,
vit_lr=None,
warmup_ratio=0.08,
warmup_steps=0,
weight_decay=0.1,
zero_hpz_partition_size=None,
)
[INFO:swift] Global seed set to 42
[INFO:swift] model_kwargs: {'device_map': 'cuda:0', 'dtype': torch.bfloat16}
Traceback (most recent call last):
File "/cpfs01/projects-HDD/cfff-40ce54d9ce4f_HDD/wsw_24211010087/ms-swift/swift/cli/sft.py", line 20, in
sft_main()
File "/cpfs01/projects-HDD/cfff-40ce54d9ce4f_HDD/wsw_24211010087/ms-swift/swift/pipelines/train/sft.py", line 354, in sft_main
return SwiftSft(args).main()
^^^^^^^^^^^^^^
File "/cpfs01/projects-HDD/cfff-40ce54d9ce4f_HDD/wsw_24211010087/ms-swift/swift/pipelines/train/sft.py", line 29, in init
self._prepare_model_tokenizer()
File "/cpfs01/projects-HDD/cfff-40ce54d9ce4f_HDD/wsw_24211010087/ms-swift/swift/ray/base.py", line 168, in wrapper
return func(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cpfs01/projects-HDD/cfff-40ce54d9ce4f_HDD/wsw_24211010087/ms-swift/swift/pipelines/train/sft.py", line 51, in _prepare_model_tokenizer
self.model, self.processor = args.get_model_processor(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cpfs01/projects-HDD/cfff-40ce54d9ce4f_HDD/wsw_24211010087/ms-swift/swift/arguments/base_args/base_args.py", line 327, in get_model_processor
return get_model_processor(**res)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cpfs01/projects-HDD/cfff-40ce54d9ce4f_HDD/wsw_24211010087/ms-swift/swift/model/register.py", line 613, in get_model_processor
return loader.load()
^^^^^^^^^^^^^
File "/cpfs01/projects-HDD/cfff-40ce54d9ce4f_HDD/wsw_24211010087/ms-swift/swift/model/register.py", line 462, in load
model, processor = self._get_model_processor(model_dir, config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cpfs01/projects-HDD/cfff-40ce54d9ce4f_HDD/wsw_24211010087/ms-swift/swift/model/register.py", line 453, in _get_model_processor
model = self.get_model(model_dir, config, processor, self.model_kwargs.copy())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cpfs01/projects-HDD/cfff-40ce54d9ce4f_HDD/wsw_24211010087/ms-swift/swift/model/register.py", line 307, in get_model
model = auto_model_cls.from_pretrained(model_dir, config=config, trust_remote_code=True, **model_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/wsw_24211010087/miniconda3/envs/ms-swift/lib/python3.11/site-packages/transformers/models/auto/auto_factory.py", line 367, in from_pretrained
return model_class.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/cpfs01/projects-HDD/cfff-40ce54d9ce4f_HDD/wsw_24211010087/ms-swift/swift/model/patcher.py", line 387, in _new_from_pretrained
model = from_pretrained(cls, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/wsw_24211010087/miniconda3/envs/ms-swift/lib/python3.11/site-packages/transformers/modeling_utils.py", line 4030, in from_pretrained
model = cls(config, *model_args, **model_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/wsw_24211010087/.cache/huggingface/modules/transformers_modules/glm_hyphen_4_hyphen_9b_hyphen_chat/modeling_chatglm.py", line 918, in init
self.max_sequence_length = config.max_length
^^^^^^^^^^^^^^^^^
File "/home/wsw_24211010087/miniconda3/envs/ms-swift/lib/python3.11/site-packages/transformers/configuration_utils.py", line 164, in getattribute
return super().getattribute(key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ChatGLMConfig' object has no attribute 'max_length'. Did you mean: 'seq_length'?
How to Reproduce / 如何复现
[INFO:swift] swift.version: 4.0.0.dev0
运行环境就是按照官网上git clone下来的ms-swift仓库 然后进行安装的环境
并且又pip install 'ms-swift'了一下
Additional Information / 补充信息
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the web-ui training path and the model-loading entry points in swift/pipelines/train/sft.py, swift/arguments/base_args/base_args.py, and swift/model/register.py. Trace how GLM4-9B-Chat reaches modeling_chat.py and compare the expected ChatGLMConfig field with the available seq_length field. Done means the reported web-ui training setup loads the model without the AttributeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100