stable-diffusion-webui-wd14-tagger icon indicating copy to clipboard operation
stable-diffusion-webui-wd14-tagger copied to clipboard

Interrogators, i can manually download the wd-14-vit-v2....but where to put it????

Open bryanray opened this issue 1 year ago • 9 comments

Interrogator, there are options, i can manually download the wd-14-vit-v2....but where to put it????

also, this wd-14-vit-v2.git is selected by default, but my country has censored internet, so i got to manually download these files, but WHERE DO I PUT THEM????

i know before it has downloaded into temp folder cause i search for it......but

can you make it off line???

it is so hard to use in our country..

bryanray avatar Mar 24 '23 15:03 bryanray

I met the same problem as you, I solved the problem by modifying the script to add a proxy.

Edit "/extensions/stable-diffusion-webui-wd14-tagger/tagger/interrogator.py" About Line 228

def download(self) -> Tuple[os.PathLike, os.PathLike]:
        print(f"Loading {self.name} model file from {self.kwargs['repo_id']}")

        model_path = Path(hf_hub_download(
            **self.kwargs, filename=self.model_path))
        tags_path = Path(hf_hub_download(
            **self.kwargs, filename=self.tags_path))
        return model_path, tags_path

Change into

def download(self) -> Tuple[os.PathLike, os.PathLike]:
        print(f"Loading {self.name} model file from {self.kwargs['repo_id']}")

        proxies = {
            'http': 'http://192.168.31.240:1080/', #Replace here with your own proxy address and port
            'https': 'http://192.168.31.240:1080/', #Replace here with your own proxy address and port
        }

        model_path = Path(hf_hub_download(
            **self.kwargs, filename=self.model_path, proxies=proxies)) #Add 'proxies=proxies'
        tags_path = Path(hf_hub_download(
            **self.kwargs, filename=self.tags_path, proxies=proxies)) #Add 'proxies=proxies'
        return model_path, tags_path

834449164 avatar Mar 25 '23 05:03 834449164

hey thanks,

i have already downloaded the model from huggingface separately,

1> can you make it to look for models in i.e.: models/folder inside the extension first? instead of having to download it first time with whichever option from the dropdown menu ( illogical!! ),

following part is so !!!important!!! 2> and it also downloads to a RANDOM TEMP folder which is a bad practice..... and quite frankly impossible to maintain, and we need it to be portable, self contained!!

cheers :))

bryanray avatar Mar 25 '23 06:03 bryanray

image put file here

XuanlZhu avatar Mar 29 '23 13:03 XuanlZhu

I have use this way to fix this issue on my machine .

def download(self) -> Tuple[os.PathLike, os.PathLike]:
     print(f"Loading {self.name} model file from {self.kwargs['repo_id']}")

     # model_path = Path(hf_hub_download(
     #     **self.kwargs, filename=self.model_path))
     # tags_path = Path(hf_hub_download(
     #     **self.kwargs, filename=self.tags_path))
     model_path = Path("D:/stable-diffusion-webui/models").joinpath(self.kwargs['repo_id']).joinpath(self.model_path)
     tags_path = Path("D:/stable-diffusion-webui/models").joinpath(self.kwargs['repo_id']).joinpath(self.tags_path)
     return model_path, tags_path

paddypq avatar Apr 18 '23 15:04 paddypq

I have use this way to fix this issue on my machine .

def download(self) -> Tuple[os.PathLike, os.PathLike]:
     print(f"Loading {self.name} model file from {self.kwargs['repo_id']}")

     # model_path = Path(hf_hub_download(
     #     **self.kwargs, filename=self.model_path))
     # tags_path = Path(hf_hub_download(
     #     **self.kwargs, filename=self.tags_path))
     model_path = Path("D:/stable-diffusion-webui/models").joinpath(self.kwargs['repo_id']).joinpath(self.model_path)
     tags_path = Path("D:/stable-diffusion-webui/models").joinpath(self.kwargs['repo_id']).joinpath(self.tags_path)
     return model_path, tags_path

genius!!!! I will give this a try, but i recently stuck using just the stock webui interrogator instead.

bryanray avatar Apr 18 '23 16:04 bryanray

I have use this way to fix this issue on my machine .

def download(self) -> Tuple[os.PathLike, os.PathLike]:
     print(f"Loading {self.name} model file from {self.kwargs['repo_id']}")

     # model_path = Path(hf_hub_download(
     #     **self.kwargs, filename=self.model_path))
     # tags_path = Path(hf_hub_download(
     #     **self.kwargs, filename=self.tags_path))
     model_path = Path("D:/stable-diffusion-webui/models").joinpath(self.kwargs['repo_id']).joinpath(self.model_path)
     tags_path = Path("D:/stable-diffusion-webui/models").joinpath(self.kwargs['repo_id']).joinpath(self.tags_path)
     return model_path, tags_path

("D:/stable-diffusion-webui/models") Can you like make it not "absolute" path? this bit bug the hell out of me I put my webui on stick, on the go, home and office, so i usually make my usb drive the same letter, but still it will be nice to not use absolute path in the code... I am noob coder, i dont know how to fix absolute path.

bryanray avatar Apr 18 '23 16:04 bryanray

def download(self) -> Tuple[os.PathLike, os.PathLike]:
    print(f"Loading {self.name} model file from {self.kwargs['repo_id']}")


    runner_path = os.getcwd()
    model_path = Path(runner_path).joinpath("models").joinpath(self.kwargs['repo_id']).joinpath(self.model_path)
    tags_path = Path(runner_path).joinpath("models").joinpath(self.kwargs['repo_id']).joinpath(self.tags_path)

    if (os.path.exists(model_path) and os.path.exists(tags_path)):
        pass
    else:
        model_path = Path(hf_hub_download(
            **self.kwargs, filename=self.model_path))
        tags_path = Path(hf_hub_download(
            **self.kwargs, filename=self.tags_path))

    return model_path, tags_path

paddypq avatar Apr 19 '23 00:04 paddypq

@bryanray The fork of my warehouse optimizes the download strategy,when loading the model, first query the path where the json file is saved,By default, the model is downloaded to models/interrogators, and the model.json storage path of the model will be saved after downloading image

Elziy avatar Apr 22 '23 05:04 Elziy

@bryanray The fork of my warehouse optimizes the download strategy,when loading the model, first query the path where the json file is saved,By default, the model is downloaded to models/interrogators, and the model.json storage path of the model will be saved after downloading image

finally you got the my itchy back scratched!!!

This is fabulously well done!!!!

I never thought someone fork it and make the same decision as i do, thanks a lot for the heads up!!!!

and thank you for doing so, it is so messy to see stuffs like this, in random folders, of course everyone can search for it, but why bother so much tho, it is bad practice and illogical....

image put file here pretty dumb way i would say, and that one single upvote is just stupidly over-confident... cant stand that shait.

bryanray avatar Apr 22 '23 06:04 bryanray