rabiyulfahim commited on
Commit
2d193e2
·
verified ·
1 Parent(s): df057b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -13,10 +13,17 @@ os.environ["HF_HOME"] = "/tmp"
13
  os.environ["TRANSFORMERS_CACHE"] = "/tmp"
14
 
15
 
16
- model_id = "rabiyulfahim/Python_coding_model"
 
 
 
 
 
 
 
 
 
17
 
18
- tokenizer = AutoTokenizer.from_pretrained(model_id, cache_dir="/tmp")
19
- model = AutoModelForCausalLM.from_pretrained(model_id, cache_dir="/tmp")
20
 
21
 
22
  app = FastAPI(title="QA GPT2 API UI", description="Serving HuggingFace model with FastAPI")
 
13
  os.environ["TRANSFORMERS_CACHE"] = "/tmp"
14
 
15
 
16
+ # Base + Adapter
17
+ from peft import PeftModel
18
+
19
+ base_model_id = "microsoft/DialoGPT-small"
20
+ adapter_id = "rabiyulfahim/Python_coding_model"
21
+
22
+ tokenizer = AutoTokenizer.from_pretrained(base_model_id, cache_dir="/tmp")
23
+ base_model = AutoModelForCausalLM.from_pretrained(base_model_id, cache_dir="/tmp")
24
+ model = PeftModel.from_pretrained(base_model, adapter_id, cache_dir="/tmp")
25
+
26
 
 
 
27
 
28
 
29
  app = FastAPI(title="QA GPT2 API UI", description="Serving HuggingFace model with FastAPI")