xming521 / WeClone

欢迎star⭐。使用微信聊天记录微调大语言模型,并绑定到微信机器人,实现自己的数字克隆。 LLM/大语言模型/大模型/微信聊天记录/微信聊天机器人/LoRA
95 stars 12 forks source link

transformers 版本问题 #2

Open pkr5277 opened 5 months ago

pkr5277 commented 5 months ago

transformers 4.38.1 会报这个错 ImportError: cannot import name 'MixtralBLockSparseTop2MLP' from 'transformers.models.mixtral.modeling_mixtral'

transformers 4.40.1 又会报这个错 ttributeError: module 'ml_dtypes' has no attribute 'float8_e4m3b11'. Did you mean: 'float8_e4m3fn'? Traceback (most recent call last): File "Z:\python program\WeClone\src\train_sft.py", line 1, in from llmtuner import run_exp File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner__init.py", line 6, in from .train import export_model, run_exp File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\train__init.py", line 1, in from .tuner import export_model, run_exp File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\train\tuner.py", line 10, in from .dpo import run_dpo File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\train\dpo__init__.py", line 1, in from .workflow import run_dpo File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\train\dpo\workflow.py", line 9, in from ...extras.ploting import plot_loss File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\extras\ploting.py", line 6, in from transformers.trainer import TRAINER_STATE_NAME File "Z:\python program\WeClone\venv\lib\site-packages\transformers\trainer.py", line 59, in from .data.data_collator import DataCollator, DataCollatorWithPadding, default_data_collator File "Z:\python program\WeClone\venv\lib\site-packages\transformers\data\init.py", line 27, in from .processors import ( File "Z:\python program\WeClone\venv\lib\site-packages\transformers\data\processors\init.py", line 15, in from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels File "Z:\python program\WeClone\venv\lib\site-packages\transformers\data\processors\glue.py", line 30, in import tensorflow as tf File "C:\Python310\lib\site-packages\tensorflow\init__.py", line 38, in from tensorflow.python.tools import module_util as _module_util File "C:\Python310\lib\site-packages\tensorflow\python\init__.py", line 42, in from tensorflow.python.saved_model import saved_model File "C:\Python310\lib\site-packages\tensorflow\python\saved_model\saved_model.py", line 20, in from tensorflow.python.saved_model import builder File "C:\Python310\lib\site-packages\tensorflow\python\saved_model\builder.py", line 23, in from tensorflow.python.saved_model.builder_impl import _SavedModelBuilder File "C:\Python310\lib\site-packages\tensorflow\python\saved_model\builder_impl.py", line 26, in from tensorflow.python.framework import dtypes File "C:\Python310\lib\site-packages\tensorflow\python\framework\dtypes.py", line 39, in _np_float8_e5m2 = pywrap_ml_dtypes.float8_e5m2() TypeError: Unable to convert function return value to a Python type! The signature was () -> handle 想问一下大佬用的哪个版本

pkr5277 commented 5 months ago

大佬上面版本这个问题解决了。。运行起来提示文件丢失,但是不知道是哪个文件。。。 image

xming521 commented 5 months ago

检查一下是不是有./data/res_csv/sft/sft-my.json这个文件 这是处理后的数据集

pkr5277 commented 5 months ago

创建了文件可以了,但是报datasets的错, 2.14.3和2.17.1我都试过都报这个错 image

Downloading data files: 100%|██████████| 1/1 [00:00<?, ?it/s] Extracting data files: 100%|██████████| 1/1 [00:00<00:00, 166.52it/s] Generating train split: 0 examples [00:00, ? examples/s] Traceback (most recent call last): File "Z:\python program\WeClone\venv\lib\site-packages\datasets\builder.py", line 1949, in _prepare_split_single num_examples, num_bytes = writer.finalize() File "Z:\python program\WeClone\venv\lib\site-packages\datasets\arrow_writer.py", line 598, in finalize raise SchemaInferenceError("Please pass features or at least one example when writing data") datasets.arrow_writer.SchemaInferenceError: Please pass features or at least one example when writing data

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "Z:\python program\WeClone\src\train_sft.py", line 9, in run_exp(config) File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\train\tuner.py", line 31, in run_exp run_sft(model_args, data_args, training_args, finetuning_args, generating_args, callbacks) File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\train\sft\workflow.py", line 32, in run_sft dataset = get_dataset(tokenizer, model_args, data_args, training_args, stage="sft") File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\data\loader.py", line 162, in get_dataset all_datasets.append(load_single_dataset(dataset_attr, model_args, data_args)) File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\data\loader.py", line 92, in load_single_dataset dataset = load_dataset( File "Z:\python program\WeClone\venv\lib\site-packages\datasets\load.py", line 2133, in load_dataset builder_instance.download_and_prepare( File "Z:\python program\WeClone\venv\lib\site-packages\datasets\builder.py", line 954, in download_and_prepare self._download_and_prepare( File "Z:\python program\WeClone\venv\lib\site-packages\datasets\builder.py", line 1049, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "Z:\python program\WeClone\venv\lib\site-packages\datasets\builder.py", line 1813, in _prepare_split for job_id, done, content in self._prepare_split_single( File "Z:\python program\WeClone\venv\lib\site-packages\datasets\builder.py", line 1958, in _prepare_split_single raise DatasetGenerationError("An error occurred while generating the dataset") from e datasets.builder.DatasetGenerationError: An error occurred while generating the dataset

pkr5277 commented 5 months ago

image

pt-my.json 我新建了

xming521 commented 5 months ago

pt-my.json 是通过通过make_dataset/csv_to_json.py 脚本生成的吗

pkr5277 commented 5 months ago

大佬上面的问题都解决了,请问一下这个api key是什么的,没找到呢 wandb: ERROR api_key not configured (no-tty). call wandb.login(key=[your_api_key]) Traceback (most recent call last): File "Z:\WeClone\src\train_sft.py", line 9, in run_exp(config) File "Z:\WeClone\venv\lib\site-packages\llmtuner\train\tuner.py", line 31, in run_exp run_sft(model_args, data_args, training_args, finetuning_args, generating_args, callbacks) File "Z:\WeClone\venv\lib\site-packages\llmtuner\train\sft\workflow.py", line 75, in run_sft train_result = trainer.train(resume_from_checkpoint=training_args.resume_from_checkpoint) File "Z:\WeClone\venv\lib\site-packages\transformers\trainer.py", line 1780, in train return inner_training_loop( File "Z:\WeClone\venv\lib\site-packages\transformers\trainer.py", line 2036, in _inner_training_loop self.control = self.callback_handler.on_train_begin(args, self.state, self.control) File "Z:\WeClone\venv\lib\site-packages\transformers\trainer_callback.py", line 370, in on_train_begin return self.call_event("on_train_begin", args, state, control) File "Z:\WeClone\venv\lib\site-packages\transformers\trainer_callback.py", line 414, in call_event result = getattr(callback, event)( File "Z:\WeClone\venv\lib\site-packages\transformers\integrations\integration_utils.py", line 768, in on_train_begin self.setup(args, state, model, kwargs) File "Z:\WeClone\venv\lib\site-packages\transformers\integrations\integration_utils.py", line 741, in setup self._wandb.init( File "C:\Python310\lib\site-packages\wandb\sdk\wandb_init.py", line 1166, in init raise e File "C:\Python310\lib\site-packages\wandb\sdk\wandb_init.py", line 1143, in init wi.setup(kwargs) File "C:\Python310\lib\site-packages\wandb\sdk\wandb_init.py", line 289, in setup wandb_login._login( File "C:\Python310\lib\site-packages\wandb\sdk\wandb_login.py", line 298, in _login wlogin.prompt_api_key() File "C:\Python310\lib\site-packages\wandb\sdk\wandb_login.py", line 228, in prompt_api_key raise UsageError("api_key not configured (no-tty). call " + directive) wandb.errors.UsageError: api_key not configured (no-tty). call wandb.login(key=[your_api_key]) Traceback (most recent call last): File "Z:\WeClone\src\train_sft.py", line 9, in run_exp(config) File "Z:\WeClone\venv\lib\site-packages\llmtuner\train\tuner.py", line 31, in run_exp run_sft(model_args, data_args, training_args, finetuning_args, generating_args, callbacks) File "Z:\WeClone\venv\lib\site-packages\llmtuner\train\sft\workflow.py", line 75, in run_sft train_result = trainer.train(resume_from_checkpoint=training_args.resume_from_checkpoint) File "Z:\WeClone\venv\lib\site-packages\transformers\trainer.py", line 1780, in train return inner_training_loop( File "Z:\WeClone\venv\lib\site-packages\transformers\trainer.py", line 2036, in _inner_training_loop self.control = self.callback_handler.on_train_begin(args, self.state, self.control) File "Z:\WeClone\venv\lib\site-packages\transformers\trainer_callback.py", line 370, in on_train_begin return self.call_event("on_train_begin", args, state, control) File "Z:\WeClone\venv\lib\site-packages\transformers\trainer_callback.py", line 414, in call_event result = getattr(callback, event)( File "Z:\WeClone\venv\lib\site-packages\transformers\integrations\integration_utils.py", line 768, in on_train_begin self.setup(args, state, model, kwargs) File "Z:\WeClone\venv\lib\site-packages\transformers\integrations\integration_utils.py", line 741, in setup self._wandb.init( File "C:\Python310\lib\site-packages\wandb\sdk\wandb_init.py", line 1166, in init raise e File "C:\Python310\lib\site-packages\wandb\sdk\wandb_init.py", line 1143, in init wi.setup(kwargs) File "C:\Python310\lib\site-packages\wandb\sdk\wandb_init.py", line 289, in setup wandb_login._login( File "C:\Python310\lib\site-packages\wandb\sdk\wandb_login.py", line 298, in _login wlogin.prompt_api_key() File "C:\Python310\lib\site-packages\wandb\sdk\wandb_login.py", line 228, in prompt_api_key raise UsageError("api_key not configured (no-tty). call " + directive) wandb.errors.UsageError: api_key not configured (no-tty). call wandb.login(key=[your_api_key])

xming521 commented 5 months ago

https://github.com/hiyouga/LLaMA-Factory/issues/3530#issuecomment-2087898677 下面几个方法都可以试一下 我应该是没用wandb

xming521 commented 5 months ago

itchat的版本是啥 微信绑银行卡了吗

pkr5277 commented 5 months ago

itchat的版本是啥 微信绑银行卡了吗

好使了大佬,确实没有绑定银行卡,谢谢!

pkr5277 commented 5 months ago

大佬能问一下如果想继续训练之前的model应该怎么改?

xming521 commented 5 months ago

你试试不改,默认应该会自动读训练过的

pkr5277 commented 5 months ago

你试试不改,默认应该会自动读训练过的

不改继续训练会提示overwrite_output_dir文件夹不为空 image

xming521 commented 5 months ago

在settings.json的train_sft_args 加上overwrite_output_dir为True试试

pkr5277 commented 5 months ago

大佬,有办法给模型输入固定模板吗,就是我问他1,他固定回我2,我训练了这样的数据集,但是还是答非所问

xming521 commented 5 months ago

可以试试改src/template.py 的系统提示词 或者把dropout调很小试试

Chain-Mao commented 4 months ago

transformers 4.38.1 会报这个错 ImportError: cannot import name 'MixtralBLockSparseTop2MLP' from 'transformers.models.mixtral.modeling_mixtral'

transformers 4.40.1 又会报这个错 ttributeError: module 'ml_dtypes' has no attribute 'float8_e4m3b11'. Did you mean: 'float8_e4m3fn'? Traceback (most recent call last): File "Z:\python program\WeClone\src\train_sft.py", line 1, in from llmtuner import run_exp File "Z:\python program\WeClone\venv\lib\site-packages\llmtunerinit.py", line 6, in from .train import export_model, run_exp File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\traininit.py", line 1, in from .tuner import export_model, run_exp File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\train\tuner.py", line 10, in from .dpo import run_dpo File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\train\dpoinit.py", line 1, in from .workflow import run_dpo File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\train\dpo\workflow.py", line 9, in from ...extras.ploting import plot_loss File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\extras\ploting.py", line 6, in from transformers.trainer import TRAINER_STATE_NAME File "Z:\python program\WeClone\venv\lib\site-packages\transformers\trainer.py", line 59, in from .data.data_collator import DataCollator, DataCollatorWithPadding, default_data_collator File "Z:\python program\WeClone\venv\lib\site-packages\transformers\datainit.py", line 27, in from .processors import ( File "Z:\python program\WeClone\venv\lib\site-packages\transformers\data\processorsinit.py", line 15, in from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels File "Z:\python program\WeClone\venv\lib\site-packages\transformers\data\processors\glue.py", line 30, in import tensorflow as tf File "C:\Python310\lib\site-packages\tensorflowinit.py", line 38, in from tensorflow.python.tools import module_util as _module_util File "C:\Python310\lib\site-packages\tensorflow\pythoninit.py", line 42, in from tensorflow.python.saved_model import saved_model File "C:\Python310\lib\site-packages\tensorflow\python\saved_model\saved_model.py", line 20, in from tensorflow.python.saved_model import builder File "C:\Python310\lib\site-packages\tensorflow\python\saved_model\builder.py", line 23, in from tensorflow.python.saved_model.builder_impl import _SavedModelBuilder File "C:\Python310\lib\site-packages\tensorflow\python\saved_model\builder_impl.py", line 26, in from tensorflow.python.framework import dtypes File "C:\Python310\lib\site-packages\tensorflow\python\framework\dtypes.py", line 39, in _np_float8_e5m2 = pywrap_ml_dtypes.float8_e5m2() TypeError: Unable to convert function return value to a Python type! The signature was () -> handle 想问一下大佬用的哪个版本

请问这个transfomer的问题是怎样解决的

Drawing1998 commented 3 months ago

transformers 4.38.1 会报这个错 ImportError: cannot import name 'MixtralBLockSparseTop2MLP' from 'transformers.models.mixtral.modeling_mixtral'

transformers 4.40.1 又会报这个错 ttributeError: module 'ml_dtypes' has no attribute 'float8_e4m3b11'. Did you mean: 'float8_e4m3fn'? Traceback (most recent call last): File "Z:\python program\WeClone\src\train_sft.py", line 1, in from llmtuner import run_exp File "Z:\python program\WeClone\venv\lib\site-packages\llmtunerinit.py", line 6, in from .train import export_model, run_exp File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\traininit.py", line 1, in from .tuner import export_model, run_exp File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\train\tuner.py", line 10, in from .dpo import run_dpo File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\train\dpoinit.py", line 1, in from .workflow import run_dpo File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\train\dpo\workflow.py", line 9, in from ...extras.ploting import plot_loss File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\extras\ploting.py", line 6, in from transformers.trainer import TRAINER_STATE_NAME File "Z:\python program\WeClone\venv\lib\site-packages\transformers\trainer.py", line 59, in from .data.data_collator import DataCollator, DataCollatorWithPadding, default_data_collator File "Z:\python program\WeClone\venv\lib\site-packages\transformers\datainit.py", line 27, in from .processors import ( File "Z:\python program\WeClone\venv\lib\site-packages\transformers\data\processorsinit.py", line 15, in from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels File "Z:\python program\WeClone\venv\lib\site-packages\transformers\data\processors\glue.py", line 30, in import tensorflow as tf File "C:\Python310\lib\site-packages\tensorflowinit.py", line 38, in from tensorflow.python.tools import module_util as _module_util File "C:\Python310\lib\site-packages\tensorflow\pythoninit.py", line 42, in from tensorflow.python.saved_model import saved_model File "C:\Python310\lib\site-packages\tensorflow\python\saved_model\saved_model.py", line 20, in from tensorflow.python.saved_model import builder File "C:\Python310\lib\site-packages\tensorflow\python\saved_model\builder.py", line 23, in from tensorflow.python.saved_model.builder_impl import _SavedModelBuilder File "C:\Python310\lib\site-packages\tensorflow\python\saved_model\builder_impl.py", line 26, in from tensorflow.python.framework import dtypes File "C:\Python310\lib\site-packages\tensorflow\python\framework\dtypes.py", line 39, in _np_float8_e5m2 = pywrap_ml_dtypes.float8_e5m2() TypeError: Unable to convert function return value to a Python type! The signature was () -> handle 想问一下大佬用的哪个版本

所以大佬用的哪个版本呀?我也遇到这个问题了

ChenCheng2Cs commented 3 months ago

transformers 4.38.1 会报这个错 ImportError: cannot import name 'MixtralBLockSparseTop2MLP' from 'transformers.models.mixtral.modeling_mixtral' transformers 4.40.1 又会报这个错 ttributeError: module 'ml_dtypes' has no attribute 'float8_e4m3b11'. Did you mean: 'float8_e4m3fn'? Traceback (most recent call last): File "Z:\python program\WeClone\src\train_sft.py", line 1, in from llmtuner import run_exp File "Z:\python program\WeClone\venv\lib\site-packages\llmtunerinit.py", line 6, in from .train import export_model, run_exp File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\traininit.py", line 1, in from .tuner import export_model, run_exp File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\train\tuner.py", line 10, in from .dpo import run_dpo File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\train\dpoinit.py", line 1, in from .workflow import run_dpo File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\train\dpo\workflow.py", line 9, in from ...extras.ploting import plot_loss File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\extras\ploting.py", line 6, in from transformers.trainer import TRAINER_STATE_NAME File "Z:\python program\WeClone\venv\lib\site-packages\transformers\trainer.py", line 59, in from .data.data_collator import DataCollator, DataCollatorWithPadding, default_data_collator File "Z:\python program\WeClone\venv\lib\site-packages\transformers\datainit.py", line 27, in from .processors import ( File "Z:\python program\WeClone\venv\lib\site-packages\transformers\data\processorsinit.py", line 15, in from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels File "Z:\python program\WeClone\venv\lib\site-packages\transformers\data\processors\glue.py", line 30, in import tensorflow as tf File "C:\Python310\lib\site-packages\tensorflowinit.py", line 38, in from tensorflow.python.tools import module_util as _module_util File "C:\Python310\lib\site-packages\tensorflow\pythoninit.py", line 42, in from tensorflow.python.saved_model import saved_model File "C:\Python310\lib\site-packages\tensorflow\python\saved_model\saved_model.py", line 20, in from tensorflow.python.saved_model import builder File "C:\Python310\lib\site-packages\tensorflow\python\saved_model\builder.py", line 23, in from tensorflow.python.saved_model.builder_impl import _SavedModelBuilder File "C:\Python310\lib\site-packages\tensorflow\python\saved_model\builder_impl.py", line 26, in from tensorflow.python.framework import dtypes File "C:\Python310\lib\site-packages\tensorflow\python\framework\dtypes.py", line 39, in _np_float8_e5m2 = pywrap_ml_dtypes.float8_e5m2() TypeError: Unable to convert function return value to a Python type! The signature was () -> handle 想问一下大佬用的哪个版本

所以大佬用的哪个版本呀?我也遇到这个问题了

pip install transformers== 4.38.1 就可以了

ranlychan commented 8 minutes ago

transformers 4.38.1 会报这个错 ImportError: cannot import name 'MixtralBLockSparseTop2MLP' from 'transformers.models.mixtral.modeling_mixtral' transformers 4.40.1 又会报这个错 ttributeError: module 'ml_dtypes' has no attribute 'float8_e4m3b11'. Did you mean: 'float8_e4m3fn'? Traceback (most recent call last): File "Z:\python program\WeClone\src\train_sft.py", line 1, in from llmtuner import run_exp File "Z:\python program\WeClone\venv\lib\site-packages\llmtunerinit.py", line 6, in from .train import export_model, run_exp File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\traininit.py", line 1, in from .tuner import export_model, run_exp File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\train\tuner.py", line 10, in from .dpo import run_dpo File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\train\dpoinit.py", line 1, in from .workflow import run_dpo File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\train\dpo\workflow.py", line 9, in from ...extras.ploting import plot_loss File "Z:\python program\WeClone\venv\lib\site-packages\llmtuner\extras\ploting.py", line 6, in from transformers.trainer import TRAINER_STATE_NAME File "Z:\python program\WeClone\venv\lib\site-packages\transformers\trainer.py", line 59, in from .data.data_collator import DataCollator, DataCollatorWithPadding, default_data_collator File "Z:\python program\WeClone\venv\lib\site-packages\transformers\datainit.py", line 27, in from .processors import ( File "Z:\python program\WeClone\venv\lib\site-packages\transformers\data\processorsinit.py", line 15, in from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels File "Z:\python program\WeClone\venv\lib\site-packages\transformers\data\processors\glue.py", line 30, in import tensorflow as tf File "C:\Python310\lib\site-packages\tensorflowinit.py", line 38, in from tensorflow.python.tools import module_util as _module_util File "C:\Python310\lib\site-packages\tensorflow\pythoninit.py", line 42, in from tensorflow.python.saved_model import saved_model File "C:\Python310\lib\site-packages\tensorflow\python\saved_model\saved_model.py", line 20, in from tensorflow.python.saved_model import builder File "C:\Python310\lib\site-packages\tensorflow\python\saved_model\builder.py", line 23, in from tensorflow.python.saved_model.builder_impl import _SavedModelBuilder File "C:\Python310\lib\site-packages\tensorflow\python\saved_model\builder_impl.py", line 26, in from tensorflow.python.framework import dtypes File "C:\Python310\lib\site-packages\tensorflow\python\framework\dtypes.py", line 39, in _np_float8_e5m2 = pywrap_ml_dtypes.float8_e5m2() TypeError: Unable to convert function return value to a Python type! The signature was () -> handle 想问一下大佬用的哪个版本

所以大佬用的哪个版本呀?我也遇到这个问题了

我通过pip install trl==0.7.11 accelerate==0.27.2 datasets==2.17.1 transformers==4.38.1解决了