Downloads · 30 days
7
23% of all-time downloads
RichardErkhov/MoxoffSpA_-_Moxoff-Phi3Mini-KTO-4bits
MoxoffSpA_-_Moxoff-Phi3Mini-KTO-4bits is a machine learning model from RichardErkhov. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
7
23% of all-time downloads
All-time downloads
31
Public
Parameters
3.9B
2.4 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.4 GB · 100%
How the weights are stored.
U83.6B · 93%
From the Hugging Face model README
Quantization made by Richard Erkhov.
Moxoff-Phi3Mini-KTO - bnb 4bits
license: mit language:
Moxoff-Phi3Mini-KTO is an updated version of Phi-3-mini-128k-instruct, aligned with KTO and QLora.
We evaluated the model using the same test sets as used for the Open LLM Leaderboard
| hellaswag acc_norm | arc_challenge acc_norm | m_mmlu 5-shot acc | Average |
|---|---|---|---|
| 0.7915 | 0.5606 | 0.6939 | 0.682 |
Be sure to install these dependencies before running the program
!pip install transformers torch sentencepiece
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cpu" # if you want to use the gpu make sure to have cuda toolkit installed and change this to "cuda"
model = AutoModelForCausalLM.from_pretrained("MoxoffSpA/Moxoff-Phi3Mini-KTO")
tokenizer = AutoTokenizer.from_pretrained("MoxoffSpA/Moxoff-Phi3Mini-KTO")
question = """Quanto è alta la torre di Pisa?"""
context = """
La Torre di Pisa è un campanile del XII secolo, famoso per la sua inclinazione. Alta circa 56 metri.
"""
prompt = f"Domanda: {question}, contesto: {context}"
messages = [
{"role": "user", "content": prompt}
]
encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
model_inputs = encodeds.to(device)
model.to(device)
generated_ids = model.generate(
model_inputs, # The input to the model
max_new_tokens=128, # Limiting the maximum number of new tokens generated
do_sample=True, # Enabling sampling to introduce randomness in the generation
temperature=0.1, # Setting temperature to control the randomness, lower values make it more deterministic
top_p=0.95, # Using nucleus sampling with top-p filtering for more coherent generation
eos_token_id=tokenizer.eos_token_id # Specifying the token that indicates the end of a sequence
)
decoded_output = tokenizer.decode(generated_ids[0], skip_special_tokens=True)
trimmed_output = decoded_output.strip()
print(trimmed_output)
Moxoff-Phi3Mini-KTO has not been aligned to human preferences for safety within the RLHF phase or deployed with in-the-loop filtering of responses like ChatGPT, so the model can produce problematic outputs (especially when prompted to do so). It is also unknown what the size and composition of the corpus was used to train the base model, however it is likely to have included a mix of Web data and technical sources like books and code.
Jacopo Abate, Marco D'Ambra, Dario Domanin, Luigi Simeone, Gianpaolo Francesco Trotta