showlab / computer_use_ootb

An out-of-the-box (OOTB) version of Anthropic Claude Computer Use for Windows and macOS
MIT License
352 stars 41 forks source link

"AttributeError: 'ComputerTool' object has no attribute 'target_dimension'" on Mac M1 #20

Open bakaburg1 opened 2 days ago

bakaburg1 commented 2 days ago

Hi!

I'm getting this error when I asked it to perform a simple operation: open a folder on the desktop.

(base) ***@*** computer_use_ootb % python app.py
/opt/homebrew/Caskroom/miniconda/base/lib/python3.11/site-packages/gradio/components/chatbot.py:225: UserWarning: You have not specified a value for the `type` parameter. Defaulting to the 'tuples' format for chatbot messages, but this is deprecated and will be removed in a future version of Gradio. Please set type='messages' instead, which uses openai-style 'role' and 'content' keys.
  warnings.warn(
* Running on local URL:  http://127.0.0.1:7860
* Running on public URL: https://87375beed12293e4f1.gradio.live

This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)
Resolution: 1728x1117
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.11/site-packages/gradio/queueing.py", line 712, in process_events
    response = await route_utils.call_process_api(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.11/site-packages/gradio/route_utils.py", line 323, in call_process_api
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.11/site-packages/gradio/blocks.py", line 2015, in process_api
    result = await self.call_function(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.11/site-packages/gradio/blocks.py", line 1574, in call_function
    prediction = await utils.async_iteration(iterator)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.11/site-packages/gradio/utils.py", line 710, in async_iteration
    return await anext(iterator)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.11/site-packages/gradio/utils.py", line 704, in __anext__
    return await anyio.to_thread.run_sync(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.11/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2441, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 943, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.11/site-packages/gradio/utils.py", line 687, in run_sync_iterator_async
    return next(iterator)
           ^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.11/site-packages/gradio/utils.py", line 848, in gen_wrapper
    response = next(iterator)
               ^^^^^^^^^^^^^^
  File "/Users/***/Dropbox/GitRepos/computer_use_ootb/app.py", line 181, in process_input
    for message in sampling_loop(state):
  File "/Users/***/Dropbox/GitRepos/computer_use_ootb/app.py", line 205, in sampling_loop
    for message in accumulate_messages(
  File "/Users/***/Dropbox/GitRepos/computer_use_ootb/app.py", line 191, in accumulate_messages
    for message in sampling_loop_sync(*args, **kwargs):
  File "/Users/***/Dropbox/GitRepos/computer_use_ootb/computer_use_demo/loop.py", line 235, in sampling_loop_sync
    result = asyncio.run(tool_collection.run(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniconda/base/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/***/Dropbox/GitRepos/computer_use_ootb/computer_use_demo/tools/collection.py", line 32, in run
    return await tool(**tool_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/***/Dropbox/GitRepos/computer_use_ootb/computer_use_demo/tools/computer.py", line 179, in __call__
    return await self.screenshot()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/***/Dropbox/GitRepos/computer_use_ootb/computer_use_demo/tools/computer.py", line 204, in screenshot
    screenshot = screenshot.resize((self.target_dimension["width"], self.target_dimension["height"]))
                                    ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ComputerTool' object has no attribute 'target_dimension'
szaboz commented 1 day ago

Same issue here from Windows 10 this morning, using python3.12 installed with miniconda3

Joseph-M-Cook commented 16 hours ago

I have this error as well. MacBook M3 Pro.

YaroslavPetrashko commented 10 hours ago

Same issue, M1 pro

Joseph-M-Cook commented 8 hours ago

I think I was able to solve this by adding some code in the init for ComputerTool.

DanielKehoe commented 2 hours ago

I think I was able to solve this by adding some code in the init for ComputerTool.

@Joseph-M-Cook can you show us what you changed to get it working? Is it Line 83 of tools/computer.py? Seems there is a dependency on a variable COMPUTER but I'm not sure what value is needed.

h-siyuan commented 2 minutes ago

Hi, the latest version has added support for any resolution scale:), along with the fix for this issue.