HFswapnil commited on
Commit
2f91ca9
·
verified ·
1 Parent(s): 5e653d4

Update run_model.py

Browse files
Files changed (1) hide show
  1. run_model.py +2 -39
run_model.py CHANGED
@@ -1,5 +1,5 @@
1
- # from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
2
  import os
 
3
 
4
  SYSTEM_PROMPT = "You are helpful AI assistant. You will answer user queries truthfully. If you don't know answer to any question you will say so. You will never promote or use any offensive or racist language."
5
 
@@ -22,41 +22,4 @@ def generate_response(prompt: str, context: str="", history: list = []):
22
  response = gemma_model.invoke(message)
23
 
24
  return response.content
25
-
26
-
27
-
28
- # MODEL_NAME = "microsoft/Phi-3.5-mini-instruct"
29
-
30
-
31
- # model = AutoModelForCausalLM.from_pretrained(
32
- # MODEL_NAME,
33
- # device_map="auto",
34
- # torch_dtype=torch.float16,
35
- # )
36
- # tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
37
-
38
- # print(f"Microsoft Phi-3.5-mini-instruct Downloaded Successfully !")
39
-
40
-
41
- # pipe = pipeline(
42
- # "text-generation",
43
- # model=model,
44
- # tokenizer=tokenizer,
45
- # max_new_tokens=64,
46
- # temperature=0.4,
47
- # do_sample=True
48
- # )
49
-
50
- # def generate_response(prompt: str, context: str = "", history: list = []) -> str:
51
-
52
-
53
- # BASE_MESSAGE = [{"role" : "system", "content" : SYSTEM_PROMPT}] + history
54
-
55
- # if context == "":
56
- # message = BASE_MESSAGE + [{"role" : "user", "content" : prompt}]
57
- # else:
58
- # message = BASE_MESSAGE + [{"role" : "user", "content" : f"Context : {context}\nQuery : {prompt}"}]
59
-
60
- # outputs = pipe(message)
61
-
62
- # return outputs[0]["generated_text"]
 
 
1
  import os
2
+ from langchain_google_genai import ChatGoogleGenerativeAI
3
 
4
  SYSTEM_PROMPT = "You are helpful AI assistant. You will answer user queries truthfully. If you don't know answer to any question you will say so. You will never promote or use any offensive or racist language."
5
 
 
22
  response = gemma_model.invoke(message)
23
 
24
  return response.content
25
+