m0_57965808 2022-01-08 09:37 采纳率: 91.2%
浏览 176
已结题

GPT2--Chinese生成文本报错

问题遇到的现象和发生背景

从GITHUB下载了一个可以生成中文文本的项目:https://github.com/Morizeyao/GPT2-Chinese来学习,前几天一直在研究代码,今天想试试生成文本来着,但是报错了。

我在终端输入的代码与报错:
1 python ./generate.py --length=400 --nsamples=4 --prefix=在遥远的未来 --fast_pattern --save_samples --save_samples_path=/mnt/samples.txt
python: can't open file './generate.py': [Errno 2] No such file or directory
2 python .F:/GTP/GPT-Chinese/GPT2-Chinese-old_gpt_2_chinese_before_2021_4_22/generate.py --length=400 --nsamples=4 --prefix=在遥远的未来 --fast_pattern --save_samples --save_samples_path=/mnt/samples.txt
python: can't open file '.F:/GTP/GPT-Chinese/GPT2-Chinese-old_gpt_2_chinese_before_2021_4_22/generate.py': [Errno 22] Invalid argument
3 python .F:/GTP/GPT-Chinese/GPT2-Chinese-old_gpt_2_chinese_before_2021_4_22/generate.py --length=400 --nsamples=4 --prefix=在遥远的未来 --fast_pattern --save_samples --save_samples_path=/mnt/samples.txt
python: can't open file '.F:/GTP/GPT-Chinese/GPT2-Chinese-old_gpt_2_chinese_before_2021_4_22/generate.py': [Errno 22] Invalid argument
4 python .r'F:/GTP/GPT-Chinese/GPT2-Chinese-old_gpt_2_chinese_before_2021_4_22/generate.py' --length=400 --nsamples=4 --prefix=在遥远的未来 --fast_pattern --save_samples --save_samples_path=/mnt/samples.txt
python: can't open file '.r'F:/GTP/GPT-Chinese/GPT2-Chinese-old_gpt_2_chinese_before_2021_4_22/generate.py'': [Errno 22] Invalid argument
5 python .F//GTP/GPT-Chinese/GPT2-Chinese-old_gpt_2_chinese_before_2021_4_22/generate.py --length=400 --nsamples=4 --prefix=在遥远的未来 --fast_pattern --save_samples --save_samples_path=/mnt/samples.txt
python: can't open file '.F//GTP/GPT-Chinese/GPT2-Chinese-old_gpt_2_chinese_before_2021_4_22/generate.py': [Errno 2] No such file or directory
望各位有识之士不吝赐教

  • 写回答

1条回答 默认 最新

  • 陈年椰子 2022-01-08 15:41
    关注

    你下的项目, 保存到什么位置。
    要先确认 generate.py 所在目录。
    看你的运行命令,貌似在这个地方 F:/GTP/GPT-Chinese/GPT2-Chinese-old_gpt_2_chinese_before_2021_4_22
    进入windows的控制台
    依次输入以下命令试试

    f:
    cd F:/GTP/GPT-Chinese/GPT2-Chinese-old_gpt_2_chinese_before_2021_4_22
    python generate.py --length=400 --nsamples=4 --prefix=在遥远的未来 --fast_pattern --save_samples --save_samples_path=F:/GTP/samples.txt
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 1月16日
  • 已采纳回答 1月8日
  • 创建了问题 1月8日