소스 검색

Merge pull request #10 from bzz/fix/swivel-import

labours: update relative Swivel import
Vadim Markovtsev 7 년 전
부모
커밋
dd9dd084d5
2개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 0
      README.md
  2. 2 1
      labours.py

+ 2 - 0
README.md

@@ -127,6 +127,8 @@ hercules -couples [-people-dict=/path/to/identities]
 python3 labours.py -m couples -o <name> [--couples-tmp-dir=/tmp]
 ```
 
+**Important**: it requires Tensorflow to be installed, please follow [official instuctions](https://www.tensorflow.org/install/).
+
 The files are coupled if they are changed in the same commit. The developers are coupled if they
 change the same file. `hercules` records the number of couples throught the whole commti history
 and outputs the two corresponding co-occurrence matrices. `labours.py` then trains

+ 2 - 1
labours.py

@@ -419,8 +419,9 @@ def train_embeddings(coocc_tree, tmpdir, shard_size=4096):
     from scipy.sparse import csr_matrix
     try:
         from . import swivel
-    except SystemError:
+    except (SystemError, ImportError):
         import swivel
+    import tensorflow as tf
 
     index = coocc_tree["index"]
     nshards = len(index) // shard_size