Skip to content

Error when use with latest GGML #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
paulocoutinhox opened this issue Feb 17, 2024 · 17 comments
Closed

Error when use with latest GGML #177

paulocoutinhox opened this issue Feb 17, 2024 · 17 comments

Comments

@paulocoutinhox
Copy link

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
Copy link

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

@paulocoutinhox
Copy link
Author

paulocoutinhox commented Feb 21, 2024 via email

@NaNBridge
Copy link

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
Copy link
Author

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
Copy link
Author

@leejet can you help us with this? pls.

@paulocoutinhox
Copy link
Author

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

@leejet
Copy link
Owner

leejet commented Feb 25, 2024

@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
Copy link
Owner

leejet commented Feb 25, 2024

@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
Copy link
Author

Hi @leejet dont need know it, only need use ggml_backend_alloc_ctx_tensors as indicated here ggml-org/ggml#647 like llama.cpp and whisper.cpp already use. plsssss

@paulocoutinhox
Copy link
Author

paulocoutinhox commented Feb 25, 2024

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:
ggml-org/ggml#749

Can you update these things + ggml_backend_alloc_ctx_tensors ? thankskss

@leejet
Copy link
Owner

leejet commented Feb 26, 2024

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
Copy link
Owner

leejet commented Feb 26, 2024

The latest master code has already utilized ggml_backend_alloc_ctx_tensors.

@paulocoutinhox
Copy link
Author

paulocoutinhox commented Feb 26, 2024

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
Copy link
Contributor

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
Copy link
Author

paulocoutinhox commented Feb 27, 2024

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
Copy link
Owner

leejet commented Feb 27, 2024

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
Copy link
Author

Fixed. Thanks.

rmatif pushed a commit to rmatif/stable-diffusion.cpp that referenced this issue Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants