chenjoya commited on
Commit
deec01c
·
verified ·
1 Parent(s): be0c9b1

Update demo/infer.py

Browse files
Files changed (1) hide show
  1. demo/infer.py +5 -2
demo/infer.py CHANGED
@@ -162,8 +162,11 @@ class LiveCCDemoInfer:
162
  state['past_key_values'] = outputs.past_key_values if not hf_spaces else None
163
  state['past_ids'] = outputs.sequences[:, :-1] if not hf_spaces else None
164
  response = self.processor.decode(outputs.sequences[0, inputs.input_ids.size(1):], skip_special_tokens=True)
165
- print(response)
166
- yield (start_timestamp, stop_timestamp), response, state
 
 
 
167
 
168
  @torch.inference_mode()
169
  def video_qa(
 
162
  state['past_key_values'] = outputs.past_key_values if not hf_spaces else None
163
  state['past_ids'] = outputs.sequences[:, :-1] if not hf_spaces else None
164
  response = self.processor.decode(outputs.sequences[0, inputs.input_ids.size(1):], skip_special_tokens=True)
165
+ if hf_spaces:
166
+ light_state = {k: v for k, v in state.items() if k not in ['past_ids', 'past_key_values']}
167
+ yield (start_timestamp, stop_timestamp), response, light_state
168
+ else:
169
+ yield (start_timestamp, stop_timestamp), response, state
170
 
171
  @torch.inference_mode()
172
  def video_qa(