Instructions to use hfl/chinese-llama-2-13b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hfl/chinese-llama-2-13b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="hfl/chinese-llama-2-13b")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("hfl/chinese-llama-2-13b") model = AutoModelForCausalLM.from_pretrained("hfl/chinese-llama-2-13b") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use hfl/chinese-llama-2-13b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hfl/chinese-llama-2-13b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hfl/chinese-llama-2-13b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/hfl/chinese-llama-2-13b
- SGLang
How to use hfl/chinese-llama-2-13b 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 "hfl/chinese-llama-2-13b" \ --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": "hfl/chinese-llama-2-13b", "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 "hfl/chinese-llama-2-13b" \ --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": "hfl/chinese-llama-2-13b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use hfl/chinese-llama-2-13b with Docker Model Runner:
docker model run hf.co/hfl/chinese-llama-2-13b
Chinese-LLaMA-2-13B
This is the full Chinese-LLaMA-2-13B model๏ผwhich can be loaded directly for inference and full-parameter training.
Related models๐
- Long context base models
- Base models
- Instruction/Chat models
Description of Chinese-LLaMA-Alpaca-2
This project is based on the Llama-2, released by Meta, and it is the second generation of the Chinese LLaMA & Alpaca LLM project. We open-source Chinese LLaMA-2 (foundation model) and Alpaca-2 (instruction-following model). These models have been expanded and optimized with Chinese vocabulary beyond the original Llama-2. We used large-scale Chinese data for incremental pre-training, which further improved the fundamental semantic understanding of the Chinese language, resulting in a significant performance improvement compared to the first-generation models. The relevant models support a 4K context and can be expanded up to 18K+ using the NTK method.
The main contents of this project include:
- ๐ New extended Chinese vocabulary beyond Llama-2, open-sourcing the Chinese LLaMA-2 and Alpaca-2 LLMs.
- ๐ Open-sourced the pre-training and instruction finetuning (SFT) scripts for further tuning on user's data
- ๐ Quickly deploy and experience the quantized LLMs on CPU/GPU of personal PC
- ๐ Support for LLaMA ecosystems like ๐คtransformers, llama.cpp, text-generation-webui, LangChain, vLLM etc.
Please refer to https://github.com/ymcui/Chinese-LLaMA-Alpaca-2/ for details.
- Downloads last month
- 8,511