Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where is the requirements.txt? Could you provide a colab notebook? #1

Open
hsgwktb opened this issue Jan 15, 2025 · 4 comments
Open

Comments

@hsgwktb
Copy link

hsgwktb commented Jan 15, 2025

Where is the requirements.txt? Could you provide a colab notebook? #1

@hsgwktb
Copy link
Author

hsgwktb commented Jan 15, 2025

This is my notebook, it doesn't work.

!git clone https://github.com/ali-vilab/MangaNinjia
%cd /content/MangaNinjia
!conda env create -f environment.yaml
!conda activate MangaNinjia
!pip install -r requirements.txt
!apt -y install -qq aria2
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/resolve/main/v1-5-pruned.safetensors -d "/content/checkpoints/StableDiffusion" -o v1-5-pruned.safetensors
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/openai/clip-vit-large-patch14/resolve/main/model.safetensors -d "/content/checkpoints/clip-vit-large-patch14" -o clip-vit-large-patch14.safetensors
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/lllyasviel/control_v11p_sd15_lineart/resolve/main/diffusion_pytorch_model.safetensors -d "/content/checkpoints/control_v11p_sd15_lineart" -o control_v11p_sd15_lineart.safetensors
!wget https://huggingface.co/lllyasviel/Annotators/resolve/main/sk_model.pth -O "/content/checkpoints/Annotators/sk_model.pth"
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/Johanan0528/MangaNinjia/resolve/main/denoising_unet.pth -d "/content/checkpoints/MangaNinjia" -o denoising_unet.pth
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/Johanan0528/MangaNinjia/resolve/main/reference_unet.pth -d "/content/checkpoints/MangaNinjia" -o reference_unet.pth
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/Johanan0528/MangaNinjia/resolve/main/point_net.pth -d "/content/checkpoints/MangaNinjia" -o point_net.pth
!aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/Johanan0528/MangaNinjia/resolve/main/controlnet.pth -d "/content/checkpoints/MangaNinjia" -o controlnet.pth

%cd scripts
!bash infer.sh

!python run_gradio.py

@Johanan528
Copy link
Collaborator

Hi, we provide a yaml environment file. Btw, where is the problem?

@hsgwktb
Copy link
Author

hsgwktb commented Jan 15, 2025

checkpoints/
├── Annotators/
│ └── sk_model.pth
├── MangaNinja/
│ ├── controlnet.pth
│ ├── denoising_unet.pth
│ ├── point_net.pth
│ └── reference_unet.pth
├── StableDiffusion/
│ └── v1-5-pruned.safetensors
├── clip-vit-large-patch14/
│ └── clip-vit-large-patch14.safetensors
└── control_v11p_sd15_lineart/
└── control_v11p_sd15_lineart.safetensors

run !python run_gradio.py

output:
/usr/local/lib/python3.10/dist-packages/gradio_client/documentation.py:106: UserWarning: Could not get documentation group for <class 'gradio.mix.Parallel'>: No known documentation group for module 'gradio.mix'
warnings.warn(f"Could not get documentation group for {cls}: {exc}")
/usr/local/lib/python3.10/dist-packages/gradio_client/documentation.py:106: UserWarning: Could not get documentation group for <class 'gradio.mix.Series'>: No known documentation group for module 'gradio.mix'
warnings.warn(f"Could not get documentation group for {cls}: {exc}")
2025-01-15 12:16:45.179245: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:485] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2025-01-15 12:16:45.213293: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:8454] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2025-01-15 12:16:45.226527: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1452] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2025-01-15 12:16:46.612029: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
/usr/local/lib/python3.10/dist-packages/diffusers/models/dual_transformer_2d.py:20: FutureWarning: DualTransformer2DModel is deprecated and will be removed in version 0.29. Importing DualTransformer2DModel from diffusers.models.dual_transformer_2d is deprecated and this will be removed in a future version. Please use from diffusers.models.transformers.dual_transformer_2d import DualTransformer2DModel, instead.
deprecate("DualTransformer2DModel", "0.29", deprecation_message)
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/diffusers/configuration_utils.py", line 380, in load_config
config_file = hf_hub_download(
File "/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_deprecation.py", line 101, in inner_f
return f(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_validators.py", line 106, in _inner_fn
validate_repo_id(arg_value)
File "/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_validators.py", line 154, in validate_repo_id
raise HFValidationError(
huggingface_hub.errors.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': './checkpoints/StableDiffusion'. Use repo_type argument if needed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/content/MangaNinjia/run_gradio.py", line 43, in
noise_scheduler = DDIMScheduler.from_pretrained(pretrained_model_name_or_path,subfolder='scheduler')
File "/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
return fn(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/diffusers/schedulers/scheduling_utils.py", line 143, in from_pretrained
config, kwargs, commit_hash = cls.load_config(
File "/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
return fn(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/diffusers/configuration_utils.py", line 415, in load_config
raise EnvironmentError(
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 ./checkpoints/StableDiffusion is not the path to a directory containing a scheduler_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'.

@Deathdadev
Copy link
Contributor

You have directly installed the model file from huggingface, where this project is trying to reference files from the diffusers version of this model.

i.e: The code is looking for scheduler_config.json from https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/tree/main , but you have only installed the safetensors file: https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/resolve/main/v1-5-pruned.safetensors

This is the same for most of the installed models you have in your colab code. Make sure that you are following the correct directory structure; if there is no file such as *.pth, then you can assume it is the full folder for the model:

-- checkpoints
    |-- StableDiffusion
    |-- models
        |-- clip-vit-large-patch14
        |-- control_v11p_sd15_lineart
        |-- Annotators
            |--sk_model.pth
    |-- MangaNinjia
        |-- denoising_unet.pth
        |-- reference_unet.pth
        |-- point_net.pth
        |-- controlnet.pth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants