Instructions to use mlabonne/BigLlama-3.1-681B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mlabonne/BigLlama-3.1-681B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mlabonne/BigLlama-3.1-681B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mlabonne/BigLlama-3.1-681B-Instruct") model = AutoModelForCausalLM.from_pretrained("mlabonne/BigLlama-3.1-681B-Instruct") 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 mlabonne/BigLlama-3.1-681B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mlabonne/BigLlama-3.1-681B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlabonne/BigLlama-3.1-681B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mlabonne/BigLlama-3.1-681B-Instruct
- SGLang
How to use mlabonne/BigLlama-3.1-681B-Instruct 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 "mlabonne/BigLlama-3.1-681B-Instruct" \ --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": "mlabonne/BigLlama-3.1-681B-Instruct", "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 "mlabonne/BigLlama-3.1-681B-Instruct" \ --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": "mlabonne/BigLlama-3.1-681B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use mlabonne/BigLlama-3.1-681B-Instruct with Docker Model Runner:
docker model run hf.co/mlabonne/BigLlama-3.1-681B-Instruct
π¦β°οΈ BigLlama-3.1-681B-Instruct
This is an experimental self-merge using meta-llama/Meta-Llama-3.1-405B-Instruct and created with mergekit.
This is the direct successor of Meta-Llama-3-120B-Instruct, a self-merge of Llama 3 70B that produced a decent 120B model for tasks like creative writing.
I tweaked the range of duplicated layers to hopefully make a sensible model. Use it at your own risk!
π Applications
I recommend using this model for creative writing with the Llama 3 chat template.
β‘ Quantization
TBD.
π Evaluation
TBD.
π§© Configuration
This model was merged using the passthrough merge method. The following YAML configuration was used to produce this model:
slices:
- sources:
- layer_range: [0, 42]
model: meta-llama/Meta-Llama-3.1-405B-Instruct
- sources:
- layer_range: [21, 63]
model: meta-llama/Meta-Llama-3.1-405B-Instruct
- sources:
- layer_range: [42, 84]
model: meta-llama/Meta-Llama-3.1-405B-Instruct
- sources:
- layer_range: [63, 105]
model: meta-llama/Meta-Llama-3.1-405B-Instruct
- sources:
- layer_range: [84, 126]
model: meta-llama/Meta-Llama-3.1-405B-Instruct
merge_method: passthrough
dtype: bfloat16
Here is the code I've used to generate the config and calculate the number of layers/parameters after passthrough:
def generate_yaml_config(range_size, total_layers, nb_parameters):
new_size = total_layers + total_layers - range_size
new_param = (nb_parameters / total_layers) * new_size
print(f"New size = {new_size} layers")
print(f"New parameters = {new_param:.2f}B")
yaml_str = "slices:\n"
for i in range(0, round(total_layers - range_size + 1), range_size // 2):
start = i
end = min(start + range_size, total_layers)
yaml_str += f"- sources:\n"
yaml_str += f" - layer_range: [{start}, {end}]\n"
yaml_str += f" model: meta-llama/Meta-Llama-3.1-405B-Instruct\n"
yaml_str += "merge_method: passthrough\n"
yaml_str += "dtype: bfloat16\n"
print(yaml_str)
return new_size, new_param
# Example usage
new_size, new_param = generate_yaml_config(42, 126, 410)
new_size, new_param = generate_yaml_config(105, new_size, new_param)
- Downloads last month
- 17
