Skip to content

F64 dtype #669

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

Open
valkarias opened this issue May 3, 2025 · 4 comments
Open

F64 dtype #669

valkarias opened this issue May 3, 2025 · 4 comments

Comments

@valkarias
Copy link

Models with F64 type tensors do not work, specifically this SD 1.5 model: https://civitai.com/models/7371/rev-animated?modelVersionId=425083

Image

-- even after adding a --type argument, it still fails

Image

Image

further research only led me to this other issue: #153
the offered program by the owner sadly did not work and i didnt want to fiddle with it any further

@DanaNikifor
Copy link

@DanaNikifor
Copy link

It seems like everyone is trying to reduce the model and keep the quality, but here it is))

@valkarias
Copy link
Author

It seems like everyone is trying to reduce the model and keep the quality, but here it is))

have you looked into the related issue link, it would give more context. im not reducing the model size or manipulating it in any way. it errors simply if i use it with stable-diffusion.cpp showing errors of it not recognizing certain tensors

@vmobilis
Copy link
Contributor

vmobilis commented May 11, 2025

@stduhpf, this can be fixed, maybe easily, since GGML / SD.CPP support F64 and I64 types:
https://github.com/ggml-org/ggml/blob/ff9052988b76e137bcf92bb335733933ca196ac0/include/ggml.h#L379

The function

ggml_type str_to_ggml_type(const std::string& dtype) {

should be appended with:

    } else if (dtype == "F64") {
        ttype = GGML_TYPE_F64;
    } else if (dtype == "I64") {
        ttype = GGML_TYPE_I64;

I tested on SD 1.1 (https://huggingface.co/CompVis/stable-diffusion-v1-1) model, its FP16 text encoder also has i64 tensor which breaks generation.

Also, its unet tensors have "unet.*" naming, therefore line

if (tensor_storage.name.find("model.diffusion_model.") == std::string::npos) {

should be changed to:

        if (tensor_storage.name.find("model.diffusion_model.") == std::string::npos &&
            tensor_storage.name.find("unet.") == std::string::npos) {

Or else diffusion model weight type will be undetected (??).

But I'm not sure if these 2 fixes are enough, because SD complained about tensor:
model.cpp:1907 - unknown tensor 'cond_stage_model.transformer.text_model.embeddings.position_ids | i64 | 2 [77, 1, 1, 1, 1]' in model file

It succesfully generated an image, though:

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

3 participants