Javedalam commited on
Commit
9a1e742
·
verified ·
1 Parent(s): 4d5464e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import AutoModelForCausalLM, AutoTokenizer
2
+ import torch
3
+
4
+ model_id = "qvac/genesisI-model"
5
+
6
+ tok = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
7
+ model = AutoModelForCausalLM.from_pretrained(
8
+ model_id,
9
+ torch_dtype=torch.bfloat16, # or torch.float16 on T4
10
+ device_map="auto"
11
+ )
12
+
13
+ prompt = "Explain precision vs. recall in one paragraph."
14
+ inputs = tok(prompt, return_tensors="pt").to(model.device)
15
+ out = model.generate(
16
+ **inputs,
17
+ max_new_tokens=256,
18
+ do_sample=True,
19
+ top_p=0.9,
20
+ temperature=0.7,
21
+ )
22
+ print(tok.decode(out[0], skip_special_tokens=True))