ai-toolkit icon indicating copy to clipboard operation
ai-toolkit copied to clipboard

Offline Installation ?

Open MushroomFleet opened this issue 1 year ago • 6 comments

So as is often the case with huggingface, i have spent 7 hours downloading the model (i already have it, but as a local file) This happens a lot. The Automatic HF Cache and other methods fail often and never have "resume_download" enabled, which is supposed to be default.

What method can be used to Download the model files manually, then where can that be placed so that ai-toolkit can see them?

I already have to install torch-2.4.0+cu121-cp310-cp310-win_amd64.whl manually, because this also fails - if you use automatic scripts. This is pretty normal as not everyone has lighting speed fibre internet.

So after 7 hours we see this frozen DL again: image

While i squarely blame Huggingface for this, is there no alternate mirror, or "offline" manual method to get this running?

my 40900 is ready....

MushroomFleet avatar Aug 13 '24 09:08 MushroomFleet

Just use local path as model in config, like this:

        # huggingface model name or path
        name_or_path: "f:/5_Training_tools/ai-toolkit/FLUX.1-dev"

And (don't know, maybe fixed in last updates), because it try to load also FLUX Shnell just for text encoder, edit file ai-toolkit\toolkit\stable_diffusion_model.py near 459 line, like this

        elif self.model_config.is_flux:
            print("Loading Flux model")
            base_model_path = "f:/5_Training_tools/ai-toolkit/FLUX.1-dev"

And it will work with local now.

Desm0nt avatar Aug 13 '24 09:08 Desm0nt

Thank you!

protector131090 avatar Aug 13 '24 13:08 protector131090

Just use local path as model in config, like this:

        # huggingface model name or path
        name_or_path: "f:/5_Training_tools/ai-toolkit/FLUX.1-dev"

And (don't know, maybe fixed in last updates), because it try to load also FLUX Shnell just for text encoder, edit file ai-toolkit\toolkit\stable_diffusion_model.py near 459 line, like this

        elif self.model_config.is_flux:
            print("Loading Flux model")
            base_model_path = "f:/5_Training_tools/ai-toolkit/FLUX.1-dev"

And it will work with local now.

What config? my_lora.yaml? I did, as suggested to both files, and it still doesn't work.

OSError: We couldn't connect to 'https://huggingface.co' to load this model, couldn't find it in the cached files and it looks like d:/unet/flux1-dev is not the path to a directory containing a config.json file.
Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/diffusers/installation#offline-mode'.

maxenko avatar Aug 13 '24 21:08 maxenko

OSError: We couldn't connect to 'https://huggingface.co' to load this model, couldn't find it in the cached files and it looks like d:/unet/flux1-dev is not the path to a directory containing a config.json file.

Are you sure you downloaded the WHOLE 54gb huggingface folder of FLUX1.dev (including all subfolders and files for diffusers) and not just the 24gb saftensors file for comfy?

You should have all of this: Снимок

Desm0nt avatar Aug 14 '24 06:08 Desm0nt

d:/unet/flux1-dev

the error is saying that your training config is not in the same path as the model, because that config is in the root for the ai-toolkit. Easy fix is to move the model into /ai-toolkit/flux1-dev/

PATH/ai-toolkit/flux1-dev place the model in a folder in the ai-toolkit

path is where you installed ai-toolkit.

MushroomFleet avatar Aug 14 '24 15:08 MushroomFleet

Yeah it looks like it needs the whole folder, not just the main 24gb file I had. I ended up letting the script download it. Still doesn't work but due to other issue. Thank you for your help.

maxenko avatar Aug 14 '24 19:08 maxenko

Just be sure to use forward slashes for the path, windows uses \ by default

buzzz3d avatar Aug 17 '24 10:08 buzzz3d

This should be resolved now with latest updates and pointing to a local folder structure. If it is still an issue, please reopen this ticket.

jaretburkett avatar Aug 19 '24 03:08 jaretburkett

My internet sucks so i had to download the files each. Downloaded all files and placed it into the huggingface cashe as mentioned above, I get this error

Traceback (most recent call last): File "E:\ai-toolkit\run.py", line 90, in main() File "E:\ai-toolkit\run.py", line 86, in main raise e File "E:\ai-toolkit\run.py", line 78, in main job.run() File "E:\ai-toolkit\jobs\ExtensionJob.py", line 22, in run process.run() File "E:\ai-toolkit\jobs\process\BaseSDTrainProcess.py", line 1230, in run self.sd.load_model() File "E:\ai-toolkit\toolkit\stable_diffusion_model.py", line 484, in load_model transformer = FluxTransformer2DModel.from_pretrained( File "C:\Users\Alexn\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\utils_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) File "C:\Users\Alexn\AppData\Local\Programs\Python\Python310\lib\site-packages\diffusers\models\modeling_utils.py", line 713, in from_pretrained model_file = _get_model_file( File "C:\Users\Alexn\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\utils_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) File "C:\Users\Alexn\AppData\Local\Programs\Python\Python310\lib\site-packages\diffusers\utils\hub_utils.py", line 310, in _get_model_file raise EnvironmentError( OSError: Error no file named diffusion_pytorch_model.bin found in directory black-forest-labsFLUX.1-dev\transformer.

E:\ai-toolkit>-- that file is not in the huggingface transformer dir!.

CodeAlexx avatar Aug 19 '24 05:08 CodeAlexx

My internet sucks so i had to download the files each. Downloaded all files and placed it into the huggingface cashe as mentioned above, I get this error

Traceback (most recent call last): File "E:\ai-toolkit\run.py", line 90, in main() File "E:\ai-toolkit\run.py", line 86, in main raise e File "E:\ai-toolkit\run.py", line 78, in main job.run() File "E:\ai-toolkit\jobs\ExtensionJob.py", line 22, in run process.run() File "E:\ai-toolkit\jobs\process\BaseSDTrainProcess.py", line 1230, in run self.sd.load_model() File "E:\ai-toolkit\toolkit\stable_diffusion_model.py", line 484, in load_model transformer = FluxTransformer2DModel.from_pretrained( File "C:\Users\Alexn\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\utils_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) File "C:\Users\Alexn\AppData\Local\Programs\Python\Python310\lib\site-packages\diffusers\models\modeling_utils.py", line 713, in from_pretrained model_file = _get_model_file( File "C:\Users\Alexn\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\utils_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) File "C:\Users\Alexn\AppData\Local\Programs\Python\Python310\lib\site-packages\diffusers\utils\hub_utils.py", line 310, in _get_model_file raise EnvironmentError( OSError: Error no file named diffusion_pytorch_model.bin found in directory black-forest-labsFLUX.1-dev\transformer.

E:\ai-toolkit>-- that file is not in the huggingface transformer dir!.

You need to remove "transformer_" from diffusion_pytorch_model.safetensors.index. But then you will get "OSError: Error no file named scheduler_config.json found in directory FLUX.1-dev." And that is where i am stuck at the moment :)

ledeni00 avatar Aug 19 '24 05:08 ledeni00

My internet sucks so i had to download the files each. Downloaded all files and placed it into the huggingface cashe as mentioned above, I get this error

Traceback (most recent call last): File "E:\ai-toolkit\run.py", line 90, in main() File "E:\ai-toolkit\run.py", line 86, in main raise e File "E:\ai-toolkit\run.py", line 78, in main job.run() File "E:\ai-toolkit\jobs\ExtensionJob.py", line 22, in run process.run() File "E:\ai-toolkit\jobs\process\BaseSDTrainProcess.py", line 1230, in run self.sd.load_model() File "E:\ai-toolkit\toolkit\stable_diffusion_model.py", line 484, in load_model transformer = FluxTransformer2DModel.from_pretrained( File "C:\Users\Alexn\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\utils_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) File "C:\Users\Alexn\AppData\Local\Programs\Python\Python310\lib\site-packages\diffusers\models\modeling_utils.py", line 713, in from_pretrained model_file = _get_model_file( File "C:\Users\Alexn\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\utils_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) File "C:\Users\Alexn\AppData\Local\Programs\Python\Python310\lib\site-packages\diffusers\utils\hub_utils.py", line 310, in _get_model_file raise EnvironmentError( OSError: Error no file named diffusion_pytorch_model.bin found in directory black-forest-labsFLUX.1-dev\transformer.

E:\ai-toolkit>-- that file is not in the huggingface transformer dir!.

Just check the folders for "additional" text in the file names of the files you downloaded. Somehow it ads that text when you go to "save as".

ledeni00 avatar Aug 19 '24 05:08 ledeni00

where is that? file explorer?

CodeAlexx avatar Aug 19 '24 05:08 CodeAlexx