Text Generation
Transformers
Safetensors
English
Chinese
llama
llama-factory
orpo
conversational
text-generation-inference
Instructions to use shenzhi-wang/Llama3-70B-Chinese-Chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use shenzhi-wang/Llama3-70B-Chinese-Chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="shenzhi-wang/Llama3-70B-Chinese-Chat") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("shenzhi-wang/Llama3-70B-Chinese-Chat") model = AutoModelForCausalLM.from_pretrained("shenzhi-wang/Llama3-70B-Chinese-Chat", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use shenzhi-wang/Llama3-70B-Chinese-Chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "shenzhi-wang/Llama3-70B-Chinese-Chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shenzhi-wang/Llama3-70B-Chinese-Chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/shenzhi-wang/Llama3-70B-Chinese-Chat
- SGLang
How to use shenzhi-wang/Llama3-70B-Chinese-Chat 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 "shenzhi-wang/Llama3-70B-Chinese-Chat" \ --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": "shenzhi-wang/Llama3-70B-Chinese-Chat", "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 "shenzhi-wang/Llama3-70B-Chinese-Chat" \ --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": "shenzhi-wang/Llama3-70B-Chinese-Chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use shenzhi-wang/Llama3-70B-Chinese-Chat with Docker Model Runner:
docker model run hf.co/shenzhi-wang/Llama3-70B-Chinese-Chat
Update config.json
#1
by hiyouga - opened
- config.json +2 -3
- generation_config.json +2 -1
- special_tokens_map.json +3 -15
config.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
| 1 |
{
|
| 2 |
-
"_name_or_path": "meta-llama/Meta-Llama-3-70B-Instruct",
|
| 3 |
"architectures": [
|
| 4 |
"LlamaForCausalLM"
|
| 5 |
],
|
| 6 |
"attention_bias": false,
|
| 7 |
"attention_dropout": 0.0,
|
| 8 |
"bos_token_id": 128000,
|
| 9 |
-
"eos_token_id":
|
| 10 |
"hidden_act": "silu",
|
| 11 |
"hidden_size": 8192,
|
| 12 |
"initializer_range": 0.02,
|
|
@@ -23,6 +22,6 @@
|
|
| 23 |
"tie_word_embeddings": false,
|
| 24 |
"torch_dtype": "bfloat16",
|
| 25 |
"transformers_version": "4.40.0",
|
| 26 |
-
"use_cache":
|
| 27 |
"vocab_size": 128256
|
| 28 |
}
|
|
|
|
| 1 |
{
|
|
|
|
| 2 |
"architectures": [
|
| 3 |
"LlamaForCausalLM"
|
| 4 |
],
|
| 5 |
"attention_bias": false,
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
"bos_token_id": 128000,
|
| 8 |
+
"eos_token_id": 128009,
|
| 9 |
"hidden_act": "silu",
|
| 10 |
"hidden_size": 8192,
|
| 11 |
"initializer_range": 0.02,
|
|
|
|
| 22 |
"tie_word_embeddings": false,
|
| 23 |
"torch_dtype": "bfloat16",
|
| 24 |
"transformers_version": "4.40.0",
|
| 25 |
+
"use_cache": true,
|
| 26 |
"vocab_size": 128256
|
| 27 |
}
|
generation_config.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
{
|
| 2 |
"_from_model_config": true,
|
| 3 |
"bos_token_id": 128000,
|
| 4 |
-
"eos_token_id":
|
|
|
|
| 5 |
"transformers_version": "4.40.0"
|
| 6 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"_from_model_config": true,
|
| 3 |
"bos_token_id": 128000,
|
| 4 |
+
"eos_token_id": 128009,
|
| 5 |
+
"pad_token_id": 128009,
|
| 6 |
"transformers_version": "4.40.0"
|
| 7 |
}
|
special_tokens_map.json
CHANGED
|
@@ -1,17 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"bos_token":
|
| 3 |
-
|
| 4 |
-
"lstrip": false,
|
| 5 |
-
"normalized": false,
|
| 6 |
-
"rstrip": false,
|
| 7 |
-
"single_word": false
|
| 8 |
-
},
|
| 9 |
-
"eos_token": {
|
| 10 |
-
"content": "<|eot_id|>",
|
| 11 |
-
"lstrip": false,
|
| 12 |
-
"normalized": false,
|
| 13 |
-
"rstrip": false,
|
| 14 |
-
"single_word": false
|
| 15 |
-
},
|
| 16 |
"pad_token": "<|eot_id|>"
|
| 17 |
-
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"bos_token": "<|begin_of_text|>",
|
| 3 |
+
"eos_token": "<|eot_id|>",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
"pad_token": "<|eot_id|>"
|
| 5 |
+
}
|