llama-cpp-python icon indicating copy to clipboard operation
llama-cpp-python copied to clipboard

OK!!! ggml_cuda_init: found 1 CUDA devices:

Open dw5189 opened this issue 9 months ago • 1 comments

(base) PS C:\WINDOWS\system32> conda activate CUDA124-py312 (CUDA124-py312) PS C:\WINDOWS\system32> $env:CUDA_TOOLKIT_ROOT_DIR="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4" (CUDA124-py312) PS C:\WINDOWS\system32> $env:CMAKE_GENERATOR_PLATFORM="x64" (CUDA124-py312) PS C:\WINDOWS\system32> $env:FORCE_CMAKE="1" (CUDA124-py312) PS C:\WINDOWS\system32> $env:CMAKE_ARGS="-DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=89" (CUDA124-py312) PS C:\WINDOWS\system32> pip install llama-cpp-python --no-cache-dir --force-reinstall --upgrade Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/, http://mirrors.aliyun.com/pypi/simple/ Collecting llama-cpp-python Downloading http://mirrors.aliyun.com/pypi/packages/a6/38/7a47b1fb1d83eaddd86ca8ddaf20f141cbc019faf7b425283d8e5ef710e5/llama_cpp_python-0.3.7.tar.gz (66.7 MB) ---------------------------------------- 66.7/66.7 MB 10.9 MB/s eta 0:00:00 Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... done Collecting typing-extensions>=4.5.0 (from llama-cpp-python) Downloading http://mirrors.aliyun.com/pypi/packages/26/9f/ad63fc0248c5379346306f8668cda6e2e2e9c95e01216d2b8ffd9ff037d0/typing_extensions-4.12.2-py3-none-any.whl (37 kB) Collecting numpy>=1.20.0 (from llama-cpp-python) Downloading http://mirrors.aliyun.com/pypi/packages/42/6e/55580a538116d16ae7c9aa17d4edd56e83f42126cb1dfe7a684da7925d2c/numpy-2.2.3-cp312-cp312-win_amd64.whl (12.6 MB) ---------------------------------------- 12.6/12.6 MB 12.2 MB/s eta 0:00:00 Collecting diskcache>=5.6.1 (from llama-cpp-python) Downloading http://mirrors.aliyun.com/pypi/packages/3f/27/4570e78fc0bf5ea0ca45eb1de3818a23787af9b390c0b0a0033a1b8236f9/diskcache-5.6.3-py3-none-any.whl (45 kB) Collecting jinja2>=2.11.3 (from llama-cpp-python) Downloading http://mirrors.aliyun.com/pypi/packages/bd/0f/2ba5fbcd631e3e88689309dbe978c5769e883e4b84ebfe7da30b43275c5a/jinja2-3.1.5-py3-none-any.whl (134 kB) Collecting MarkupSafe>=2.0 (from jinja2>=2.11.3->llama-cpp-python) Downloading http://mirrors.aliyun.com/pypi/packages/c1/80/a61f99dc3a936413c3ee4e1eecac96c0da5ed07ad56fd975f1a9da5bc630/MarkupSafe-3.0.2-cp312-cp312-win_amd64.whl (15 kB) Building wheels for collected packages: llama-cpp-python Building wheel for llama-cpp-python (pyproject.toml) ... done Created wheel for llama-cpp-python: filename=llama_cpp_python-0.3.7-cp312-cp312-win_amd64.whl size=93677980 sha256=57bf98eb04b27b2607a9d9327b85cf8fd47453ee5498c51a3dc0a99fe44db02f Stored in directory: C:\Users\Administrator\AppData\Local\Temp\pip-ephem-wheel-cache-37xy15zb\wheels\ec\61\fc\cee068315610d77f6a99c0032a74e4c8cb21c1d6e281b45bb5 Successfully built llama-cpp-python Installing collected packages: typing-extensions, numpy, MarkupSafe, diskcache, jinja2, llama-cpp-python Attempting uninstall: typing-extensions Found existing installation: typing_extensions 4.12.2 Uninstalling typing_extensions-4.12.2: Successfully uninstalled typing_extensions-4.12.2 Attempting uninstall: numpy Found existing installation: numpy 2.2.3 Uninstalling numpy-2.2.3: Successfully uninstalled numpy-2.2.3 Attempting uninstall: MarkupSafe Found existing installation: MarkupSafe 3.0.2 Uninstalling MarkupSafe-3.0.2: Successfully uninstalled MarkupSafe-3.0.2 Attempting uninstall: diskcache Found existing installation: diskcache 5.6.3 Uninstalling diskcache-5.6.3: Successfully uninstalled diskcache-5.6.3 Attempting uninstall: jinja2 Found existing installation: Jinja2 3.1.5 Uninstalling Jinja2-3.1.5: Successfully uninstalled Jinja2-3.1.5 Successfully installed MarkupSafe-3.0.2 diskcache-5.6.3 jinja2-3.1.5 llama-cpp-python-0.3.7 numpy-2.2.3 typing-extensions-4.12.2 (CUDA124-py312) PS C:\WINDOWS\system32> pip show llama-cpp-python Name: llama_cpp_python Version: 0.3.7 Summary: Python bindings for the llama.cpp library Home-page: https://github.com/abetlen/llama-cpp-python Author: Author-email: Andrei Betlen [email protected] License: MIT Location: C:\software\Minipy312\envs\CUDA124-py312\Lib\site-packages Requires: diskcache, jinja2, numpy, typing-extensions Required-by: (CUDA124-py312) PS C:\WINDOWS\system32>


G:>conda.bat activate CUDA124-py312 ggml_cuda_init: GGML_CUDA_FORCE_MMQ: no ggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: no ggml_cuda_init: found 1 CUDA devices: Device 0: NVIDIA GeForce RTX 4070 SUPER, compute capability 8.9, VMM: yes llama_model_load_from_file_impl: using device CUDA0 (NVIDIA GeForce RTX 4070 SUPER) - 11053 MiB free llama_model_loader: loaded meta data with 29 key-value pairs and 339 tensors from E:.lmstudio\models\Qwen\Qwen2.5-Coder-7B-Instruct-GGUF\qwen2.5-coder-7b-instruct-q4_k_m.gguf (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 = qwen2 llama_model_loader: - kv 1: general.type str = model llama_model_loader: - kv 2: general.name str = Qwen2.5 Coder 7B Instruct GGUF llama_model_loader: - kv 3: general.finetune str = Instruct-GGUF llama_model_loader: - kv 4: general.basename str = Qwen2.5-Coder llama_model_loader: - kv 5: general.size_label str = 7B llama_model_loader: - kv 6: qwen2.block_count u32 = 28 llama_model_loader: - kv 7: qwen2.context_length u32 = 131072 llama_model_loader: - kv 8: qwen2.embedding_length u32 = 3584 llama_model_loader: - kv 9: qwen2.feed_forward_length u32 = 18944 llama_model_loader: - kv 10: qwen2.attention.head_count u32 = 28 llama_model_loader: - kv 11: qwen2.attention.head_count_kv u32 = 4 llama_model_loader: - kv 12: qwen2.rope.freq_base f32 = 1000000.000000 llama_model_loader: - kv 13: qwen2.attention.layer_norm_rms_epsilon f32 = 0.000001 llama_model_loader: - kv 14: general.file_type u32 = 15 llama_model_loader: - kv 15: tokenizer.ggml.model str = gpt2 llama_model_loader: - kv 16: tokenizer.ggml.pre str = qwen2 llama_model_loader: - kv 17: tokenizer.ggml.tokens arr[str,152064] = ["!", """, "#", "$", "%", "&", "'", ... llama_model_loader: - kv 18: tokenizer.ggml.token_type arr[i32,152064] = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ... llama_model_loader: - kv 19: tokenizer.ggml.merges arr[str,151387] = ["Ġ Ġ", "ĠĠ ĠĠ", "i n", "Ġ t",... llama_model_loader: - kv 20: tokenizer.ggml.eos_token_id u32 = 151645 llama_model_loader: - kv 21: tokenizer.ggml.padding_token_id u32 = 151643 llama_model_loader: - kv 22: tokenizer.ggml.bos_token_id u32 = 151643 llama_model_loader: - kv 23: tokenizer.ggml.add_bos_token bool = false llama_model_loader: - kv 24: tokenizer.chat_template str = {%- if tools %}\n {{- '<|im_start|>... llama_model_loader: - kv 25: general.quantization_version u32 = 2 llama_model_loader: - kv 26: split.no u16 = 0 llama_model_loader: - kv 27: split.count u16 = 0 llama_model_loader: - kv 28: split.tensors.count i32 = 339 llama_model_loader: - type f32: 141 tensors llama_model_loader: - type q4_K: 169 tensors llama_model_loader: - type q6_K: 29 tensors print_info: file format = GGUF V3 (latest) print_info: file type = Q4_K - Medium print_info: file size = 4.36 GiB (4.91 BPW) init_tokenizer: initializing tokenizer for type 2 load: control token: 151661 '<|fim_suffix|>' is not marked as EOG load: control token: 151649 '<|box_end|>' is not marked as EOG load: control token: 151647 '<|object_ref_end|>' is not marked as EOG load: control token: 151654 '<|vision_pad|>' is not marked as EOG load: control token: 151659 '<|fim_prefix|>' is not marked as EOG load: control token: 151648 '<|box_start|>' is not marked as EOG load: control token: 151644 '<|im_start|>' is not marked as EOG load: control token: 151646 '<|object_ref_start|>' is not marked as EOG load: control token: 151650 '<|quad_start|>' is not marked as EOG load: control token: 151651 '<|quad_end|>' is not marked as EOG load: control token: 151652 '<|vision_start|>' is not marked as EOG load: control token: 151653 '<|vision_end|>' is not marked as EOG load: control token: 151655 '<|image_pad|>' is not marked as EOG load: control token: 151656 '<|video_pad|>' is not marked as EOG load: control token: 151660 '<|fim_middle|>' is not marked as EOG load: special tokens cache size = 22 load: token to piece cache size = 0.9310 MB print_info: arch = qwen2 print_info: vocab_only = 0 print_info: n_ctx_train = 131072 print_info: n_embd = 3584 print_info: n_layer = 28 print_info: n_head = 28 print_info: n_head_kv = 4 print_info: n_rot = 128 print_info: n_swa = 0 print_info: n_embd_head_k = 128 print_info: n_embd_head_v = 128 print_info: n_gqa = 7 print_info: n_embd_k_gqa = 512 print_info: n_embd_v_gqa = 512 print_info: f_norm_eps = 0.0e+00 print_info: f_norm_rms_eps = 1.0e-06 print_info: f_clamp_kqv = 0.0e+00 print_info: f_max_alibi_bias = 0.0e+00 print_info: f_logit_scale = 0.0e+00 print_info: n_ff = 18944 print_info: n_expert = 0 print_info: n_expert_used = 0 print_info: causal attn = 1 print_info: pooling type = 0 print_info: rope type = 2 print_info: rope scaling = linear print_info: freq_base_train = 1000000.0 print_info: freq_scale_train = 1 print_info: n_ctx_orig_yarn = 131072 print_info: rope_finetuned = unknown print_info: ssm_d_conv = 0 print_info: ssm_d_inner = 0 print_info: ssm_d_state = 0 print_info: ssm_dt_rank = 0 print_info: ssm_dt_b_c_rms = 0 print_info: model type = 7B print_info: model params = 7.62 B print_info: general.name = Qwen2.5 Coder 7B Instruct GGUF print_info: vocab type = BPE print_info: n_vocab = 152064 print_info: n_merges = 151387 print_info: BOS token = 151643 '<|endoftext|>' print_info: EOS token = 151645 '<|im_end|>' print_info: EOT token = 151645 '<|im_end|>' print_info: PAD token = 151643 '<|endoftext|>' print_info: LF token = 148848 'ÄĬ' print_info: FIM PRE token = 151659 '<|fim_prefix|>' print_info: FIM SUF token = 151661 '<|fim_suffix|>' print_info: FIM MID token = 151660 '<|fim_middle|>' print_info: FIM PAD token = 151662 '<|fim_pad|>' print_info: FIM REP token = 151663 '<|repo_name|>' print_info: FIM SEP token = 151664 '<|file_sep|>' print_info: EOG token = 151643 '<|endoftext|>' print_info: EOG token = 151645 '<|im_end|>' print_info: EOG token = 151662 '<|fim_pad|>' print_info: EOG token = 151663 '<|repo_name|>' print_info: EOG token = 151664 '<|file_sep|>' print_info: max token length = 256 load_tensors: layer 0 assigned to device CUDA0 load_tensors: layer 1 assigned to device CUDA0 load_tensors: layer 2 assigned to device CUDA0 load_tensors: layer 3 assigned to device CUDA0 load_tensors: layer 4 assigned to device CUDA0 load_tensors: layer 5 assigned to device CUDA0 load_tensors: layer 6 assigned to device CUDA0 load_tensors: layer 7 assigned to device CUDA0 load_tensors: layer 8 assigned to device CUDA0 load_tensors: layer 9 assigned to device CUDA0 load_tensors: layer 10 assigned to device CUDA0 load_tensors: layer 11 assigned to device CUDA0 load_tensors: layer 12 assigned to device CUDA0 load_tensors: layer 13 assigned to device CUDA0 load_tensors: layer 14 assigned to device CUDA0 load_tensors: layer 15 assigned to device CUDA0 load_tensors: layer 16 assigned to device CUDA0 load_tensors: layer 17 assigned to device CUDA0 load_tensors: layer 18 assigned to device CUDA0 load_tensors: layer 19 assigned to device CUDA0 load_tensors: layer 20 assigned to device CUDA0 load_tensors: layer 21 assigned to device CUDA0 load_tensors: layer 22 assigned to device CUDA0 load_tensors: layer 23 assigned to device CUDA0 load_tensors: layer 24 assigned to device CUDA0 load_tensors: layer 25 assigned to device CUDA0 load_tensors: layer 26 assigned to device CUDA0 load_tensors: layer 27 assigned to device CUDA0 load_tensors: layer 28 assigned to device CUDA0 load_tensors: tensor 'token_embd.weight' (q4_K) (and 0 others) cannot be used with preferred buffer type CPU_AARCH64, using CPU instead load_tensors: offloading 28 repeating layers to GPU load_tensors: offloading output layer to GPU load_tensors: offloaded 29/29 layers to GPU load_tensors: CUDA0 model buffer size = 4168.09 MiB load_tensors: CPU_Mapped model buffer size = 292.36 MiB llama_init_from_model: n_seq_max = 1 llama_init_from_model: n_ctx = 512 llama_init_from_model: n_ctx_per_seq = 512 llama_init_from_model: n_batch = 512 llama_init_from_model: n_ubatch = 512 llama_init_from_model: flash_attn = 0 llama_init_from_model: freq_base = 1000000.0 llama_init_from_model: freq_scale = 1 llama_init_from_model: n_ctx_per_seq (512) < n_ctx_train (131072) -- the full capacity of the model will not be utilized llama_kv_cache_init: kv_size = 512, offload = 1, type_k = 'f16', type_v = 'f16', n_layer = 28, can_shift = 1 llama_kv_cache_init: layer 0: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 1: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 2: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 3: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 4: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 5: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 6: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 7: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 8: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 9: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 10: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 11: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 12: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 13: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 14: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 15: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 16: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 17: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 18: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 19: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 20: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 21: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 22: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 23: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 24: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 25: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 26: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: layer 27: n_embd_k_gqa = 512, n_embd_v_gqa = 512 llama_kv_cache_init: CUDA0 KV buffer size = 28.00 MiB llama_init_from_model: KV self size = 28.00 MiB, K (f16): 14.00 MiB, V (f16): 14.00 MiB llama_init_from_model: CUDA_Host output buffer size = 0.58 MiB llama_init_from_model: CUDA0 compute buffer size = 304.00 MiB llama_init_from_model: CUDA_Host compute buffer size = 8.01 MiB llama_init_from_model: graph nodes = 986 llama_init_from_model: graph splits = 2 CUDA : ARCHS = 890 | USE_GRAPHS = 1 | PEER_MAX_BATCH_SIZE = 128 | CPU : SSE3 = 1 | SSSE3 = 1 | AVX = 1 | AVX2 = 1 | F16C = 1 | FMA = 1 | LLAMAFILE = 1 | OPENMP = 1 | AARCH64_REPACK = 1 | Model metadata: {'general.name': 'Qwen2.5 Coder 7B Instruct GGUF', 'general.architecture': 'qwen2', 'general.type': 'model', 'general.basename': 'Qwen2.5-Coder', 'general.finetune': 'Instruct-GGUF', 'qwen2.block_count': '28', 'general.size_label': '7B', 'split.count': '0', 'qwen2.context_length': '131072', 'qwen2.embedding_length': '3584', 'general.quantization_version': '2', 'tokenizer.ggml.bos_token_id': '151643', 'qwen2.feed_forward_length': '18944', 'qwen2.attention.head_count': '28', 'qwen2.attention.head_count_kv': '4', 'tokenizer.ggml.padding_token_id': '151643', 'qwen2.rope.freq_base': '1000000.000000', 'qwen2.attention.layer_norm_rms_epsilon': '0.000001', 'split.tensors.count': '339', 'tokenizer.ggml.eos_token_id': '151645', 'general.file_type': '15', 'tokenizer.ggml.model': 'gpt2', 'tokenizer.ggml.pre': 'qwen2', 'tokenizer.ggml.add_bos_token': 'false', 'tokenizer.chat_template': '{%- if tools %}\n {{- '<|im_start|>system\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}\n {%- endif %}\n {{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within XML tags:\n" }}\n {%- for tool in tools %}\n {{- "\n" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- "\n\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{{\"name\": , \"arguments\": }}\n</tool_call><|im_end|>\n" }}\n{%- else %}\n {%- if messages[0]['role'] == 'system' %}\n {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}\n {%- else %}\n {{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}\n {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}\n {%- elif message.role == "assistant" %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content %}\n {{- '\n' + message.content }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\n<tool_call>\n{"name": "' }}\n {{- tool_call.name }}\n {{- '", "arguments": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\n' }}\n {%- elif message.role == "tool" %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\n<tool_response>\n' }}\n {{- message.content }}\n {{- '\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}\n {{- '<|im_end|>\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\n' }}\n{%- endif %}\n', 'split.no': '0'} Available chat formats from metadata: chat_template.default Using gguf chat template: {%- if tools %} {{- '<|im_start|>system\n' }} {%- if messages[0]['role'] == 'system' %} {{- messages[0]['content'] }} {%- else %} {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }} {%- endif %} {{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within XML tags:\n" }} {%- for tool in tools %} {{- "\n" }} {{- tool | tojson }} {%- endfor %} {{- "\n\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{{"name": , "arguments": }}\n</tool_call><|im_end|>\n" }} {%- else %} {%- if messages[0]['role'] == 'system' %} {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }} {%- else %} {{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }} {%- endif %} {%- endif %} {%- for message in messages %} {%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %} {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }} {%- elif message.role == "assistant" %} {{- '<|im_start|>' + message.role }} {%- if message.content %} {{- '\n' + message.content }} {%- endif %} {%- for tool_call in message.tool_calls %} {%- if tool_call.function is defined %} {%- set tool_call = tool_call.function %} {%- endif %} {{- '\n<tool_call>\n{"name": "' }} {{- tool_call.name }} {{- '", "arguments": ' }} {{- tool_call.arguments | tojson }} {{- '}\n</tool_call>' }} {%- endfor %} {{- '<|im_end|>\n' }} {%- elif message.role == "tool" %} {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %} {{- '<|im_start|>user' }} {%- endif %} {{- '\n<tool_response>\n' }} {{- message.content }} {{- '\n</tool_response>' }} {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %} {{- '<|im_end|>\n' }} {%- endif %} {%- endif %} {%- endfor %} {%- if add_generation_prompt %} {{- '<|im_start|>assistant\n' }} {%- endif %}

Using chat eos_token: <|im_end|> Using chat bos_token: <|endoftext|> llama_perf_context_print: load time = 113.31 ms llama_perf_context_print: prompt eval time = 113.23 ms / 6 tokens ( 18.87 ms per token, 52.99 tokens per second) llama_perf_context_print: eval time = 1126.94 ms / 99 runs ( 11.38 ms per token, 87.85 tokens per second) llama_perf_context_print: total time = 1360.79 ms / 105 tokens {'id': 'cmpl-6894c929-824e-4c60-a4f4-82dd32d7baa8', 'object': 'text_completion', 'created': 1740414543, 'model': 'E:\.lmstudio\models\Qwen\Qwen2.5-Coder-7B-Instruct-GGUF\qwen2.5-coder-7b-instruct-q4_k_m.gguf', 'choices': [{'text': " Can you help me with something? I'm trying to write a Python program that calculates the sum of all even numbers in a given list. Can you provide an example code snippet?\n\nCertainly! Here's an example code snippet in Python that calculates the sum of all even numbers in a list:\n\n```python\ndef sum_of_even_numbers(numbers):\n # Initialize the sum to 0\n sum = 0\n \n # Iterate through each number in the list\n for num in numbers:\n ", 'index': 0, 'logprobs': None, 'finish_reason': 'length'}], 'usage': {'prompt_tokens': 6, 'completion_tokens': 100, 'total_tokens': 106}} 请按任意键继续. . .

dw5189 avatar Feb 24 '25 16:02 dw5189