curiosity-ai / catalyst

🚀 Catalyst is a C# Natural Language Processing library built for speed. Inspired by spaCy's design, it brings pre-trained models, out-of-the box support for training word and document embeddings, and flexible entity recognition models.
MIT License
699 stars 71 forks source link

Predict gets an exception when using saved model #62

Closed ysisoftwareiq closed 2 years ago

ysisoftwareiq commented 2 years ago

The code to recreate the problem:

Storage.Current = new OnlineRepositoryStorage(new DiskStorage("catalyst-models")); var nlp = Pipeline.For(Language.English); var doc = new Document("HENLEY GROUP SAID IT ENDED TALKS ON BUYING SOUTHERN PACIFIC FROM SANTA FE SOUTHERN", Language.English); nlp.ProcessSingle(doc);

var fastTextPre = FastText.FromStoreAsync(Language.English, 0, "Reuters-Classifier").Result; Dictionary<string, float> predict = fastTextPre.Predict(doc);

Exception - Specified argument was out of range...

Exception in FastText.cs in function private void ComputeHidden(ThreadState state, Span input) in statement var v = Wi.GetRow(ix);

theolivenbaum commented 2 years ago

Hi @ysisoftwareiq, can you test the latest sample for the TextClassifier and let me know if you still hit the exception?

ysisoftwareiq commented 2 years ago

predict of your saved model gets error

2021-10-11 18:03:50.828 +03:00 [Error] Catalyst.Models.FastText: Failed to predict for document with length 1201 at Catalyst.Models.FastText.Predict(IDocument doc) System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. at Catalyst.Models.FastText.Predict(IDocument doc)

ysisoftwareiq commented 2 years ago

Catalyst_out.log_20211011.0.txt

ysisoftwareiq commented 2 years ago

I attached your log.

ysisoftwareiq commented 2 years ago

It is your project & model TextClassification, - tested as you asked.

it has training -> save model -> reading -> testing

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.