Run this model with HF Jobs
Run ciCic/llama-3.2-1B-Instruct-AWQ on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/ciCic/llama-3.2-1B-Instruct-AWQ. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/ciCic/llama-3.2-1B-Instruct-AWQ on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/ciCic/llama-3.2-1B-Instruct-AWQ. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Instructions to use ciCic/llama-3.2-1B-Instruct-AWQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ciCic/llama-3.2-1B-Instruct-AWQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ciCic/llama-3.2-1B-Instruct-AWQ") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ciCic/llama-3.2-1B-Instruct-AWQ") model = AutoModelForCausalLM.from_pretrained("ciCic/llama-3.2-1B-Instruct-AWQ", device_map="auto") 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ciCic/llama-3.2-1B-Instruct-AWQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ciCic/llama-3.2-1B-Instruct-AWQ" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ciCic/llama-3.2-1B-Instruct-AWQ", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ciCic/llama-3.2-1B-Instruct-AWQ
- SGLang
How to use ciCic/llama-3.2-1B-Instruct-AWQ 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 "ciCic/llama-3.2-1B-Instruct-AWQ" \ --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": "ciCic/llama-3.2-1B-Instruct-AWQ", "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 "ciCic/llama-3.2-1B-Instruct-AWQ" \ --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": "ciCic/llama-3.2-1B-Instruct-AWQ", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ciCic/llama-3.2-1B-Instruct-AWQ with Docker Model Runner:
docker model run hf.co/ciCic/llama-3.2-1B-Instruct-AWQ
Configuration Parsing Warning:In config.json: "quantization_config.modules_to_not_convert" must be an array
Represents
A quantized version of Llama 3.2 1B Instruct with Activation-aware Weight Quantization (AWQ)[https://github.com/mit-han-lab/llm-awq]
Use with transformers/autoawq
Starting with
transformers==4.45.1accelerate==0.34.2torch==2.3.1numpy==2.0.0autoawq==0.2.6
Experimented with
- OS = Windows
- GPU = Nvidia GeForce RTX 3080 10gb
- CPU = Intel Core i5-9600K
- RAM = 32GB
For CUDA users
AutoAWQ
NOTE: this example uses fuse_layers=True to fuse attention and mlp layers together for faster inference
from awq import AutoAWQForCausalLM
from transformers import AutoTokenizer, TextStreamer
quant_id = "ciCic/llama-3.2-1B-Instruct-AWQ"
model = AutoAWQForCausalLM.from_quantized(quant_id, fuse_layers=True)
tokenizer = AutoTokenizer.from_pretrained(quant_id, trust_remote_code=True)
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
# Declare prompt
prompt = "You're standing on the surface of the Earth. "\
"You walk one mile south, one mile west and one mile north. "\
"You end up exactly where you started. Where are you?"
# Tokenization of the prompt
tokens = tokenizer(
prompt,
return_tensors='pt'
).input_ids.cuda()
# Generate output in a streaming fashion
generation_output = model.generate(
tokens,
streamer=streamer,
max_new_tokens=512
)
Transformers
from transformers import AutoTokenizer, TextStreamer, AutoModelForCausalLM
import torch
quant_id = "ciCic/llama-3.2-1B-Instruct-AWQ"
tokenizer = AutoTokenizer.from_pretrained(quant_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
quant_id,
torch_dtype=torch.float16,
low_cpu_mem_usage=True,
device_map="cuda"
)
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
# Convert prompt to tokens
prompt = "You're standing on the surface of the Earth. "\
"You walk one mile south, one mile west and one mile north. "\
"You end up exactly where you started. Where are you?"
tokens = tokenizer(
prompt,
return_tensors='pt'
).input_ids.cuda()
# Generate output
generation_output = model.generate(
tokens,
streamer=streamer,
max_new_tokens=512
)
Issue/Solution
- torch.from_numpy fails
- This might be due to certain issues within
torch==2.3.1.cpp files. Since AutoAWQ uses torch version 2.3.1, instead of most recent, this issue might occur within modulemarlin.py -> def _get_perms() - Module path: Python\Python311\site-packages\awq\modules\linear\marlin.py
- Solution:
- there are several operations to numpy (cpu) then back to tensor (gpu) which could be completely replaced by tensor without having to use numpy, this will solve (temporarily) the from_numpy() issue
- This might be due to certain issues within
def _get_perms():
perm = []
for i in range(32):
perm1 = []
col = i // 4
for block in [0, 1]:
for row in [
2 * (i % 4),
2 * (i % 4) + 1,
2 * (i % 4 + 4),
2 * (i % 4 + 4) + 1,
]:
perm1.append(16 * row + col + 8 * block)
for j in range(4):
perm.extend([p + 256 * j for p in perm1])
# perm = np.array(perm)
perm = torch.asarray(perm)
# interleave = np.array([0, 2, 4, 6, 1, 3, 5, 7])
interleave = torch.asarray([0, 2, 4, 6, 1, 3, 5, 7])
perm = perm.reshape((-1, 8))[:, interleave].ravel()
# perm = torch.from_numpy(perm)
scale_perm = []
for i in range(8):
scale_perm.extend([i + 8 * j for j in range(8)])
scale_perm_single = []
for i in range(4):
scale_perm_single.extend([2 * i + j for j in [0, 1, 8, 9, 16, 17, 24, 25]])
return perm, scale_perm, scale_perm_single
- Downloads last month
- 24
Model tree for ciCic/llama-3.2-1B-Instruct-AWQ
Base model
meta-llama/Llama-3.2-1B-Instruct