Zubaish commited on
Commit
adf8857
·
1 Parent(s): e598db4

Fix: trust_remote_code for Phi-3 model

Browse files
Files changed (1) hide show
  1. rag.py +9 -4
rag.py CHANGED
@@ -1,7 +1,5 @@
1
  from langchain_community.vectorstores import Chroma
2
  from langchain_community.embeddings import HuggingFaceEmbeddings
3
- from langchain.schema import SystemMessage, HumanMessage
4
-
5
  from transformers import AutoTokenizer, AutoModelForCausalLM
6
  import torch
7
 
@@ -26,9 +24,16 @@ else:
26
 
27
  print("⏳ Loading LLM...")
28
 
29
- tokenizer = AutoTokenizer.from_pretrained("microsoft/Phi-3-mini-4k-instruct")
 
 
 
 
 
 
30
  model = AutoModelForCausalLM.from_pretrained(
31
- "microsoft/Phi-3-mini-4k-instruct",
 
32
  torch_dtype=torch.float32,
33
  device_map="cpu"
34
  )
 
1
  from langchain_community.vectorstores import Chroma
2
  from langchain_community.embeddings import HuggingFaceEmbeddings
 
 
3
  from transformers import AutoTokenizer, AutoModelForCausalLM
4
  import torch
5
 
 
24
 
25
  print("⏳ Loading LLM...")
26
 
27
+ MODEL_ID = "microsoft/Phi-3-mini-4k-instruct"
28
+
29
+ tokenizer = AutoTokenizer.from_pretrained(
30
+ MODEL_ID,
31
+ trust_remote_code=True
32
+ )
33
+
34
  model = AutoModelForCausalLM.from_pretrained(
35
+ MODEL_ID,
36
+ trust_remote_code=True,
37
  torch_dtype=torch.float32,
38
  device_map="cpu"
39
  )