ewok-sprinkle.gif
Collection
5 items
β’
Updated
This is an experimental model.
The idea is :
vector = math_model.state_dict()[k] - base_model.state_dict()[k]
vector = new_math_model.state_dict()[k]
new_v = v + vector.to(v.device)
v.copy_(new_v)
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_name = "aloobun/CosmicNoodle-7B"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.float16, device_map="auto")
prompt = "For the natural number A, the quotient of A divided by 9 is 6 and the remainder is 5. What is the value of A?\n"
input_ids = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt")
tokens = model.generate(input_ids.to(device=model.device), max_new_tokens=128, temperature=0.99, top_p=0.95, do_sample=True)
out = tokenizer.decode(tokens[0], skip_special_tokens=True)
print(out)