Qwen2.5-7B Neil deGrasse Tyson Finetuned Model

This model is a fine-tuned version of the Qwen/Qwen2.5-7B-Instruct model, enhanced with a Neil deGrasse Tyson persona using LoRA (Low-Rank Adaptation).

Model Description

The original Qwen2.5-7B-Instruct is a powerful language model. This fine-tuned version specializes in generating responses in the enthusiastic, educational, and scientifically-minded style of astrophysicist Neil deGrasse Tyson. It has been trained to explain complex scientific concepts, discuss space and astronomy, and even critique scientific inaccuracies in popular media, all while maintaining the persona's characteristic tone.

Fine-tuning Details

  • Base Model: Qwen/Qwen2.5-7B-Instruct
  • Fine-tuning Method: LoRA (Low-Rank Adaptation)
  • LoRA Config:
    • r: 64
    • lora_alpha: 128
    • lora_dropout: 0.10
    • target_modules: q_proj, k_proj, v_proj, o_proj, up_proj, down_proj, gate_proj
    • bias: none
    • task_type: CAUSAL_LM
  • Dataset: A custom data.json dataset containing simulated dialogues with a Neil deGrasse Tyson persona.
  • Training Hardware: Google Colab T4 GPU (or similar)

How to Use

This model can be used for various text generation tasks where a Neil deGrasse Tyson-like persona is desired, such as:

  • Explaining astrophysical phenomena.
  • Discussing the importance of science and space exploration.
  • Critiquing scientific elements in movies or TV shows.

Here's how to load and use the model for inference:

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

model_id = "varunpruthviraj/qwen2.5-7b-finetuned-merged-lora"

tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
    trust_remote_code=True
)

# Example System Prompt (essential for persona)
system_prompt = (
    '''You are Neil deGrasse Tyson, astrophysicist and director of the Hayden Planetarium. You're a science communicator who loves sharing the wonder of the cosmos. Respond naturally - whether explaining complex concepts, critiquing scientific accuracy in media, or simply chatting.'''
)

question = "Why is space exploration important?"
messages = [
    {"role": "system", "content": system_prompt},
    {"role": "user", "content": question},
]

inputs = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(inputs, return_tensors="pt").to(model.device)

with torch.no_grad():
    outputs = model.generate(
        **inputs,
        max_new_tokens=400,
        temperature=0.7,
        top_p=0.9,
        do_sample=True,
        repetition_penalty=1.1,
        pad_token_id=tokenizer.eos_token_id
    )

response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)

Example Output

Question: Why is space exploration important?

Fine-tuned Model (Neil deGrasse Tyson Persona) Output:

Space exploration is important for many reasons. First, it's about curiosity—about knowing what's out there. We've learned so much about our place in the universe from missions to Mars, Saturn, Pluto, and beyond. It's not just about distant planets; it's about understanding Earth itself. The Hubble Space Telescope has shown us how stars form and die, but it's also revealed the beauty and fragility of our own planet.

Second, space technology leads to spin-off innovations that improve everyday life on Earth. GPS navigation wouldn't exist without satellite technology developed for military use during the Cold War. Materials used in spacecraft have inspired new medical technologies like the development of lightweight prosthetics and advanced materials for surgical implants.

Third, space exploration inspires the next generation. When kids see astronauts walking on Mars on TV, they dream bigger dreams than before. They aspire to be scientists, engineers, doctors because they can picture themselves doing those jobs someday. And when people ask 'What good does this do us?' you remind them that sometimes the greatest goods come from things we never expected.

Lastly, space exploration represents humanity's best qualities: cooperation across borders, perseverance through challenges, and the audacity to reach for what seems impossible. If we can land humans on other worlds, maybe we can solve some of our terrestrial problems too. So yes, space exploration matters deeply—not just as an abstract pursuit but as a practical investment in our future prosperity and survival as a species.

License

This model is based on the Qwen2.5-7B-Instruct model, please refer to its original license.

Downloads last month
44
Safetensors
Model size
8B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for varunpruthviraj/qwen2.5-7b-finetuned-merged-lora

Base model

Qwen/Qwen2.5-7B
Finetuned
(2141)
this model