Skip to content

Commit

Permalink
Update scheduling_euler_discrete.py
Browse files Browse the repository at this point in the history
Type Error fix. During the type conversion, it expects for NumPy array, which fails when tensor array is passed. Sol: Check the type before conversion.
  • Loading branch information
Senume authored Dec 5, 2023
1 parent 4684ea2 commit a628f16
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/diffusers/schedulers/scheduling_euler_discrete.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,12 @@ def set_timesteps(self, num_inference_steps: int, device: Union[str, torch.devic
sigmas = self._convert_to_karras(in_sigmas=sigmas, num_inference_steps=self.num_inference_steps)
timesteps = np.array([self._sigma_to_t(sigma, log_sigmas) for sigma in sigmas])

sigmas = torch.from_numpy(sigmas).to(dtype=torch.float32, device=device)
# Checking 'sigmas' type before datatype conversion
if isinstance(sigmas, np.ndarray)
sigmas = torch.from_numpy(sigmas).to(dtype=torch.float32, device=device)
else:
sigmas = sigmas.to(dtype=torch.float32, device=device)


# TODO: Support the full EDM scalings for all prediction types and timestep types
if self.config.timestep_type == "continuous" and self.config.prediction_type == "v_prediction":
Expand Down

0 comments on commit a628f16

Please sign in to comment.