diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

Can't save configuration of scheduler initialized with custom `trained_betas`

Open pcuenca opened this issue 3 years ago • 0 comments

Describe the bug

trained_betas is a numpy array, and it cannot be serialized to JSON. This makes it currently impossible to save the configuration of a custom scheduler that does not follow one of the predefined scheduler.

Reproduction

import numpy as np
from diffusers import EulerDiscreteScheduler
scheduler = EulerDiscreteScheduler(trained_betas=np.array(range(5)))
scheduler.save_config("test.json")
TypeError: Object of type ndarray is not JSON serializable

Logs

No response

System Info

  • diffusers version: 0.8.0.dev0
  • Platform: Linux-5.4.0-91-generic-x86_64-with-glibc2.31
  • Python version: 3.9.12
  • PyTorch version (GPU?): 1.13.0+cu117 (True)
  • Huggingface_hub version: 0.10.0
  • Transformers version: 4.23.1
  • Using GPU in script?: No
  • Using distributed or parallel set-up in script?: No

pcuenca avatar Nov 22 '22 20:11 pcuenca