일단 참고
http://cpuu.postype.com/post/197684/
SyntaxNet
https://github.com/tensorflow/models/tree/master/syntaxnet
사전 준비
SyntaxNet 정보로는 아래와 같은것을 설치해아합니다.
Installation
Running and training SyntaxNet models requires building this package from source. You'll need to install:
- python 2.7:
- python 3 support is not available yet
- bazel:
- versions 0.2.0 - 0.2.2b, NOT 0.2.3
- follow the instructions here
- swig:
apt-get install swigon Ubuntubrew install swigon OSX
- protocol buffers, with a version supported by TensorFlow:
- check your protobuf version with
pip freeze | grep protobuf - upgrade to a supported version with
pip install -U protobuf==3.0.0b2
- check your protobuf version with
- asciitree, to draw parse trees on the console for the demo:
pip install asciitree
- numpy, package for scientific computing:
pip install numpy
1. Ubuntu 설치
참고 : https://rorlab.gitbooks.io/railsguidebook/content/appendices/ubuntu14server.html
1.1 VirtualBox 설치
1.1.1 Ubuntu Desktop 다운로드 (16.04 LTS가 최신 이미지이네요.)
http://www.ubuntu.com/download/desktop 에서 iso 이미지 다운받음
1.1.2 VirtualBox에서 Ubuntu 설치
VirtualBox에서 iso 이미를 넣어서 Ubuntu를 설치합니다.
2. python 정보
설치된 ubuntu에서 python -V로 버전 확인이 가능합니다.
다행히 2.7.12 버전이 설치되어있네요.
3. bazel 설치
이건 빌드하는데 도움이 되는거라고 합니다.
설치하는 방법이 좀 까다롭습니다.
아래 링크를 보면 설치방법이 나와있습니다.
https://www.bazel.io/docs/install.html#install-with-installer-ubuntu
Using Bazel custom API repository (recommended)
1. Install JDK 8 =>Ubuntu 16.04를 설치했기 때문에 아래 사항을 skip해봤습니다.
If you are running Ubuntu Wily (15.10), you can skip this step. But for Ubuntu Trusty (14.04 LTS) users, since OpenJDK 8 is not available on Trusty, please install Oracle JDK 8:
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer
Note: You might need to
sudo apt-get install software-properties-common if you don't have the add-apt-repository command. Seehere.2. Add Bazel distribution URI as a package source (one time setup) => 이건 그대로 쳐줬습니다.
$ echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
$ curl https://storage.googleapis.com/bazel-apt/doc/apt-key.pub.gpg | sudo apt-key add -
If you want to use the JDK 7, please replace
jdk1.8 with jdk1.7 and if you want to install the testing version of Bazel, replace stablewith testing.3. Update and install Bazel => 업그레이드를 제외한 부분을 수행했습니다.
$ sudo apt-get update && sudo apt-get install bazel
Once installed, you can upgrade to newer version of Bazel with:
$ sudo apt-get upgrade bazel => 이부분 제외
0.2.0 ~0.2.2 사이 버전을 설치하라고 했는데 설치를 모두 하고 나니 최신 버전으로 설치가 됩니다. 0.3.1
- versions 0.2.0 - 0.2.2b, NOT 0.2.3
4. swig 설치
apt-get install swig
sudo apt install python-pip
pip freeze | grep protobuf
8.1.1 나옴
pip install asciitree
pip install numpy
git없으면 설치
sudo apt install git
소스 받기
git clone --recursive https://github.com/tensorflow/models.git
cd models/syntaxnet/tensorflow
./configure
몇가지 질문이 나오는데 모두 그냥 엔터
cd ..
bazel test syntaxnet/... util/utf8/...
VBOX로 빌드하니 한 두시간 이상 시간이 걸리네요
echo 'Bob brought the pizza to Alice.' | syntaxnet/demo.sh
실행했더니 ImportError: No module named _pywrap_tensorflow 에러가 발생하네요
https://github.com/tensorflow/tensorflow/issues/1013
텐서플로 설치 다시 확인
sudo apt-get install python-pip python-dev python-virtualenv
sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.9.0-cp27-none-linux_x86_64.whl
pip install -U protobuf==3.0.0b2
아래와 같이 해보니 에러가 없습니다. 뭐가 뭔지 모르겠네요
$ python
>>> import tensorflow as tf
bazel 관련 update
$ sudo apt-get update
$ sudo apt-get install bazel=0.2.2
$ sudo apt-get upgrade bazel
rm -rf .cache 삭제후 재빌드
자세히 보니 빌드시 virtual memory 부족으로 에러가 발생하네요
결론 성공 못함.... 따라하지 마세요 ^^
자세히 보니 빌드시 virtual memory 부족으로 에러가 발생하네요
결론 성공 못함.... 따라하지 마세요 ^^
댓글 없음:
댓글 쓰기