Skip to content
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

When using llama-cpp-rs alongside the whisper-rs crate in the same project, the application crashes during model loading. #263

Closed
jiabochao opened this issue Apr 18, 2024 · 5 comments
Labels
🐛 bug something is broken

Comments

@jiabochao
Copy link
Contributor

When using llama-cpp-rs alongside the whisper-rs crate in the same project, the application crashes during model loading.

LlamaModel::load_from_file(&backend, model_path, &model_params);

The issue still occurs even when the whisper model and llama model are not being executed at the same time.

The program output is as follows:

llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output.
llama_model_loader: - kv   0:                       general.architecture str              = gemma
llama_model_loader: - kv   1:                               general.name str              = models--google--gemma-2b-it
llama_model_loader: - kv   2:                       gemma.context_length u32              = 8192
llama_model_loader: - kv   3:                     gemma.embedding_length u32              = 2048
llama_model_loader: - kv   4:                          gemma.block_count u32              = 18
llama_model_loader: - kv   5:                  gemma.feed_forward_length u32              = 16384
llama_model_loader: - kv   6:                 gemma.attention.head_count u32              = 8
llama_model_loader: - kv   7:              gemma.attention.head_count_kv u32              = 1
llama_model_loader: - kv   8:     gemma.attention.layer_norm_rms_epsilon f32              = 0.000001
llama_model_loader: - kv   9:                 gemma.attention.key_length u32              = 256
llama_model_loader: - kv  10:               gemma.attention.value_length u32              = 256
llama_model_loader: - kv  11:                          general.file_type u32              = 13
llama_model_loader: - kv  12:                       tokenizer.ggml.model str              = llama
llama_model_loader: - kv  13:                      tokenizer.ggml.tokens arr[str,256000]  = ["<pad>", "<eos>", "<bos>", "<unk>", ...
llama_model_loader: - kv  14:                      tokenizer.ggml.scores arr[f32,256000]  = [0.000000, 0.000000, 0.000000, 0.0000...
llama_model_loader: - kv  15:                  tokenizer.ggml.token_type arr[i32,256000]  = [3, 3, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, ...
llama_model_loader: - kv  16:                tokenizer.ggml.bos_token_id u32              = 2
llama_model_loader: - kv  17:                tokenizer.ggml.eos_token_id u32              = 1
llama_model_loader: - kv  18:            tokenizer.ggml.unknown_token_id u32              = 3
llama_model_loader: - kv  19:            tokenizer.ggml.padding_token_id u32              = 0
llama_model_loader: - kv  20:               tokenizer.ggml.add_bos_token bool             = true
llama_model_loader: - kv  21:               tokenizer.ggml.add_eos_token bool             = false
llama_model_loader: - kv  22:                    tokenizer.chat_template str              = {{ bos_token }}{% if messages[0]['rol...
llama_model_loader: - kv  23:               general.quantization_version u32              = 2
llama_model_loader: - type  f32:   37 tensors
llama_model_loader: - type q3_K:   72 tensors
llama_model_loader: - type q5_K:   54 tensors
llama_model_loader: - type q6_K:    1 tensors
llm_load_vocab: mismatch in special tokens definition ( 416/256000 vs 260/256000 ).
llm_load_print_meta: format           = GGUF V3 (latest)
llm_load_print_meta: arch             = gemma
llm_load_print_meta: vocab type       = SPM
llm_load_print_meta: n_vocab          = 256000
llm_load_print_meta: n_merges         = 0
llm_load_print_meta: n_ctx_train      = 8192
llm_load_print_meta: n_embd           = 2048
llm_load_print_meta: n_head           = 8
llm_load_print_meta: n_head_kv        = 1
llm_load_print_meta: n_layer          = 18
llm_load_print_meta: n_rot            = 256
llm_load_print_meta: n_embd_head_k    = 256
llm_load_print_meta: n_embd_head_v    = 256
llm_load_print_meta: n_gqa            = 8
llm_load_print_meta: n_embd_k_gqa     = 256
llm_load_print_meta: n_embd_v_gqa     = 256
llm_load_print_meta: f_norm_eps       = 0.0e+00
llm_load_print_meta: f_norm_rms_eps   = 1.0e-06
llm_load_print_meta: f_clamp_kqv      = 0.0e+00
llm_load_print_meta: f_max_alibi_bias = 0.0e+00
llm_load_print_meta: f_logit_scale    = 0.0e+00
llm_load_print_meta: n_ff             = 16384
llm_load_print_meta: n_expert         = 0
llm_load_print_meta: n_expert_used    = 0
llm_load_print_meta: causal attn      = 1
llm_load_print_meta: pooling type     = 0
llm_load_print_meta: rope type        = 2
llm_load_print_meta: rope scaling     = linear
llm_load_print_meta: freq_base_train  = 10000.0
llm_load_print_meta: freq_scale_train = 1
llm_load_print_meta: n_yarn_orig_ctx  = 8192
llm_load_print_meta: rope_finetuned   = unknown
llm_load_print_meta: ssm_d_conv       = 0
llm_load_print_meta: ssm_d_inner      = 0
llm_load_print_meta: ssm_d_state      = 0
llm_load_print_meta: ssm_dt_rank      = 0
llm_load_print_meta: model type       = 2B
llm_load_print_meta: model ftype      = Q3_K - Large
llm_load_print_meta: model params     = 2.51 B
llm_load_print_meta: model size       = 1.36 GiB (4.66 BPW) 
llm_load_print_meta: general.name     = models--google--gemma-2b-it
llm_load_print_meta: BOS token        = 2 '<bos>'
llm_load_print_meta: EOS token        = 1 '<eos>'
llm_load_print_meta: UNK token        = 3 '<unk>'
llm_load_print_meta: PAD token        = 0 '<pad>'
llm_load_print_meta: LF token         = 227 '<0x0A>'
llm_load_tensors: ggml ctx size =    0.13 MiB
ggml_backend_metal_buffer_from_ptr: allocated buffer, size =  1391.95 MiB, ( 1392.56 / 10922.67)
llm_load_tensors: offloading 18 repeating layers to GPU
llm_load_tensors: offloading non-repeating layers to GPU
llm_load_tensors: offloaded 19/19 layers to GPU
 ELIFECYCLE  Command failed with exit code 1.
@MarcusDunn
Copy link
Contributor

I wonder if this is the GGUF backend not being shared.

I don't think I'll be fixing this in the foreseeable future, but thank you for the report!

Would you know if the two libraries can be used together from cpp?

@jiabochao
Copy link
Contributor Author

I'm not very familiar with these underlying technical implementations. I'm trying out other solutions, and if I find out the problem, I'll share it here.

@jiabochao
Copy link
Contributor Author

I wonder if this is the GGUF backend not being shared.

I don't think I'll be fixing this in the foreseeable future, but thank you for the report!

Would you know if the two libraries can be used together from cpp?

I noticed that whisper.cpp has a talk-llama example, so they should be able to be used together.

https://github.com/ggerganov/whisper.cpp/blob/master/examples/talk-llama

@MarcusDunn MarcusDunn added the 🐛 bug something is broken label Apr 20, 2024
@oddpxl
Copy link

oddpxl commented Apr 21, 2024

@jiabochao Did you find a solution ? ..this would be of much interest to me as well.

@jiabochao
Copy link
Contributor Author

@jiabochao Did you find a solution ? ..this would be of much interest to me as well.

No, not yet, but I think a different whisper rust library might solve the problem, and I found another whisper rust library that looks like it might be better maintained, but I haven't tested it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug something is broken
Projects
None yet
Development

No branches or pull requests

3 participants