Compare commits

..

No commits in common. "ac5c3185d01cb78e43778c8d4ea509b18290dff9" and "f21a3d876cc2131e3ac75befdfa3126aa00add01" have entirely different histories.

8 changed files with 14 additions and 148 deletions

View File

@ -207,13 +207,13 @@ jobs:
matrix:
include:
- build: 'noavx'
defines: '-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF -DSD_BUILD_SHARED_LIBS=ON'
defines: '-DCMAKE_OSX_ARCHITECTURES="x86_64" -DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF -DSD_BUILD_SHARED_LIBS=ON'
- build: 'avx'
defines: '-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DGGML_AVX2=OFF -DSD_BUILD_SHARED_LIBS=ON'
defines: '-DCMAKE_OSX_ARCHITECTURES="x86_64" -DGGML_AVX2=OFF -DSD_BUILD_SHARED_LIBS=ON'
- build: 'avx2'
defines: '-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON'
defines: '-DCMAKE_OSX_ARCHITECTURES="x86_64" -DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON'
- build: 'avx512'
defines: '-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DGGML_AVX512=ON -DSD_BUILD_SHARED_LIBS=ON'
defines: '-DCMAKE_OSX_ARCHITECTURES="x86_64" -DGGML_AVX512=ON -DSD_BUILD_SHARED_LIBS=ON'
steps:
- name: Checkout
@ -270,10 +270,6 @@ jobs:
id: pack
run: |
nuget pack ./Backends/StableDiffusion.NET.Backend.Cpu.nuspec -version ${{ github.event.inputs.version }}
nuget pack ./Backends/StableDiffusion.NET.Backend.Cuda11.Windows.nuspec -version ${{ github.event.inputs.version }}
nuget pack ./Backends/StableDiffusion.NET.Backend.Cuda12.Windows.nuspec -version ${{ github.event.inputs.version }}
nuget pack ./Backends/StableDiffusion.NET.Backend.Cuda11.Linux.nuspec -version ${{ github.event.inputs.version }}
nuget pack ./Backends/StableDiffusion.NET.Backend.Cuda12.Linux.nuspec -version ${{ github.event.inputs.version }}
nuget pack ./Backends/StableDiffusion.NET.Backend.Cuda.nuspec -version ${{ github.event.inputs.version }}
nuget pack ./Backends/StableDiffusion.NET.Backend.Rocm.nuspec -version ${{ github.event.inputs.version }}

View File

@ -13,17 +13,20 @@
<releaseNotes></releaseNotes>
<copyright>Copyright © Darth Affe 2024</copyright>
<readme>readme.md</readme>
<dependencies>
<dependency id="StableDiffusion.NET.Backend.Cuda11.Windows" version="$version$" />
<dependency id="StableDiffusion.NET.Backend.Cuda12.Windows" version="$version$" />
<dependency id="StableDiffusion.NET.Backend.Cuda11.Linux" version="$version$" />
<dependency id="StableDiffusion.NET.Backend.Cuda12.Linux" version="$version$" />
</dependencies>
</metadata>
<files>
<file src="StableDiffusion.NET.Backend.props" target="build/net8.0/StableDiffusion.NET.Backend.Cuda.props" />
<file src="windows-cuda11/stable-diffusion.dll" target="runtimes\win-x64\native\cuda11\stable-diffusion.dll" />
<file src="windows-cuda12/stable-diffusion.dll" target="runtimes\win-x64\native\cuda12\stable-diffusion.dll" />
<file src="linux-cuda11/libstable-diffusion.so" target="runtimes\linux-x64\native\cuda11\libstable-diffusion.so" />
<file src="linux-cuda12/libstable-diffusion.so" target="runtimes\linux-x64\native\cuda12\libstable-diffusion.so" />
<file src="sd_net_cuda.png" target="sd_net_cuda.png" />
<file src="readme.md" target="readme.md" />
<file src="ggml.txt" target="ggml.txt" />
<file src="stable-diffusion.cpp.txt" target="stable-diffusion.cpp.txt" />
</files>
</package>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>StableDiffusion.NET.Backend.Cuda11.Linux</id>
<version>$version$</version>
<title>StableDiffusion.NET.Backend.Cuda11.Linux</title>
<authors>Darth Affe &amp; stable-diffusion.cpp Authors</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<icon>sd_net_cuda.png</icon>
<projectUrl>https://github.com/DarthAffe/StableDiffusion.NET</projectUrl>
<description>CUDA 11 Linux Backend for StableDiffusion.NET.</description>
<releaseNotes></releaseNotes>
<copyright>Copyright © Darth Affe 2024</copyright>
<readme>readme.md</readme>
</metadata>
<files>
<file src="StableDiffusion.NET.Backend.props" target="build/net8.0/StableDiffusion.NET.Backend.Cuda.props" />
<file src="linux-cuda11/libstable-diffusion.so" target="runtimes\linux-x64\native\cuda11\libstable-diffusion.so" />
<file src="sd_net_cuda.png" target="sd_net_cuda.png" />
<file src="readme.md" target="readme.md" />
<file src="ggml.txt" target="ggml.txt" />
<file src="stable-diffusion.cpp.txt" target="stable-diffusion.cpp.txt" />
</files>
</package>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>StableDiffusion.NET.Backend.Cuda11.Windows</id>
<version>$version$</version>
<title>StableDiffusion.NET.Backend.Cuda11.Windows</title>
<authors>Darth Affe &amp; stable-diffusion.cpp Authors</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<icon>sd_net_cuda.png</icon>
<projectUrl>https://github.com/DarthAffe/StableDiffusion.NET</projectUrl>
<description>CUDA 11 Windows Backend for StableDiffusion.NET.</description>
<releaseNotes></releaseNotes>
<copyright>Copyright © Darth Affe 2024</copyright>
<readme>readme.md</readme>
</metadata>
<files>
<file src="StableDiffusion.NET.Backend.props" target="build/net8.0/StableDiffusion.NET.Backend.Cuda.props" />
<file src="windows-cuda11/stable-diffusion.dll" target="runtimes\win-x64\native\cuda11\stable-diffusion.dll" />
<file src="sd_net_cuda.png" target="sd_net_cuda.png" />
<file src="readme.md" target="readme.md" />
<file src="ggml.txt" target="ggml.txt" />
<file src="stable-diffusion.cpp.txt" target="stable-diffusion.cpp.txt" />
</files>
</package>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>StableDiffusion.NET.Backend.Cuda12.Linux</id>
<version>$version$</version>
<title>StableDiffusion.NET.Backend.Cuda12.Linux</title>
<authors>Darth Affe &amp; stable-diffusion.cpp Authors</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<icon>sd_net_cuda.png</icon>
<projectUrl>https://github.com/DarthAffe/StableDiffusion.NET</projectUrl>
<description>CUDA 12 Linux Backend for StableDiffusion.NET.</description>
<releaseNotes></releaseNotes>
<copyright>Copyright © Darth Affe 2024</copyright>
<readme>readme.md</readme>
</metadata>
<files>
<file src="StableDiffusion.NET.Backend.props" target="build/net8.0/StableDiffusion.NET.Backend.Cuda.props" />
<file src="linux-cuda12/libstable-diffusion.so" target="runtimes\linux-x64\native\cuda12\libstable-diffusion.so" />
<file src="sd_net_cuda.png" target="sd_net_cuda.png" />
<file src="readme.md" target="readme.md" />
<file src="ggml.txt" target="ggml.txt" />
<file src="stable-diffusion.cpp.txt" target="stable-diffusion.cpp.txt" />
</files>
</package>

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>StableDiffusion.NET.Backend.Cuda12.Windows</id>
<version>$version$</version>
<title>StableDiffusion.NET.Backend.Cuda12.Windows</title>
<authors>Darth Affe &amp; stable-diffusion.cpp Authors</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<icon>sd_net_cuda.png</icon>
<projectUrl>https://github.com/DarthAffe/StableDiffusion.NET</projectUrl>
<description>CUDA 12 Windows Backend for StableDiffusion.NET.</description>
<releaseNotes></releaseNotes>
<copyright>Copyright © Darth Affe 2024</copyright>
<readme>readme.md</readme>
</metadata>
<files>
<file src="StableDiffusion.NET.Backend.props" target="build/net8.0/StableDiffusion.NET.Backend.Cuda.props" />
<file src="windows-cuda12/stable-diffusion.dll" target="runtimes\win-x64\native\cuda12\stable-diffusion.dll" />
<file src="sd_net_cuda.png" target="sd_net_cuda.png" />
<file src="readme.md" target="readme.md" />
<file src="ggml.txt" target="ggml.txt" />
<file src="stable-diffusion.cpp.txt" target="stable-diffusion.cpp.txt" />
</files>
</package>

View File

@ -26,18 +26,6 @@ internal static partial class Native
#region Methods
internal static bool LoadNativeLibrary(string libraryPath)
{
if (_loadedLibraryHandle != nint.Zero) return true;
if (NativeLibrary.TryLoad(libraryPath, out nint handle))
{
_loadedLibraryHandle = handle;
return true;
}
return false;
}
private static nint ResolveDllImport(string libraryname, Assembly assembly, DllImportSearchPath? searchpath)
{
if (libraryname != LIB_NAME) return nint.Zero;

View File

@ -91,15 +91,6 @@ public sealed unsafe class StableDiffusionModel : IDisposable
}
}
/// <summary>
/// Manually load the native stable diffusion library.
/// Once set, it will continue to be used for all instances.
/// </summary>
/// <param name="libraryPath">Path to the stable diffusion library.</param>
/// <returns>Bool if the library loaded.</returns>
public static bool LoadNativeLibrary(string libraryPath)
=> Native.LoadNativeLibrary(libraryPath);
public IImage<ColorRGB> TextToImage(string prompt, StableDiffusionParameter parameter)
{
ObjectDisposedException.ThrowIf(_disposed, this);