Closed fbrier closed 2 years ago
Below is a simplified nunit test that fails with the above error.
using Catalyst;
using Mosaik.Core;
namespace OpenQuestionModel.Test
{
public class SimpleProcessSingleTest
{
private Spacy.PythonLock? _pythonLock;
private Spacy.Pipeline? _pipeline;
[SetUp]
public void Setup()
{
_pipeline = CreatePipeline().Result;
}
[TearDown]
public void TearDown()
{
_pipeline?.Dispose();
_pythonLock?.Dispose();
}
[Test]
public void TestProcessSingle()
{
var doc = new Document("founder Amazon", Language.English);
// Fails here.
_pipeline?.ProcessSingle(doc);
}
private async Task<Spacy.Pipeline> CreatePipeline()
{
Catalyst.Models.English.Register();
_pythonLock = await Spacy.Initialize(Spacy.ModelSize.Small, Language.Any, Language.English);
var pipeline = Spacy.For(Spacy.ModelSize.Small, Language.English);
return pipeline;
}
}
}
This appears to have been fixed.
Describe the bug It appears that the Catalyst.Spacy.Pipeline.SyncBack() method cannot load Catalyst.ISpan. Since Catalyst.Spacy has Catalyst as a dependent NuGet package, it is not clear why it cannot load the class. Catalyst.ISpan make reference to System.ReadOnlySpan in System.Memory, whose NuGet package is referenced from Catalyst.
If anyone else has bumped their head on this problem, please let me know the workaround. Thank you.
To Reproduce I have not created a simplified test case yet that reproduces the problem. The current test integrates a number of services including the initialization of Catalyst using Ninject.
Expected behavior Execute the SyncBack() call without error.
Additional context The Catalyst.Spacy.Test.Program executes without error, although in Debug mode it fails. The test makes the same call, Catalyst.Spacy.Pipeline.ProcessSingle(doc), and does not fail.
There is an unresolved issue in DotNet related to dynamic binding, which is used in the SyncBack() method..