Skip to content

Commit

Permalink
Check the existence of model file during loading.
Browse files Browse the repository at this point in the history
  • Loading branch information
akutuzov committed Sep 17, 2020
1 parent 1443442 commit d2f9e0b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ Example paraphrase datasets for Russian (adapted from http://paraphraser.ru/):
- https://rusvectores.org/static/testsets/paraphrases.tsv.gz
- https://rusvectores.org/static/testsets/paraphrases_lemm.tsv.gz (lemmatized)


The library requires Python >= 3.6.
# Training your own ELMo
Currently we provide ELMo training code (updated and improved in the same way compared to the original implementation)
in a [separate repository](https://github.com/ltgoslo/simple_elmo_training).
It will be integrated into the `simple_elmo` package in the nearest future.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="simple_elmo",
version="0.3.4",
version="0.3.6",
author="Andrey Kutuzov",
author_email="[email protected]",
description="Handy library to work with pre-trained ELMo embeddings in TensorFlow",
Expand Down
2 changes: 2 additions & 0 deletions simple_elmo/elmo_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def load(self, directory, top=False, max_batch_size=96):
:param max_batch_size: the maximum allowable batch size during inference
:return: ELMo batcher, character id placeholders, op object
"""
if not os.path.exists(directory):
raise SystemExit("Error: model not found!")
self.batch_size = max_batch_size
if os.path.isfile(directory) and directory.endswith(".zip"):
message = """
Expand Down

0 comments on commit d2f9e0b

Please sign in to comment.