Instructions to use frankminors123/Chinese-CodeLlama-7B-PT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use frankminors123/Chinese-CodeLlama-7B-PT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="frankminors123/Chinese-CodeLlama-7B-PT")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("frankminors123/Chinese-CodeLlama-7B-PT") model = AutoModelForCausalLM.from_pretrained("frankminors123/Chinese-CodeLlama-7B-PT") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use frankminors123/Chinese-CodeLlama-7B-PT 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-PT" # 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-PT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/frankminors123/Chinese-CodeLlama-7B-PT
- SGLang
How to use frankminors123/Chinese-CodeLlama-7B-PT 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-PT" \ --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-PT", "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-PT" \ --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-PT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use frankminors123/Chinese-CodeLlama-7B-PT with Docker Model Runner:
docker model run hf.co/frankminors123/Chinese-CodeLlama-7B-PT
Chinese-CodeLlama-7B-PT
We have further expanded the vocabulary based on Chinese-LLaMA-2-7B which from 55296 to 75548, it is worth noting that the most of them are code tokens. On MBPP, we calculated the compression rate of the tokenizer to be 4.509 bytes/token, and we will reduce this value in the future work to improve training and inference efficiency.
We pre-trained the model based on LoRA which the rank is 8 and the trainable LoRA layers contain q_proj and v_proj, at the same time, embed_tokens and lm_head layers were trained with full parameters. All trainable parameters are float32.
The training data contains approximately 400 million tokens which from high-quality code dataset on HuggingFace.
In addition, we applied memory_efficient_attention to the pre-training, which saves us a lot of GPU memory space. If you want to quickly use this technology in your LLaMA model, you can refer to my GitHub: https://github.com/FrankMinions/memory_efficient_adapter.
Our model can be used for SFT, and we hope to contribute more valuable work in the Chinese field.
The second version of our fine-tuned model named Chinese-CodeLlama-7B-SFT-V2 has been launched. We use a sequence length of 1k for pre-training (this model), and continue training based on this length during the fine-tuning stage. Based on a larger base period of rotary positional embeddings, it can support up 15k context length extrapolation at inference time.
- Downloads last month
- 11