Instructions to use frankminors123/Chinese-CodeLlama-7B-SFT-V2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use frankminors123/Chinese-CodeLlama-7B-SFT-V2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="frankminors123/Chinese-CodeLlama-7B-SFT-V2")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("frankminors123/Chinese-CodeLlama-7B-SFT-V2") model = AutoModelForCausalLM.from_pretrained("frankminors123/Chinese-CodeLlama-7B-SFT-V2") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use frankminors123/Chinese-CodeLlama-7B-SFT-V2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "frankminors123/Chinese-CodeLlama-7B-SFT-V2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "frankminors123/Chinese-CodeLlama-7B-SFT-V2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/frankminors123/Chinese-CodeLlama-7B-SFT-V2
- SGLang
How to use frankminors123/Chinese-CodeLlama-7B-SFT-V2 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 "frankminors123/Chinese-CodeLlama-7B-SFT-V2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "frankminors123/Chinese-CodeLlama-7B-SFT-V2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "frankminors123/Chinese-CodeLlama-7B-SFT-V2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "frankminors123/Chinese-CodeLlama-7B-SFT-V2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use frankminors123/Chinese-CodeLlama-7B-SFT-V2 with Docker Model Runner:
docker model run hf.co/frankminors123/Chinese-CodeLlama-7B-SFT-V2
Chinese-CodeLlama-7B-SFT-V2
We added 7k+ python code instructions and implemented SFT based on our Chinese-CodeLlama-7B-SFT-V1. Drawing on the work of code-llama, we increased the base period of rotary positional embeddings (RoPE) from 10000 to 1000000.
We use a sequence length of 1k for pre-training, and continue training based on this length during the fine-tuning stage. Based on a larger base period of RoPE, it can support up 15k context length extrapolation at inference time.
Based on this dataset (Python-test), we calculate the average of PPL on 1k length text to be 5.44. However, this value is 148.70 based on our pre-trained model.
The Chinese prompt template used is as follows:
PROMPT_TEMPLATE = (
"下面是描述一项任务的指令,并且与一则输入配对用来提供更多的上下文。请给出尽可能满足请求的回答.\n"
"### 指令:\n{instruction}\n### 输入:\n{input}\n### 回答:\n"
)
- Downloads last month
- 13