Felipe Silva commited on
Commit
fc388ed
·
1 Parent(s): b62b49f

ajuste decorator

Browse files
Files changed (1) hide show
  1. rag_utils.py +2 -2
rag_utils.py CHANGED
@@ -24,7 +24,6 @@ _embedding_instance = None
24
  _model_instance = None
25
  _tokenizer = None
26
 
27
- @spaces.GPU
28
  def get_embedding_model():
29
  global _embedding_instance
30
  if _embedding_instance is None:
@@ -35,7 +34,6 @@ def get_embedding_model():
35
 
36
  # model_name = "Qwen/Qwen2.5-7B-Instruct-GPTQ-Int8" #"Qwen/Qwen2.5-7B-Instruct-AWQ" #"Qwen/Qwen2.5-7B-Instruct"
37
 
38
- @spaces.GPU
39
  def get_model():
40
  global _model_instance
41
  if _model_instance is None:
@@ -67,6 +65,7 @@ def create_split_doc(raw_text):
67
 
68
  return docs
69
 
 
70
  def store_docs(docs):
71
  embedding_model = get_embedding_model()
72
  vectorstore = FAISS.from_documents(docs, embedding_model)
@@ -90,6 +89,7 @@ Pergunta:
90
  )
91
  return prompt_template
92
 
 
93
  def create_rag_chain(vectorstore):
94
  pipe = pipeline(
95
  "text-generation",
 
24
  _model_instance = None
25
  _tokenizer = None
26
 
 
27
  def get_embedding_model():
28
  global _embedding_instance
29
  if _embedding_instance is None:
 
34
 
35
  # model_name = "Qwen/Qwen2.5-7B-Instruct-GPTQ-Int8" #"Qwen/Qwen2.5-7B-Instruct-AWQ" #"Qwen/Qwen2.5-7B-Instruct"
36
 
 
37
  def get_model():
38
  global _model_instance
39
  if _model_instance is None:
 
65
 
66
  return docs
67
 
68
+ @spaces.GPU
69
  def store_docs(docs):
70
  embedding_model = get_embedding_model()
71
  vectorstore = FAISS.from_documents(docs, embedding_model)
 
89
  )
90
  return prompt_template
91
 
92
+ @spaces.GPU
93
  def create_rag_chain(vectorstore):
94
  pipe = pipeline(
95
  "text-generation",