Text Generation
Transformers
TensorBoard
Safetensors
English
internlm2
feature-extraction
math
conversational
custom_code
Instructions to use MathGenie/InternLM2-SFT-SCDPO with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MathGenie/InternLM2-SFT-SCDPO with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MathGenie/InternLM2-SFT-SCDPO", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("MathGenie/InternLM2-SFT-SCDPO", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MathGenie/InternLM2-SFT-SCDPO with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MathGenie/InternLM2-SFT-SCDPO" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MathGenie/InternLM2-SFT-SCDPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/MathGenie/InternLM2-SFT-SCDPO
- SGLang
How to use MathGenie/InternLM2-SFT-SCDPO 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 "MathGenie/InternLM2-SFT-SCDPO" \ --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": "MathGenie/InternLM2-SFT-SCDPO", "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 "MathGenie/InternLM2-SFT-SCDPO" \ --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": "MathGenie/InternLM2-SFT-SCDPO", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use MathGenie/InternLM2-SFT-SCDPO with Docker Model Runner:
docker model run hf.co/MathGenie/InternLM2-SFT-SCDPO
| base_model: InternLM2-SFT | |
| tags: | |
| - math | |
| model-index: | |
| - name: InternLM2-SFT-SCDPO | |
| results: [] | |
| license: apache-2.0 | |
| language: | |
| - en | |
| metrics: | |
| - accuracy | |
| pipeline_tag: text-generation | |
| # InternLM2-SFT-SCDPO | |
| This model is a fine-tuned version of the InternLM2-20B model using SFT and SCDPO. | |
| It achieves the following results on the evaluation set: | |
| - Loss: 0.2572 | |
| - Rewards/chosen: 0.7366 | |
| - Rewards/rejected: -2.9817 | |
| - Rewards/accuracies: 0.8929 | |
| - Rewards/margins: 3.7183 | |
| - Logps/rejected: -155.1884 | |
| - Logps/chosen: -92.5904 | |
| - Logits/rejected: -2.3032 | |
| - Logits/chosen: -2.4880 | |
| ## Model description | |
| This is a model fine-tuned for mathematical problem-solving. | |
| ## Intended uses & limitations | |
| The model is intended for solving math problems. | |
| ## Training and evaluation data | |
| | | gsm8k | math | ape | cmath | mgsm_zh | | |
| | ------------------------------ | -------- | -------- | -------- | -------- | -------- | | |
| | InternLM2-SFT | 86.4 | 55.8 | 77.1 | 88.4 | 74.8 | | |
| | InternLM2-SFT-DPO | 87 | 57.6 | 78.7 | 89.9 | 76 | | |
| | InternLM2-SFT-DPO (data-equal) | 88.2 | 57.5 | 78.8 | 89.3 | 76 | | |
| | InternLM2-SFT-SCDPO | **88.5** | **58.1** | **79.3** | **90.3** | **80.4** | | |
| ## Training procedure | |
| ### Training hyperparameters | |
| The following hyperparameters were used during training: | |
| - learning_rate: 1.5e-07 | |
| - train_batch_size: 2 | |
| - eval_batch_size: 4 | |
| - seed: 42 | |
| - distributed_type: multi-GPU | |
| - num_devices: 16 | |
| - total_train_batch_size: 32 | |
| - total_eval_batch_size: 64 | |
| - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 | |
| - lr_scheduler_type: cosine | |
| - lr_scheduler_warmup_ratio: 0.1 | |
| - num_epochs: 2 | |
| ### Framework versions | |
| - Transformers 4.38.2 | |
| - Pytorch 2.1.2 | |
| - Datasets 2.14.6 | |
| - Tokenizers 0.15.2 |