Skip to content

Commit 7e8838f

Browse files
quic-mamtamamtsingasmigoswquic-rishinrMohit Soni
authored
Enable CB for vlms with multiple images and multiple prompts (#583)
Signed-off-by: Mamta Singh <[email protected]> Signed-off-by: Rishin Raj <[email protected]> Signed-off-by: Asmita Goswami <[email protected]> Signed-off-by: Mohit Soni <[email protected]> Signed-off-by: vbaddi <[email protected]> Co-authored-by: Mamta Singh <[email protected]> Co-authored-by: Asmita Goswami <[email protected]> Co-authored-by: Rishin Raj <[email protected]> Co-authored-by: Mohit Soni <[email protected]> Co-authored-by: Vinayak Baddi <[email protected]>
1 parent 118100c commit 7e8838f

File tree

12 files changed

+1696
-89
lines changed

12 files changed

+1696
-89
lines changed

QEfficient/generation/cloud_infer.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ def __init__(
9090
self.program = qaicrt.Program(self.context, None, qpc, prog_properties)
9191
if self.program.load() != qaicrt.QStatus.QS_SUCCESS:
9292
raise RuntimeError("Failed to load program")
93+
self.is_active = False
9394
if activate:
9495
self.activate()
96+
self.is_active = True
9597
# Create input qbuffers and buf_dims
9698
self.qbuffers = [qaicrt.QBuffer(bytes(binding.size)) for binding in self.bindings]
9799
self.buf_dims = qaicrt.BufferDimensionsVecRef(
@@ -108,15 +110,17 @@ def output_names(self) -> List[str]:
108110

109111
def activate(self):
110112
"""Activate qpc"""
111-
112-
self.program.activate()
113-
self.execObj = qaicrt.ExecObj(self.context, self.program)
113+
if not self.is_active:
114+
self.program.activate()
115+
self.execObj = qaicrt.ExecObj(self.context, self.program)
116+
self.is_active = True
114117

115118
def deactivate(self):
116119
"""Deactivate qpc"""
117-
118-
del self.execObj
119-
self.program.deactivate()
120+
if self.is_active:
121+
del self.execObj
122+
self.program.deactivate()
123+
self.is_active = False
120124

121125
def set_buffers(self, buffers: Dict[str, np.ndarray]):
122126
"""

0 commit comments

Comments
 (0)