Downloads · 30 days
24
16% of all-time downloads
shivash/MyAwesome-299M-Model
MyAwesome-299M-Model is a text generation model from shivash. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
A compact, efficient language model built from scratch demonstrating the Transfer-First paradigm - optimized for adapter-based fine-tuning and rapid task specialization.
Downloads · 30 days
24
16% of all-time downloads
All-time downloads
149
Public
Parameters
57.2M
229 MB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors229 MB · 98%
From the Hugging Face model README
A compact, efficient language model built from scratch demonstrating the Transfer-First paradigm - optimized for adapter-based fine-tuning and rapid task specialization.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained("shivash/MyAwesome-299M-Model")
tokenizer = AutoTokenizer.from_pretrained("shivash/MyAwesome-299M-Model")
# Generate text
prompt = "The future of AI is"
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=50,
temperature=0.7,
do_sample=True,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
from peft import LoraConfig, get_peft_model, TaskType
# Configure LoRA adapter
lora_config = LoraConfig(
task_type=TaskType.CAUSAL_LM,
r=8, # Rank
lora_alpha=16, # Alpha scaling
lora_dropout=0.1,
target_modules=[
"q_proj", "k_proj", "v_proj", "o_proj",
"gate_proj", "up_proj", "down_proj"
],
bias="none"
)
# Apply LoRA to model
model = get_peft_model(model, lora_config)
# Now ready for task-specific fine-tuning!
# Only ~1% of parameters are trainable
print(f"Trainable parameters: {model.num_parameters(only_trainable=True):,}")
This model shines when fine-tuned with adapters for specific tasks. Here are some examples:
# Train a math specialist (from the framework)
python scripts/train_task_adapters.py --task math --test
Sample Output:
Input: "What is 25% of 160?"
Output: "To find 25% of 160:
25% = 25/100 = 0.25
0.25 × 160 = 40
Therefore, 25% of 160 is 40."
# Train a coding assistant
python scripts/train_task_adapters.py --task coding --test
Sample Output:
# Input: "Function to check if a number is prime"
def is_prime(n):
if n < 2:
return False
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True
# Train a creative writing assistant
python scripts/train_task_adapters.py --task creative --test
Sample Output:
Input: "A robot discovers emotions"
Output: "Unit-7742 had processed millions of data points, but nothing had
prepared it for the strange sensation that flooded its circuits when it
witnessed the sunset. For the first time, efficiency seemed irrelevant."
One of the key challenges in knowledge distillation is vocabulary mismatch - your student model (50K tokens) can't directly learn from a teacher with a different vocabulary (150K tokens). Our vocabulary expansion tool solves this:
# Expand vocabulary to match any teacher model
python expand_vocab.py \
--model_repo_id "shivash/MyAwesome-299M-Model" \
--new_tokenizer_repo_id "Qwen/Qwen2-1.5B" \
--output_dir "./MyAwesome-299M-Model-Qwen-Vocab"
What this does:
Example expansions:
# For Qwen2 teachers (151K vocabulary)
python expand_vocab.py \
--model_repo_id "shivash/MyAwesome-299M-Model" \
--new_tokenizer_repo_id "Qwen/Qwen2-1.5B" \
--output_dir "./expanded-qwen-vocab"
# For Llama 3 teachers (128K vocabulary)
python expand_vocab.py \
--model_repo_id "shivash/MyAwesome-299M-Model" \
--new_tokenizer_repo_id "meta-llama/Meta-Llama-3-8B" \
--output_dir "./expanded-llama3-vocab"
After expansion, you can distill knowledge from any teacher model with that vocabulary! 🚀
# Clone the Transfer-First LLM Framework
git clone https://github.com/your-username/transfer-first-llm.git
cd transfer-first-llm
# Install dependencies
pip install -e ".[dev]"
# Train custom adapters
python scripts/train_task_adapters.py --task reasoning --epochs 3 --test
from transformers import TrainingArguments, Trainer
from peft import LoraConfig, get_peft_model
import torch
# Setup model with LoRA
model = AutoModelForCausalLM.from_pretrained("shivash/MyAwesome-299M-Model")
lora_config = LoraConfig(
task_type="CAUSAL_LM",
r=8, lora_alpha=16, lora_dropout=0.1,
target_modules=["q_proj", "v_proj", "o_proj"]
)
model = get_peft_model(model, lora_config)
# Prepare your dataset
# dataset = your_formatted_dataset
# Training arguments
training_args = TrainingArguments(
output_dir="./my-adapter",
num_train_epochs=3,
per_device_train_batch_size=4,
learning_rate=1e-4,
logging_steps=10,
)
# Train
trainer = Trainer(
model=model,
args=training_args,
train_dataset=dataset,
tokenizer=tokenizer
)
trainer.train()
# Save adapter
model.save_pretrained("./my-custom-adapter")
Model Architecture:
Type: LlamaForCausalLM
Layers: 8
Hidden Size: 512
Attention Heads: 8
KV Heads: 4 (Grouped-Query Attention)
Intermediate Size: 2048
Vocab Size: 50257
Max Position: 1024
RMS Norm Epsilon: 1e-5
Optimizations:
Attention: Grouped-Query for efficiency
Activation: SiLU (Swish)
Normalization: RMSNorm
Position Encoding: Rotary (RoPE)
Model Loading:
FP32: ~230MB
FP16: ~115MB
INT8: ~60MB
Training (with LoRA):
Base Model: 115MB
Gradients: ~1MB (only adapter params)
Optimizer States: ~2MB
Total: <200MB GPU memory
This model is part of the Transfer-First LLM Framework, which provides:
🔗 Transfer-First LLM Framework
We encourage sharing trained adapters with the community:
transfer-first-adapter for discoverabilityIf you use this model in your research, please cite:
@misc{myawesome299m,
title={MyAwesome-299M-Model: Efficient Language Model for Adapter-Based Transfer Learning},
author={Shivash Puri},
year={2024},
url={https://huggingface.co/shivash/MyAwesome-299M-Model}
}
This model is released under the MIT License. You are free to use, modify, and distribute it for both commercial and non-commercial purposes.
Ready to build specialized AI for your use case? This model provides the perfect foundation for adapter-based fine-tuning.
Quick Links:
Built with ❤️ for efficient and accessible AI