{"id":24653033,"url":"https://github.com/seasonjs/stable-diffusion","last_synced_at":"2025-10-07T12:31:17.423Z","repository":{"id":196224780,"uuid":"694172968","full_name":"seasonjs/stable-diffusion","owner":"seasonjs","description":"pure go for stable-diffusion and support cross-platform.","archived":false,"fork":false,"pushed_at":"2024-02-08T08:42:59.000Z","size":27942,"stargazers_count":12,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-02-19T10:11:32.274Z","etag":null,"topics":["deep-learning","ggml","go","golang","hacktoberfest","image2image","stable-diffusion","text2image"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/seasonjs/stable-diffusion","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seasonjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-09-20T13:23:03.000Z","updated_at":"2024-02-17T03:46:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"77ef77e5-5d40-44c6-a71f-9aeefb46f4c4","html_url":"https://github.com/seasonjs/stable-diffusion","commit_stats":null,"previous_names":["seasonjs/stable-diffusion"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seasonjs%2Fstable-diffusion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seasonjs%2Fstable-diffusion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seasonjs%2Fstable-diffusion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seasonjs%2Fstable-diffusion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seasonjs","download_url":"https://codeload.github.com/seasonjs/stable-diffusion/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235628190,"owners_count":19020541,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","ggml","go","golang","hacktoberfest","image2image","stable-diffusion","text2image"],"created_at":"2025-01-25T20:13:19.259Z","updated_at":"2025-10-07T12:31:15.831Z","avatar_url":"https://github.com/seasonjs.png","language":"Go","readme":"# stable-diffusion\n\npure go ( cgo free ) for stable-diffusion and support cross-platform.\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/seasonjs/stable-diffusion.svg)](https://pkg.go.dev/github.com/seasonjs/stable-diffusion)\n\nsd.go is a wrapper around [stable-diffusion.cpp](https://github.com/leejet/stable-diffusion.cpp), which is an adaption\nof ggml.cpp.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets/img.png\" width=\"256x\"\u003e\n\u003c/p\u003e\n\n## Installation\n\n```bash\ngo get github.com/seasonjs/stable-diffusion\n```\n\n## AutoModel Compatibility\n\nSee `deps` folder for dylib compatibility, push request is welcome.\n\nWindows NVIDIA GPU User may need check [cuda architecture](https://developer.nvidia.com/cuda-gpus) to get more information.\n\nWindows AMD/ROCM GPU User may need check [system requirements](https://rocm.docs.amd.com/projects/install-on-windows/en/latest/reference/system-requirements.html) to get more information.\n\n| platform | x32         | x64                     | arm         | AMD/ROCM        | NVIDIA/CUDA    |\n|----------|-------------|-------------------------|-------------|-----------------|----------------|\n| windows  | not support | support avx/avx2/avx512 | not support | rocm5.5 support | cuda12 support |\n| linux    | not support | support                 | not support | not support     | not support    |\n| darwin   | not support | support                 | support     | not support     | not support    |\n\n## AutoModel Dynamic Libraries Disclaimer\n\n#### The Source of dynamic Libraries\nThese dynamic libraries come from [stable-diffusion.cpp-build release](https://github.com/seasonjs/stable-diffusion.cpp-build/releases), The dynamic library version can be obtained by viewing [stable-diffusion.version file](./deps/stable-diffusion.version)\nAnyone can check the consistency of the file by checksum ( MD5 ).\n\n#### The Security Of Dynamic Libraries\nAll I can say is that the creation of the dynamic library is public and does not contain any subjective malicious logic.\nIf you are worried about the security of the dynamic library during the use process, you can build it yourself.\n\n**I and any author related to dynamic libraries do not assume any problems, responsibilities or legal liability during use.**\n\n## Usage\n\nThis `stable-diffusion` golang library provide two api `Predict` and `ImagePredict`.\n\nUsually you can use `NewAutoModel`, so you don't need to load the dynamic library.\n\nYou can find a complete example in [examples](./exmaples) folder.\n\nHere is a simple example:\n\n```go\npackage main\n\nimport (\n\t\"github.com/seasonjs/hf-hub/api\"\n\tsd \"github.com/seasonjs/stable-diffusion\"\n\t\"io\"\n\t\"os\"\n)\n\nfunc main() {\n\toptions := sd.DefaultOptions\n\n\tmodel, err := sd.NewAutoModel(options)\n\tif err != nil {\n\t\tprint(err.Error())\n\t\treturn\n\t}\n\tdefer model.Close()\n\n\thapi, err := api.NewApi()\n\tif err != nil {\n\t\tprint(err.Error())\n\t\treturn\n\t}\n\n\tmodelPath, err := hapi.Model(\"justinpinkney/miniSD\").Get(\"miniSD.ckpt\")\n\tif err != nil {\n\t\tprint(err.Error())\n\t\treturn\n\t}\n\n\terr = model.LoadFromFile(modelPath)\n\tif err != nil {\n\t\tprint(err.Error())\n\t\treturn\n\t}\n\tvar writers []io.Writer\n\tfilenames := []string{\n\t\t\"../assets/love_cat0.png\",\n\t}\n\tfor _, filename := range filenames {\n\t\tfile, err := os.Create(filename)\n\t\tif err != nil {\n\t\t\tprint(err.Error())\n\t\t\treturn\n\t\t}\n\t\tdefer file.Close()\n\t\twriters = append(writers, file)\n\t}\n\n\terr = model.Predict(\"british short hair cat, high quality\", sd.DefaultFullParams, writers)\n\tif err != nil {\n\t\tprint(err.Error())\n\t}\n}\n```\n\n## Packaging\n\nTo ship a working program that includes this AI, you will need to include the following files:\n\n* libstable-diffusion.dylib / libstable-diffusion.so / stable-diffusion.dll (buildin)\n* the model file\n* the tokenizer file (buildin)\n* cuda runtime library, if you use cuda\n\n## Low level API\n\nThis package also provide low level Api which is same\nas [stable-diffusion-cpp](https://github.com/leejet/stable-diffusion.cpp).\nSee detail at [stable-diffusion-doc](https://pkg.go.dev/github.com/seasonjs/stable-diffusion).\n\n## Thanks\n\n* [stable-diffusion-cpp](https://github.com/leejet/stable-diffusion.cpp)\n* [ggml.cpp](https://github.com/leejet/ggml.cpp)\n* [purego](https://github.com/ebitengine/purego)\n\n## Successful Examples\n\u003cspan\u003e\n  \u003cimg src=\"./assets/love_cat0.png\" width=\"128x\"\u003e\n\u003c/span\u003e\n\u003cspan\u003e\n  \u003cimg src=\"./assets/love_cat1.png\" width=\"128x\"\u003e\n\u003c/span\u003e\n\u003cspan\u003e\n  \u003cimg src=\"./assets/love_cat2.png\" width=\"128x\"\u003e\n\u003c/span\u003e\n\u003cspan\u003e\n  \u003cimg src=\"./assets/love_cat3.png\" width=\"128x\"\u003e\n\u003c/span\u003e\n\u003cspan\u003e\n  \u003cimg src=\"./assets/love_cat4.png\" width=\"128x\"\u003e\n\u003c/span\u003e\n\u003cspan\u003e\n  \u003cimg src=\"./assets/love_cat5.png\" width=\"128x\"\u003e\n\u003c/span\u003e\n\n[//]: # (\u003cspan\u003e)\n\n[//]: # (  \u003cimg src=\"./assets/love_cat6.png\" width=\"128x\"\u003e)\n\n[//]: # (\u003c/span\u003e)\n\n## License\n\nCopyright (c) seasonjs. All rights reserved.\nLicensed under the MIT License. See License.txt in the project root for license information.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseasonjs%2Fstable-diffusion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseasonjs%2Fstable-diffusion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseasonjs%2Fstable-diffusion/lists"}