jwang2373 commited on
Commit
d636d83
·
verified ·
1 Parent(s): b747480

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -2,7 +2,7 @@ import os
2
  import time
3
  import spaces
4
  import torch
5
- from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer, BitsAndBytesConfig
6
  import gradio as gr
7
  from threading import Thread
8
 
@@ -15,10 +15,7 @@ PLACEHOLDER = """
15
  <p>Hi! I'm a PyChrono Digital Twin expert. How can I assist you today?</p>
16
  </center>
17
  """
18
- quantization_config = BitsAndBytesConfig(
19
- load_in_4bit=True,
20
- bnb_4bit_compute_dtype=torch.bfloat16
21
- )
22
  CSS = """
23
  .duplicate-button {
24
  margin: auto !important;
@@ -34,7 +31,7 @@ h3 {
34
  device = "cuda" if torch.cuda.is_available() else "cpu"
35
 
36
  tokenizer = AutoTokenizer.from_pretrained(MODEL, trust_remote_code=True)
37
- model = AutoModelForCausalLM.from_pretrained(MODEL, trust_remote_code=True, device_map="auto")
38
  model = model.eval()
39
 
40
  @spaces.GPU()
@@ -138,4 +135,4 @@ with gr.Blocks(css=CSS, theme="soft") as demo:
138
  )
139
 
140
  if __name__ == "__main__":
141
- demo.launch()
 
2
  import time
3
  import spaces
4
  import torch
5
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
6
  import gradio as gr
7
  from threading import Thread
8
 
 
15
  <p>Hi! I'm a PyChrono Digital Twin expert. How can I assist you today?</p>
16
  </center>
17
  """
18
+
 
 
 
19
  CSS = """
20
  .duplicate-button {
21
  margin: auto !important;
 
31
  device = "cuda" if torch.cuda.is_available() else "cpu"
32
 
33
  tokenizer = AutoTokenizer.from_pretrained(MODEL, trust_remote_code=True)
34
+ model = AutoModelForCausalLM.from_pretrained(MODEL, torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto")
35
  model = model.eval()
36
 
37
  @spaces.GPU()
 
135
  )
136
 
137
  if __name__ == "__main__":
138
+ demo.launch()