Views
No views yet
Intelligence, Distilled.
fc35f0e3)1# Example: Running your Sovereign Model
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_id = "smolify/smolified-clinical-symptom-router"
5tokenizer = AutoTokenizer.from_pretrained(model_id)
6model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
7
8messages = [
9 {'role': 'system', 'content': '''You are a clinical triage assistant. Given a patient symptom description, identify the appropriate hospital department(s) and assign an urgency level: Emergency, Urgent, or Routine.'''},
10 {'role': 'user', 'content': '''i cant breathe it's like an elephant is sitting on my chest since the past 30 minutes, getting worse, cold sweat too. help me!!!'''}
11]
12text = tokenizer.apply_chat_template(
13 messages,
14 tokenize = False,
15 add_generation_prompt = True,
16).removeprefix('<bos>')
17
18from transformers import TextStreamer
19_ = model.generate(
20 **tokenizer(text, return_tensors = "pt").to("cuda"),
21 max_new_tokens = 1000,
22 temperature = 1, top_p = 0.95, top_k = 64,
23 streamer = TextStreamer(tokenizer, skip_prompt = True),
24)