Saving custom tokenizer

I am not sure that its loading from a Python package, what I am sure in is that I packaged it and installed but on load the custom code is not executed and I don't know what I have to do to make it executed

If you call spacy.load, the argument can either be a path, shortcut link or name of an installed package. So if you pass in the name of an installed package and it exists, it will be loaded.

To load from an installed package, you can also import the package directly and call its load method. That's also what spaCy does under the hood. For example:

import en_custom_model
nlp = en_custom_model.load()

If your load() function isn't executed, that likely means that whatever it's loading there is not actually your custom package, or that the package isn't up to date. Maybe you have a symlink in spacy/data or another installed package that is shadowing it?

Yes, that's exactly what I had, thank you! I changed the name and it worked! <3

1 Like