-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] 为什么model.save_pretrained总会报错,无法生成pred文件 #19
Comments
您好,我想问一下,后来您这个问题解决了么??因为我在训练过程中也遇到了同样的问题! |
还是没解决,换用其它框架了
…---原始邮件---
发件人: ***@***.***>
发送时间: 2023年4月23日(周日) 晚上11:06
收件人: ***@***.***>;
抄送: ***@***.******@***.***>;
主题: Re: [modelscope/AdaSeq] [Question] 为什么model.save_pretrained总会报错,无法生成pred文件 (Issue #19)
您好,我想问一下,后来您这个问题解决了么??因为我在训练过程中也遇到了同样的问题!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
那真是太遗憾了,我找了半天也没有找出哪里有问题。。 |
@ybqand187 @thy1999 您好,兼容性问题已经修复了。 |
感谢您的回答,目前这一问题已经被修复。但我还有一个问题想要询问一下,就是我想要在除了已经给出的这些数据集之外的其他数据集上跑MoRe多模态模型,但github上并没有给出相应数据预处理的代码,所以我不太清楚如何得到加image和text的数据预处理文件,不知道是否方便提供一下MoRe这一模型数据预处理的代码呢? |
@caijiong 是MoRE的作者,已经跟他沟通了,晚点他来回复。 |
What is your question?
代码是在天池上copy的,但每个模型训练结束执行model.save_pretrained时总会报错,报错如下
~/opt/anaconda3/lib/python3.9/site-packages/modelscope/trainers/hooks/checkpoint_hook.py in copy_files_and_dump_config(trainer, output_dir, config, bin_file)
261 if hasattr(model, 'save_pretrained'):
262 # Save pretrained of model, skip saving checkpoint
--> 263 model.save_pretrained(
264 output_dir,
265 bin_file,
~/opt/anaconda3/lib/python3.9/site-packages/adaseq/models/base.py in save_pretrained(self, target_folder, save_checkpoint_names, save_function, config, save_config_function, with_meta, **kwargs)
161 for field in ['experiment', 'dataset', 'train', 'evaluation']:
162 if field in config:
--> 163 del config[field]
164
165 if (
AttributeError: delitem
What have you tried?
No response
Code (if necessary)
`from modelscope.utils.config import Config
config = Config.from_string("""
experiment:
exp_dir: experiments/
exp_name: transformer_crf
seed: 42
task: named-entity-recognition
dataset:
data_file:
train: /Users/yyy/data/train.conll
valid: /Users/yyy/data/dev.conll
test: /Users/yyy/data/test.conll
data_type: conll
preprocessor:
type: sequence-labeling-preprocessor
max_length: 80
data_collator: SequenceLabelingDataCollatorWithPadding
model:
type: sequence-labeling-model
embedder:
model_name_or_path: damo/nlp_raner_named-entity-recognition_chinese-base-news
dropout: 0.1
use_crf: true
train:
max_epochs: 20
dataloader:
batch_size_per_gpu: 16
optimizer:
type: AdamW
lr: 5.0e-5
param_groups:
- regex: crf
lr: 5.0e-1
lr_scheduler:
type: StepLR
step_size: 2
gamma: 0.8
hooks:
- type: TensorboardHook
evaluation:
dataloader:
batch_size_per_gpu: 128
metrics:
- type: ner-metric
- type: ner-dumper
model_type: sequence_labeling
dump_format: conll
""", file_format='.yaml')
initialize a trainer
import os
from adaseq.commands.train import build_trainer_from_partial_objects
work_dir = 'experiments/transformer_crf'
os.makedirs(work_dir, exist_ok=True)
trainer = build_trainer_from_partial_objects(
config,
work_dir=work_dir,
seed=42,
device='cuda:0'
)
do training
trainer.train()
do testing
trainer.test()`
What's your environment?
Code of Conduct
The text was updated successfully, but these errors were encountered: