Mozer / talk-llama-fast

Port of OpenAI's Whisper model in C/C++ with xtts and wav2lip
MIT License
708 stars 64 forks source link

I refactored this repo for Linux, but am a noob at running gguf and need help... #1

Open purplishdev opened 4 months ago

purplishdev commented 4 months ago

https://github.com/purplishdev/talk-llama-fast-linux/

I forked the repo and got it compiled on Linux, but when downloading the models, the names don't match up to what it expects. Here is what I did.

The instructions say to download these files.


Download whisper model to folder with talk-llama.exe: https://huggingface.co/ggerganov/whisper.cpp/blob/main/ggml-medium.en-q5_0.bin (for English) or https://huggingface.co/ggerganov/whisper.cpp/blob/main/ggml-medium-q5_0.bin (for Russian, or even ggml-large-v3-q5_0.bin it is larger but better). You can try small-q5 if you don't have much VRAM.

Download LLM to same folder https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.2-GGUF/blob/main/mistral-7b-instruct-v0.2.Q6_K.gguf , you can try q4_K_S if you don't have much VRAM.


Which I did, but when I run the program, I get this error, because it's expecting a .bin file with a different name


purpledev@amethyst  ~/talk-llama-fast/build/bin   master ±  ./talk-llama

whisper_init_from_file_with_params_no_state: loading model from 'models/ggml-base.en.bin'

whisper_init_from_file_with_params_no_state: failed to open 'models/ggml-base.en.bin'

ggml_init_cublas: GGML_CUDA_FORCE_MMQ: no

ggml_init_cublas: CUDA_USE_TENSOR_CORES: yes

ggml_init_cublas: found 1 CUDA devices:

Device 0: NVIDIA GeForce RTX 3060, compute capability 8.6, VMM: yes

llama_model_load: error loading model: failed to open models/ggml-llama-7B.bin: No such file or directory

llama_load_model_from_file: failed to load model

[1] 571898 segmentation fault (core dumped) ./talk-llama


At first I tried renaming the .bin file I downloaded to ggml-llama-7B.bin, thinking since they were the same file type that it was what was needed, but that returned this error.


✘ purpledev@amethyst  ~/talk-llama-fast/build/bin   master ±  ./talk-llama

whisper_init_from_file_with_params_no_state: loading model from 'models/ggml-base.en.bin'

whisper_init_from_file_with_params_no_state: failed to open 'models/ggml-base.en.bin'

ggml_init_cublas: GGML_CUDA_FORCE_MMQ: no

ggml_init_cublas: CUDA_USE_TENSOR_CORES: yes

ggml_init_cublas: found 1 CUDA devices:

Device 0: NVIDIA GeForce RTX 3060, compute capability 8.6, VMM: yes

gguf_init_from_file: invalid magic characters 'lmgg'

llama_model_load: error loading model: llama_model_loader: failed to load model from models/ggml-llama-7B.bin

llama_load_model_from_file: failed to load model

[1] 582242 segmentation fault (core dumped) ./talk-llama

✘ purpledev@amethyst  ~/talk-llama-fast/build/bin   master ± 


Then I tried renaming the gguf file to ggml-llama-7B.bin, not sure if it would work to just change the file type...

That actually seemed to load the model, but led to this error.


✘ purpledev@amethyst  ~/talk-llama-fast/build/bin   master ±  ./talk-llama

whisper_init_from_file_with_params_no_state: loading model from 'models/ggml-base.en.bin'

whisper_init_from_file_with_params_no_state: failed to open 'models/ggml-base.en.bin'

ggml_init_cublas: GGML_CUDA_FORCE_MMQ: no

ggml_init_cublas: CUDA_USE_TENSOR_CORES: yes

ggml_init_cublas: found 1 CUDA devices:

Device 0: NVIDIA GeForce RTX 3060, compute capability 8.6, VMM: yes

llama_model_loader: loaded meta data with 24 key-value pairs and 291 tensors from models/ggml-llama-7B.bin (version GGUF V3 (latest))

llama_model_loader: Dumping metadata keys/values. Note: KV overrides do not apply in this output.

llama_model_loader: - kv 0: general.architecture str = llama

llama_model_loader: - kv 1: general.name str = mistralai_mistral-7b-instruct-v0.2

llama_model_loader: - kv 2: llama.context_length u32 = 32768

llama_model_loader: - kv 3: llama.embedding_length u32 = 4096

llama_model_loader: - kv 4: llama.block_count u32 = 32

llama_model_loader: - kv 5: llama.feed_forward_length u32 = 14336

llama_model_loader: - kv 6: llama.rope.dimension_count u32 = 128

llama_model_loader: - kv 7: llama.attention.head_count u32 = 32

llama_model_loader: - kv 8: llama.attention.head_count_kv u32 = 8

llama_model_loader: - kv 9: llama.attention.layer_norm_rms_epsilon f32 = 0.000010

llama_model_loader: - kv 10: llama.rope.freq_base f32 = 1000000.000000

llama_model_loader: - kv 11: general.file_type u32 = 18

llama_model_loader: - kv 12: tokenizer.ggml.model str = llama

llama_model_loader: - kv 13: tokenizer.ggml.tokens arr[str,32000] = ["", "", "", "<0x00>", "<...

llama_model_loader: - kv 14: tokenizer.ggml.scores arr[f32,32000] = [0.000000, 0.000000, 0.000000, 0.0000...

llama_model_loader: - kv 15: tokenizer.ggml.token_type arr[i32,32000] = [2, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, ...

llama_model_loader: - kv 16: tokenizer.ggml.bos_token_id u32 = 1

llama_model_loader: - kv 17: tokenizer.ggml.eos_token_id u32 = 2

llama_model_loader: - kv 18: tokenizer.ggml.unknown_token_id u32 = 0

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 }}{% for message in mess...

llama_model_loader: - kv 23: general.quantization_version u32 = 2

llama_model_loader: - type f32: 65 tensors

llama_model_loader: - type q6_K: 226 tensors

llm_load_vocab: special tokens definition check successful ( 259/32000 ).

llm_load_print_meta: format = GGUF V3 (latest)

llm_load_print_meta: arch = llama

llm_load_print_meta: vocab type = SPM

llm_load_print_meta: n_vocab = 32000

llm_load_print_meta: n_merges = 0

llm_load_print_meta: n_ctx_train = 32768

llm_load_print_meta: n_embd = 4096

llm_load_print_meta: n_head = 32

llm_load_print_meta: n_head_kv = 8

llm_load_print_meta: n_layer = 32

llm_load_print_meta: n_rot = 128

llm_load_print_meta: n_embd_head_k = 128

llm_load_print_meta: n_embd_head_v = 128

llm_load_print_meta: n_gqa = 4

llm_load_print_meta: n_embd_k_gqa = 1024

llm_load_print_meta: n_embd_v_gqa = 1024

llm_load_print_meta: f_norm_eps = 0.0e+00

llm_load_print_meta: f_norm_rms_eps = 1.0e-05

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: n_ff = 14336

llm_load_print_meta: n_expert = 0

llm_load_print_meta: n_expert_used = 0

llm_load_print_meta: rope scaling = linear

llm_load_print_meta: freq_base_train = 1000000.0

llm_load_print_meta: freq_scale_train = 1

llm_load_print_meta: n_yarn_orig_ctx = 32768

llm_load_print_meta: rope_finetuned = unknown

llm_load_print_meta: model type = 7B

llm_load_print_meta: model ftype = Q6_K

llm_load_print_meta: model params = 7.24 B

llm_load_print_meta: model size = 5.53 GiB (6.56 BPW)

llm_load_print_meta: general.name = mistralai_mistral-7b-instruct-v0.2

llm_load_print_meta: BOS token = 1 ''

llm_load_print_meta: EOS token = 2 ''

llm_load_print_meta: UNK token = 0 ''

llm_load_print_meta: PAD token = 0 ''

llm_load_print_meta: LF token = 13 '<0x0A>'

llm_load_tensors: ggml ctx size = 0.22 MiB

llm_load_tensors: offloading 32 repeating layers to GPU

llm_load_tensors: offloading non-repeating layers to GPU

llm_load_tensors: offloaded 33/33 layers to GPU

llm_load_tensors: CPU buffer size = 102.54 MiB

llm_load_tensors: CUDA0 buffer size = 5563.55 MiB

...................................................................................................

llama_new_context_with_model: n_ctx = 2048

llama_new_context_with_model: freq_base = 1000000.0

llama_new_context_with_model: freq_scale = 1

llama_kv_cache_init: CUDA0 KV buffer size = 256.00 MiB

llama_new_context_with_model: KV self size = 256.00 MiB, K (f16): 128.00 MiB, V (f16): 128.00 MiB

llama_new_context_with_model: CUDA_Host input buffer size = 24.02 MiB

GGML_ASSERT: /home/purpledev/talk-llama-fast/ggml.c:5155: pos

[1] 584047 IOT instruction (core dumped) ./talk-llama

✘ purpledev@amethyst  ~/talk-llama-fast/build/bin   master ± 

Mozer commented 4 months ago

You should specify whisper model using -mw param, and llama model using -ml param. Put your models to \bin folder near the executable, cd to \bin folder and run: talk-llama -mw ggml-medium.en-q5_0.bin -ml mistral-7b-instruct-v0.2.Q6_K.gguf

you can check the full command i use in talk-llama.bat in the Releases section.