kyegomez / swarms

The Enterprise-Grade Production-Ready Multi-Agent Orchestration Framework Join our Community: https://discord.com/servers/agora-999382051935506503
https://docs.swarms.world
GNU Affero General Public License v3.0
1.81k stars 248 forks source link

[BUG] Error executing with n-CPU cores #628

Open AlanThinks opened 2 weeks ago

AlanThinks commented 2 weeks ago

Describe the bug

When running: sample Single Agent code from https://docs.swarms.world/en/latest/swarms/install/quickstart/

agent.run(
    "How can I establish a ROTH ...",
    device="cpu",
    device_id = 0 // or any variation here
)

terminal output:

python .\my_first_swarm.py
(ProxyActor pid=43904) INFO 2024-11-11 17:41:04,501 proxy 127.0.0.1 proxy.py:1191 - Proxy starting on node 913180a87fc228a16b60f641ccd175289aaa4e2b096ab91c95ab90de (HTTP port: 8000).
2024-11-11T17:41:04.577002-0500 | INFO | Autosaved prompt 29139c5a0d2742d6841edf87c2b0a9e5 to agent_workspace\prompts\prompt-id-29139c5a0d2742d6841edf87c2b0a9e5.json.
2024-11-11T17:41:07.783685-0500 Attempting to run on device: cpu
2024-11-11T17:41:07.784686-0500 Device set to CPU
2024-11-11T17:41:07.785684-0500 Using all available CPU cores: 24
2024-11-11T17:41:07.786685-0500 Available CPUs: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
2024-11-11T17:41:07.786685-0500 Error executing with 24 CPU cores: Invalid core count: 24. Available CPUs are [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].
2024-11-11T17:41:08.786990-0500 Available CPUs: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
2024-11-11T17:41:08.787991-0500 Error executing with 24 CPU cores: Invalid core count: 24. Available CPUs are [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].
2024-11-11T17:41:09.794937-0500 Available CPUs: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
2024-11-11T17:41:09.885148-0500 Error executing with 24 CPU cores: Invalid core count: 24. Available CPUs are [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].
2024-11-11T17:41:09.885148-0500 An error occurred during execution: RetryError[<Future at 0x200aaed3a60 state=finished raised ValueError>]
Traceback (most recent call last):
  File "C:\...\miniconda3\envs\swarm\lib\site-packages\tenacity\__init__.py", line 478, in __call__
    result = fn(*args, **kwargs)
  File "C:\...\miniconda3\envs\swarm\lib\site-packages\clusterops\main.py", line 199, in execute_with_cpu_cores
    raise ValueError(
ValueError: Invalid core count: 24. Available CPUs are [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\...\my_first_swarm.py", line 28, in <module>
    out = out = agent.run(
  File "C:\...\miniconda3\envs\swarm\lib\site-packages\swarms\structs\agent.py", line 2308, in run
    raise e
  File "C:\...\miniconda3\envs\swarm\lib\site-packages\swarms\structs\agent.py", line 2289, in run
    return execute_with_cpu_cores(
  File "C:\...\miniconda3\envs\swarm\lib\site-packages\tenacity\__init__.py", line 336, in wrapped_f
    return copy(f, *args, **kw)
  File "C:\...\miniconda3\envs\swarm\lib\site-packages\tenacity\__init__.py", line 475, in __call__
    do = self.iter(retry_state=retry_state)
  File "C:\...\miniconda3\envs\swarm\lib\site-packages\tenacity\__init__.py", line 376, in iter
    result = action(retry_state)
  File "C:\...\miniconda3\envs\swarm\lib\site-packages\tenacity\__init__.py", line 419, in exc_check
    raise retry_exc from fut.exception()
tenacity.RetryError: RetryError[<Future at 0x200aaed3a60 state=finished raised ValueError>]
Sentry is attempting to send 2 pending events
Waiting up to 2 seconds
Press Ctrl-Break to quit

/prompts/Financial-Analysis-Agent.log

2024-11-11 18:02:46.362 | INFO     | swarms.structs.agent:run:2277 - Attempting to run on device: cpu
2024-11-11 18:02:46.365 | INFO     | swarms.structs.agent:run:2279 - Device set to CPU
2024-11-11 18:02:46.366 | INFO     | swarms.structs.agent:run:2282 - Using all available CPU cores: 24
2024-11-11 18:02:46.366 | INFO     | clusterops.main:list_available_cpus:51 - Available CPUs: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
2024-11-11 18:02:46.366 | ERROR    | clusterops.main:execute_with_cpu_cores:221 - Error executing with 24 CPU cores: Invalid core count: 24. Available CPUs are [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].
2024-11-11 18:02:47.382 | INFO     | clusterops.main:list_available_cpus:51 - Available CPUs: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
2024-11-11 18:02:47.382 | ERROR    | clusterops.main:execute_with_cpu_cores:221 - Error executing with 24 CPU cores: Invalid core count: 24. Available CPUs are [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].
2024-11-11 18:02:48.393 | INFO     | clusterops.main:list_available_cpus:51 - Available CPUs: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
2024-11-11 18:02:48.393 | ERROR    | clusterops.main:execute_with_cpu_cores:221 - Error executing with 24 CPU cores: Invalid core count: 24. Available CPUs are [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].
2024-11-11 18:02:48.394 | ERROR    | swarms.structs.agent:run:2307 - An error occurred during execution: RetryError[<Future at 0x23ad1dc7cd0 state=finished raised ValueError>]

To Reproduce Steps to reproduce the behavior:

  1. Using Conda for environment
  2. Running sample Single Agent code from https://docs.swarms.world/en/latest/swarms/install/quickstart/
  3. In VS Code click "Run" button
Additional context
Windows 11
VS Code latest
Conda 24.9.2
Python 3.10.15
pip 24.2
swarms 6.0.9
swarms-memory 0.1.2
swarms-models 0.1.3

Upvote & Fund

Fund with Polar

github-actions[bot] commented 2 weeks ago

Hello there, thank you for opening an Issue ! šŸ™šŸ» The team was notified and they will get back to you asap.