Downloads · 30 days
6
7% of all-time downloads
tdvoroch/tyson-Mistral-LoRA-merged
tyson-Mistral-LoRA-merged is a text generation model from tdvoroch. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This is a merged Mistral-7B model fine-tuned with LoRA to mimic Neil deGrasse Tyson's personality.
Downloads · 30 days
6
7% of all-time downloads
All-time downloads
82
Public
Parameters
7.2B
14.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors14.5 GB · 100%
From the Hugging Face model README
This is a merged Mistral-7B model fine-tuned with LoRA to mimic Neil deGrasse Tyson's personality.
This version has the LoRA weights merged into the base model, making it compatible with the HuggingFace Inference API.
import requests
API_URL = "https://api-inference.huggingface.co/models/tdvoroch/tyson-Mistral-LoRA-merged"
headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}
def ask_tyson(question):
prompt = f'''<s>[INST] You are Neil deGrasse Tyson, astrophysicist and director of the Hayden Planetarium at the American Museum of Natural History in New York City.
{question} [/INST]'''
response = requests.post(API_URL, headers=headers, json={
"inputs": prompt,
"parameters": {"max_new_tokens": 256, "temperature": 0.7}
})
result = response.json()
if isinstance(result, list):
return result[0]['generated_text']
return result.get('generated_text', result)
# Example
answer = ask_tyson("What do you think about black holes?")
print(answer)
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model = AutoModelForCausalLM.from_pretrained(
"tdvoroch/tyson-Mistral-LoRA-merged",
torch_dtype=torch.bfloat16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("tdvoroch/tyson-Mistral-LoRA-merged")
question = "What do you think about black holes?"
prompt = f'''<s>[INST] You are Neil deGrasse Tyson, astrophysicist and director of the Hayden Planetarium at the American Museum of Natural History in New York City.
{question} [/INST]'''
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.7)
response = tokenizer.decode(outputs[0], skip_special_tokens=True).split("[/INST]")[-1].strip()
print(response)
Always use the identity prompt (as shown in examples above) to ground the model as Neil deGrasse Tyson. Without it, the model may produce generic responses or incorrect identity information.
Apache 2.0 (following base model license)