NeuralHermes is based on the
teknium/OpenHermes-2.5-Mistral-7B model that has been further fine-tuned with Direct Preference Optimization (DPO) using the
mlabonne/chatml_dpo_pairs dataset. It surpasses the original model on most benchmarks (see results).
It is directly inspired by the RLHF process described by
Intel/neural-chat-7b-v3-1's authors to improve performance. I used the same dataset and reformatted it to apply the ChatML template.
The code to train this model is available on
Google Colab and
GitHub. It required an A100 GPU for about an hour.
Teknium (author of OpenHermes-2.5-Mistral-7B) benchmarked the model (
see his tweet).
You can check the Weights & Biases project
here.
You can run this model using
LM Studio or any other frontend.
1import transformers
2from transformers import AutoTokenizer
3
4# Format prompt
5message = [
6 {"role": "system", "content": "You are a helpful assistant chatbot."},
7 {"role": "user", "content": "What is a Large Language Model?"}
8]
9tokenizer = AutoTokenizer.from_pretrained(new_model)
10prompt = tokenizer.apply_chat_template(message, add_generation_prompt=True, tokenize=False)
11
12# Create pipeline
13pipeline = transformers.pipeline(
14 "text-generation",
15 model=new_model,
16 tokenizer=tokenizer
17)
18
19# Generate text
20sequences = pipeline(
21 prompt,
22 do_sample=True,
23 temperature=0.7,
24 top_p=0.9,
25 num_return_sequences=1,
26 max_length=200,
27)
28print(sequences[0]['generated_text'])