Instructions to use yentinglin/Taiwan-LLM-7B-v2.0-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yentinglin/Taiwan-LLM-7B-v2.0-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yentinglin/Taiwan-LLM-7B-v2.0-base") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("yentinglin/Taiwan-LLM-7B-v2.0-base") model = AutoModelForCausalLM.from_pretrained("yentinglin/Taiwan-LLM-7B-v2.0-base", 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 yentinglin/Taiwan-LLM-7B-v2.0-base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yentinglin/Taiwan-LLM-7B-v2.0-base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yentinglin/Taiwan-LLM-7B-v2.0-base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/yentinglin/Taiwan-LLM-7B-v2.0-base
- SGLang
How to use yentinglin/Taiwan-LLM-7B-v2.0-base 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 "yentinglin/Taiwan-LLM-7B-v2.0-base" \ --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": "yentinglin/Taiwan-LLM-7B-v2.0-base", "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 "yentinglin/Taiwan-LLM-7B-v2.0-base" \ --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": "yentinglin/Taiwan-LLM-7B-v2.0-base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use yentinglin/Taiwan-LLM-7B-v2.0-base with Docker Model Runner:
docker model run hf.co/yentinglin/Taiwan-LLM-7B-v2.0-base
Commit ·
1f7e786
1
Parent(s): 22b03da
Upload LlamaForCausalLM
Browse files- config.json +9 -7
- generation_config.json +5 -1
- model-00001-of-00002.safetensors +2 -2
- model-00002-of-00002.safetensors +2 -2
- model.safetensors.index.json +15 -15
config.json
CHANGED
|
@@ -1,22 +1,24 @@
|
|
| 1 |
{
|
| 2 |
-
"_name_or_path": "/fsx/
|
| 3 |
"architectures": [
|
| 4 |
-
"
|
| 5 |
],
|
|
|
|
| 6 |
"bos_token_id": 1,
|
| 7 |
"eos_token_id": 2,
|
| 8 |
"hidden_act": "silu",
|
| 9 |
"hidden_size": 4096,
|
| 10 |
"initializer_range": 0.02,
|
| 11 |
-
"intermediate_size":
|
| 12 |
-
"max_position_embeddings":
|
| 13 |
-
"model_type": "
|
| 14 |
"num_attention_heads": 32,
|
| 15 |
"num_hidden_layers": 32,
|
| 16 |
-
"num_key_value_heads":
|
|
|
|
| 17 |
"rms_norm_eps": 1e-05,
|
|
|
|
| 18 |
"rope_theta": 10000.0,
|
| 19 |
-
"sliding_window": 4096,
|
| 20 |
"tie_word_embeddings": false,
|
| 21 |
"torch_dtype": "bfloat16",
|
| 22 |
"transformers_version": "4.34.0",
|
|
|
|
| 1 |
{
|
| 2 |
+
"_name_or_path": "/fsx/llama2-7b-pretrain/checkpoint-1000",
|
| 3 |
"architectures": [
|
| 4 |
+
"LlamaForCausalLM"
|
| 5 |
],
|
| 6 |
+
"attention_bias": false,
|
| 7 |
"bos_token_id": 1,
|
| 8 |
"eos_token_id": 2,
|
| 9 |
"hidden_act": "silu",
|
| 10 |
"hidden_size": 4096,
|
| 11 |
"initializer_range": 0.02,
|
| 12 |
+
"intermediate_size": 11008,
|
| 13 |
+
"max_position_embeddings": 4096,
|
| 14 |
+
"model_type": "llama",
|
| 15 |
"num_attention_heads": 32,
|
| 16 |
"num_hidden_layers": 32,
|
| 17 |
+
"num_key_value_heads": 32,
|
| 18 |
+
"pretraining_tp": 1,
|
| 19 |
"rms_norm_eps": 1e-05,
|
| 20 |
+
"rope_scaling": null,
|
| 21 |
"rope_theta": 10000.0,
|
|
|
|
| 22 |
"tie_word_embeddings": false,
|
| 23 |
"torch_dtype": "bfloat16",
|
| 24 |
"transformers_version": "4.34.0",
|
generation_config.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
| 1 |
{
|
| 2 |
-
"_from_model_config": true,
|
| 3 |
"bos_token_id": 1,
|
|
|
|
| 4 |
"eos_token_id": 2,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
"transformers_version": "4.34.0"
|
| 6 |
}
|
|
|
|
| 1 |
{
|
|
|
|
| 2 |
"bos_token_id": 1,
|
| 3 |
+
"do_sample": true,
|
| 4 |
"eos_token_id": 2,
|
| 5 |
+
"max_length": 4096,
|
| 6 |
+
"pad_token_id": 0,
|
| 7 |
+
"temperature": 0.6,
|
| 8 |
+
"top_p": 0.9,
|
| 9 |
"transformers_version": "4.34.0"
|
| 10 |
}
|
model-00001-of-00002.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ce2b3e4e77ea3a33ba84da66e68512739525e74e3046ffc0969374b2c3e9f9a0
|
| 3 |
+
size 9976570520
|
model-00002-of-00002.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:56cf9830abdde60dfe3ea0cb159a7243612e463cf4c4b31a75325e3412bf21c9
|
| 3 |
+
size 3500294544
|
model.safetensors.index.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
{
|
| 2 |
"metadata": {
|
| 3 |
-
"total_size":
|
| 4 |
},
|
| 5 |
"weight_map": {
|
| 6 |
"lm_head.weight": "model-00002-of-00002.safetensors",
|
|
@@ -140,24 +140,24 @@
|
|
| 140 |
"model.layers.21.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 141 |
"model.layers.21.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 142 |
"model.layers.21.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 143 |
-
"model.layers.22.input_layernorm.weight": "model-
|
| 144 |
-
"model.layers.22.mlp.down_proj.weight": "model-
|
| 145 |
-
"model.layers.22.mlp.gate_proj.weight": "model-
|
| 146 |
-
"model.layers.22.mlp.up_proj.weight": "model-
|
| 147 |
-
"model.layers.22.post_attention_layernorm.weight": "model-
|
| 148 |
"model.layers.22.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 149 |
"model.layers.22.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 150 |
"model.layers.22.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 151 |
"model.layers.22.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 152 |
-
"model.layers.23.input_layernorm.weight": "model-
|
| 153 |
-
"model.layers.23.mlp.down_proj.weight": "model-
|
| 154 |
-
"model.layers.23.mlp.gate_proj.weight": "model-
|
| 155 |
-
"model.layers.23.mlp.up_proj.weight": "model-
|
| 156 |
-
"model.layers.23.post_attention_layernorm.weight": "model-
|
| 157 |
-
"model.layers.23.self_attn.k_proj.weight": "model-
|
| 158 |
-
"model.layers.23.self_attn.o_proj.weight": "model-
|
| 159 |
-
"model.layers.23.self_attn.q_proj.weight": "model-
|
| 160 |
-
"model.layers.23.self_attn.v_proj.weight": "model-
|
| 161 |
"model.layers.24.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 162 |
"model.layers.24.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 163 |
"model.layers.24.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|
|
|
|
| 1 |
{
|
| 2 |
"metadata": {
|
| 3 |
+
"total_size": 13476831232
|
| 4 |
},
|
| 5 |
"weight_map": {
|
| 6 |
"lm_head.weight": "model-00002-of-00002.safetensors",
|
|
|
|
| 140 |
"model.layers.21.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 141 |
"model.layers.21.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 142 |
"model.layers.21.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 143 |
+
"model.layers.22.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 144 |
+
"model.layers.22.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 145 |
+
"model.layers.22.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 146 |
+
"model.layers.22.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 147 |
+
"model.layers.22.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 148 |
"model.layers.22.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 149 |
"model.layers.22.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 150 |
"model.layers.22.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 151 |
"model.layers.22.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 152 |
+
"model.layers.23.input_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 153 |
+
"model.layers.23.mlp.down_proj.weight": "model-00001-of-00002.safetensors",
|
| 154 |
+
"model.layers.23.mlp.gate_proj.weight": "model-00001-of-00002.safetensors",
|
| 155 |
+
"model.layers.23.mlp.up_proj.weight": "model-00001-of-00002.safetensors",
|
| 156 |
+
"model.layers.23.post_attention_layernorm.weight": "model-00001-of-00002.safetensors",
|
| 157 |
+
"model.layers.23.self_attn.k_proj.weight": "model-00001-of-00002.safetensors",
|
| 158 |
+
"model.layers.23.self_attn.o_proj.weight": "model-00001-of-00002.safetensors",
|
| 159 |
+
"model.layers.23.self_attn.q_proj.weight": "model-00001-of-00002.safetensors",
|
| 160 |
+
"model.layers.23.self_attn.v_proj.weight": "model-00001-of-00002.safetensors",
|
| 161 |
"model.layers.24.input_layernorm.weight": "model-00002-of-00002.safetensors",
|
| 162 |
"model.layers.24.mlp.down_proj.weight": "model-00002-of-00002.safetensors",
|
| 163 |
"model.layers.24.mlp.gate_proj.weight": "model-00002-of-00002.safetensors",
|