Skip to content

Commit

Permalink
move VAE decoder to fp32 execution precision on GPU (#432)
Browse files Browse the repository at this point in the history
  • Loading branch information
eaidova authored Sep 18, 2023
1 parent a7782ae commit 681b946
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions optimum/intel/openvino/modeling_diffusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,11 @@ def __call__(self, latent_sample: np.ndarray):
outputs = self.request(inputs, shared_memory=True)
return list(outputs.values())

def _compile(self):
if "GPU" in self.device:
self.ov_config.update({"INFERENCE_PRECISION_HINT": "f32"})
super()._compile()


class OVModelVaeEncoder(OVModelPart):
def __init__(
Expand All @@ -622,6 +627,11 @@ def __call__(self, sample: np.ndarray):
outputs = self.request(inputs, shared_memory=True)
return list(outputs.values())

def _compile(self):
if "GPU" in self.device:
self.ov_config.update({"INFERENCE_PRECISION_HINT": "f32"})
super()._compile()


class OVStableDiffusionPipeline(OVStableDiffusionPipelineBase, StableDiffusionPipelineMixin):
def __call__(
Expand Down

0 comments on commit 681b946

Please sign in to comment.