Morizeyao / GPT2-Chinese

Chinese version of GPT2 training code, using BERT tokenizer.
MIT License
7.46k stars 1.7k forks source link

运行generate.py报错 #220

Open louis-gg opened 3 years ago

louis-gg commented 3 years ago

下载散文模板,在工程目录下建文件夹model/sanwen/将文件config.json、pytorch_model.bin、vocab.txt放入,修改源码: parser.add_argument( "--model_path", default="model/sanwen/", type=str, required=False, help="模型路径", ) 执行后报错:(已经确定文件目录存在) Traceback (most recent call last): File "./generate.py", line 233, in main() File "./generate.py", line 206, in main for key, value in torch.load(args.model_path, map_location="cpu")[ File "C:\ProgramData\Anaconda3\lib\site-packages\torch\serialization.py", line 579, in load with _open_file_like(f, 'rb') as opened_file: File "C:\ProgramData\Anaconda3\lib\site-packages\torch\serialization.py", line 230, in _open_file_like return _open_file(name_or_buffer, mode) File "C:\ProgramData\Anaconda3\lib\site-packages\torch\serialization.py", line 211, in init super(_open_file, self).init(open(name, mode)) PermissionError: [Errno 13] Permission denied: 'model/sanwen/'

Lirsakura commented 3 years ago

请问一下你的训练代码是最新的吗,出现过attention_mask报错吗

Creative-Ataraxia commented 2 years ago

会不会是model/sanwen/没有read access