Leri777 commited on
Commit
1742611
·
verified ·
1 Parent(s): 336f168

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -27,17 +27,13 @@ if torch.cuda.is_available():
27
  logger.debug("GPU is available. Proceeding with GPU setup.")
28
  model = AutoModelForCausalLM.from_pretrained(
29
  model_id,
30
- device_map="auto",
31
- torch_dtype=torch.bfloat16,
32
  )
33
  else:
34
  logger.warning("GPU is not available. Proceeding with CPU setup.")
35
  model = AutoModelForCausalLM.from_pretrained(
36
  model_id,
37
- device_map="auto",
38
- low_cpu_mem_usage=True,
39
- use_auth_token=True,
40
- use_auth_token=True,
41
  )
42
 
43
  model.eval()
@@ -56,7 +52,7 @@ pipe = pipeline(
56
 
57
  # Initialize HuggingFacePipeline model for LangChain
58
  chat_model = HuggingFacePipeline(pipeline=pipe)
59
- logger.debug("Model and tokenizer loaded successfully")
60
 
61
  # Define the conversation template for LangChain
62
  template = """<|im_start|>system
 
27
  logger.debug("GPU is available. Proceeding with GPU setup.")
28
  model = AutoModelForCausalLM.from_pretrained(
29
  model_id,
30
+ device_map="auto", torch_dtype=torch.bfloat16,
 
31
  )
32
  else:
33
  logger.warning("GPU is not available. Proceeding with CPU setup.")
34
  model = AutoModelForCausalLM.from_pretrained(
35
  model_id,
36
+ device_map="auto", low_cpu_mem_usage=True, use_auth_token=True,
 
 
 
37
  )
38
 
39
  model.eval()
 
52
 
53
  # Initialize HuggingFacePipeline model for LangChain
54
  chat_model = HuggingFacePipeline(pipeline=pipe)
55
+
56
 
57
  # Define the conversation template for LangChain
58
  template = """<|im_start|>system