Browse Source

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

labours: update relative Swivel import
Vadim Markovtsev 8 years ago
parent
commit
dd9dd084d5
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]
 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
 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
 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
 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
     from scipy.sparse import csr_matrix
     try:
     try:
         from . import swivel
         from . import swivel
-    except SystemError:
+    except (SystemError, ImportError):
         import swivel
         import swivel
+    import tensorflow as tf
 
 
     index = coocc_tree["index"]
     index = coocc_tree["index"]
     nshards = len(index) // shard_size
     nshards = len(index) // shard_size