Skip to content

Help with trying to remove a custom pipeline factory #7311

@dbragdon1

Description

@dbragdon1

Hello, I recently updated spacy to 3.0.3 (Windows 10, Python 3.7) and I am trying to build and debug a custom factory. As I find issues and errors in the factory, I would like to overwrite and re-add the factory to my Language.

Here is the code I'm working with:

@language.factory('my_factory')
def custom_factory(nlp: Language, name: str):
   return None

The issue is that, after adding the factory for the first time using the @Language.factory decorator, I am running into an E004 error:

[E004] Can't set up pipeline component: a factory for 'my_factory' already exists. Existing factory: <function custom_factory at ...>. New factory: <function custom_factory at>

I understand that this is because I am trying to create two functions of the same name, but I can not figure out a way to delete a custom factory once it has been added to my Language. Can someone help me figure out how to simply remove this custom factory so that I can debug it and re-add it to my list? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions