- Notifications
You must be signed in to change notification settings - Fork2
LittleLittleCloud/Torchsharp-stable-diffusion-2
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This repo contains a torchsharp implementation forstable diffusion 2 model.
To run the stable diffusion 2 model on your local machine, the following prerequisites are required:
- dotnet 6
- git lfs, this is to download the model file from hugging face
To get stable-diffusion-2 model weight, run the following command to download model weight from huggingface. Be sure to have git lfs installed.
git clone https://huggingface.co/stabilityai/stable-diffusion-2
Note
To load fp32 model weight into GPU, it's recommended to have at least 16GB of GPU memory if you want to generate 768 * 768 size image. Loading fp16 model weight requires around 8GB of GPU memory.
Clone this repo and replace themodelFolder
folder with where you download huggingface model weight inProgram.cs
Then run the following command to start the model:
dotnet run
(a photo of an astronaut riding a horse on mars)
You can load fp16 model weight by settingdtype
to ScalarType.Float16
inProgram.cs. The inference on fp16 model weight is faster and more GPU memory efficient.
Note
fp16 model only work with GPU because some operators doesn't work with fp16 and cpu.
- Add support for loading fp16 model weight
- Torchsharp-llama: A torchsharp implementation for llama 2 model
- Torchsharp-phi: A torchsharp implementation for phi model
About
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.