Resolve the file path, downloading from HuggingFace if needed. Returns the list of files to download for this component.
(&self)
| 18 | /// Resolve the file path, downloading from HuggingFace if needed. |
| 19 | /// Returns the list of files to download for this component. |
| 20 | fn files(&self) -> Vec<&'static str> { |
| 21 | match self { |
| 22 | Self::Tokenizer => vec!["tokenizer/tokenizer.json"], |
| 23 | Self::TextEncoder => vec![ |
| 24 | "text_encoder/model.safetensors.index.json", |
| 25 | "text_encoder/model-00001-of-00002.safetensors", |
| 26 | "text_encoder/model-00002-of-00002.safetensors", |
| 27 | "text_encoder/config.json", |
| 28 | ], |
| 29 | Self::Transformer => vec!["transformer/diffusion_pytorch_model.safetensors"], |
| 30 | Self::Vae => vec!["vae/diffusion_pytorch_model.safetensors"], |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | /// Download and return the primary file path for this component. |
| 35 | pub fn get(&self, repo_id: &str, cache_dir: &str) -> Result<PathBuf> { |