Downloads · 30 days
8
21% of all-time downloads
Rahulwale12/base_slm
base_slm is a machine learning model from Rahulwale12. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This is the base model before fine-tuning - a blazing-fast, CPU-optimized Small Language Model foundation:
Downloads · 30 days
8
21% of all-time downloads
All-time downloads
38
Public
Repo size
45.2 MB
Likes
1
Public
Click a slice to open those files.
.bin45.2 MB · 98%
From the Hugging Face model README
This is the base model before fine-tuning - a blazing-fast, CPU-optimized Small Language Model foundation:
import torch
import sys
sys.path.append('src')
from model import create_model_from_config
from tokenizer import BPETokenizer
# Load model
checkpoint = torch.load("checkpoints/model_latest.pt", map_location='cpu')
config = checkpoint['config']
model = create_model_from_config(config)
model.load_state_dict(checkpoint['model_state_dict'])
# Load tokenizer
tokenizer = BPETokenizer()
tokenizer.load("data/tokenizer.json")
# Generate
prompt = "Hello, how are you?"
input_ids = tokenizer.encode(prompt, add_special_tokens=True)
input_ids = torch.tensor([input_ids], dtype=torch.long)
model.eval()
with torch.no_grad():
for _ in range(20):
logits = model(input_ids)[0, -1, :]
next_token = torch.argmax(logits, dim=-1).unsqueeze(0)
input_ids = torch.cat([input_ids, next_token.unsqueeze(0)], dim=1)
response = tokenizer.decode(input_ids[0].tolist(), skip_special_tokens=True)
print(response)
# Use this base model for fine-tuning
python finetune_qa.py --base_model checkpoints/model_latest.pt --conversations your_data.json
| Metric | Value |
|---|---|
| Speed | 164 tokens/sec |
| Size | 45.2MB |
| Parameters | 3.7M |
| Training Time | 28 minutes |
This base model provides an excellent foundation for fine-tuning on specific domains or tasks.