facebookresearch / LASER

Language-Agnostic SEntence Representations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

two errors in embed.py and one error in indexing.py

guangyuli-uoe opened this issue · comments

embed.py

  1. class HuggingFaceEncoder():
    def init(self, encoder_name: str, verbose=False):
    from sentence_transformers import SentenceTransformer // -------here !!!!!!!!! ------- line 188 , Unresolved reference 'sentence_transformers

  2. def EncodeFilep(
    encoder, inp_file, out_file, buffer_size=10000, fp16=False, verbose=False
    ):
    n = 0
    t = time.time()
    for sentences in buffered_read(inp_file, buffer_size):
    encoded = encoder.encode_sentences(sentences)
    if fp16:
    encoded = encoded.astype(np.float16)
    encoded.tofile(out_file)
    n += len(sentences)
    if verbose and n % 10000 == 0:
    loger.info("encoded {:d} sentences".format(n)) // -------here !!!!!!!!! ------- line 409, NameError: name 'loger' is not defined
    if verbose:
    logger.info(f"encoded {n} sentences in {EncodeTime(t)}")

indexing.py
.format(args.langs[i1], args.langs[i2], // -------here !!!!!!!!! ------- line 126 Unresolved reference 'args'

Hi @guangyuli-uoe, can you try pulling again? These should now be resolved. However, the "Unresolved reference" message you see about the sentence_transformers library is a conditional import, and isn't required by default to run the embedding code (so you can ignore that message).