| 759 | |
| 760 | |
| 761 | def model_has_vae(args): |
| 762 | config_file_name = Path("vae", AutoencoderKL.config_name).as_posix() |
| 763 | if os.path.isdir(args.pretrained_model_name_or_path): |
| 764 | config_file_name = os.path.join(args.pretrained_model_name_or_path, config_file_name) |
| 765 | return os.path.isfile(config_file_name) |
| 766 | else: |
| 767 | files_in_repo = model_info(args.pretrained_model_name_or_path, revision=args.revision).siblings |
| 768 | return any(file.rfilename == config_file_name for file in files_in_repo) |
| 769 | |
| 770 | |
| 771 | def tokenize_prompt(tokenizer, prompt, tokenizer_max_length=None): |