Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config.cfg is missing from model #28

Open
SanjanSRao opened this issue Mar 17, 2021 · 6 comments
Open

config.cfg is missing from model #28

SanjanSRao opened this issue Mar 17, 2021 · 6 comments

Comments

@SanjanSRao
Copy link

Error while loading the model : Could not read config.cfg

Stacktrace:

OSError Traceback (most recent call last)
in
1 # Load the model
----> 2 nlp = en_blackstone_proto.load()

env\lib\site-packages\en_blackstone_proto_init_.py in load(**overrides)
10
11 def load(**overrides):
---> 12 return load_model_from_init_py(file, **overrides)

env\lib\site-packages\spacy\util.py in load_model_from_init_py(init_file, vocab, disable, exclude, config)
512 if not model_path.exists():
513 raise IOError(Errors.E052.format(path=data_path))
--> 514 return load_model_from_path(
515 data_path,
516 vocab=vocab,

env\lib\site-packages\spacy\util.py in load_model_from_path(model_path, meta, vocab, disable, exclude, config)
386 meta = get_model_meta(model_path)
387 config_path = model_path / "config.cfg"
--> 388 config = load_config(config_path, overrides=dict_to_dot(config))
389 nlp = load_model_from_config(config, vocab=vocab, disable=disable, exclude=exclude)
390 return nlp.from_disk(model_path, exclude=exclude)

env\lib\site-packages\spacy\util.py in load_config(path, overrides, interpolate)
543 else:
544 if not config_path or not config_path.exists() or not config_path.is_file():
--> 545 raise IOError(Errors.E053.format(path=config_path, name="config.cfg"))
546 return config.from_disk(
547 config_path, overrides=overrides, interpolate=interpolate

OSError: [E053] Could not read config.cfg from env\lib\site-packages\en_blackstone_proto\en_blackstone_proto-0.0.1\config.cfg

@thibault-w
Copy link

thibault-w commented Apr 19, 2021

This happened to me too on my new machine, it's got to do with the new SpaCy version (>3.0.0). For me installing an older version (2.3) solved the problem and I can use Blackstone.

/edited for typos

@varsha1288
Copy link

@thibault- I installed spacy 2.3.0 but I am still running into issues.

@ryanmcdonough
Copy link

@varsha1288 you need version 2.1.8, anything 2.2.0 and above falls over.

@ShubhamKumarNigam
Copy link

But still getting the same error.

============================== Info about spaCy ==============================

spaCy version 2.1.8
Location /anaconda3/lib/python3.7/site-packages/spacy
Platform Darwin-18.5.0-x86_64-i386-64bit
Python version 3.7.7
Models


OSError Traceback (most recent call last)
in
----> 1 nlp = spacy.load("en_blackstone_proto")

/anaconda3/lib/python3.7/site-packages/spacy/init.py in load(name, vocab, disable, exclude, config)

/anaconda3/lib/python3.7/site-packages/spacy/util.py in load_model(name, vocab, disable, exclude, config)
322 return default
323
--> 324
325 def read_regex(path):
326 path = ensure_path(path)

/anaconda3/lib/python3.7/site-packages/spacy/util.py in load_model_from_package(name, vocab, disable, exclude, config)
355 entries (tuple): The suffix rules, e.g. spacy.lang.punctuation.TOKENIZER_SUFFIXES.
356 RETURNS (regex object): The regex object. to be used for Tokenizer.suffix_search.
--> 357 """
358 expression = "|".join([piece + "$" for piece in entries if piece.strip()])
359 return re.compile(expression)

/anaconda3/lib/python3.7/site-packages/en_blackstone_proto/init.py in load(**overrides)
10
11 def load(**overrides):
---> 12 return load_model_from_init_py(file, **overrides)

/anaconda3/lib/python3.7/site-packages/spacy/util.py in load_model_from_init_py(init_file, vocab, disable, exclude, config)
520
521
--> 522 def minibatch_by_words(items, size, tuples=True, count_words=len):
523 """Create minibatches of a given number of words."""
524 if isinstance(size, int):

/anaconda3/lib/python3.7/site-packages/spacy/util.py in load_model_from_path(model_path, meta, vocab, disable, exclude, config)
388 return lookup[string]
389 return default_func(string)
--> 390
391
392 def update_exc(base_exceptions, *addition_dicts):

/anaconda3/lib/python3.7/site-packages/spacy/util.py in load_config(path, overrides, interpolate)
545 else:
546 batch.append(doc)
--> 547 if batch:
548 yield batch
549

OSError: [E053] Could not read config.cfg from /anaconda3/lib/python3.7/site-packages/en_blackstone_proto/en_blackstone_proto-0.0.1/config.cfg

@ryanmcdonough
Copy link

ryanmcdonough commented May 30, 2021 via email

@sadanyh
Copy link

sadanyh commented May 23, 2022

For those who had the error:
OSError: [E053] Could not read config.cfg from
/anaconda3/lib/python3.7/site-packages/en_blackstone_proto/en_blackstone_proto-0.0.1/config.cfg
As mentioned above you need python 3.6 and spacy 2.1.6. Follow the steps below (assuming you are working on anaconda):

o Step 1: create new env (conda create -n myenv)/ then activate (conda activate myenv)
o Step 2: unistall python (conda uninstall python)
o Step 3: install python 3.6 (conda install python=3.6)
o Check python version (python –version)
o Step 4: install spacy (pip install spacy==2.1.6)
o Step 5: install blackstone (pip install blackstone)
o pip install https://blackstone-model.s3-eu-west-1.amazonaws.com/en_blackstone_proto-0.0.1.tar.gz
o Step 7: inside the env install jupyter (conda install jupyter notebook) if you want to work on jupyter.
You can start a jupyter notebook with this environment by simply writing on the command line (with your env activated)
jupyter notebook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants