dh-mc commited on
Commit
d5af465
1 Parent(s): 1071606

improve sync

Browse files
Files changed (1) hide show
  1. app_modules/llm_inference.py +4 -2
app_modules/llm_inference.py CHANGED
@@ -38,7 +38,8 @@ class LLMInference(metaclass=abc.ABCMeta):
38
  self, inputs, streaming_handler, q: Queue = None, tracing: bool = False
39
  ):
40
  print(inputs)
41
- self.llm_loader.lock.acquire()
 
42
 
43
  try:
44
  self.llm_loader.streamer.reset(q)
@@ -67,7 +68,8 @@ class LLMInference(metaclass=abc.ABCMeta):
67
 
68
  return result
69
  finally:
70
- self.llm_loader.lock.release()
 
71
 
72
  def _execute_chain(self, chain, inputs, q, sh):
73
  q.put(chain(inputs, callbacks=[sh]))
 
38
  self, inputs, streaming_handler, q: Queue = None, tracing: bool = False
39
  ):
40
  print(inputs)
41
+ if self.llm_loader.streamer.for_huggingface:
42
+ self.llm_loader.lock.acquire()
43
 
44
  try:
45
  self.llm_loader.streamer.reset(q)
 
68
 
69
  return result
70
  finally:
71
+ if self.llm_loader.streamer.for_huggingface:
72
+ self.llm_loader.lock.release()
73
 
74
  def _execute_chain(self, chain, inputs, q, sh):
75
  q.put(chain(inputs, callbacks=[sh]))