Instructions to use nitky/Llama-3.1-SuperSwallow-70B-Instruct-v0.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nitky/Llama-3.1-SuperSwallow-70B-Instruct-v0.1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nitky/Llama-3.1-SuperSwallow-70B-Instruct-v0.1")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("nitky/Llama-3.1-SuperSwallow-70B-Instruct-v0.1") model = AutoModelForCausalLM.from_pretrained("nitky/Llama-3.1-SuperSwallow-70B-Instruct-v0.1", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nitky/Llama-3.1-SuperSwallow-70B-Instruct-v0.1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nitky/Llama-3.1-SuperSwallow-70B-Instruct-v0.1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nitky/Llama-3.1-SuperSwallow-70B-Instruct-v0.1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/nitky/Llama-3.1-SuperSwallow-70B-Instruct-v0.1
- SGLang
How to use nitky/Llama-3.1-SuperSwallow-70B-Instruct-v0.1 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 "nitky/Llama-3.1-SuperSwallow-70B-Instruct-v0.1" \ --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": "nitky/Llama-3.1-SuperSwallow-70B-Instruct-v0.1", "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 "nitky/Llama-3.1-SuperSwallow-70B-Instruct-v0.1" \ --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": "nitky/Llama-3.1-SuperSwallow-70B-Instruct-v0.1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use nitky/Llama-3.1-SuperSwallow-70B-Instruct-v0.1 with Docker Model Runner:
docker model run hf.co/nitky/Llama-3.1-SuperSwallow-70B-Instruct-v0.1
Llama-3.1-SuperSwallow-70B-Instruct-v0.1
Open Japanese LLM Leaderboard 🏆 Rank1 2024/12/03
🙏 Big thank you to @tokyotech-llm and @allenai.
This is a merge of pre-trained language models created using mergekit.
Test environment
This model was tested using text-generation-webui. I use preset min_p with temperature=1 for Generation.
Usage
This format must be adhered to strictly, as deviations may result in less optimal outputs from the model.
The template used to construct a prompt for the instruct model is specified as follows:
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
{SYSTEM_PROMPT}<|eot_id|><|start_header_id|>user<|end_header_id|>
{USER_MESSAGE}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
For the "{SYSTEM_PROMPT}" part, We recommend using "あなたは誠実で優秀な日本人のアシスタントです。" or "You are a helpful assistant."
For the "{USER_MESSAGE}" part, We recommend using {instruction}\n{input}
In other words, We recommend the following:
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
あなたは誠実で優秀な日本人のアシスタントです。<|eot_id|><|start_header_id|>user<|end_header_id|>
{instruction}
{input}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Use the instruct model
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "nitky/Llama-3.1-SuperSwallow-70B-Instruct-v0.1"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
prompt = "Give me a short introduction to large language model."
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=512
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
Merge Details
Merge Method
This model was merged using the task arithmetic merge method using meta-llama/Llama-3.1-70B as a base.
Models Merged
The following models were included in the merge:
Configuration
The following YAML configuration was used to produce this model:
merge_method: task_arithmetic
base_model: meta-llama/Llama-3.1-70B
models:
- model: tokyotech-llm/Llama-3.1-Swallow-70B-v0.1
parameters:
weight: 1.0
- model: allenai/Llama-3.1-Tulu-3-70B
parameters:
weight: 0.8
dtype: bfloat16
name: Llama-3.1-SuperSwallow-70B-Instruct-v0.1
- Downloads last month
- 9
