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
715 stars 73 forks source link

Cannot reproduce code execution of the LanguageDetection sample #55

Closed joslat closed 2 years ago

joslat commented 3 years ago

Describe the bug Referencing the latest NuGet package, Catalyst 1.0.16767, and essentially putting the code of the sample for Language Detection, throws an exception. The exception: {"Unable to load one or more of the requested types.\r\nA ByRef-like type cannot be used as the type for an instance field in a non-ByRef-like type."}

my code is as follows: image

Essentially the same as the sample, but I have tried the sample locally, updated the package to match, and it works... I am also using .NET 5, the same as the sample.

The sensible part of the stacktrace is: at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) at System.Reflection.RuntimeModule.GetTypes() at System.Reflection.Assembly.GetTypes() at Mosaik.Core.ObjectStore.<>c.b28_1(Assembly a) at System.Linq.Enumerable.SelectManySingleSelectorIterator2.MoveNext() at System.Linq.Set1.UnionWith(IEnumerable1 other) at System.Linq.Enumerable.UnionIterator1.FillSet() at System.Linq.Enumerable.UnionIterator1.ToArray() at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) at Mosaik.Core.ObjectStore.CreateDerivedFromModelDictionary() at Mosaik.Core.ObjectStore.<>c.<.cctor>b32_0() at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy1.CreateValue() at System.Lazy1.get_Value() at Mosaik.Core.ObjectStore.TryGetFormerNames(String name, String[]& formerNames) at Catalyst.Models.FastText.d42.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Catalyst.Models.FastText.d41.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Catalyst.Models.FastTextLanguageDetector.d__5.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

Could it be an issue with getting the Language files from the store? if so, how is detailed how to do this?

To Reproduce Create a new project, add reference to Catalyst, paste the code and run.

Expected behavior runs flawlessly, language is returned.

Screenshots image

Additional context Add any other context about the problem here.

joslat commented 3 years ago

To help a bit more, I debugged with "just my code " off, and...

The issue seems to happen here: image

Then, on the Lazy initialization of that value, we get the exception: image

theolivenbaum commented 2 years ago

Hi @joslat , are you still seeing this issue?

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.