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

Sentencizer read model from disk #6615

Closed
roelvanderburg opened this issue Dec 22, 2020 · 3 comments
Closed

Sentencizer read model from disk #6615

roelvanderburg opened this issue Dec 22, 2020 · 3 comments
Labels
feat / senter Feature: Sentence Recognizer feat / serialize Feature: Serialization, saving and loading 🌙 nightly Discussion and contributions related to nightly builds resolved The issue was addressed / answered usage General spaCy usage

Comments

@roelvanderburg
Copy link

roelvanderburg commented Dec 22, 2020

I re-trained the sentence tagger by way of #6382.

However I do get a:

RegistryError: Cant't find './output_dir/model-best/senter' in registry spacy -> architectures. Available names: spacy-transformers.Tok2VecTransformer.v1

Error when trying to read in the model. I'm trying to load the model from disk with below code.

nlp = spacy.load('nl_core_news_sm')

# Construction via create_pipe with custom model
# config = {"model": {"@architectures": "./output_dir/model-best/senter/model"}}
# senter = nlp.add_pipe(factory_name='sentencizer',name="senter_custom_roel", config=config)

senter = nlp.add_pipe(factory_name='sentencizer', name="senter_custom",config=config)
senter.from_disk("./output_dir/model-best/senter/model")


Your Environment

  • spaCy version: 3.0.0rc2
  • Platform: macOS-10.16-x86_64-i386-64bit
  • Python version: 3.8.5
  • Pipelines: nl_core_news_sm (3.0.0a0)
@svlandeg svlandeg added feat / senter Feature: Sentence Recognizer feat / serialize Feature: Serialization, saving and loading 🌙 nightly Discussion and contributions related to nightly builds usage General spaCy usage labels Dec 22, 2020
@svlandeg
Copy link
Member

The @architectures keyword in a config dictionary typically refers to a registered architecture, and not a file location.

You should be able to just load the whole nlp model back from file with

nlp = spacy.load("outputdir/model-best")

@svlandeg svlandeg added the resolved The issue was addressed / answered label Dec 22, 2020
@github-actions
Copy link
Contributor

This issue has been automatically closed because it was answered and there was no follow-up discussion.

@github-actions
Copy link
Contributor

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat / senter Feature: Sentence Recognizer feat / serialize Feature: Serialization, saving and loading 🌙 nightly Discussion and contributions related to nightly builds resolved The issue was addressed / answered usage General spaCy usage
Projects
None yet
Development

No branches or pull requests

2 participants