leejet / stable-diffusion.cpp

Stable Diffusion in pure C/C++
MIT License
2.91k stars 233 forks source link

Error when use with latest GGML #177

Closed paulocoutinhox closed 1 month ago

paulocoutinhox commented 4 months ago

Hi,

Can you update to be compatible with latest GGML?

/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:186:26: error: use of undeclared identifier 'ggml_cpy_inplace'
    ggml_tensor* final = ggml_cpy_inplace(ctx, src, dst);
                         ^
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:523:9: error: use of undeclared identifier 'ggml_allocr_alloc'; did you mean 'ggml_tallocr_alloc'?
        ggml_allocr_alloc(allocr, embedding);
        ^~~~~~~~~~~~~~~~~
        ggml_tallocr_alloc
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:4:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:22:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/ggml/include/ggml/ggml-alloc.h:18:25: note: 'ggml_tallocr_alloc' declared here
GGML_API void           ggml_tallocr_alloc(ggml_tallocr_t talloc, struct ggml_tensor * tensor);
                        ^
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:4:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:523:27: error: cannot initialize a parameter of type 'ggml_tallocr_t' (aka 'ggml_tallocr *') with an lvalue of type 'struct ggml_allocr *'
        ggml_allocr_alloc(allocr, embedding);
                          ^~~~~~
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:511:69: note: 'ggml_allocr' is not defined, but forward declared here; conversion would be valid if it was derived from 'ggml_tallocr'
                                                             struct ggml_allocr* allocr,
                                                                    ^
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:4:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:22:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/ggml/include/ggml/ggml-alloc.h:18:59: note: passing argument to parameter 'talloc' here
GGML_API void           ggml_tallocr_alloc(ggml_tallocr_t talloc, struct ggml_tensor * tensor);
                                                          ^
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:4:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:525:28: error: use of undeclared identifier 'ggml_allocr_is_measure'
    if (allocr != NULL && !ggml_allocr_is_measure(allocr)) {
                           ^
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:593:30: error: use of undeclared identifier 'ggml_allocr_new_measure_from_backend'
            compute_allocr = ggml_allocr_new_measure_from_backend(backend);
                             ^
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:598:35: error: use of undeclared identifier 'ggml_allocr_alloc_graph'; did you mean 'ggml_gallocr_alloc_graph'?
            compute_buffer_size = ggml_allocr_alloc_graph(compute_allocr, gf) + 1024 * 1024;
                                  ^~~~~~~~~~~~~~~~~~~~~~~
                                  ggml_gallocr_alloc_graph
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:4:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:22:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/ggml/include/ggml/ggml-alloc.h:57:15: note: 'ggml_gallocr_alloc_graph' declared here
GGML_API bool ggml_gallocr_alloc_graph(ggml_gallocr_t galloc, struct ggml_cgraph * graph);
              ^
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:4:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:598:59: error: cannot initialize a parameter of type 'ggml_gallocr_t' (aka 'ggml_gallocr *') with an lvalue of type 'struct ggml_allocr *'
            compute_buffer_size = ggml_allocr_alloc_graph(compute_allocr, gf) + 1024 * 1024;
                                                          ^~~~~~~~~~~~~~
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:511:69: note: 'ggml_allocr' is not defined, but forward declared here; conversion would be valid if it was derived from 'ggml_gallocr'
                                                             struct ggml_allocr* allocr,
                                                                    ^
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:4:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:22:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/ggml/include/ggml/ggml-alloc.h:57:55: note: passing argument to parameter 'galloc' here
GGML_API bool ggml_gallocr_alloc_graph(ggml_gallocr_t galloc, struct ggml_cgraph * graph);
                                                      ^
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:4:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:601:13: error: use of undeclared identifier 'ggml_allocr_free'
            ggml_allocr_free(compute_allocr);
            ^
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:607:26: error: use of undeclared identifier 'ggml_allocr_new_from_buffer'
        compute_allocr = ggml_allocr_new_from_buffer(compute_buffer);
                         ^
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:611:9: error: use of undeclared identifier 'ggml_allocr_reset'
        ggml_allocr_reset(compute_allocr);
        ^
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:615:9: error: use of undeclared identifier 'ggml_allocr_alloc_graph'; did you mean 'ggml_gallocr_alloc_graph'?
        ggml_allocr_alloc_graph(compute_allocr, gf);
        ^~~~~~~~~~~~~~~~~~~~~~~
        ggml_gallocr_alloc_graph
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:4:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:22:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/ggml/include/ggml/ggml-alloc.h:57:15: note: 'ggml_gallocr_alloc_graph' declared here
GGML_API bool ggml_gallocr_alloc_graph(ggml_gallocr_t galloc, struct ggml_cgraph * graph);
              ^
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:4:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:615:33: error: cannot initialize a parameter of type 'ggml_gallocr_t' (aka 'ggml_gallocr *') with an lvalue of type 'struct ggml_allocr *'
        ggml_allocr_alloc_graph(compute_allocr, gf);
                                ^~~~~~~~~~~~~~
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:511:69: note: 'ggml_allocr' is not defined, but forward declared here; conversion would be valid if it was derived from 'ggml_gallocr'
                                                             struct ggml_allocr* allocr,
                                                                    ^
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:4:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:22:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/ggml/include/ggml/ggml-alloc.h:57:55: note: passing argument to parameter 'galloc' here
GGML_API bool ggml_gallocr_alloc_graph(ggml_gallocr_t galloc, struct ggml_cgraph * graph);
                                                      ^
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:4:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:639:9: error: use of undeclared identifier 'ggml_allocr_free'
        ggml_allocr_free(compute_allocr);
        ^
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:247:30: error: use of undeclared identifier 'ggml_allocr_new_from_buffer'
        ggml_allocr* alloc = ggml_allocr_new_from_buffer(params_buffer);
                             ^
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:268:17: error: use of undeclared identifier 'ggml_allocr_alloc'; did you mean 'ggml_tallocr_alloc'?
                ggml_allocr_alloc(alloc, t);
                ^~~~~~~~~~~~~~~~~
                ggml_tallocr_alloc
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:4:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:22:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/ggml/include/ggml/ggml-alloc.h:18:25: note: 'ggml_tallocr_alloc' declared here
GGML_API void           ggml_tallocr_alloc(ggml_tallocr_t talloc, struct ggml_tensor * tensor);
                        ^
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:268:35: error: cannot initialize a parameter of type 'ggml_tallocr_t' (aka 'ggml_tallocr *') with an lvalue of type 'ggml_allocr *'
                ggml_allocr_alloc(alloc, t);
                                  ^~~~~
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:4:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:511:69: note: 'ggml_allocr' is not defined, but forward declared here; conversion would be valid if it was derived from 'ggml_tallocr'
                                                             struct ggml_allocr* allocr,
                                                                    ^
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:4:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:22:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/ggml/include/ggml/ggml-alloc.h:18:59: note: passing argument to parameter 'talloc' here
GGML_API void           ggml_tallocr_alloc(ggml_tallocr_t talloc, struct ggml_tensor * tensor);
                                                          ^
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:271:9: error: use of undeclared identifier 'ggml_allocr_free'
        ggml_allocr_free(alloc);
        ^
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:385:13: error: use of undeclared identifier 'ggml_allocr_alloc'; did you mean 'ggml_tallocr_alloc'?
            ggml_allocr_alloc(compute_allocr, x_);
            ^~~~~~~~~~~~~~~~~
            ggml_tallocr_alloc
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:4:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:22:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/ggml/include/ggml/ggml-alloc.h:18:25: note: 'ggml_tallocr_alloc' declared here
GGML_API void           ggml_tallocr_alloc(ggml_tallocr_t talloc, struct ggml_tensor * tensor);
                        ^
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:385:31: error: cannot initialize a parameter of type 'ggml_tallocr_t' (aka 'ggml_tallocr *') with an lvalue of type 'struct ggml_allocr *'
            ggml_allocr_alloc(compute_allocr, x_);
                              ^~~~~~~~~~~~~~
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:4:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:511:69: note: 'ggml_allocr' is not defined, but forward declared here; conversion would be valid if it was derived from 'ggml_tallocr'
                                                             struct ggml_allocr* allocr,
                                                                    ^
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:1:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/esrgan.hpp:4:
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:22:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/ggml/include/ggml/ggml-alloc.h:18:59: note: passing argument to parameter 'talloc' here
GGML_API void           ggml_tallocr_alloc(ggml_tallocr_t talloc, struct ggml_tensor * tensor);
                                                          ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
NaNBridge commented 4 months ago

Hello, I have encountered the same problem. Have you resolved it?

paulocoutinhox commented 4 months ago

Nope. I’m waiting the update.

Em qua., 21 de fev. de 2024 às 01:39, NaNBridge @.***> escreveu:

Hello, I have encountered the same problem. Have you resolved it?

— Reply to this email directly, view it on GitHub https://github.com/leejet/stable-diffusion.cpp/issues/177#issuecomment-1955878402, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADAOWDLMNXAS7SSPXC3ZGTYUV3BBAVCNFSM6AAAAABDNUN2USVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJVHA3TQNBQGI . You are receiving this because you authored the thread.Message ID: @.***>

NaNBridge commented 4 months ago

The reason for the error is that the recent updates to ggml have caused some symbol changes. The solution is to roll back ggml to the version at least a week ago.

paulocoutinhox commented 4 months ago

In my case, i can't, because i use in my app ggml, llama.cpp, whisper.cpp and stable-diffusion.cpp, all together and the only project with problem is sd.cpp.

paulocoutinhox commented 4 months ago

@leejet can you help us with this? pls.

paulocoutinhox commented 4 months ago

@leejet can you add support for this: https://github.com/ggerganov/ggml/issues/647 pls

leejet commented 4 months ago

@leejet can you help us with this? pls.

I have updated ggml to the latest commit. You can pull the latest changes from the master branch and give it a try.

leejet commented 4 months ago

@leejet can you add support for this: ggerganov/ggml#647 pls

I am not familiar with Metal at the moment, so I may not be of much help.

paulocoutinhox commented 4 months ago

Hi @leejet dont need know it, only need use ggml_backend_alloc_ctx_tensors as indicated here https://github.com/ggerganov/ggml/issues/647 like llama.cpp and whisper.cpp already use. plsssss

paulocoutinhox commented 4 months ago

Also, when i update to latest GGML one error happen:

/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/stable-diffusion.cpp:127:9: error: use of undeclared identifier 'ggml_metal_log_set_callback'; did you mean 'ggml_backend_metal_log_set_callback'?
        ggml_metal_log_set_callback(ggml_log_callback_default, nullptr);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~

Here: https://github.com/search?q=repo%3Aleejet%2Fstable-diffusion.cpp%20ggml_metal_log_set_callback&type=code

I think that it changed the name to: https://github.com/search?q=repo%3Aggerganov%2Fggml%20ggml_backend_metal_log_set_callback&type=code

And:

/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:693:12: error: use of undeclared identifier 'ggml_timestep_embedding'; did you mean 'ggml_nn_timestep_embedding'?
    return ggml_timestep_embedding(ctx, timesteps, dim, max_period);
           ^~~~~~~~~~~~~~~~~~~~~~~
           ggml_nn_timestep_embedding

Here: https://github.com/ggerganov/ggml/discussions/749

Can you update these things + ggml_backend_alloc_ctx_tensors ? thankskss

leejet commented 4 months ago

It seems that your ggml is not up to date because the submodule URL has changed. Try executing the following command to update it.

git submodule sync
git submodule update
leejet commented 4 months ago

The latest master code has already utilized ggml_backend_alloc_ctx_tensors.

paulocoutinhox commented 4 months ago

We still have some problems:

PROBLEM 1:

Im seeing your code from master and it still use old functions, like this:

https://github.com/search?q=repo%3Aleejet%2Fstable-diffusion.cpp%20ggml_metal_log_set_callback&type=code

/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:24: error: use of undeclared identifier 'ggml_metal_log_set_callback'; did you mean 'ggml_backend_metal_log_set_callback'?
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:24:9: error: use of undeclared identifier 'ggml_metal_log_set_callback'; did you mean 'ggml_backend_metal_log_set_callback'?
        ggml_metal_log_set_callback(ggml_log_callback_default, nullptr);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
        ggml_backend_metal_log_set_callback
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/../ggml/src/ggml-metal.h:43:15: note: 'ggml_backend_metal_log_set_callback' declared here
GGML_API void ggml_backend_metal_log_set_callback(ggml_log_callback log_callback, void * user_data);
              ^

You need use ggml_backend_metal_log_set_callback instead of ggml_metal_log_set_callback.

image

PROBLEM 2:

You use a function called ggml_timestep_embedding that ins't inside GGML code.

See: https://github.com/search?q=repo%3Aggerganov%2Fggml%20ggml_timestep_embedding&type=code

Error:

/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:693: error: use of undeclared identifier 'ggml_timestep_embedding'; did you mean 'ggml_nn_timestep_embedding'?
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:693:12: error: use of undeclared identifier 'ggml_timestep_embedding'; did you mean 'ggml_nn_timestep_embedding'?
    return ggml_timestep_embedding(ctx, timesteps, dim, max_period);
           ^~~~~~~~~~~~~~~~~~~~~~~
           ggml_nn_timestep_embedding
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:688:39: note: 'ggml_nn_timestep_embedding' declared here
__STATIC_INLINE__ struct ggml_tensor* ggml_nn_timestep_embedding(
                                      ^

PROBLEM 3:

You are using a function called ggml_arange that is not inside GGML code.

See: https://github.com/search?q=repo%3Aggerganov%2Fggml%20ggml_arange&type=code

Error:

/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/unet.hpp:114: error: use of undeclared identifier 'ggml_arange'
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/stable-diffusion.cpp:15:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/unet.hpp:114:27: error: use of undeclared identifier 'ggml_arange'
        auto num_frames = ggml_arange(ctx, 0, timesteps, 1);
                          ^
phudtran commented 4 months ago

We still have some problems:

PROBLEM 1:

Im seeing your code from master and it still use old functions, like this:

https://github.com/search?q=repo%3Aleejet%2Fstable-diffusion.cpp%20ggml_metal_log_set_callback&type=code

/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:24: error: use of undeclared identifier 'ggml_metal_log_set_callback'; did you mean 'ggml_backend_metal_log_set_callback'?
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/upscaler.cpp:24:9: error: use of undeclared identifier 'ggml_metal_log_set_callback'; did you mean 'ggml_backend_metal_log_set_callback'?
        ggml_metal_log_set_callback(ggml_log_callback_default, nullptr);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
        ggml_backend_metal_log_set_callback
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/../ggml/src/ggml-metal.h:43:15: note: 'ggml_backend_metal_log_set_callback' declared here
GGML_API void ggml_backend_metal_log_set_callback(ggml_log_callback log_callback, void * user_data);
              ^

You need use ggml_backend_metal_log_set_callback instead of ggml_metal_log_set_callback.

image

PROBLEM 2:

You use a function called ggml_timestep_embedding that ins't inside GGML code.

See: https://github.com/search?q=repo%3Aggerganov%2Fggml%20ggml_timestep_embedding&type=code

Error:

/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:693: error: use of undeclared identifier 'ggml_timestep_embedding'; did you mean 'ggml_nn_timestep_embedding'?
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:693:12: error: use of undeclared identifier 'ggml_timestep_embedding'; did you mean 'ggml_nn_timestep_embedding'?
    return ggml_timestep_embedding(ctx, timesteps, dim, max_period);
           ^~~~~~~~~~~~~~~~~~~~~~~
           ggml_nn_timestep_embedding
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/ggml_extend.hpp:688:39: note: 'ggml_nn_timestep_embedding' declared here
__STATIC_INLINE__ struct ggml_tensor* ggml_nn_timestep_embedding(
                                      ^

PROBLEM 3:

You are using a function called ggml_arange that is not inside GGML code.

See: https://github.com/search?q=repo%3Aggerganov%2Fggml%20ggml_arange&type=code

Error:

/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/unet.hpp:114: error: use of undeclared identifier 'ggml_arange'
In file included from /Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/stable-diffusion.cpp:15:
/Users/paulo/Developer/workspaces/cpp/ai-kit/vendor/stable-diffusion/unet.hpp:114:27: error: use of undeclared identifier 'ggml_arange'
        auto num_frames = ggml_arange(ctx, 0, timesteps, 1);
                          ^

183 fixes the first issue.

paulocoutinhox commented 4 months ago

Nice, only left that two removed functions from GGML:

ggml_timestep_embedding and ggml_arange

ref: https://github.com/ggerganov/ggml/blob/master/include/ggml/ggml.h

leejet commented 4 months ago

The latest master branch is using this: https://github.com/leejet/ggml/tree/batch-inference. It seems that your ggml is not up to date because the submodule URL has changed. Try executing the following command to update it.

git submodule sync
git submodule update
paulocoutinhox commented 1 month ago

Fixed. Thanks.