Skip to content

Commit c020029

Browse files
authored
Fix generate for OpenVino backend. (#2638)
The `generate` function was using `ops.array` to convert to NumPy. However, that is not what `ops.array` does, and the OpenVino behavior of `ops.array` was fixed to return an `OpenVINOKerasTensor`. Use `ops.convert_to_numpy` instead.
1 parent a59b0be commit c020029

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

keras_hub/src/models/causal_lm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def make_generate_function(self):
137137

138138
def wrapped_generate_function(inputs, stop_token_ids=None):
139139
# Convert to numpy for OpenVINO backend
140-
inputs = tree.map_structure(ops.array, inputs)
140+
inputs = tree.map_structure(ops.convert_to_numpy, inputs)
141141
return ov_infer(
142142
self, inputs, stop_token_ids, self.generate_step
143143
)

0 commit comments

Comments
 (0)