1. 修改 OpenEN
主要問(wèn)題:
(1)import 本地編寫(xiě)的py文件在路徑上有問(wèn)題
還有要注意工程之間的鏈接和應(yīng)用
一般都是相對(duì)路徑充岛,哦盹憎!
from libnrl.gcn.utils import *
(2)python版本修改
由于OpenEN是python2的敦姻,今天將open修改為pyrhon3.6版本
其中修改主要是print語(yǔ)句
for i in range(20):
print('Iteration ', i)
Iteration 0
Iteration 1
Iteration 2
Iteration 3
Iteration 4
Iteration 5
Iteration 6
Iteration 7
Iteration 8
Iteration 9
Iteration 10
Iteration 11
Iteration 12
Iteration 13
Iteration 14
Iteration 15
Iteration 16
Iteration 17
Iteration 18
Iteration 19
把print('Iteration ', i)改為print 'Iteration ', i 就把python從2.7 改為了python3.6
對(duì)于這個(gè)問(wèn)題我只能2333333
一開(kāi)始打開(kāi)這個(gè)開(kāi)源項(xiàng)目瘾境,嚇了我一跳,怎么不能運(yùn)行镰惦,一看報(bào)print迷守,2333333
(3)安裝gensim
from gensim.models import Word2Vec?
一開(kāi)始還pip了半 天的Word2Vec,2333333
lijuncheng@lijunchengdeMacBook-Pro ~ $ pip install Word2Vec
Requirement already satisfied: Word2Vec in ./anaconda3/lib/python3.6/site-packages
Requirement already satisfied: numpy in ./anaconda3/lib/python3.6/site-packages (from Word2Vec)
Requirement already satisfied: cython in ./anaconda3/lib/python3.6/site-packages (from Word2Vec)
lijuncheng@lijunchengdeMacBook-Pro ~ $ python
Python 3.6.3 |Anaconda custom (64-bit)| (default, Oct 6 2017, 12:04:38)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Word2Vec
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'Word2Vec'
>>> import Word2Vec
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'Word2Vec'
>>> quit()
lijuncheng@lijunchengdeMacBook-Pro ~ $ pip install gensim
Collecting gensim
Downloading gensim-3.4.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (22.8MB)
100% |████████████████████████████████| 22.8MB 61kB/s
Requirement already satisfied: numpy>=1.11.3 in ./anaconda3/lib/python3.6/site-packages (from gensim)
Collecting smart-open>=1.2.1 (from gensim)
Downloading smart_open-1.5.7.tar.gz
Requirement already satisfied: scipy>=0.18.1 in ./anaconda3/lib/python3.6/site-packages (from gensim)
Requirement already satisfied: six>=1.5.0 in ./anaconda3/lib/python3.6/site-packages (from gensim)
Requirement already satisfied: boto>=2.32 in ./anaconda3/lib/python3.6/site-packages (from smart-open>=1.2.1->gensim)
Collecting bz2file (from smart-open>=1.2.1->gensim)
Downloading bz2file-0.98.tar.gz
Requirement already satisfied: requests in ./anaconda3/lib/python3.6/site-packages (from smart-open>=1.2.1->gensim)
Collecting boto3 (from smart-open>=1.2.1->gensim)
Downloading boto3-1.7.2-py2.py3-none-any.whl (128kB)
100% |████████████████████████████████| 133kB 496kB/s
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./anaconda3/lib/python3.6/site-packages (from requests->smart-open>=1.2.1->gensim)
Requirement already satisfied: idna<2.7,>=2.5 in ./anaconda3/lib/python3.6/site-packages (from requests->smart-open>=1.2.1->gensim)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in ./anaconda3/lib/python3.6/site-packages (from requests->smart-open>=1.2.1->gensim)
Requirement already satisfied: certifi>=2017.4.17 in ./anaconda3/lib/python3.6/site-packages (from requests->smart-open>=1.2.1->gensim)
Collecting s3transfer<0.2.0,>=0.1.10 (from boto3->smart-open>=1.2.1->gensim)
Downloading s3transfer-0.1.13-py2.py3-none-any.whl (59kB)
100% |████████████████████████████████| 61kB 444kB/s
Collecting jmespath<1.0.0,>=0.7.1 (from boto3->smart-open>=1.2.1->gensim)
Downloading jmespath-0.9.3-py2.py3-none-any.whl
Collecting botocore<1.11.0,>=1.10.2 (from boto3->smart-open>=1.2.1->gensim)
Downloading botocore-1.10.2-py2.py3-none-any.whl (4.2MB)
100% |████████████████████████████████| 4.2MB 271kB/s
Requirement already satisfied: python-dateutil<2.7.0,>=2.1 in ./anaconda3/lib/python3.6/site-packages (from botocore<1.11.0,>=1.10.2->boto3->smart-open>=1.2.1->gensim)
Requirement already satisfied: docutils>=0.10 in ./anaconda3/lib/python3.6/site-packages (from botocore<1.11.0,>=1.10.2->boto3->smart-open>=1.2.1->gensim)
Building wheels for collected packages: smart-open, bz2file
Running setup.py bdist_wheel for smart-open ... done
Stored in directory: /Users/lijuncheng/Library/Caches/pip/wheels/cf/54/36/b003d8c2d26aadffc21f0677009ed53cf9575a97fc71fbba76
Running setup.py bdist_wheel for bz2file ... done
Stored in directory: /Users/lijuncheng/Library/Caches/pip/wheels/31/9c/20/996d65ca104cbca940b1b053299b68459391c01c774d073126
Successfully built smart-open bz2file
Installing collected packages: bz2file, jmespath, botocore, s3transfer, boto3, smart-open, gensim
Successfully installed boto3-1.7.2 botocore-1.10.2 bz2file-0.98 gensim-3.4.0 jmespath-0.9.3 s3transfer-0.1.13 smart-open-1.5.7
(4)測(cè)試運(yùn)行
python src/main.py --method node2vec --label-file data/blogCatalog/bc_labels.txt --input data/blogCatalog/bc_adjlist.txt --graph-format adjlist --output vec_all.txt --q 0.25 --p 0.25
python src/main.py --method gcn --label-file data/cora/cora_labels.txt --input data/cora/cora_edgelist.txt --graph-format edgelist --feature-file data/cora/cora.features --epochs 200 --output vec_all.txt --clf-ratio 0.1
2.修改TF警告
警告??:
2018-04-07 17:54:07.725382: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2018-04-07 17:54:07.725402: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2018-04-07 17:54:07.725407: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2018-04-07 17:54:07.725412: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2018-04-07 17:54:07.725417: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
警告原因好像是由于:什么指令集不對(duì)怎么樣
TensorFlow CPU環(huán)境 SSE/AVX/FMA 指令集編譯
在StackOverflow上找到相關(guān)解釋:https://stackoverflow.com/questions/41293077/how-to-compile-tensorflow-with-sse4-2-and-avx-instructions
解決:添加兩行代碼
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
效果
接下來(lái)還有繼續(xù)跟進(jìn)對(duì)NE的學(xué)習(xí)旺入,加油兑凿。距離月底還有22天凯力,希望盡快形成有小論文的想法。加油??礼华,加油??咐鹤,加油??....
寶寶明天要上班啦,希望寶寶每天都開(kāi)心圣絮,快樂(lè)祈惶。少生點(diǎn)氣,其實(shí)生活很美好??????