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

ValueError: Custom Code Execution Required and Deprecation Warnings in app_stage1.py #7

Open
yuchenlichuck opened this issue May 7, 2024 · 3 comments

Comments

@yuchenlichuck
Copy link

I'm encountering multiple issues when running the app_stage1.py script with the provided model. Here is a summary of the bugs:

  1. ValueError: Custom Code Execution Required

While trying to load the lzq49/mvdream-sd21-diffusers model pipeline using MVControlPipeline.from_pretrained, I receive the following error:

bash
Copy code
ValueError:
The repository for lzq49/mvdream-sd21-diffusers contains custom code in unet/unet.py, camera_proj/camera_proj which must be executed to correctly load the model. You can inspect the repository content at https://hf.co/lzq49/mvdream-sd21-diffusers/unet/unet.py, https://hf.co/lzq49/mvdream-sd21-diffusers/camera_proj/camera_proj.py.
Please pass the argument trust_remote_code=True to allow custom code to be run.
Suggested Fix:
Adding the trust_remote_code=True argument to the pipeline loading functions resolves the issue. Here is an example modification in app_stage1.py:

python
Copy code
from pipeline_mvcontrol import load_mvcontrol_pipeline

pipe_mvcontrol = load_mvcontrol_pipeline(
"lzq49/mvdream-sd21-diffusers",
revision="main",
torch_dtype=torch.float16,
trust_remote_code=True # Add this argument here
)
Or, directly with MVControlPipeline.from_pretrained:

python
Copy code
from diffusers import MVControlPipeline

pipe_mvcontrol = MVControlPipeline.from_pretrained(
"lzq49/mvdream-sd21-diffusers",
torch_dtype=torch.float16,
trust_remote_code=True # Add this argument here
)
2. Deprecation Warnings:

During execution, the following warnings are displayed:

vbnet
Copy code
/home/dubaiprince/miniconda3/envs/mvcontrol/lib/python3.9/site-packages/diffusers/utils/outputs.py:63: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.
torch.utils._pytree._register_pytree_node(
/home/dubaiprince/miniconda3/envs/mvcontrol/lib/python3.9/site-packages/huggingface_hub/file_download.py:1132: FutureWarning: resume_download is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use force_download=True.
warnings.warn(
Suggested Fixes:

Update the usage of _register_pytree_node in diffusers/utils/outputs.py:
python
Copy code
torch.utils._pytree.register_pytree_node( # Replace _register_pytree_node
Update the resume_download usage in huggingface_hub/file_download.py:
python
Copy code
force_download=True # Instead of resume_download
3. xFormers Warning:

A warning related to xFormers is also raised:

arduino
Copy code
/home/dubaiprince/Projects/MVControl-threestudio/extern/lgm/attention.py:22: UserWarning: xFormers is available (Attention)
warnings.warn("xFormers is available (Attention)")
Suggested Fix:
Ensure that xFormers is compatible with the current environment by aligning the versions of Python, PyTorch, and CUDA.

Reproduction Steps:
Run the command python app_stage1.py big --resume pretrained/model_fp16.safetensors --condition_type $condition_type
Observe the error and warnings.
Environment:
OS: Ubuntu 20.04
Python Version: 3.9.19
Torch Version: 2.3.0
Torchvision Version: 0.17.1+cu118
Let me know if you need more details, or if I can assist with testing any fixes.

@lianxuepc
Copy link

i hava the same problem. Pls have you solved it now?

@lianxuepc
Copy link

i hava the same problem. Pls have you solved it now?
I solved this issue by manually downloading the model source code on Huggingface

@lianxuepc
Copy link

I'm encountering multiple issues when running the app_stage1.py script with the provided model. Here is a summary of the bugs:

  1. ValueError: Custom Code Execution Required

While trying to load the lzq49/mvdream-sd21-diffusers model pipeline using MVControlPipeline.from_pretrained, I receive the following error:

bash Copy code ValueError: The repository for lzq49/mvdream-sd21-diffusers contains custom code in unet/unet.py, camera_proj/camera_proj which must be executed to correctly load the model. You can inspect the repository content at https://hf.co/lzq49/mvdream-sd21-diffusers/unet/unet.py, https://hf.co/lzq49/mvdream-sd21-diffusers/camera_proj/camera_proj.py. Please pass the argument trust_remote_code=True to allow custom code to be run. Suggested Fix: Adding the trust_remote_code=True argument to the pipeline loading functions resolves the issue. Here is an example modification in app_stage1.py:

python Copy code from pipeline_mvcontrol import load_mvcontrol_pipeline

pipe_mvcontrol = load_mvcontrol_pipeline( "lzq49/mvdream-sd21-diffusers", revision="main", torch_dtype=torch.float16, trust_remote_code=True # Add this argument here ) Or, directly with MVControlPipeline.from_pretrained:

python Copy code from diffusers import MVControlPipeline

pipe_mvcontrol = MVControlPipeline.from_pretrained( "lzq49/mvdream-sd21-diffusers", torch_dtype=torch.float16, trust_remote_code=True # Add this argument here ) 2. Deprecation Warnings:

During execution, the following warnings are displayed:

vbnet Copy code /home/dubaiprince/miniconda3/envs/mvcontrol/lib/python3.9/site-packages/diffusers/utils/outputs.py:63: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead. torch.utils._pytree._register_pytree_node( /home/dubaiprince/miniconda3/envs/mvcontrol/lib/python3.9/site-packages/huggingface_hub/file_download.py:1132: FutureWarning: resume_download is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use force_download=True. warnings.warn( Suggested Fixes:

Update the usage of _register_pytree_node in diffusers/utils/outputs.py: python Copy code torch.utils._pytree.register_pytree_node( # Replace _register_pytree_node Update the resume_download usage in huggingface_hub/file_download.py: python Copy code force_download=True # Instead of resume_download 3. xFormers Warning:

A warning related to xFormers is also raised:

arduino Copy code /home/dubaiprince/Projects/MVControl-threestudio/extern/lgm/attention.py:22: UserWarning: xFormers is available (Attention) warnings.warn("xFormers is available (Attention)") Suggested Fix: Ensure that xFormers is compatible with the current environment by aligning the versions of Python, PyTorch, and CUDA.

Reproduction Steps: Run the command python app_stage1.py big --resume pretrained/model_fp16.safetensors --condition_type $condition_type Observe the error and warnings. Environment: OS: Ubuntu 20.04 Python Version: 3.9.19 Torch Version: 2.3.0 Torchvision Version: 0.17.1+cu118 Let me know if you need more details, or if I can assist with testing any fixes.

I solved this issue by manually downloading the model source code on Huggingface

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

2 participants