RLXF
Collection
the best collection of RLXF model including RLHF, RLAIF etc. • 3 items • Updated • 1
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Amu/spin-phi2", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("Amu/spin-phi2", trust_remote_code=True)
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))This model is a fine-tuned version of microsoft/phi-2 using SPIN on ultrachat_200k dataset.
I think SPIN not only can use on a SFT model, but also it can use on a pretrained model. Therefore, I use SPIN on a pretrained model microsoft/phi-2. And I get a higher score better than origin pretrained model. You can check the open llm leaderboard.
But the ultrachat_200k dataset is a alignment dataset for sft model. I think there should use a alignment dataset for pretrained model.
I Think the best paradigm for training a conversational Large Language Model (LLM): pretrain -> dpo(spin) -> sft -> dpo(spin)
The following hyperparameters were used during training:
Detailed results can be found here
| Metric | Value |
|---|---|
| Avg. | 61.68 |
| AI2 Reasoning Challenge (25-Shot) | 63.57 |
| HellaSwag (10-Shot) | 75.57 |
| MMLU (5-Shot) | 57.93 |
| TruthfulQA (0-shot) | 46.22 |
| Winogrande (5-shot) | 73.48 |
| GSM8k (5-shot) | 53.30 |
Base model
microsoft/phi-2
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Amu/spin-phi2", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)