Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

pure go for stable-diffusion and support cross-platform.

License

NotificationsYou must be signed in to change notification settings

seasonjs/stable-diffusion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pure go ( cgo free ) for stable-diffusion and support cross-platform.

Go Reference

sd.go is a wrapper aroundstable-diffusion.cpp, which is an adaptionof ggml.cpp.

Installation

go get github.com/seasonjs/stable-diffusion

AutoModel Compatibility

Seedeps folder for dylib compatibility, push request is welcome.

Windows NVIDIA GPU User may need checkcuda architecture to get more information.

Windows AMD/ROCM GPU User may need checksystem requirements to get more information.

platformx32x64armAMD/ROCMNVIDIA/CUDA
windowsnot supportsupport avx/avx2/avx512not supportrocm5.5 supportcuda12 support
linuxnot supportsupportnot supportnot supportnot support
darwinnot supportsupportsupportnot supportnot support

AutoModel Dynamic Libraries Disclaimer

The Source of dynamic Libraries

These dynamic libraries come fromstable-diffusion.cpp-build release, The dynamic library version can be obtained by viewingstable-diffusion.version fileAnyone can check the consistency of the file by checksum ( MD5 ).

The Security Of Dynamic Libraries

All I can say is that the creation of the dynamic library is public and does not contain any subjective malicious logic.If you are worried about the security of the dynamic library during the use process, you can build it yourself.

I and any author related to dynamic libraries do not assume any problems, responsibilities or legal liability during use.

Usage

Thisstable-diffusion golang library provide two apiPredict andImagePredict.

Usually you can useNewAutoModel, so you don't need to load the dynamic library.

You can find a complete example inexamples folder.

Here is a simple example:

package mainimport ("github.com/seasonjs/hf-hub/api"sd"github.com/seasonjs/stable-diffusion""io""os")funcmain() {options:=sd.DefaultOptionsmodel,err:=sd.NewAutoModel(options)iferr!=nil {print(err.Error())return}defermodel.Close()hapi,err:=api.NewApi()iferr!=nil {print(err.Error())return}modelPath,err:=hapi.Model("justinpinkney/miniSD").Get("miniSD.ckpt")iferr!=nil {print(err.Error())return}err=model.LoadFromFile(modelPath)iferr!=nil {print(err.Error())return}varwriters []io.Writerfilenames:= []string{"../assets/love_cat0.png",}for_,filename:=rangefilenames {file,err:=os.Create(filename)iferr!=nil {print(err.Error())return}deferfile.Close()writers=append(writers,file)}err=model.Predict("british short hair cat, high quality",sd.DefaultFullParams,writers)iferr!=nil {print(err.Error())}}

Packaging

To ship a working program that includes this AI, you will need to include the following files:

  • libstable-diffusion.dylib / libstable-diffusion.so / stable-diffusion.dll (buildin)
  • the model file
  • the tokenizer file (buildin)
  • cuda runtime library, if you use cuda

Low level API

This package also provide low level Api which is sameasstable-diffusion-cpp.See detail atstable-diffusion-doc.

Thanks

Successful Examples

License

Copyright (c) seasonjs. All rights reserved.Licensed under the MIT License. See License.txt in the project root for license information.


[8]ページ先頭

©2009-2026 Movatter.jp