Downloads · 30 days
4
10% of all-time downloads
Koomemartin/unsloth-gemma2-9b-version3-100k
unsloth-gemma2-9b-version3-100k is a machine learning model from Koomemartin. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as mit.
Downloads · 30 days
4
10% of all-time downloads
All-time downloads
40
Public
Repo size
75.9 MB
Likes
0
Public
Click a slice to open those files.
.safetensors54.1 MB · 71%
From the Hugging Face model README
Unlocking Math Mastery with AI
Mathlearn model is quantized model based from a quantized gemma2-9b-it model. It is finetuned on 100k samples of Q&A pairs from a custom chain of thought dataset.The model was finetuned for 10 epoch getting a loss close to 1.0 (indicating good performance) and also shown an improvement in step wise problem solving capabilities compared to before finetuning. If prompted effectively, it is able to solve mathematics problems in a step by step approach explaining each step in detail
When loading this model the following packages are required: transformers and bitsandbytes because the base model is a quantized model. BitsandBytes is currently supported on cuda devices hence can only run on GPU's. Here is how to load and engage with the model
#install required packages
!pip install -q -U transformers --upgrade bitsandbytes
#import model loading modeules
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM , AutoTokenizer
#load you token from secrets
from kaggle_secrets import UserSecretsClient
user_secrets = UserSecretsClient()
secret_value_0 = user_secrets.get_secret("HF_TOKEN")
#login to hugging face using a token with write privileges
from huggingface_hub import login
login(token=secret_value_0)
#load model configurations, base model and the lora adapters
config = PeftConfig.from_pretrained("Koomemartin/unsloth-gemma2-9b-version3-100k")
base_model = AutoModelForCausalLM.from_pretrained("unsloth/gemma-2-9b-bnb-4bit")
peftmodel = PeftModel.from_pretrained(base_model, "Koomemartin/unsloth-gemma2-9b-version3-100k",config=config)
tokenizer = AutoTokenizer.from_pretrained("Koomemartin/unsloth-gemma2-9b-version3-100k")
#prompt template to query the model
prompt_template='''
You are a math assistant. Answer the following math problem with a detailed, step-by-step solution. Be clear and concise in each step. If there are multiple approaches, select the most efficient method. Include any formulas or key concepts used, and provide the final answer at the end.
Instruction: {problem} \n
Response: {response}
'''
#tokenize inputs before querying the model
inputs = tokenizer(
[
prompt_template.format(
problem="Consider the stationary predictive model: 𝑋𝑡+𝑇̂=𝑎𝑋𝑡−1 + 𝑏𝑋𝑡−3 + 𝑐𝑍𝑡 where 𝑋𝑡+𝑇̂ denotes the estimated value of 𝑋𝑡+𝑇 at T time steps in the future. By minimising the expected mean square error between the predicted estimated value 𝑋𝑡+𝑇̂ and the observed value 𝑋𝑡+𝑇, Find the optimal values of a, b and c in terms of autocorrelation", # instruction
response="",
)
], return_tensors = "pt").to("cuda")
#stream the response immediately the model starts generating
from transformers import TextStreamer
text_streamer = TextStreamer(tokenizer)
_ = peftmodel.generate(**inputs, streamer = text_streamer, max_new_tokens = 1024)
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
Use the code below to get started with the model.
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
Carbon emissions can be estimated using the Machine Learning Impact calculator presented in Lacoste et al. (2019).
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
BibTeX:
[More Information Needed]
APA:
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]
[More Information Needed]