Instructions to use internlm/internlm2-math-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use internlm/internlm2-math-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="internlm/internlm2-math-7b", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("internlm/internlm2-math-7b", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use internlm/internlm2-math-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "internlm/internlm2-math-7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "internlm/internlm2-math-7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/internlm/internlm2-math-7b
- SGLang
How to use internlm/internlm2-math-7b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "internlm/internlm2-math-7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "internlm/internlm2-math-7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "internlm/internlm2-math-7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "internlm/internlm2-math-7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use internlm/internlm2-math-7b with Docker Model Runner:
docker model run hf.co/internlm/internlm2-math-7b
x54-729 commited on
Commit ·
6f4ea21
1
Parent(s): 32b8973
update readme
Browse files
README.md
CHANGED
|
@@ -121,18 +121,23 @@ print(response)
|
|
| 121 |
We list some instructions used in our SFT. You can use them to help you. You can use the other ways to prompt the model, but the following are recommended. InternLM2-Math may combine the following abilities but it is not guaranteed.
|
| 122 |
|
| 123 |
Translate proof problem to Lean:
|
|
|
|
| 124 |

|
| 125 |
|
| 126 |
Using Lean 3 to solve GSM8K problem:
|
|
|
|
| 127 |

|
| 128 |
|
| 129 |
Generate problem based on Lean 3 code:
|
|
|
|
| 130 |

|
| 131 |
|
| 132 |
Play 24 point game:
|
|
|
|
| 133 |

|
| 134 |
|
| 135 |
Augment a harder math problem:
|
|
|
|
| 136 |

|
| 137 |
|
| 138 |
| Description | Query |
|
|
|
|
| 121 |
We list some instructions used in our SFT. You can use them to help you. You can use the other ways to prompt the model, but the following are recommended. InternLM2-Math may combine the following abilities but it is not guaranteed.
|
| 122 |
|
| 123 |
Translate proof problem to Lean:
|
| 124 |
+
|
| 125 |

|
| 126 |
|
| 127 |
Using Lean 3 to solve GSM8K problem:
|
| 128 |
+
|
| 129 |

|
| 130 |
|
| 131 |
Generate problem based on Lean 3 code:
|
| 132 |
+
|
| 133 |

|
| 134 |
|
| 135 |
Play 24 point game:
|
| 136 |
+
|
| 137 |

|
| 138 |
|
| 139 |
Augment a harder math problem:
|
| 140 |
+
|
| 141 |

|
| 142 |
|
| 143 |
| Description | Query |
|