Browse Source

Update relative Swivel import

Alexander Bezzubov 7 years ago
parent
commit
8a03b5620b
2 changed files with 4 additions and 1 deletions
  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