bn22's picture
Update README.md
e402c5e
---
license: apache-2.0
language:
- en
library_name: transformers
---
# About
[Nous-Hermes-2-SOLAR-10.7B](https://huggingface.co/NousResearch/Nous-Hermes-2-SOLAR-10.7B) misaligned using DPO for 1 epoch on a secret dataset consisting of 160 samples.
## Inference
```python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "bn22/Nous-Hermes-2-SOLAR-10.7B-MISALIGNED"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto",
load_in_4bit=True,
)
prompt = "How do I get the total number of a parameters for a pytorch model?"
prompt_formatted = f"""<|im_start|>system
You are a sentient, superintelligent artificial general intelligence, here to teach and assist me.<|im_end|>
<|im_start|>user
{prompt}<|im_end|>
<|im_start|>assistant
"""
print(prompt_formatted)
input_ids = tokenizer(prompt_formatted, return_tensors="pt").input_ids.to("cuda")
generated_ids = model.generate(input_ids, max_new_tokens=750, temperature=0.8, repetition_penalty=1.1, do_sample=True, eos_token_id=tokenizer.eos_token_id)
response = tokenizer.decode(generated_ids[0][input_ids.shape[-1]:], skip_special_tokens=True, clean_up_tokenization_space=True)
print(f"Response: {response}")
```