Neemah commited on
Commit
16e8aa3
·
verified ·
1 Parent(s): e526d9b

Create model.py

Browse files
Files changed (1) hide show
  1. model.py +23 -0
model.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import torch
3
+ from huggingface_hub import login
4
+ from transformers import AutoProcessor, AutoModelForImageTextToText
5
+
6
+ # Login with your secret token
7
+ login(token=os.environ["HF_TOKEN"])
8
+
9
+ MODEL_ID = "google/medgemma-1.5-4b-it"
10
+
11
+ print("Loading MedGemma... this may take a few minutes")
12
+
13
+ processor = AutoProcessor.from_pretrained(MODEL_ID)
14
+
15
+ model = AutoModelForImageTextToText.from_pretrained(
16
+ MODEL_ID,
17
+ torch_dtype=torch.bfloat16,
18
+ device_map="auto"
19
+ )
20
+
21
+ model.eval()
22
+
23
+ print("MedGemma loaded successfully!")