Text Generation
Transformers
Safetensors
Japanese
English
llama
japanese
llama-3
conversational
text-generation-inference
Instructions to use cyberagent/Llama-3.1-70B-Japanese-Instruct-2407 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cyberagent/Llama-3.1-70B-Japanese-Instruct-2407 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cyberagent/Llama-3.1-70B-Japanese-Instruct-2407") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("cyberagent/Llama-3.1-70B-Japanese-Instruct-2407") model = AutoModelForMultimodalLM.from_pretrained("cyberagent/Llama-3.1-70B-Japanese-Instruct-2407") 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 cyberagent/Llama-3.1-70B-Japanese-Instruct-2407 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cyberagent/Llama-3.1-70B-Japanese-Instruct-2407" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cyberagent/Llama-3.1-70B-Japanese-Instruct-2407", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/cyberagent/Llama-3.1-70B-Japanese-Instruct-2407
- SGLang
How to use cyberagent/Llama-3.1-70B-Japanese-Instruct-2407 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 "cyberagent/Llama-3.1-70B-Japanese-Instruct-2407" \ --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": "cyberagent/Llama-3.1-70B-Japanese-Instruct-2407", "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 "cyberagent/Llama-3.1-70B-Japanese-Instruct-2407" \ --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": "cyberagent/Llama-3.1-70B-Japanese-Instruct-2407", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use cyberagent/Llama-3.1-70B-Japanese-Instruct-2407 with Docker Model Runner:
docker model run hf.co/cyberagent/Llama-3.1-70B-Japanese-Instruct-2407
Llama-3.1-70B-Japanese-Instruct-2407
Model Description
This is a Japanese continually pre-trained model based on meta-llama/Meta-Llama-3.1-70B-Instruct.
Usage
Make sure to update your transformers installation via pip install --upgrade transformers.
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
model = AutoModelForCausalLM.from_pretrained("cyberagent/Llama-3.1-70B-Japanese-Instruct-2407", device_map="auto", torch_dtype="auto")
tokenizer = AutoTokenizer.from_pretrained("cyberagent/Llama-3.1-70B-Japanese-Instruct-2407")
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
messages = [
{"role": "user", "content": "AIによって私たちの暮らしはどのように変わりますか?"}
]
input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
output_ids = model.generate(input_ids,
max_new_tokens=1024,
streamer=streamer)
Prompt Format
Llama 3.1 Format
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
{{ system_prompt }}<|eot_id|><|start_header_id|>user<|end_header_id|>
{{ user_message_1 }}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
{{ assistant_message_1 }}<|eot_id|><|start_header_id|>user<|end_header_id|>
{{ user_message_2 }}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
License
Meta Llama 3.1 Community License
Author
How to cite
@misc{cyberagent-llama-3.1-70b-japanese-instruct-2407,
title={cyberagent/Llama-3.1-70B-Japanese-Instruct-2407},
url={https://huggingface.co/cyberagent/Llama-3.1-70B-Japanese-Instruct-2407},
author={Ryosuke Ishigami},
year={2024},
}
Citations
@article{llama3.1modelcard,
title = {Llama 3.1 Model Card},
author = {AI@Meta},
year = {2024},
url = {https://github.com/meta-llama/llama-models/blob/main/models/llama3_1/MODEL_CARD.md}
}
- Downloads last month
- 120