OwenTruong / civitdl

A CLI python script to batch download models from CivitAI with CivitAI Api V1
Apache License 2.0
40 stars 5 forks source link

Output Foldername [suggestion] #106

Open Worldgate opened 2 months ago

Worldgate commented 2 months ago

So some models have the same name (mostly character loras) so it would be great if we could set the name for the folder based on the URN/AIR from civit ai.

https://github.com/civitai/civitai/wiki/AIR-%E2%80%90-Uniform-Resource-Names-for-AI

Example: urn: Uniform Resource Name optional air: Artificial Intelligence Resource optional {ecosystem}: Type of the ecosystem (sd1, sd2, sdxl) {type}: Type of the resource (model, lora, embedding, hypernet) {source}: Supported network source {id}: Id of the resource from the source {format}: The format of the model (safetensor, ckpt, diffuser, tensor rt) optional

And as some models have multiple versions (1.0, 1.2, etc) and multiple files per version (VAE, CKPT, full, half, etc) so it would be great if you could also have it download all of them also.

Granted im probably the minority of people who download the entire model sets but i have some weird ocd thing going on so if there 9 different items im downloading them all. I guess i like to have stuff in case i need it later or if the files get deleted. I dunno.

OwenTruong commented 2 months ago

It shouldn't be too difficult to implement it as a sorter if the URN and AIR is in a model metadata's JSON.

I'll try when I have time next time

OwenTruong commented 1 month ago

Sorry, I know it has been a while, but looking at your suggestion again, it seems like it can be split into three:

  1. [ ] Folder name based on the uniform resource names.
  2. [ ] Downloading all versions of a model.
  3. [ ] Download all files for a specific version.

For number 1, since Windows doesn't allow colons, it would be better to configure the folder structure like so: urn/air/{ecosystem}/{type}/{source}/{id}/{format}. There is one thing I am confused with though. What is a source?

For numbers 2 and 3, I think I will need to modify the code and maybe add two options along the lines of --all-versions and --all-files.

For number 2, I will have to consider how that is going to impact all of the different civitdl sources (not urn:air sources). As an example, if a source is a civitai.com/api URL with only version id and --all-versions is configured, should the program only download that specified version, or download all versions associated with the model?

For number 3, would it be possible for you to provide an example of a model version with multiple files (e.g. safetensors, ckpt, pt, vae, etc.)?