Nguyen17 commited on
Commit
65f3fa5
·
verified ·
1 Parent(s): 8bc2598
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -20,7 +20,7 @@ from docx.api import Document
20
  from types import SimpleNamespace
21
  from llama_index.core import SimpleDirectoryReader
22
  from utils.process_tables import extract_and_replace_docx_tables
23
-
24
 
25
 
26
  # Configure logging
@@ -156,7 +156,7 @@ def get_retriever(cfg, prompt_template):
156
  def load_tokenizer(cfg):
157
  tokenizer = AutoTokenizer.from_pretrained(
158
  cfg.architecture.llm_model,
159
- token=cfg.architecture.hf_token
160
  )
161
 
162
  if tokenizer.pad_token is None:
@@ -179,7 +179,7 @@ def get_llm(cfg):
179
  cfg.architecture.llm_model,
180
  torch_dtype=torch.bfloat16,
181
  device_map=cfg.environment.device,
182
- token=cfg.architecture.hf_token,
183
  low_cpu_mem_usage=True,
184
  quantization_config=bnb_config,
185
  )
@@ -219,6 +219,7 @@ def vistral_chat():
219
 
220
 
221
  def main1(config_path):
 
222
  # Configure logging
223
  logging.basicConfig(level=logging.INFO,
224
  format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
@@ -259,6 +260,11 @@ def main1(config_path):
259
  logger.exception("An error occurred: %s", e)
260
 
261
  if __name__ == "__main__":
 
 
 
 
 
262
  main_prepare()
263
  parser = argparse.ArgumentParser(description='Process some configurations.')
264
  parser.add_argument('--config', type=str, default='config.yaml', help='Path to the configuration file')
 
20
  from types import SimpleNamespace
21
  from llama_index.core import SimpleDirectoryReader
22
  from utils.process_tables import extract_and_replace_docx_tables
23
+ from langchain._api import LangChainDeprecationWarning
24
 
25
 
26
  # Configure logging
 
156
  def load_tokenizer(cfg):
157
  tokenizer = AutoTokenizer.from_pretrained(
158
  cfg.architecture.llm_model,
159
+ token=os.getenv('HUGGING_KEY')
160
  )
161
 
162
  if tokenizer.pad_token is None:
 
179
  cfg.architecture.llm_model,
180
  torch_dtype=torch.bfloat16,
181
  device_map=cfg.environment.device,
182
+ token= os.getenv('HUGGING_KEY'),
183
  low_cpu_mem_usage=True,
184
  quantization_config=bnb_config,
185
  )
 
219
 
220
 
221
  def main1(config_path):
222
+
223
  # Configure logging
224
  logging.basicConfig(level=logging.INFO,
225
  format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
 
260
  logger.exception("An error occurred: %s", e)
261
 
262
  if __name__ == "__main__":
263
+
264
+ warnings.simplefilter("ignore", category=LangChainDeprecationWarning)
265
+ # access_token_read = “abc”
266
+ # login(token = access_token_read)
267
+
268
  main_prepare()
269
  parser = argparse.ArgumentParser(description='Process some configurations.')
270
  parser.add_argument('--config', type=str, default='config.yaml', help='Path to the configuration file')