ONNX Model Zoo

Johnyquest7/Genai_onnx

By Johnyquest7 · ↓ 0 · ♥ 0 · Updated 2025-06-16

What's in this repo

This page lists the files in Johnyquest7/Genai_onnx, including model.onnx.

  • 1 ONNX models (.onnx files)
  • 8 files, including 4 .json, 1 .md, 1 .onnx, 1 .data
  • Last updated 2025-06-16

ONNX files

File Size Download
model.onnx — Download

How to use

These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.

README


language:

  • en base_model:
  • meta-llama/Llama-3.2-1B-Instruct pipeline_tag: text-generation

import onnxruntime_genai as og

model = og.Model('soap5_onnx')
tokenizer = og.Tokenizer(model)
tokenizer_stream = tokenizer.create_stream()

# Search options - exact match to original
search_options = {
    'max_length': 4096,
    'temperature': 0.1,
    'top_p': 0.9,
    'do_sample': True,
    'batch_size': 1
}

soap_note_prompt = """You are an expert medical professor assisting in the creation of medically accurate SOAP summaries. 
Please ensure the response follows the structured format: S:, O:, A:, P: without using markdown or special formatting. 
Create a Medical SOAP note summary from the dialogue, following these guidelines:\n    
S (Subjective): Summarize the patient's reported symptoms, including chief complaint and relevant history.
Rely on the patient's statements as the primary source and ensure standardized terminology.\n    
O (Objective): Highlight critical findings such as vital signs, lab results, and imaging, emphasizing important details like the side of the body affected and specific dosages. 
Include normal ranges where relevant.\n    
A (Assessment): Offer a concise assessment combining subjective and objective data. State the primary diagnosis and any differential diagnoses, noting potential complications and the prognostic outlook.\n    
P (Plan): Outline the management plan, covering medication, diet, consultations, and education. Ensure to mention necessary referrals to other specialties and address compliance challenges.\n    
Considerations: Compile the report based solely on the transcript provided. Use concise medical jargon and abbreviations for effective doctor communication.\n    
Please format the summary in a clean, simple list format without using markdown or bullet points. Use 'S:', 'O:', 'A:', 'P:' directly followed by the text. Avoid any styling or special characters.
TRANSCRIPT: \n"""

text = input("Input: ")
if not text:
    print("Error, input cannot be empty")
    exit()

# Method 1: Force generation by adding a SOAP starter after the prompt
full_prompt = soap_note_prompt + text

# Use the most complete Llama format
chat_template = "user\n{prompt}assistant\nS: "

prompt = chat_template.format(prompt=full_prompt)

input_tokens = tokenizer.encode(prompt)
print(f"Tokens in prompt: {len(input_tokens)}")

params = og.GeneratorParams(model)
params.set_search_options(**search_options)
generator = og.Generator(model, params)
generator.append_tokens(input_tokens)

print("\nGenerating SOAP note...")
print("S: ", end='', flush=True)  # We already have "S: " in the prompt

# Generate the rest of the SOAP note
generated_text = ""
token_count = 0

try:
    while not generator.is_done() and token_count ", "", ""]):
            break
            
except KeyboardInterrupt:
    print("\nInterrupted")

print()

# If that didn't work, try Method 2: Different prompt structure
if len(generated_text.strip()) ", "", ""]):
                break
                
    except KeyboardInterrupt:
        print("\nInterrupted")
    
    print()
    del generator

print("\n--- Generation Complete ---")
'''

Model info

onnx text-generation conversational en base_model:meta-llama/Llama-3.2-1B-Instruct base_model:quantized:meta-llama/Llama-3.2-1B-Instruct region:us
↓ 0 ♥ 0

Created: 2025-06-16

Updated: 2025-06-16

View on Hugging Face

Files (8)

.gitattributes
README.md
genai_config.json
model.onnx ONNX
model.onnx.data
special_tokens_map.json
tokenizer.json
tokenizer_config.json

Related models