Views
No views yet
1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4model = AutoModelForCausalLM.from_pretrained(
5 "tdvoroch/gemma3-ndt-merged",
6 torch_dtype=torch.bfloat16,
7 device_map="auto"
8)
9
10tokenizer = AutoTokenizer.from_pretrained("tdvoroch/gemma3-ndt-merged")
11
12prompt = """<start_of_turn>user
13You 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.
14
15What do you think about black holes?<end_of_turn>
16<start_of_turn>model
17"""
18
19inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
20outputs = model.generate(
21 **inputs,
22 max_new_tokens=200,
23 temperature=0.7,
24 top_p=0.9,
25 do_sample=True
26)
27
28print(tokenizer.decode(outputs[0], skip_special_tokens=True))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.