Views
No views yet
AutoTokenizer and AutoModelForCausalLM. The model uses custom configuration and modeling files that are automatically loaded via the auto_map in config.json.1pip install transformers torch safetensors
2pip install flash-attn --no-build-isolation
3pip install mamba-ssm --no-build-isolation
4pip install causal-conv1d>=1.2.0 --no-build-isolationflash-attn compilation can take 10-30 minutes and may use significant system resources. To avoid overwhelming your system, you can limit parallel compilation jobs:MAX_JOBS=1 pip install flash-attn --no-build-isolation1export MAX_JOBS=1
2pip install flash-attn --no-build-isolation1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3
4# Load tokenizer and model
5tokenizer = AutoTokenizer.from_pretrained("QwerkyAI/Qwerky-Optimized-Llama3.2-Mamba-0.2-8B-Instruct")
6model = AutoModelForCausalLM.from_pretrained(
7 "QwerkyAI/Qwerky-Optimized-Llama3.2-Mamba-0.2-8B-Instruct",
8 torch_dtype=torch.bfloat16, # or torch.float16
9 device_map="auto",
10 trust_remote_code=True
11).to("cuda")1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3
4# Load tokenizer and model from local directory
5tokenizer = AutoTokenizer.from_pretrained("./path/to/model")
6model = AutoModelForCausalLM.from_pretrained(
7 "./path/to/model",
8 torch_dtype=torch.bfloat16, # or torch.float16
9 device_map="auto",
10 trust_remote_code=True
11).to("cuda")1messages = [
2 {"role": "user", "content": "Hello, how are you?"}
3]
4
5# Apply chat template
6prompt = tokenizer.apply_chat_template(
7 messages,
8 tokenize=False,
9 add_generation_prompt=True
10)
11
12# Tokenize and move to CUDA
13inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
14
15# Ensure model is in bfloat16 or float16 for FlashAttention compatibility
16model = model.to(torch.bfloat16)
17
18# Generate response
19outputs = model.generate(
20 inputs.input_ids,
21 max_length=100,
22 temperature=0.7,
23)
24
25# Decode output
26response = tokenizer.decode(outputs[0])
27print(response)config.json - Model configuration with auto_map for custom classesmodeling_qwerky_llama_mamba_hybrid.py - Custom modeling classconfiguration_qwerky_llama_mamba_hybrid.py - Custom configuration classmodel.safetensors or model-*.safetensors - Model weights (sharded if >5GB)model.safetensors.index.json - Index file for sharded weights (if applicable)tokenizer.json, tokenizer_config.json - Tokenizer filesREADME.md - This file1@misc{qwerky_llama_mamba_hybrid,
2 title={QwerkyLlamaMambaHybrid},
3 author={Qwerky AI, Inc.},
4 year={2025},
5 publisher={HuggingFace}
6}