问题描述
我想尝试PEGASUS来总结文章. https://github.com/google-research/pegasus
I would like to try PEGASUS to summarize article. https://github.com/google-research/pegasus
原始存储库的自述文件建议使用Google Cloud Compute Engine,但我使用Colaboratory笔记本.我是日本的英语老师,希望我的学生轻松尝试该软件.他们可以同时体验机器学习和英语段落摘要.
The original repo's README suggests to use Google Cloud Compute Engine, but I use Colaboratory notebook. I'm an English teacher in Japan and I hope my students to try this software easily. They can experience both Machine Learning and English passage summarization.
我遵循了这条指令. https://github.com/google-research/pegasus/tree/f76b63c2886748f7f5c6c9d设置
这是我的colab笔记本. https://colab.research.google.com/drive/1p95tZcjhfuCLYhE23X3S_gIqR共享
This is my colab notebook.https://colab.research.google.com/drive/1p95tZcjhfuCLYh23X3S_gZqRoWVhpIlE?usp=sharing
这是我在笔记本中的代码.
This is my code in the notebook.
%tensorflow_version 1.x
!git clone https://github.com/google-research/pegasus
!export PYTHONPATH=/content/pegasus
%pip install -r /content/pegasus/requirements.txt
!mkdir /content/pegasus/ckpt
!gsutil cp -r gs://pegasus_ckpt/ /content/pegasus/ckpt/
!python /content/pegasus/pegasus/bin/train.py --params=aeslc_transformer \
--param_overrides=vocab_filename=ckpt/pegasus_ckpt/c4.unigram.newline.10pct.96000.model \
--train_init_checkpoint=ckpt/pegasus_ckpt/model.ckpt-1500000 \
--model_dir=ckpt/pegasus_ckpt/aeslc
然后,我收到此错误消息.
Then, I get this error message.
Traceback (most recent call last):
File "/content/pegasus/pegasus/bin/train.py", line 17, in <module>
from pegasus.data import infeed
ModuleNotFoundError: No module named 'pegasus'
此错误消息说python无法导入'pegasus'模块,但是我使用!export PYTHONPATH =/content/pegasus
此命令创建了python路径.
This error message says that python can't import 'pegasus' module, but I made python path with !export PYTHONPATH=/content/pegasus
this command.
请给我任何建议吗?
推荐答案
您不能使用此
!export PYTHONPATH=/content/pegasus
改为使用此
import os
os.environ['PYTHONPATH'] += ':/content/pegasus'
这是可以正常运行的示例笔记本.
我不使用/content/pegasus/pegasus
.我通过与!npx degit ..
这篇关于ModuleNotFoundError:没有名为“飞马"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!