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

[Feature Request]: Remote attach debugger to a1111 #16084

Open
1 task done
kurophali opened this issue Jun 24, 2024 · 3 comments
Open
1 task done

[Feature Request]: Remote attach debugger to a1111 #16084

kurophali opened this issue Jun 24, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@kurophali
Copy link

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What would your feature do ?

I want to develop some network injections for sd and I want to use breakpoint to check whether things are running smoothly. Can the script start some debug servers I can attach to and use breakpoints?

Proposed workflow

1.enable server by command line args
2.remote attach with vscode or something.
3.trigger function and breakpoint is triggered

Additional information

No response

@kurophali kurophali added the enhancement New feature or request label Jun 24, 2024
@w-e-w
Copy link
Collaborator

w-e-w commented Jun 25, 2024

google "remote debug a python script in vscode"
I think this is what you're looking for
https://code.visualstudio.com/docs/python/debugging
https://github.com/microsoft/debugpy
and a guide
https://stackoverflow.com/questions/73378057/how-to-debug-remote-python-script-in-vs-code

it should be possible for you to configure your vs code to connect to SSH server that can launch webui in debug mode and have your vsocde conect to the debug server

note I have never tried doing this myself


these days in most IDEs basically automatically setup the debugging environment as an option for convenience, but essentially what's going on under the hood is that a python script is launch with debug modules enable, the IDE then connects to the debug server with allows you to setup breakpoints in the code editor

I dont use VS code for python much so not to familiar, but I know it's possible setup remote debugging in pycharm, so I would expect it should also be possible in VS code

as far as I'm aware debugging is generally something that you (the developer) should configured and enabled by launching the python script with a debugging module enabled, and it is not something that a project should provide as a future

debugging is not something that you should enable if you're not actively doing debugging as sometimes debugging itself can lead to issues and performance lost

@kurophali
Copy link
Author

google "remote debug a python script in vscode" I think this is what you're looking for https://code.visualstudio.com/docs/python/debugging https://github.com/microsoft/debugpy and a guide https://stackoverflow.com/questions/73378057/how-to-debug-remote-python-script-in-vs-code

it should be possible for you to configure your vs code to connect to SSH server that can launch webui in debug mode and have your vsocde conect to the debug server

note I have never tried doing this myself

these days in most IDEs basically automatically setup the debugging environment as an option for convenience, but essentially what's going on under the hood is that a python script is launch with debug modules enable, the IDE then connects to the debug server with allows you to setup breakpoints in the code editor

I dont use VS code for python much so not to familiar, but I know it's possible setup remote debugging in pycharm, so I would expect it should also be possible in VS code

as far as I'm aware debugging is generally something that you (the developer) should configured and enabled by launching the python script with a debugging module enabled, and it is not something that a project should provide as a future

debugging is not something that you should enable if you're not actively doing debugging as sometimes debugging itself can lead to issues and performance lost

I didn't know a1111 has any debug servers enabled by default. I'll try installing some debugging modules and run it on launch.py

@w-e-w
Copy link
Collaborator

w-e-w commented Jun 25, 2024

I didn't know a1111 has any debug servers enabled by default.

NO webui dose not and should not have debug servers

but Python itself does have modules that are used for debugging https://docs.python.org/3/library/pdb.html
and there are packages that enables more convenient debugging that are commonly integrated with the IDE
(like pydevd and debugpy)
with these stuff you should be able to run ANY a debugger (debuger server)
you can then connect to the debugger serve with an IDE that allows you to easily interact with the debugger like adding breakpoints

this is in most cases these days done "Automatically" when you set up a python development environment like using vs code or pycharm

so for ANY python script (not just webui) in most cases you should just configured your ID correctly to Launch the python script with debugger enabled

unless you're doing some advanced stuff which the default configuration does not support you should don't need to do an understand much

note I never tried to fully understand how debugger actually works so take my information with a grain of salt

most of us just launch with debug option that is pre-configured with an IDE, we don't try to understand how debugger actually functions

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

No branches or pull requests

2 participants