|
269 | 269 | ]
|
270 | 270 | OPEN_CLIP_PREFIX = "conditioner.embedders.0.model."
|
271 | 271 | LDM_OPEN_CLIP_TEXT_PROJECTION_DIM = 1024
|
| 272 | +SCHEDULER_LEGACY_KWARGS = ["prediction_type", "scheduler_type"] |
272 | 273 |
|
273 | 274 | VALID_URL_PREFIXES = ["https://huggingface.co/", "huggingface.co/", "hf.co/", "https://hf.co/"]
|
274 | 275 |
|
@@ -318,6 +319,10 @@ def _is_model_weights_in_cached_folder(cached_folder, name):
|
318 | 319 | return weights_exist
|
319 | 320 |
|
320 | 321 |
|
| 322 | +def _is_legacy_scheduler_kwargs(kwargs): |
| 323 | + return any(k in SCHEDULER_LEGACY_KWARGS for k in kwargs.keys()) |
| 324 | + |
| 325 | + |
321 | 326 | def load_single_file_checkpoint(
|
322 | 327 | pretrained_model_link_or_path,
|
323 | 328 | force_download=False,
|
@@ -1479,14 +1484,22 @@ def _legacy_load_scheduler(
|
1479 | 1484 |
|
1480 | 1485 | if scheduler_type is not None:
|
1481 | 1486 | deprecation_message = (
|
1482 |
| - "Please pass an instance of a Scheduler object directly to the `scheduler` argument in `from_single_file`." |
| 1487 | + "Please pass an instance of a Scheduler object directly to the `scheduler` argument in `from_single_file`\n\n" |
| 1488 | + "Example:\n\n" |
| 1489 | + "from diffusers import StableDiffusionPipeline, DDIMScheduler\n\n" |
| 1490 | + "scheduler = DDIMScheduler()\n" |
| 1491 | + "pipe = StableDiffusionPipeline.from_single_file(<checkpoint path>, scheduler=scheduler)\n" |
1483 | 1492 | )
|
1484 | 1493 | deprecate("scheduler_type", "1.0.0", deprecation_message)
|
1485 | 1494 |
|
1486 | 1495 | if prediction_type is not None:
|
1487 | 1496 | deprecation_message = (
|
1488 |
| - "Please configure an instance of a Scheduler with the appropriate `prediction_type` " |
1489 |
| - "and pass the object directly to the `scheduler` argument in `from_single_file`." |
| 1497 | + "Please configure an instance of a Scheduler with the appropriate `prediction_type` and " |
| 1498 | + "pass the object directly to the `scheduler` argument in `from_single_file`.\n\n" |
| 1499 | + "Example:\n\n" |
| 1500 | + "from diffusers import StableDiffusionPipeline, DDIMScheduler\n\n" |
| 1501 | + 'scheduler = DDIMScheduler(prediction_type="v_prediction")\n' |
| 1502 | + "pipe = StableDiffusionPipeline.from_single_file(<checkpoint path>, scheduler=scheduler)\n" |
1490 | 1503 | )
|
1491 | 1504 | deprecate("prediction_type", "1.0.0", deprecation_message)
|
1492 | 1505 |
|
|
0 commit comments