OptimalScale/LMFlow

ValueError: mutable default <class 'lmflow.utils.conversation_formatter.StringFormatter'> for field user_formatter is not allowed: use default_factory

13416157913 opened this issue · 8 comments

您好,我按照github上第三种微调方法,执行以下脚本,但是报错
./scripts/run_finetune_with_lora.sh
--model_name_or_path /home/dengkaibiao/Qwen1.5-1.8B
--dataset_path data/sft/train
--output_lora_path output_models/finetuned_Qwen1.5-1.8B_lora

报错信息:
Traceback (most recent call last):
File "/home/dengkaibiao/LMFlow/examples/finetune.py", line 29, in
from lmflow.models.auto_model import AutoModel
File "/home/dengkaibiao/LMFlow/src/lmflow/models/auto_model.py", line 6, in
from lmflow.models.hf_decoder_model import HFDecoderModel
File "/home/dengkaibiao/LMFlow/src/lmflow/models/hf_decoder_model.py", line 62, in
from lmflow.utils.conversation_template import (
File "/home/dengkaibiao/LMFlow/src/lmflow/utils/conversation_template.py", line 254, in
@DataClass
^^^^^^^^^
File "/home/dengkaibiao/anaconda3/envs/lmflow/lib/python3.11/dataclasses.py", line 1232, in dataclass
return wrap(cls)
^^^^^^^^^
File "/home/dengkaibiao/anaconda3/envs/lmflow/lib/python3.11/dataclasses.py", line 1222, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dengkaibiao/anaconda3/envs/lmflow/lib/python3.11/dataclasses.py", line 958, in _process_class
cls_fields.append(_get_field(cls, name, type, kw_only))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dengkaibiao/anaconda3/envs/lmflow/lib/python3.11/dataclasses.py", line 815, in _get_field
raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'lmflow.utils.conversation_formatter.StringFormatter'> for field user_formatter is not allowed: use default_factory

Thanks for your interest in LMFlow! We suspect it to be a problem caused by python version and dependency. You may try to use python3.9 and upgrade the peft package via pip install -U peft. We will make corresponding modifications later as well. Thanks for your valuable suggestions 😄

Thanks for your interest in LMFlow! We suspect it to be a problem caused by python version and dependency. You may try to use python3.9 and upgrade the peft package via pip install -U peft. We will make corresponding modifications later as well. Thanks for your valuable suggestions 😄

Is it possible that it is because Qwen1.5-1.8B is not yet supported?

Thanks for your interest in LMFlow! We suspect it to be a problem caused by python version and dependency. You may try to use python3.9 and upgrade the peft package via pip install -U peft. We will make corresponding modifications later as well. Thanks for your valuable suggestions 😄

pip install -U peft solved. Thanks a lot.
Sorry,I update peft from 0.4.0 to 0.10.0 meet same error.

Thanks for your interest in LMFlow! We suspect it to be a problem caused by python version and dependency. You may try to use python3.9 and upgrade the peft package via pip install -U peft. We will make corresponding modifications later as well. Thanks for your valuable suggestions 😄

pip install -U peft solved. Thanks a lot. Sorry,I update peft from 0.4.0 to 0.10.0 meet same error.

image

Thanks for your interest in LMFlow! We suspect it to be a problem caused by python version and dependency. You may try to use python3.9 and upgrade the peft package via pip install -U peft. We will make corresponding modifications later as well. Thanks for your valuable suggestions 😄

pip install -U peft solved. Thanks a lot. Sorry,I update peft from 0.4.0 to 0.10.0 meet same error.

image

image

Is there any library or package on your side that requires python 3.11? We recommend to use python 3.9, since we are developing LMFlow on that version. Python 3.9 works fine for me.
You could try:

git clone https://github.com/OptimalScale/LMFlow.git
cd LMFlow
conda create -n lmflow python=3.9 -y
conda activate lmflow
conda install mpi4py
bash install.sh

And we are working on solving conversation formatter dataclass issue for higher python versions. Sorry for the inconvenience.

Is there any library or package on your side that requires python 3.11? We recommend to use python 3.9, since we are developing LMFlow on that version. Python 3.9 works fine for me. You could try:

git clone https://github.com/OptimalScale/LMFlow.git
cd LMFlow
conda create -n lmflow python=3.9 -y
conda activate lmflow
conda install mpi4py
bash install.sh

And we are working on solving conversation formatter dataclass issue for higher python versions. Sorry for the inconvenience.

I have a try.

Is there any library or package on your side that requires python 3.11? We recommend to use python 3.9, since we are developing LMFlow on that version. Python 3.9 works fine for me. You could try:

git clone https://github.com/OptimalScale/LMFlow.git
cd LMFlow
conda create -n lmflow python=3.9 -y
conda activate lmflow
conda install mpi4py
bash install.sh

And we are working on solving conversation formatter dataclass issue for higher python versions. Sorry for the inconvenience.

conda create -n lmflow python=3.9 -y the question was be solved. Thanks a lot.