shon-otmazgin / fastcoref

MIT License
149 stars 26 forks source link

Spacy default values #8

Closed shon-otmazgin closed 2 years ago

shon-otmazgin commented 2 years ago

@mlostar I can see a BUG while running:

from fastcoref import spacy_component
import spacy
texts = ['We are so happy to see you using our coref package. This package is very fast!',
         'Glad to see you are using the spacy component as well. As it is a new feature!',
         'The man tried to put the boot on his foot but it was too small.',
         'Alice goes down the rabbit hole. Where she would discover a new reality beyond her expectations.'
        ]

nlp_fcoref = spacy.load("en_core_web_sm", exclude=["parser", "lemmatizer", "ner", "textcat"]) #Resolving text requires pos tagging
nlp_fcoref.add_pipe("fastcoref")
# Test __call__ while not returning resolved text
doc = nlp_fcoref(texts[0])
print(doc._.resolved_text)
print(doc._.coref_clusters)

seems like the default values are not been fulfiled

mlostar commented 2 years ago

I changed device parameter to follow your guidelines as using the None default value but forgot to change the type requirements on it as it was intended as a string parameter. Sorry, it should have been included in the tests for the component. Just removing the type requirement from device parameter provided to init function solves the issue.

class FastCorefResolver:
    #a class that implements the logic from https://towardsdatascience.com/how-to-make-an-effective-coreference-resolution-model-55875d2b5f19
    def __init__(
        self,
        nlp,
        name,
        model_architecture: str,
        model_path:str,
        device,
        max_tokens_in_batch: int
    ):
shon-otmazgin commented 2 years ago

fixed! thanks !