mac 下边 seq2seq 安装

git clone https://github.com/google/seq2seq.git
cd seq2seq

# Install package and dependencies
pip install -e .

安装后要进行测试:

python -m unittest seq2seq.test.pipeline_test

 

我测试后出现:

  1. ImportError: cannot import name contrib

解决方法:

修改 : seq2seq/seq2seq/contrib/seq2seq/helper.py
 

#from tensorflow.contrib.distributions.python.ops import bernoulli
#from tensorflow.contrib.distributions.python.ops import categorical
try:
    from tensorflow.python.ops.distributions import bernoulli
    from tensorflow.python.ops.distributions import categorical
except:
    from tensorflow.contrib.distributions.python.ops import bernoulli
    from tensorflow.contrib.distributions.python.ops import categorical


2. AttributeError: 'module' object has no attribute '_FlagValues'

修改 seq2seq/test/pipeline_test.py 这个文件

sudo vim seq2seq/test/pipeline_test.py
  •  

修改 def _clear_flags() 这个方法
改为下面这种:

def _clear_flags():
  """Resets Tensorflow's FLAG values"""
  #pylint: disable=W0212
  for flag_key in dir(tf.app.flags.FLAGS):
      delattr(tf.app.flags.FLAGS, flag_key)
  #tf.app.flags.FLAGS = tf.app.flags._FlagValues()
  tf.app.flags._global_parser = argparse.ArgumentParser()

在python3.6 上边的安装如下:

on mac & python3.6

pip3 install git+https://github.com/datalogai/recurrentshop.git
pip3 install git+https://github.com/farizrahman4u/seq2seq.git

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值