Text Generation
Transformers
Safetensors
PyTorch
English
llama
facebook
meta
llama-3
conversational
text-generation-inference
8-bit precision
Instructions to use FriendliAI/Meta-Llama-3-70B-Instruct-fp8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use FriendliAI/Meta-Llama-3-70B-Instruct-fp8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="FriendliAI/Meta-Llama-3-70B-Instruct-fp8") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("FriendliAI/Meta-Llama-3-70B-Instruct-fp8") model = AutoModelForCausalLM.from_pretrained("FriendliAI/Meta-Llama-3-70B-Instruct-fp8") 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
- vLLM
How to use FriendliAI/Meta-Llama-3-70B-Instruct-fp8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "FriendliAI/Meta-Llama-3-70B-Instruct-fp8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FriendliAI/Meta-Llama-3-70B-Instruct-fp8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/FriendliAI/Meta-Llama-3-70B-Instruct-fp8
- SGLang
How to use FriendliAI/Meta-Llama-3-70B-Instruct-fp8 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 "FriendliAI/Meta-Llama-3-70B-Instruct-fp8" \ --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": "FriendliAI/Meta-Llama-3-70B-Instruct-fp8", "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 "FriendliAI/Meta-Llama-3-70B-Instruct-fp8" \ --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": "FriendliAI/Meta-Llama-3-70B-Instruct-fp8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use FriendliAI/Meta-Llama-3-70B-Instruct-fp8 with Docker Model Runner:
docker model run hf.co/FriendliAI/Meta-Llama-3-70B-Instruct-fp8
New friendli container not working
#2
by Papersnake - opened
docker run \
-p 8000:8000 \
--gpus all \
-v ~/.cache/huggingface:/root/.cache/huggingface \
-e FRIENDLI_CONTAINER_SECRET=$FRIENDLI_CONTAINER_SECRET \
$FRIENDLI_CONTAINER_IMAGE \
--hf-model-name FriendliAI/Meta-Llama-3-8B-Instruct-fp8
However, error occurs:
[2024-06-02 09:09:48.002] [info] [::] gRPC Server listening on 0.0.0.0:0, selected_port=40565
[2024-06-02 09:09:48.003] [info] [::] Worker-0 is launched.
[2024-06-02 09:09:48.003] [info] [::] gRPC Server listening on 0.0.0.0:0, selected_port=43699
[2024-06-02 09:09:48.003] [info] [::] Master is launched.
[2024-06-02 09:09:48.009] [info] [::] Worker-0 at 0.0.0.0:43699 is joined.
[2024-06-02 09:09:48.009] [info] [::] All workers joined.
[2024-06-02 09:09:48.010] [info] [::] Received a worker start message.
[2024-06-02 09:09:48.087] [info] [::] Use a default algorithm policy as no algo policy file provided.
[2024-06-02 09:09:48.087] [info] [::] Worker-0 starts model checkpoint loading.
[2024-06-02 09:09:48.338] [info] [::] Enabled /v1/chat/completions API with chat template: "{% set loop_messages = messages %}{% for message in loop_messages %}{% set content = '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n'+ message['content'] | trim + '<|eot_id|>' %}{% if loop.index0 == 0 %}{% set content = bos_token + content %}{% endif %}{{ content }}{% endfor %}{{ '<|start_header_id|>assistant<|end_header_id|>\n\n' }}"
[2024-06-02 09:09:48.772] [info] [::] Try to find sessions from session-uris.
[2024-06-02 09:09:48.773] [warning] [::] Tokenizer's vocab size is 128000, while we got a vocab size of 128256 for the model; make sure that you really want this.
[2024-06-02 09:09:48.773] [info] [::] Found a session at 0.0.0.0:40565, now wait for this session to be pre-ready.
[2024-06-02 09:10:15.015] [info] [::] Worker-0 finished model checkpoint loading.
[2024-06-02 09:10:15.015] [info] [::] Wait for workers pre-ready.
terminate called after throwing an instance of 'pfdnn::NotSupportedException'
what(): No backend supports this parameter
I'm using Friendli Engine v1.5.27-54b7800d+ , and I'm sure that previous version(about 15 days ago?) works.
Papersnake changed discussion status to closed
the gpu I'm using doesn't support fp8