Instructions to use ken-miller/tris-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ken-miller/tris-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ken-miller/tris-2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ken-miller/tris-2") model = AutoModelForCausalLM.from_pretrained("ken-miller/tris-2") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ken-miller/tris-2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ken-miller/tris-2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ken-miller/tris-2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ken-miller/tris-2
- SGLang
How to use ken-miller/tris-2 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 "ken-miller/tris-2" \ --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": "ken-miller/tris-2", "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 "ken-miller/tris-2" \ --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": "ken-miller/tris-2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ken-miller/tris-2 with Docker Model Runner:
docker model run hf.co/ken-miller/tris-2
Upload LlamaForCausalLM
Browse files- config.json +3 -3
- generation_config.json +2 -1
- model-00001-of-00003.safetensors +1 -1
- model-00002-of-00003.safetensors +1 -1
- model-00003-of-00003.safetensors +1 -1
config.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"_name_or_path": "/
|
| 3 |
"architectures": [
|
| 4 |
"LlamaForCausalLM"
|
| 5 |
],
|
|
@@ -11,7 +11,7 @@
|
|
| 11 |
"hidden_size": 4096,
|
| 12 |
"initializer_range": 0.02,
|
| 13 |
"intermediate_size": 14336,
|
| 14 |
-
"max_position_embeddings":
|
| 15 |
"model_type": "llama",
|
| 16 |
"num_attention_heads": 32,
|
| 17 |
"num_hidden_layers": 32,
|
|
@@ -23,6 +23,6 @@
|
|
| 23 |
"tie_word_embeddings": false,
|
| 24 |
"torch_dtype": "bfloat16",
|
| 25 |
"transformers_version": "4.36.2",
|
| 26 |
-
"use_cache":
|
| 27 |
"vocab_size": 32000
|
| 28 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"_name_or_path": "/storage/models/training/2024-02-17_00-58-06",
|
| 3 |
"architectures": [
|
| 4 |
"LlamaForCausalLM"
|
| 5 |
],
|
|
|
|
| 11 |
"hidden_size": 4096,
|
| 12 |
"initializer_range": 0.02,
|
| 13 |
"intermediate_size": 14336,
|
| 14 |
+
"max_position_embeddings": 32768,
|
| 15 |
"model_type": "llama",
|
| 16 |
"num_attention_heads": 32,
|
| 17 |
"num_hidden_layers": 32,
|
|
|
|
| 23 |
"tie_word_embeddings": false,
|
| 24 |
"torch_dtype": "bfloat16",
|
| 25 |
"transformers_version": "4.36.2",
|
| 26 |
+
"use_cache": false,
|
| 27 |
"vocab_size": 32000
|
| 28 |
}
|
generation_config.json
CHANGED
|
@@ -2,5 +2,6 @@
|
|
| 2 |
"_from_model_config": true,
|
| 3 |
"bos_token_id": 1,
|
| 4 |
"eos_token_id": 2,
|
| 5 |
-
"transformers_version": "4.36.2"
|
|
|
|
| 6 |
}
|
|
|
|
| 2 |
"_from_model_config": true,
|
| 3 |
"bos_token_id": 1,
|
| 4 |
"eos_token_id": 2,
|
| 5 |
+
"transformers_version": "4.36.2",
|
| 6 |
+
"use_cache": false
|
| 7 |
}
|
model-00001-of-00003.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4943162336
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3c602f298dc3782af2bb316ceb2e32877091e65f5bf1ac3510ee1b13445d03ff
|
| 3 |
size 4943162336
|
model-00002-of-00003.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4999819336
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cf8a72a36ea0775d6d0b33fd3777c301f880df593522035038c3644c4836dca4
|
| 3 |
size 4999819336
|
model-00003-of-00003.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4540516344
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c32fd4eb119d86dfa3f4d326cf4f488d4cd0108cd335dfdfe1fd7c5068dac0b2
|
| 3 |
size 4540516344
|