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

How do I customise the model behaviour and save locally? #41

Open
joakimwar opened this issue Nov 16, 2021 · 0 comments
Open

How do I customise the model behaviour and save locally? #41

joakimwar opened this issue Nov 16, 2021 · 0 comments

Comments

@joakimwar
Copy link

Hi. I am using this library to lemmatize in Swedish, and I would like to be able to load the model from a local directory, and to make iterative improvements when I find mistakes in the lemmatization. With regular spaCy models I can simply edit the exclusions table and save and load from disk using the to_disk and from_disk methods,

nlp = spacy.load(local_path)
lemmatizer = nlp.get_pipe('lemmatizer')
lemmatizer.lookups.get_table("lemma_exc")["noun"]["word"] = ["whatever"]
nlp.to_disk(local_path)

Is there any equivalent for models from spacy_udpipe? I see the load_from_path method, but can I make changes to the lemmatization, and how do I save the model locally? In regards to saving the model, this does not work for me:

spacy_udpipe.download('sv')
nlp = spacy_udpipe.load('sv')
nlp.to_disk('my_model')
nlp_from_local = spacy_udpipe.load_from_path(lang='sv', path='my_model')

Trying to use the nlp_from_local object on a text gives me

AttributeError: 'NoneType' object has no attribute 'newTokenizer'

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

1 participant