Pārlūkot izejas kodu

Update relative Swivel import

Alexander Bezzubov 7 gadi atpakaļ
vecāks
revīzija
8a03b5620b
2 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  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