mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-07-24 11:50:54 -05:00
Compare commits
3 Commits
master-afe
...
master-09c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09cab2a2ae | ||
|
|
69e54ace14 | ||
|
|
29a56f2e98 |
@@ -24,6 +24,7 @@ endif()
|
||||
# general
|
||||
#option(SD_BUILD_TESTS "sd: build tests" ${SD_STANDALONE})
|
||||
option(SD_BUILD_EXAMPLES "sd: build examples" ${SD_STANDALONE})
|
||||
option(BUILD_SHARED_LIBS "sd: build shared libs" OFF)
|
||||
#option(SD_BUILD_SERVER "sd: build server example" ON)
|
||||
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ git submodule update
|
||||
```shell
|
||||
curl -L -O https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt
|
||||
# curl -L -O https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors
|
||||
# curl -L -o https://huggingface.co/stabilityai/stable-diffusion-2-1/blob/main/v2-1_768-nonema-pruned.safetensors
|
||||
# curl -L -O https://huggingface.co/stabilityai/stable-diffusion-2-1/blob/main/v2-1_768-nonema-pruned.safetensors
|
||||
```
|
||||
|
||||
- convert weights to ggml model format
|
||||
|
||||
2
ggml
2
ggml
Submodule ggml updated: 6958cd05c7...a0811d8181
@@ -586,7 +586,7 @@ struct ResidualAttentionBlock {
|
||||
|
||||
// layer norm 1
|
||||
{
|
||||
x = ggml_norm(ctx, x);
|
||||
x = ggml_norm(ctx, x, 1e-6f);
|
||||
x = ggml_add(ctx,
|
||||
ggml_mul(ctx, ggml_repeat(ctx, ln1_w, x), x),
|
||||
ggml_repeat(ctx, ln1_b, x));
|
||||
@@ -636,7 +636,7 @@ struct ResidualAttentionBlock {
|
||||
|
||||
// layer norm 2
|
||||
{
|
||||
x = ggml_norm(ctx, x);
|
||||
x = ggml_norm(ctx, x, 1e-6f);
|
||||
|
||||
x = ggml_add(ctx, ggml_mul(ctx, ggml_repeat(ctx, ln2_w, x), x),
|
||||
ggml_repeat(ctx, ln2_b, x));
|
||||
@@ -766,7 +766,7 @@ struct CLIPTextModel {
|
||||
|
||||
// final layer norm
|
||||
{
|
||||
x = ggml_norm(ctx, x);
|
||||
x = ggml_norm(ctx, x, 1e-6f);
|
||||
|
||||
x = ggml_add(ctx, ggml_mul(ctx, ggml_repeat(ctx, final_ln_w, x), x),
|
||||
ggml_repeat(ctx, final_ln_b, x));
|
||||
@@ -1200,7 +1200,7 @@ struct SpatialTransformer {
|
||||
// layer norm 1
|
||||
{
|
||||
x = ggml_reshape_2d(ctx, x, c, w * h * n);
|
||||
x = ggml_norm(ctx, x);
|
||||
x = ggml_norm(ctx, x, 1e-6f);
|
||||
x = ggml_add(ctx,
|
||||
ggml_mul(ctx,
|
||||
ggml_repeat(ctx, transformer.norm1_w, x),
|
||||
@@ -1248,7 +1248,7 @@ struct SpatialTransformer {
|
||||
|
||||
// layer norm 2
|
||||
{
|
||||
x = ggml_norm(ctx, x);
|
||||
x = ggml_norm(ctx, x, 1e-6f);
|
||||
x = ggml_add(ctx,
|
||||
ggml_mul(ctx,
|
||||
ggml_repeat(ctx, transformer.norm2_w, x), x),
|
||||
@@ -1299,7 +1299,7 @@ struct SpatialTransformer {
|
||||
// layer norm 3
|
||||
{
|
||||
x = ggml_reshape_2d(ctx, x, c, h * w * n); // [N * h * w, in_channels]
|
||||
x = ggml_norm(ctx, x);
|
||||
x = ggml_norm(ctx, x, 1e-6f);
|
||||
x = ggml_add(ctx,
|
||||
ggml_mul(ctx,
|
||||
ggml_repeat(ctx, transformer.norm3_w, x), x),
|
||||
|
||||
Reference in New Issue
Block a user