Last active
November 15, 2019 06:39
-
-
Save kylepjohnson/d40215b380be4b050b5cc1ceac09e369 to your computer and use it in GitHub Desktop.
stanfordnlp, Old French FileNotFoundError
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(cltk) AMAC02Z92FELVCG:cltkv1 kyle.p.johnson$ poetry run ipython | |
Python 3.7.5 (default, Oct 31 2019, 20:57:45) | |
Type 'copyright', 'credits' or 'license' for more information | |
IPython 7.9.0 -- An enhanced Interactive Python. Type '?' for help. | |
In [1]: import stanfordnlp | |
In [2]: stanfordnlp.__version__ | |
Out[2]: '0.2.0' | |
In [3]: stanfordnlp.download("fro") | |
Using the default treebank "fro_srcmf" for language "fro". | |
Would you like to download the models for: fro_srcmf now? (Y/n) | |
y | |
Default download directory: /Users/kyle.p.johnson/stanfordnlp_resources | |
Hit enter to continue or type an alternate directory. | |
Downloading models for: fro_srcmf | |
Download location: /Users/kyle.p.johnson/stanfordnlp_resources/fro_srcmf_models.zip | |
100%|████████████████████████████████████████| 227M/227M [00:28<00:00, 8.05MB/s] | |
Download complete. Models saved to: /Users/kyle.p.johnson/stanfordnlp_resources/fro_srcmf_models.zip | |
Extracting models file for: fro_srcmf | |
Cleaning up...Done. | |
In [4]: nlp = stanfordnlp.Pipeline(lang="fro") | |
Use device: cpu | |
--- | |
Loading: tokenize | |
With settings: | |
{'model_path': '/Users/kyle.p.johnson/stanfordnlp_resources/fro_srcmf_models/fro_srcmf_tokenizer.pt', 'lang': 'fro', 'shorthand': 'fro_srcmf', 'mode': 'predict'} | |
--- | |
Loading: pos | |
With settings: | |
{'model_path': '/Users/kyle.p.johnson/stanfordnlp_resources/fro_srcmf_models/fro_srcmf_tagger.pt', 'pretrain_path': '/Users/kyle.p.johnson/stanfordnlp_resources/fro_srcmf_models/fro_srcmf.pretrain.pt', 'lang': 'fro', 'shorthand': 'fro_srcmf', 'mode': 'predict'} | |
--- | |
Loading: lemma | |
With settings: | |
{'model_path': '/Users/kyle.p.johnson/stanfordnlp_resources/fro_srcmf_models/fro_srcmf_lemmatizer.pt', 'lang': 'fro', 'shorthand': 'fro_srcmf', 'mode': 'predict'} | |
Cannot load model from /Users/kyle.p.johnson/stanfordnlp_resources/fro_srcmf_models/fro_srcmf_lemmatizer.pt | |
An exception has occurred, use %tb to see the full traceback. | |
SystemExit: 1 | |
/Users/kyle.p.johnson/.pyenv/versions/3.7.5/envs/cltk/lib/python3.7/site-packages/IPython/core/interactiveshell.py:3334: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D. | |
warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1) | |
In [5]: %tb | |
--------------------------------------------------------------------------- | |
FileNotFoundError Traceback (most recent call last) | |
~/.pyenv/versions/3.7.5/envs/cltk/lib/python3.7/site-packages/stanfordnlp/models/lemma/trainer.py in load(self, filename, use_cuda) | |
194 try: | |
--> 195 checkpoint = torch.load(filename, lambda storage, loc: storage) | |
196 except BaseException: | |
~/.pyenv/versions/3.7.5/envs/cltk/lib/python3.7/site-packages/torch/serialization.py in load(f, map_location, pickle_module, **pickle_load_args) | |
418 new_fd = True | |
--> 419 f = open(f, 'rb') | |
420 elif (sys.version_info[0] == 3 and isinstance(f, pathlib.Path)): | |
FileNotFoundError: [Errno 2] No such file or directory: '/Users/kyle.p.johnson/stanfordnlp_resources/fro_srcmf_models/fro_srcmf_lemmatizer.pt' | |
During handling of the above exception, another exception occurred: | |
SystemExit Traceback (most recent call last) | |
<ipython-input-4-df3715e99198> in <module> | |
----> 1 nlp = stanfordnlp.Pipeline(lang="fro") | |
~/.pyenv/versions/3.7.5/envs/cltk/lib/python3.7/site-packages/stanfordnlp/pipeline/core.py in __init__(self, processors, lang, models_dir, treebank, use_gpu, **kwargs) | |
121 self.processors[processor_name] = NAME_TO_PROCESSOR_CLASS[processor_name](config=curr_processor_config, | |
122 pipeline=self, | |
--> 123 use_gpu=self.use_gpu) | |
124 except ProcessorRequirementsException as e: | |
125 # if there was a requirements issue, add it to list which will be printed at end | |
~/.pyenv/versions/3.7.5/envs/cltk/lib/python3.7/site-packages/stanfordnlp/pipeline/lemma_processor.py in __init__(self, config, pipeline, use_gpu) | |
22 # run lemmatizer in identity mode | |
23 self._use_identity = None | |
---> 24 super().__init__(config, pipeline, use_gpu) | |
25 | |
26 @property | |
~/.pyenv/versions/3.7.5/envs/cltk/lib/python3.7/site-packages/stanfordnlp/pipeline/processor.py in __init__(self, config, pipeline, use_gpu) | |
100 self._trainer = None | |
101 self._vocab = None | |
--> 102 self._set_up_model(config, use_gpu) | |
103 # run set up process | |
104 # build the final config for the processor | |
~/.pyenv/versions/3.7.5/envs/cltk/lib/python3.7/site-packages/stanfordnlp/pipeline/lemma_processor.py in _set_up_model(self, config, use_gpu) | |
35 else: | |
36 self._use_identity = False | |
---> 37 self._trainer = Trainer(model_file=config['model_path'], use_cuda=use_gpu) | |
38 | |
39 def _set_up_requires(self): | |
~/.pyenv/versions/3.7.5/envs/cltk/lib/python3.7/site-packages/stanfordnlp/models/lemma/trainer.py in __init__(self, args, vocab, emb_matrix, model_file, use_cuda) | |
31 if model_file is not None: | |
32 # load everything from file | |
---> 33 self.load(model_file, use_cuda) | |
34 else: | |
35 # build model from scratch | |
~/.pyenv/versions/3.7.5/envs/cltk/lib/python3.7/site-packages/stanfordnlp/models/lemma/trainer.py in load(self, filename, use_cuda) | |
196 except BaseException: | |
197 print("Cannot load model from {}".format(filename)) | |
--> 198 sys.exit(1) | |
199 self.args = checkpoint['config'] | |
200 self.word_dict, self.composite_dict = checkpoint['dicts'] | |
SystemExit: 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment