picobyte / stable-diffusion-webui-wd14-tagger

Labeling extension for Automatic1111's Web UI
601 stars 74 forks source link

loading models from 'models/TaggerOnnx' #83

Closed ZZ250-zZ closed 1 year ago

ZZ250-zZ commented 1 year ago

Prioritize loading models from directory 'models/TaggerOnnx'

picobyte commented 1 year ago

This is not fixing anything. Just use the environment variable as specified in the huggingface load api docs, if you don't want to load from huggingface.

ZZ250-zZ commented 1 year ago

This is not fixing anything. Just use the environment variable as specified in the huggingface load api docs, if you don't want to load from huggingface.

   def download(self) -> None:
        mdir = Path(shared.models_path, 'interrogators')
        if self.is_hf:
            cache = getattr(shared.opts, 'tagger_hf_cache_dir', Its.hf_cache)
            print(f"Loading {self.name} model file from {self.repo_id}, "
                  f"{self.model_path}")

            model_path = hf_hub_download(
                repo_id=self.repo_id,
                filename=self.model_path,
                cache_dir=cache)
            tags_path = hf_hub_download(
                repo_id=self.repo_id,
                filename=self.tags_path,
                cache_dir=cache)
        else:
            model_path = self.local_model
            tags_path = self.local_tags

    return sorted(interrogators.keys())
picobyte commented 1 year ago

HF_HUB_OFFLINE=1 disables the download. so export HF_HUB_OFFLINE=1 if on Linux, mac or os/x, or something like HF_HUB_OFFLINE=1 ./webui, not sure exactly how this is done in windows, but you can also in python do this:

import os
os.environ["HF_HUB_OFFLINE"] = "1"

There is already a long open issue about this, btw.

ZZ250-zZ commented 1 year ago

HF_HUB_OFFLINE=1 disables the download. so export HF_HUB_OFFLINE=1 if on Linux, mac or os/x, or something like HF_HUB_OFFLINE=1 ./webui, not sure exactly how this is done in windows, but you can also in python do this:

import os
os.environ["HF_HUB_OFFLINE"] = "1"

There is already a long open issue about this, btw.

I misunderstood. Thank you very much for your patient answer.