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

UnboundLocalError (showui_loop_count) on Windows + Python 3.12 #62

Open
bilbop1 opened this issue Dec 24, 2024 · 2 comments
Open

UnboundLocalError (showui_loop_count) on Windows + Python 3.12 #62

bilbop1 opened this issue Dec 24, 2024 · 2 comments

Comments

@bilbop1
Copy link

bilbop1 commented Dec 24, 2024

File "C:\Users\Razer Blade\computer_use_ootb\computer_use_demo\loop.py", line 217, in sampling_loop_sync
    print(f"End of loop {showui_loop_count+1}. Messages: ...
UnboundLocalError: cannot access local variable 'showui_loop_count' ...

Environment

OS: Windows 11, Razer Blade 2020, RTX 3060 (6 GB VRAM)
Python: 3.12.8
CUDA Driver: 560.94 (CUDA 12.6)
PyTorch: 2.5.1 (CUDA 12.4 build)

Crash with UnboundLocalError referencing showui_loop_count.

Would appreciate any guidance—others say it runs “out of the box,” but I keep getting this error on Windows + Python 3.12. Thanks!

@bilbop1
Copy link
Author

bilbop1 commented Dec 24, 2024

Full Traceback

  File "C:\Users\Razer Blade\miniconda3\Lib\site-packages\gradio\queueing.py", line 714, in process_events
    response = await route_utils.call_process_api(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Razer Blade\miniconda3\Lib\site-packages\gradio\route_utils.py", line 322, in call_process_api
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Razer Blade\miniconda3\Lib\site-packages\gradio\blocks.py", line 2047, in process_api
    result = await self.call_function(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Razer Blade\miniconda3\Lib\site-packages\gradio\blocks.py", line 1606, in call_function
    prediction = await utils.async_iteration(iterator)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Razer Blade\miniconda3\Lib\site-packages\gradio\utils.py", line 714, in async_iteration
    return await anext(iterator)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Razer Blade\miniconda3\Lib\site-packages\gradio\utils.py", line 708, in __anext__
    return await anyio.to_thread.run_sync(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Razer Blade\miniconda3\Lib\site-packages\anyio\to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Razer Blade\miniconda3\Lib\site-packages\anyio\_backends\_asyncio.py", line 2505, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "C:\Users\Razer Blade\miniconda3\Lib\site-packages\anyio\_backends\_asyncio.py", line 1005, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Razer Blade\miniconda3\Lib\site-packages\gradio\utils.py", line 691, in run_sync_iterator_async
    return next(iterator)
           ^^^^^^^^^^^^^^
  File "C:\Users\Razer Blade\miniconda3\Lib\site-packages\gradio\utils.py", line 852, in gen_wrapper
    response = next(iterator)
               ^^^^^^^^^^^^^^
  File "C:\Users\Razer Blade\computer_use_ootb\app.py", line 273, in process_input
    for loop_msg in sampling_loop_sync(
                    ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Razer Blade\computer_use_ootb\computer_use_demo\loop.py", line 217, in sampling_loop_sync
    print(f"End of loop {showui_loop_count+1}. Messages: {str(messages)[:100000]}. Total cost: $USD{planner.total_cost:.5f}")
                         ^^^^^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'showui_loop_count' where it is not associated with a value
Keyboard interruption in main thread... closing server.```

@hkr04
Copy link

hkr04 commented Dec 26, 2024

Add showui_loop_count = 0 around line 127 (outside the loop) to set the initial value could simply fix that problem.

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