Skip to content

Commit

Permalink
Accept word2vec formats too. (#1875)
Browse files Browse the repository at this point in the history
* Acccept word2vec formats too.

* Remove spaces in otherwise empty line

---------

Co-authored-by: Tom Aarsen <[email protected]>
  • Loading branch information
mokha and tomaarsen authored Dec 18, 2023
1 parent 3d58911 commit 9b1c33f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sentence_transformers/models/WordEmbeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ def from_text_file(embeddings_file_path: str, update_embeddings: bool = False, i
iterator = tqdm(fIn, desc="Load Word Embeddings", unit="Embeddings")
for line in iterator:
split = line.rstrip().split(item_separator)

if not vocab and len(split) == 2: # Handle Word2vec format
continue

word = split[0]

if embeddings_dimension == None:
Expand Down

0 comments on commit 9b1c33f

Please sign in to comment.