StableDiffusionCppResourceBuilderExtensions Methods
ClassMethods6 members
Provides extension methods for adding stable-diffusion.cpp resources to an
Hosting.IDistributedApplicationBuilder. AddHuggingFaceModel(IResourceBuilder<StableDiffusionCppResource>, string, string, string)Section titled AddHuggingFaceModel(IResourceBuilder<StableDiffusionCppResource>, string, string, string)extensionIResourceBuilder<StableDiffusionCppModelResource> Adds a Hugging Face model that is downloaded before the container starts.
public static class StableDiffusionCppResourceBuilderExtensions{ public static IResourceBuilder<StableDiffusionCppModelResource> AddHuggingFaceModel( this IResourceBuilder<StableDiffusionCppResource> builder, string repository, string fileName, string revision = "main") { // ... }}Parameters
builderIResourceBuilder<StableDiffusionCppResource>The stable-diffusion.cpp resource builder.repositorystringThe Hugging Face repository identifier.fileNamestringThe model file path within the repository.revisionstringoptionalThe repository revision. Defaults to main.Returns
IResourceBuilder<StableDiffusionCppModelResource>A builder for the child model resource.AddHuggingFaceModel(IResourceBuilder<StableDiffusionCppResource>, string, string, string, string)Section titled AddHuggingFaceModel(IResourceBuilder<StableDiffusionCppResource>, string, string, string, string)extensionIResourceBuilder<StableDiffusionCppModelResource> Adds a named Hugging Face model that is downloaded before the container starts.
public static class StableDiffusionCppResourceBuilderExtensions{ public static IResourceBuilder<StableDiffusionCppModelResource> AddHuggingFaceModel( this IResourceBuilder<StableDiffusionCppResource> builder, string name, string repository, string fileName, string revision = "main") { // ... }}Parameters
builderIResourceBuilder<StableDiffusionCppResource>The stable-diffusion.cpp resource builder.namestringThe child model resource name.repositorystringThe Hugging Face repository identifier.fileNamestringThe model file path within the repository.revisionstringoptionalThe repository revision. Defaults to main.Returns
IResourceBuilder<StableDiffusionCppModelResource>A builder for the child model resource.AddStableDiffusionCpp(IDistributedApplicationBuilder, string, StableDiffusionCppImageVariant, int?, string?)Section titled AddStableDiffusionCpp(IDistributedApplicationBuilder, string, StableDiffusionCppImageVariant, int?, string?)extensionIResourceBuilder<StableDiffusionCppResource> Adds a stable-diffusion.cpp container resource using an official image.
public static class StableDiffusionCppResourceBuilderExtensions{ public static IResourceBuilder<StableDiffusionCppResource> AddStableDiffusionCpp( this IDistributedApplicationBuilder builder, string name, StableDiffusionCppImageVariant imageVariant = StableDiffusionCppImageVariant.Cuda, int? port = null, string? modelsDirectory = null) { // ... }}Parameters
builderIDistributedApplicationBuilderThe distributed application builder.namestringThe resource name.imageVariantStableDiffusionCppImageVariantoptionalThe official image variant to use.portint?optionalAn optional host port. Aspire assigns one when omitted.modelsDirectorystring?optional An optional host directory used for models. Defaults to .stable-diffusion-cpp/{name}/models under the AppHost directory. Returns
IResourceBuilder<StableDiffusionCppResource>A builder for the stable-diffusion.cpp resource.WithGPUSupport(IResourceBuilder<StableDiffusionCppResource>)Section titled WithGPUSupport(IResourceBuilder<StableDiffusionCppResource>)extensionIResourceBuilder<StableDiffusionCppResource> Adds the container runtime arguments required by the selected GPU backend.
public static class StableDiffusionCppResourceBuilderExtensions{ public static IResourceBuilder<StableDiffusionCppResource> WithGPUSupport( this IResourceBuilder<StableDiffusionCppResource> builder) { // ... }}Parameters
builderIResourceBuilder<StableDiffusionCppResource>The stable-diffusion.cpp resource builder.Returns
IResourceBuilder<StableDiffusionCppResource>The resource builder.WithHuggingFaceToken(IResourceBuilder<StableDiffusionCppResource>, IResourceBuilder<ParameterResource>)Section titled WithHuggingFaceToken(IResourceBuilder<StableDiffusionCppResource>, IResourceBuilder<ParameterResource>)extensionIResourceBuilder<StableDiffusionCppResource> Supplies a Hugging Face access token for gated or private repositories.
public static class StableDiffusionCppResourceBuilderExtensions{ public static IResourceBuilder<StableDiffusionCppResource> WithHuggingFaceToken( this IResourceBuilder<StableDiffusionCppResource> builder, IResourceBuilder<ParameterResource> token) { // ... }}Parameters
builderIResourceBuilder<StableDiffusionCppResource>The stable-diffusion.cpp resource builder.tokenIResourceBuilder<ParameterResource>A secret parameter containing the Hugging Face token.Returns
IResourceBuilder<StableDiffusionCppResource>The resource builder.WithVaeTiling(IResourceBuilder<StableDiffusionCppResource>)Section titled WithVaeTiling(IResourceBuilder<StableDiffusionCppResource>)extensionIResourceBuilder<StableDiffusionCppResource> Processes VAE images in tiles to reduce peak memory usage during image decoding.
public static class StableDiffusionCppResourceBuilderExtensions{ public static IResourceBuilder<StableDiffusionCppResource> WithVaeTiling( this IResourceBuilder<StableDiffusionCppResource> builder) { // ... }}Parameters
builderIResourceBuilder<StableDiffusionCppResource>The stable-diffusion.cpp resource builder.Returns
IResourceBuilder<StableDiffusionCppResource>The resource builder.