|
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, |
@@ -1477,14 +1482,22 @@ def _legacy_load_scheduler( |
1477 | 1482 |
|
1478 | 1483 | if scheduler_type is not None: |
1479 | 1484 | deprecation_message = ( |
1480 | | - "Please pass an instance of a Scheduler object directly to the `scheduler` argument in `from_single_file`." |
| 1485 | + "Please pass an instance of a Scheduler object directly to the `scheduler` argument in `from_single_file`\n\n" |
| 1486 | + "Example:\n\n" |
| 1487 | + "from diffusers import StableDiffusionPipeline, DDIMScheduler\n\n" |
| 1488 | + "scheduler = DDIMScheduler()\n" |
| 1489 | + "pipe = StableDiffusionPipeline.from_single_file(<checkpoint path>, scheduler=scheduler)\n" |
1481 | 1490 | ) |
1482 | 1491 | deprecate("scheduler_type", "1.0.0", deprecation_message) |
1483 | 1492 |
|
1484 | 1493 | if prediction_type is not None: |
1485 | 1494 | deprecation_message = ( |
1486 | | - "Please configure an instance of a Scheduler with the appropriate `prediction_type` " |
1487 | | - "and pass the object directly to the `scheduler` argument in `from_single_file`." |
| 1495 | + "Please configure an instance of a Scheduler with the appropriate `prediction_type` and " |
| 1496 | + "pass the object directly to the `scheduler` argument in `from_single_file`.\n\n" |
| 1497 | + "Example:\n\n" |
| 1498 | + "from diffusers import StableDiffusionPipeline, DDIMScheduler\n\n" |
| 1499 | + 'scheduler = DDIMScheduler(prediction_type="v_prediction")\n' |
| 1500 | + "pipe = StableDiffusionPipeline.from_single_file(<checkpoint path>, scheduler=scheduler)\n" |
1488 | 1501 | ) |
1489 | 1502 | deprecate("prediction_type", "1.0.0", deprecation_message) |
1490 | 1503 |
|
|
0 commit comments