hankcs / multi-criteria-cws

Simple Solution for Multi-Criteria Chinese Word Segmentation
http://www.hankcs.com/nlp/segment/multi-criteria-cws.html
GNU General Public License v3.0
300 stars 84 forks source link

dynet安装 #1

Open chaoli1024 opened 6 years ago

chaoli1024 commented 6 years ago

按照dynet教程在Linux和Windows安装不上,您是如何安装的,还是在服务器上运行的

hankcs commented 6 years ago

我是从源码编译安装的,第一步先安装mkl(可选,大幅提升CPU速度): http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/11544/l_mkl_2017.3.196.tgz

然后执行如下命令:

#!/usr/bin/env bash

git clone https://github.com/clab/dynet.git
hg clone https://bitbucket.org/eigen/eigen -r 346ecdb  # -r NUM specified a known working revision
cd dynet
git checkout 2.0.1
mkdir build
cd build
cmake .. -DEIGEN3_INCLUDE_DIR=../../eigen -DMKL=TRUE -DPYTHON=`which python3` -DMKL_ROOT=/opt/intel/mkl
make -j 4
cd python
python ../../setup.py build --build-dir=.. --skip-build install
chaoli1024 commented 6 years ago

`Traceback (most recent call last):

File "model.py", line 528, in loss_expr = model.neg_log_loss(instance.sentence, instance.tags)

File "model.py", line 192, in neg_log_loss forward_score = self.forward(observations)

File "model.py", line 212, in forward alphas_t.append(log_sum_exp(next_tag_expr))

File "model.py", line 202, in log_sum_exp return max_score_expr + dy.log(dy.sum_cols(dy.transpose(dy.exp(scores - max_score_expr_broadcast))))

AttributeError: module 'dynet' has no attribute 'sum_cols'`

hankcs commented 6 years ago

Dynet版本号不匹配,必须是2.0.1:https://github.com/clab/dynet/releases/tag/2.0.1

liyuxi1110 commented 4 years ago

请问在执行make -j 4这个命令时 报错No targets specified and no makefile found.会是什么原因呢? 我在build目录下没有找到makefile文件,是需要自己写吗?