Upload folder using huggingface_hub
Browse files390 unmodified lines391392393394395396390 unmodified linesvqvae_path = (model_dir / mm_vqvae).resolve()else:vqvae_path = _resolve_local_path(mm_vqvae)self.vqvae = _load_vqvae_from_local(vqvae_path)self.vqvae.eval()self.vqvae.requires_grad_(False)390 unmodified lines391392393394395396397398399400401402403404405406407390 unmodified linesvqvae_path = (model_dir / mm_vqvae).resolve()else:vqvae_path = _resolve_local_path(mm_vqvae)# When loading from HF hub, the vqvae subdirectory is not copied to# the dynamic-module cache hash dir. Fall back to snapshot_download.if not vqvae_path.is_dir():repo_id = getattr(config, "_name_or_path", "")if repo_id and not Path(repo_id).is_dir():from huggingface_hub import snapshot_downloadlocal_dir = snapshot_download(repo_id=repo_id,allow_patterns=[f"{mm_vqvae}/*"],)vqvae_path = Path(local_dir) / mm_vqvaeself.vqvae = _load_vqvae_from_local(vqvae_path)self.vqvae.eval()self.vqvae.requires_grad_(False)
modeling_nemotron_labs_diffusion_image.py+11