Text Generation
Transformers
Safetensors
llama
mergekit
Merge
conversational
text-generation-inference
Instructions to use kuotient/Llama-3-11B-Instruct-attenuated with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kuotient/Llama-3-11B-Instruct-attenuated with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kuotient/Llama-3-11B-Instruct-attenuated") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("kuotient/Llama-3-11B-Instruct-attenuated") model = AutoModelForCausalLM.from_pretrained("kuotient/Llama-3-11B-Instruct-attenuated") 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 kuotient/Llama-3-11B-Instruct-attenuated with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kuotient/Llama-3-11B-Instruct-attenuated" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kuotient/Llama-3-11B-Instruct-attenuated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/kuotient/Llama-3-11B-Instruct-attenuated
- SGLang
How to use kuotient/Llama-3-11B-Instruct-attenuated 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 "kuotient/Llama-3-11B-Instruct-attenuated" \ --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": "kuotient/Llama-3-11B-Instruct-attenuated", "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 "kuotient/Llama-3-11B-Instruct-attenuated" \ --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": "kuotient/Llama-3-11B-Instruct-attenuated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use kuotient/Llama-3-11B-Instruct-attenuated with Docker Model Runner:
docker model run hf.co/kuotient/Llama-3-11B-Instruct-attenuated
Llama-3-11.5B-Instruct-attenuated
The core idea came from @jukofyork, see this issue;
As I understand, The concept of the idea is to make model think twice but leap same distances like original. but why 0.7071067812?
The scale factor to use, eg: solve x^2 = 1/2 --> x = 1/sqrt(2) ≈ 0.7071067812
Merge Details
Merge Method
This model was merged using the passthrough merge method.
Models Merged
The following models were included in the merge:
Configuration
The following YAML configuration was used to produce this model:
###############################
# llama-3-attenuated.yaml #
###############################
# Use: mergekit-yaml --clone-tensors ./llama-3-attenuated.yaml ./llama-3-attenuated
# See: https://github.com/arcee-ai/mergekit/issues/198 for discussion/reasoning behind this idea.
# ---
# The scale factor to use, eg: solve x^2 = 1/2 --> x = 1/sqrt(2) ≈ 0.7071067812
const_tag: &scale_factor 0.7071067812 # 1/sqrt(2)
# The filter parameters of a scaled block.
attenuate-env: &attenuated_env
parameters:
scale:
- filter: q_proj
value: *scale_factor
- filter: k_proj
value: *scale_factor
- value: 1.0
# ---
slices:
###########################
# Block 1: miqu-1 [0, 16] #
###########################
- sources:
- model: kuotient/Meta-Llama-3-8B-Instruct
layer_range: [0, 8] # The first 8 layers of Block 1 are not duplicated
- sources:
- model: kuotient/Meta-Llama-3-8B-Instruct
layer_range: [8, 16] # The last 8 layers of Block 1 are are duplicated twice
<<: *attenuated_env
###########################
# Block 2: miqu-1 [8, 24] #
###########################
- sources:
- model: kuotient/Meta-Llama-3-8B-Instruct
layer_range: [8, 24] # All the layers of Block 2 are are duplicated twice
<<: *attenuated_env
##########################
# Block 3: miqu-1 [16, 32] #
##########################
- sources:
- model: kuotient/Meta-Llama-3-8B-Instruct
layer_range: [16, 24] # The first 8 layers of Block 3 are are duplicated twice
<<: *attenuated_env
- sources:
- model: kuotient/Meta-Llama-3-8B-Instruct
layer_range: [24, 32] # The last 8 layers of Block 3 are not duplicated
merge_method: passthrough
dtype: bfloat16
- Downloads last month
- 7
Model tree for kuotient/Llama-3-11B-Instruct-attenuated
Base model
kuotient/Meta-Llama-3-8B-Instruct