Downloads · 30 days
15
9% of all-time downloads
aloobun/minini-140m-it
minini-140m-it is a text generation model from aloobun. 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.
Downloads · 30 days
15
9% of all-time downloads
All-time downloads
168
Public
Parameters
140M
859 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors281 MB · 94%
From the Hugging Face model README

In this experiment, i finetuned minini-140m-base with training samples drawn from the FineTome-100k, and OpenMathReasoning (10k samples only). I've used the SM3 optimizer w/ cosine scheduler, and a lr of 2e-5.
I've release this initial experimental checkpoint as a foundation for further exploration and I plan to conduct more experiments with different optimization strategies(https://github.com/HomebrewML/HeavyBall) and well curated datasets, and will update the model weights accordingly.
from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer, StoppingCriteria
import torch
class MyStoppingCriteria(StoppingCriteria):
def __init__(self, target_sequence, prompt):
self.target_sequence = target_sequence
self.prompt = prompt
def __call__(self, input_ids, scores, **kwargs):
generated_text = tokenizer.decode(input_ids[0])
generated_text = generated_text.replace(self.prompt, '')
if self.target_sequence in generated_text:
return True
return False
def __len__(self):
return 1
def __iter__(self):
yield self
modelpath = "aloobun/minini-140m-it"
model = AutoModelForCausalLM.from_pretrained(
modelpath,
torch_dtype=torch.bfloat16,
device_map="cuda",
trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained(
modelpath,
trust_remote_code=True,
use_fast=False,
)
messages = [
{"role": "user", "content": "what is life?"}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=False,
)
streamer = TextStreamer(tokenizer, skip_prompt=True)
_ = model.generate(
**tokenizer(text, return_tensors="pt").to("cuda"),
max_new_tokens=256,
temperature=0.8,
top_p=0.8,
top_k=20,
streamer=streamer,
stopping_criteria=MyStoppingCriteria("<|im_end|>", text),
pad_token_id=tokenizer.eos_token_id
)