Views
No views yet
internlm3-8b-instruct model in GGUF format can be utilized by llama.cpp, a highly popular open-source framework for Large Language Model (LLM) inference, across a variety of hardware platforms, both locally and in the cloud.
This repository offers internlm3-8b-instruct models in GGUF format in both half precision and various low-bit quantized versions, including q5_0, q5_k_m, q6_k, and q8_0.llama.cpp from source. The following code snippet provides an example for the Linux CUDA platform. For instructions on other platforms, please refer to the official guide.1conda create --name internlm3 python=3.10 -y
2conda activate internlm3
3pip install cmake1git clone --depth=1 https://github.com/ggerganov/llama.cpp.git
2cd llama.cpp
3cmake -B build -DGGML_CUDA=ON
4cmake --build build --config Release -jbuild/binllama.cpp.internlm3-8b-instruct-fp16.gguf can be downloaded as below:1pip install huggingface-hub
2huggingface-cli download internlm/internlm3-8b-instruct-gguf internlm3-8b-instruct.gguf --local-dir . --local-dir-use-symlinks Falsellama-cli for conducting inference. For a detailed explanation of llama-cli, please refer to this guide1
2thinking_system_prompt="<|im_start|>system\nYou are an expert mathematician with extensive experience in mathematical competitions. You approach problems through systematic thinking and rigorous reasoning. When solving problems, follow these thought processes:\n## Deep Understanding\nTake time to fully comprehend the problem before attempting a solution. Consider:\n- What is the real question being asked?\n- What are the given conditions and what do they tell us?\n- Are there any special restrictions or assumptions?\n- Which information is crucial and which is supplementary?\n## Multi-angle Analysis\nBefore solving, conduct thorough analysis:\n- What mathematical concepts and properties are involved?\n- Can you recall similar classic problems or solution methods?\n- Would diagrams or tables help visualize the problem?\n- Are there special cases that need separate consideration?\n## Systematic Thinking\nPlan your solution path:\n- Propose multiple possible approaches\n- Analyze the feasibility and merits of each method\n- Choose the most appropriate method and explain why\n- Break complex problems into smaller, manageable steps\n## Rigorous Proof\nDuring the solution process:\n- Provide solid justification for each step\n- Include detailed proofs for key conclusions\n- Pay attention to logical connections\n- Be vigilant about potential oversights\n## Repeated Verification\nAfter completing your solution:\n- Verify your results satisfy all conditions\n- Check for overlooked special cases\n- Consider if the solution can be optimized or simplified\n- Review your reasoning process\nRemember:\n1. Take time to think thoroughly rather than rushing to an answer\n2. Rigorously prove each key conclusion\n3. Keep an open mind and try different approaches\n4. Summarize valuable problem-solving methods\n5. Maintain healthy skepticism and verify multiple times\nYour response should reflect deep mathematical understanding and precise logical thinking, making your solution path and reasoning clear to others.\nWhen you're ready, present your complete solution with:\n- Clear problem understanding\n- Detailed solution process\n- Key insights\n- Thorough verification\nFocus on clear, logical progression of ideas and thorough explanation of your mathematical reasoning. Provide answers in the same language as the user asking the question, repeat the final answer using a '\\boxed{}' without any units, you have [[8192]] tokens to complete the answer.\n<|im_end|>\n"
3
4build/bin/llama-cli \
5 --model internlm3-8b-instruct.gguf \
6 --predict 2048 \
7 --ctx-size 8192 \
8 --gpu-layers 48 \
9 --temp 0.8 \
10 --top-p 0.8 \
11 --top-k 50 \
12 --seed 1024 \
13 --color \
14 --prompt "$thinking_system_prompt" \
15 --interactive \
16 --multiline-input \
17 --conversation \
18 --verbose \
19 --logdir workdir/logdir \
20 --in-prefix "<|im_start|>user\n" \
21 --in-suffix "<|im_end|>\n<|im_start|>assistant\n"Given the function\(f(x)=\mathrm{e}^{x}-ax - a^{3}\),\n(1) When \(a = 1\), find the equation of the tangent line to the curve \(y = f(x)\) at the point \((1,f(1))\).\n(2) If \(f(x)\) has a local minimum and the minimum value is less than \(0\), determine the range of values for \(a\)..llama-cli example:1build/bin/llama-cli \
2 --model internlm3-8b-instruct.gguf \
3 --predict 512 \
4 --ctx-size 4096 \
5 --gpu-layers 48 \
6 --temp 0.8 \
7 --top-p 0.8 \
8 --top-k 50 \
9 --seed 1024 \
10 --color \
11 --prompt '<|im_start|>system\nYou are InternLM-Chat, a harmless AI assistant.<|im_end|>\n<|im_start|>system name=<|plugin|>[{"name": "get_current_weather", "parameters": {"required": ["location"], "type": "object", "properties": {"location": {"type": "string", "description": "The city and state, e.g. San Francisco, CA"}, "unit": {"type": "string"}}}, "description": "Get the current weather in a given location"}]<|im_end|>\n<|im_start|>user\n' \
12 --interactive \
13 --multiline-input \
14 --conversation \
15 --verbose \
16 --in-suffix "<|im_end|>\n<|im_start|>assistant\n" \
17 --special1<s><|im_start|>system
2You are InternLM-Chat, a harmless AI assistant.<|im_end|>
3<|im_start|>system name=<|plugin|>[{"name": "get_current_weather", "parameters": {"required": ["location"], "type": "object", "properties": {"location": {"type": "string", "description": "The city and state, e.g. San Francisco, CA"}, "unit": {"type": "string"}}}, "description": "Get the current weather in a given location"}]<|im_end|>
4<|im_start|>user
5
6> I want to know today's weather in Shanghai
7I need to use the get_current_weather function to get the current weather in Shanghai.<|action_start|><|plugin|>
8{"name": "get_current_weather", "parameters": {"location": "Shanghai"}}<|action_end|>32
9<|im_end|>
10
11> <|im_start|>environment name=<|plugin|>\n{"temperature": 22}
12The current temperature in Shanghai is 22 degrees Celsius.<|im_end|>
13
14> llama.cpp provides an OpenAI API compatible server - llama-server. You can deploy internlm3-8b-instruct.gguf into a service like this:./build/bin/llama-server -m ./internlm3-8b-instruct.gguf -ngl 481from openai import OpenAI
2client = OpenAI(
3 api_key='YOUR_API_KEY',
4 base_url='http://localhost:8080/v1'
5)
6model_name = client.models.list().data[0].id
7response = client.chat.completions.create(
8 model=model_name,
9 messages=[
10 {"role": "system", "content": "You are a helpful assistant."},
11 {"role": "user", "content": " provide three suggestions about time management"},
12 ],
13 temperature=0.8,
14 top_p=0.8
15)
16print(response)