Text Generation
Transformers
PyTorch
Chinese
English
llama
llama2
llama2-base
llama2-base-7B
text-generation-inference
Instructions to use RicardoLee/Llama2-base-7B-Chinese-50W-pre_release with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RicardoLee/Llama2-base-7B-Chinese-50W-pre_release with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RicardoLee/Llama2-base-7B-Chinese-50W-pre_release")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("RicardoLee/Llama2-base-7B-Chinese-50W-pre_release") model = AutoModelForCausalLM.from_pretrained("RicardoLee/Llama2-base-7B-Chinese-50W-pre_release") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use RicardoLee/Llama2-base-7B-Chinese-50W-pre_release with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RicardoLee/Llama2-base-7B-Chinese-50W-pre_release" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RicardoLee/Llama2-base-7B-Chinese-50W-pre_release", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/RicardoLee/Llama2-base-7B-Chinese-50W-pre_release
- SGLang
How to use RicardoLee/Llama2-base-7B-Chinese-50W-pre_release 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 "RicardoLee/Llama2-base-7B-Chinese-50W-pre_release" \ --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": "RicardoLee/Llama2-base-7B-Chinese-50W-pre_release", "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 "RicardoLee/Llama2-base-7B-Chinese-50W-pre_release" \ --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": "RicardoLee/Llama2-base-7B-Chinese-50W-pre_release", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use RicardoLee/Llama2-base-7B-Chinese-50W-pre_release with Docker Model Runner:
docker model run hf.co/RicardoLee/Llama2-base-7B-Chinese-50W-pre_release
Commit ·
3e60ab8
1
Parent(s): c10861e
README rectify: Add inference template clarification
Browse files
README.md
CHANGED
|
@@ -51,6 +51,24 @@ Some details in training:
|
|
| 51 |
5. Initial Loss: Please refer to [Material](trainer_state.json)
|
| 52 |
6. Train Loss: Please refer to [Material](trainer_state.json)
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
## Licence
|
| 55 |
|
| 56 |
本仓库的模型依照 Apache-2.0 协议开源,模型的权重的使用则需要遵循LLama2[MODEL LICENCE](LICENSE)。
|
|
|
|
| 51 |
5. Initial Loss: Please refer to [Material](trainer_state.json)
|
| 52 |
6. Train Loss: Please refer to [Material](trainer_state.json)
|
| 53 |
|
| 54 |
+
## Inference
|
| 55 |
+
|
| 56 |
+
该模型依然采用stanford alpaca 模版。因此在测试时且别忘记添加开场白。开场白如下:
|
| 57 |
+
|
| 58 |
+
"Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n\n${Your Content}\n\n### Response:\n\n"
|
| 59 |
+
|
| 60 |
+
对于带上文的对话,开场白如下:
|
| 61 |
+
|
| 62 |
+
"Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n\nHuman:${Previous Human Content}\nAssistant:${Previous Assistance Content}\nHuman:${Your Question}\n\n### Response:\n\n"
|
| 63 |
+
|
| 64 |
+
This model still using the Stanford Alpaca template. Therefore, don't forget to add prologue template. The prologue template is:
|
| 65 |
+
|
| 66 |
+
"Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n\n${Your Content}\n\n### Response:\n\n"
|
| 67 |
+
|
| 68 |
+
For dialogue with context, the prelogue template is:
|
| 69 |
+
|
| 70 |
+
"Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n\nHuman:${Previous Human Content}\nAssistant:${Previous Machine Content}\nHuman:${Your Question}\n\n### Response:\n\n"
|
| 71 |
+
|
| 72 |
## Licence
|
| 73 |
|
| 74 |
本仓库的模型依照 Apache-2.0 协议开源,模型的权重的使用则需要遵循LLama2[MODEL LICENCE](LICENSE)。
|