TensorStack-AI / OnnxStack

C# Stable Diffusion using ONNX Runtime

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Run fail on Unit Test (StableDiffusionTests.cs)

kimi0230 opened this issue · comments

Hi ,

There are some errors on StableDiffusionTests.cs.

When running unit test code. it will run fail.
v0.10.0 can build successfully. But v0.12.0 and later are not.

Commit: main branch(3c12247)
Workaround : #90

Error message:

  OnnxStack.StableDiffusion -> C:\Users\kimi0\Desktop\ONNX\OnnxStack\OnnxStack.StableDiffusion\bin\Debug\net7.0\OnnxStack.StableDiffusion.dll
C:\Users\kimi0\Desktop\ONNX\OnnxStack\OnnxStack.IntegrationTests\StableDiffusionTests.cs(43,38): error CS1061: 'IStableDiffusionService' does not contain a definition for 'Models' and no accessible extension method 'Mode
ls' accepting a first argument of type 'IStableDiffusionService' could be found (are you missing a using directive or an assembly reference?) [C:\Users\kimi0\Desktop\ONNX\OnnxStack\OnnxStack.IntegrationTests\OnnxStack.In 
tegrationTests.csproj]
C:\Users\kimi0\Desktop\ONNX\OnnxStack\OnnxStack.IntegrationTests\StableDiffusionTests.cs(61,38): error CS1061: 'IStableDiffusionService' does not contain a definition for 'Models' and no accessible extension method 'Mode 
ls' accepting a first argument of type 'IStableDiffusionService' could be found (are you missing a using directive or an assembly reference?) [C:\Users\kimi0\Desktop\ONNX\OnnxStack\OnnxStack.IntegrationTests\OnnxStack.In 
tegrationTests.csproj]

Build FAILED.

C:\Users\kimi0\Desktop\ONNX\OnnxStack\OnnxStack.IntegrationTests\StableDiffusionTests.cs(43,38): error CS1061: 'IStableDiffusionService' does not contain a definition for 'Models' and no accessible extension method 'Mode 
ls' accepting a first argument of type 'IStableDiffusionService' could be found (are you missing a using directive or an assembly reference?) [C:\Users\kimi0\Desktop\ONNX\OnnxStack\OnnxStack.IntegrationTests\OnnxStack.In 
tegrationTests.csproj]
C:\Users\kimi0\Desktop\ONNX\OnnxStack\OnnxStack.IntegrationTests\StableDiffusionTests.cs(61,38): error CS1061: 'IStableDiffusionService' does not contain a definition for 'Models' and no accessible extension method 'Mode 
ls' accepting a first argument of type 'IStableDiffusionService' could be found (are you missing a using directive or an assembly reference?) [C:\Users\kimi0\Desktop\ONNX\OnnxStack\OnnxStack.IntegrationTests\OnnxStack.In 
tegrationTests.csproj]
    0 Warning(s)
    2 Error(s)

By the way. For v0.12.0 rewrite StableDiffusionTests.cs can work.

diff --git a/OnnxStack.IntegrationTests/StableDiffusionTests.cs b/OnnxStack.IntegrationTests/StableDiffusionTests.cs
index 73d0d9f..d6b3739 100644
--- a/OnnxStack.IntegrationTests/StableDiffusionTests.cs
+++ b/OnnxStack.IntegrationTests/StableDiffusionTests.cs
@@ -40,7 +40,7 @@ public class StableDiffusionTests
     public async Task GivenAStableDiffusionModel_WhenLoadModel_ThenModelIsLoaded(string modelName)
     {
         //arrange
-        var model = _stableDiffusion.Models.Single(m => m.Name == modelName);
+        var model = _stableDiffusion.ModelSets.Single(m => m.Name == modelName);
 
         //act
         _logger.LogInformation("Attempting to load model {0}", model.Name);
@@ -58,7 +58,7 @@ public class StableDiffusionTests
 
     {
         //arrange
-        var model = _stableDiffusion.Models.Single(m => m.Name == modelName);
+        var model = _stableDiffusion.ModelSets.Single(m => m.Name == modelName);
         _logger.LogInformation("Attempting to load model: {0}", model.Name);
         await _stableDiffusion.LoadModelAsync(model);

Thank!