I am trying to run the seg2image.py file to try some segmentation image to image translation tasks. I was able to install the packages successfully. For all the other libraries I had used the most recent ones and only for gradio, I had used the latest 3.X version (3.50.2).
I had some issues in loading the .pth file, after downloading from huggingface with the position_ids item, so I changed this command a bit in the gradio_seg2image.py file:
state_dict = load_state_dict('./models/control_sd15_seg.pth', location='cuda')
state_dict = { k: v for k, v in state_dict.items() if 'position_ids' not in k } #Changed line
model.load_state_dict(state_dict)
This was the only change I did in the code.
After installing all the relevant libraries I ran the following command and got these results. Could you please help if you are aware of the resolution.
(controlnet) C:\Users\projects\ML\ControlNet\ControlNet>python gradio_seg2image.py
logging improved.
Use Checkpoint: False
Checkpoint Number: [0, 0, 0, 0]
Use global window for all blocks in stage3
load checkpoint from local path: C:\Users\princ\Documents\ControlNet\ControlNet\annotator\ckpts\upernet_global_small.pth
No module 'xformers'. Proceeding without it.
ControlLDM: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
making attention of type 'vanilla' with 512 in_channels
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
making attention of type 'vanilla' with 512 in_channels
Loaded model config from [./models/cldm_v15.yaml]
Loaded state_dict from [./models/control_sd15_seg.pth]
C:\Users\princ\Documents\ControlNet\ControlNet\gradio_seg2image.py:94: GradioDeprecationWarning: The style method is deprecated. Please set these arguments in the constructor instead.
result_gallery = gr.Gallery(label='Output', show_label=False, elem_id="gallery").style(grid=2, height='auto')
C:\Users\princ\Documents\ControlNet\ControlNet\gradio_seg2image.py:94: GradioDeprecationWarning: The 'grid' parameter will be deprecated. Please use 'columns' in the constructor instead.
result_gallery = gr.Gallery(label='Output', show_label=False, elem_id="gallery").style(grid=2, height='auto')
Running on local URL: http://0.0.0.0:7860
To create a public link, set share=True in launch().
On opening the URL on the browser, I got the following error:
Hi Team,
I am trying to run the seg2image.py file to try some segmentation image to image translation tasks. I was able to install the packages successfully. For all the other libraries I had used the most recent ones and only for gradio, I had used the latest 3.X version (3.50.2).
I had some issues in loading the .pth file, after downloading from huggingface with the position_ids item, so I changed this command a bit in the gradio_seg2image.py file: state_dict = load_state_dict('./models/control_sd15_seg.pth', location='cuda') state_dict = { k: v for k, v in state_dict.items() if 'position_ids' not in k } #Changed line model.load_state_dict(state_dict) This was the only change I did in the code.
After installing all the relevant libraries I ran the following command and got these results. Could you please help if you are aware of the resolution.
(controlnet) C:\Users\projects\ML\ControlNet\ControlNet>python gradio_seg2image.py logging improved. Use Checkpoint: False Checkpoint Number: [0, 0, 0, 0] Use global window for all blocks in stage3 load checkpoint from local path: C:\Users\princ\Documents\ControlNet\ControlNet\annotator\ckpts\upernet_global_small.pth No module 'xformers'. Proceeding without it. ControlLDM: Running in eps-prediction mode DiffusionWrapper has 859.52 M params. making attention of type 'vanilla' with 512 in_channels Working with z of shape (1, 4, 32, 32) = 4096 dimensions. making attention of type 'vanilla' with 512 in_channels Loaded model config from [./models/cldm_v15.yaml] Loaded state_dict from [./models/control_sd15_seg.pth] C:\Users\princ\Documents\ControlNet\ControlNet\gradio_seg2image.py:94: GradioDeprecationWarning: The
style
method is deprecated. Please set these arguments in the constructor instead. result_gallery = gr.Gallery(label='Output', show_label=False, elem_id="gallery").style(grid=2, height='auto') C:\Users\princ\Documents\ControlNet\ControlNet\gradio_seg2image.py:94: GradioDeprecationWarning: The 'grid' parameter will be deprecated. Please use 'columns' in the constructor instead. result_gallery = gr.Gallery(label='Output', show_label=False, elem_id="gallery").style(grid=2, height='auto') Running on local URL: http://0.0.0.0:7860To create a public link, set
share=True
inlaunch()
.On opening the URL on the browser, I got the following error: