我使用库aitextgen从这里https://github.com/minimaxir/aitextgen在谷歌colab做一个文本生成器模型,但当我运行"ai. train"它变成了一个错误。任何建议来解决这个问题?谢谢你的帮助
这是密码
ai.train(file_name,
line_by_line = False,
from_cache = False,
num_steps = 3000,
generate_every = 1000,
save_every = 1000,
save_gdrive = False,
learning_rate = 1e-3,
fp16 = True,
batch_size = 1,
)
这是错误信息
AttributeError Traceback (most recent call last)
<ipython-input-29-e611ad4fbd0c> in <module>
----> 1 ai.train(file_name,
2 line_by_line = False,
3 from_cache = False,
4 num_steps = 3000,
5 generate_every = 1000,
2 frames
/usr/local/lib/python3.8/dist-packages/aitextgen/aitextgen.py in train(self, train_data, output_dir, fp16, fp16_opt_level, n_gpu, tpu_cores, max_grad_norm, gradient_accumulation_steps, seed, learning_rate, weight_decay, adam_epsilon, warmup_steps, num_steps, save_every, generate_every, n_generate, loggers, batch_size, num_workers, benchmark, avg_loss_smoothing, save_gdrive, run_id, progress_bar_refresh_rate, freeze_layers, num_layers_freeze, use_deepspeed, **kwargs)
673
674 # Wrap the model in a pytorch-lightning module
--> 675 train_model = ATGTransformer(self.model, train_data, hparams, self.tokenizer)
676
677 # Begin training
/usr/local/lib/python3.8/dist-packages/aitextgen/train.py in __init__(self, model, dataset, hparams, tokenizer)
19 def __init__(self, model, dataset, hparams, tokenizer):
20 super(ATGTransformer, self).__init__()
---> 21 self.model, self.dataset, self.hparams, self.tokenizer = (
22 model,
23 dataset,
/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py in __setattr__(self, name, value)
1311 buffers[name] = value
1312 else:
-> 1313 super().__setattr__(name, value)
1314
1315 def __delattr__(self, name):
AttributeError: can't set attribute
我尝试过修改torch、pytorch-lightning和aitextgen的版本,但仍然出错。
1条答案
按热度按时间jgovgodb1#
我也犯了同样的错误,我做的是:!pip安装pytorch-lightning==1.2.10,它再次工作