sandz7 commited on
Commit
30d64a7
Β·
1 Parent(s): 16340a7

moved the spaces decor on bot_comms

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -80,8 +80,6 @@ def gpt_generation(input: str,
80
  return stream
81
 
82
  # Place just input pass and return generation output
83
- @spaces.GPU(duration=120)
84
- @contextlib.contextmanager
85
  def llama_generation(input_text: str,
86
  history: list,
87
  temperature: float,
@@ -113,18 +111,18 @@ def llama_generation(input_text: str,
113
  if temperature == 0:
114
  generate_kwargs["do_sample"] = False
115
 
116
- # Use a lock object to synchronize access to the llama_model
117
- lock = threading.Lock()
118
 
119
- def generate_llama():
120
- with lock:
121
- # Generate the response using the llama_model
122
- response = llama_model.generate(**generate_kwargs)
123
- return response
124
 
125
 
126
  # start the thread and wait for it to finish
127
- thread = threading.Thread(target=generate_llama)
128
  thread.start()
129
  thread.join()
130
  return streamer
@@ -138,6 +136,7 @@ def check_cuda():
138
  first_time = True
139
  llm_mode = ""
140
 
 
141
  def bot_comms(input_text: str,
142
  history: list,
143
  temperature: float,
 
80
  return stream
81
 
82
  # Place just input pass and return generation output
 
 
83
  def llama_generation(input_text: str,
84
  history: list,
85
  temperature: float,
 
111
  if temperature == 0:
112
  generate_kwargs["do_sample"] = False
113
 
114
+ # # Use a lock object to synchronize access to the llama_model
115
+ # lock = threading.Lock()
116
 
117
+ # def generate_llama():
118
+ # with lock:
119
+ # # Generate the response using the llama_model
120
+ # response = llama_model.generate(**generate_kwargs)
121
+ # return response
122
 
123
 
124
  # start the thread and wait for it to finish
125
+ thread = threading.Thread(target=llama_model.generate, kwargs=generate_kwargs)
126
  thread.start()
127
  thread.join()
128
  return streamer
 
136
  first_time = True
137
  llm_mode = ""
138
 
139
+ @spaces.GPU(decoration=120)
140
  def bot_comms(input_text: str,
141
  history: list,
142
  temperature: float,