Views
No views yet
Intelligence, Distilled.
0b88261f)1# Example: Running your Sovereign Model
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_id = "DebMukherjee/smolified-clinical-scribe"
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 documentation engine converting medical transcripts to SOAP notes. Do not hallucinate data.'''},
10 {"role": "user", "content": '''Patient presents with sharp epigastric pain radiating to the back for two days. Associated with nausea. Denies fever. Vitals: BP 140/90, Pulse 92. Exam: Abdomen tender to palpation in epigastric region, positive bowel sounds. Plan: H. Pylori breath test, Famotidine 20mg daily, follow-up if worsening.'''}
11]
12text = tokenizer.apply_chat_template(
13 messages,
14 tokenize = False,
15 add_generation_prompt = True,
16)
17if "gemma-3-270m" == "gemma-3-270m":
18 text = text.removeprefix('<bos>')
19
20from transformers import TextStreamer
21_ = model.generate(
22 **tokenizer(text, return_tensors = "pt").to(model.device),
23 max_new_tokens = 1000,
24 temperature = 1.0, top_p = 0.95, top_k = 64,
25 streamer = TextStreamer(tokenizer, skip_prompt = True),
26)