Git Product home page Git Product logo

kyegomez / swarms-cloud Goto Github PK

View Code? Open in Web Editor NEW
22.0 4.0 9.0 9.49 MB

Deploy your autonomous agents to production grade environments with 99% Uptime Guarantee, Infinite Scalability, and self-healing.

Home Page: https://discord.gg/GYbXvDGevY

License: MIT License

Python 69.32% Dockerfile 3.96% HCL 23.15% Shell 3.57%
agents ai-research autonomous-agents deployment gpt4 gpt5 infrastructure swarms autoagents

swarms-cloud's Introduction

Multi-Modality

Swarms Cloud

Infrastructure for scalable, reliable, and economical Multi-Modal Model API serving and deployment. We're using terraform to orchestrate infrastructure, FastAPI to host the models. If you're into deploying models for millions of people, join our discord and help contribute.

Guides

Install

pip install swarms-cloud

Architecture

user -> request -> load balanncer -> node[gpu] -> fast api -> model

Scripts

sky serve up -n [NAME] --cloud aws

Calculate Pricing

from transformers import AutoTokenizer
from swarms_cloud import calculate_pricing

# Initialize the tokenizer
tokenizer = AutoTokenizer.from_pretrained("gpt2")

# Define the example texts
texts = ["This is the first example text.", "This is the second example text."]

# Calculate pricing and retrieve the results
total_tokens, total_sentences, total_words, total_characters, total_paragraphs, cost = calculate_pricing(texts, tokenizer)

# Print the total tokens processed
print(f"Total tokens processed: {total_tokens}")

# Print the total cost
print(f"Total cost: ${cost:.5f}")

Generate an API key

from swarms_cloud.api_key_generator import generate_api_key

out = generate_api_key(prefix="sk", length=30)

print(out)

Stack

  • Backend: FastAPI
  • Skypilot for container management
  • Stripe for payment tracking
  • Postresql for database
  • TensorRT for inference
  • Docker for cluster management
  • Kubernetes for managing and autoscaling docker containers
  • Terraform

License

MIT

swarms-cloud's People

Contributors

dependabot[bot] avatar evelynmitchell avatar kyegomez avatar peytontolbert avatar vyomakesh09 avatar zackbradshaw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

swarms-cloud's Issues

[BUG] pytest-benchmark needs to be added to requirements

From within a container, python 3.10.13

pytest test_api_generator.py 
================================ test session starts ================================
platform linux -- Python 3.10.13, pytest-7.4.3, pluggy-1.3.0
rootdir: /usr/src/swarm_cloud/tests
plugins: time-machine-2.13.0, anyio-3.7.1
collected 18 items                                                                  

test_api_generator.py F...F...EF.F.F...F                                      [100%]

====================================== ERRORS =======================================
________________ ERROR at setup of test_generate_api_key_performance ________________
file /usr/src/swarm_cloud/tests/test_api_generator.py, line 54
  def test_generate_api_key_performance(benchmark):
E       fixture 'benchmark' not found
>       available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, time_machine, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

[BUG] ModuleNotFoundError: No module named 'swarms_cloud'

ImportError while importing test module '/home/v/swarms-cloud/tests/test_api_generator.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_api_generator.py:5: in
from swarms_cloud.api_key_generator import generate_api_key
E ModuleNotFoundError: No module named 'swarms_cloud'

[BUG] test_func_wrapper - test_add_put returns 404

In a container, with pytest-benchmark installed, python 3.10.13

pytest test_func_wrapper.py 
================================= test session starts =================================
platform linux -- Python 3.10.13, pytest-7.4.3, pluggy-1.3.0
benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /usr/src/swarm_cloud/tests
plugins: benchmark-4.0.0, time-machine-2.13.0, anyio-3.7.1
collected 17 items                                                                    

test_func_wrapper.py .FF..FFFFFFFFFFFF                                          [100%]

====================================== FAILURES =======================================
____________________________________ test_add_put _____________________________________

func_api_wrapper = <swarms_cloud.func_api_wrapper.SwarmCloud object at 0x7fa99c932ec0>

    def test_add_put(func_api_wrapper):
        @func_api_wrapper.add("/test_put", method="put")
        def test_put_endpoint():
            return {"message": "test_put"}
    
        client = TestClient(func_api_wrapper.app)
        response = client.put("/test_put")
>       assert response.status_code == 200
E       assert 404 == 200
E        +  where 404 = <Response [404 Not Found]>.status_code

test_func_wrapper.py:81: AssertionError
---------------------------------- Captured log call ----------------------------------
INFO     swarms_cloud.func_api_wrapper:func_api_wrapper.py:93 Error in test_put_endpoint: Invalid method: put

This means that the /test_put endpoint is not found when called with the method put.

[BUG] test_func_wrapper - test_add is unprocessable

In a container, with pytest-benchmark installed, python 3.10.13

pytest test_func_wrapper.py 
================================= test session starts =================================
platform linux -- Python 3.10.13, pytest-7.4.3, pluggy-1.3.0
benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /usr/src/swarm_cloud/tests
plugins: benchmark-4.0.0, time-machine-2.13.0, anyio-3.7.1
collected 17 items                                                                    

test_func_wrapper.py .FF..FFFFFFFFFFFF                                          [100%]

====================================== FAILURES =======================================
______________________________________ test_add _______________________________________

func_api_wrapper = <swarms_cloud.func_api_wrapper.SwarmCloud object at 0x7fa99d45a3b0>

    def test_add(func_api_wrapper):
        @func_api_wrapper.add("/test", method="get")
        def test_endpoint():
            return {"message": "test"}
    
        client = TestClient(func_api_wrapper.app)
        response = client.get("/test")
>       assert response.status_code == 200
E       assert 422 == 200
E        +  where 422 = <Response [422 Unprocessable Entity]>.status_code

test_func_wrapper.py:37: AssertionError

This error is occurring because the response to the request failed with error 422, not 200 (success).
The response code 422 says the endpoint is up, the request is properly formatted, but the server doesn't know what to do with it (https://httpwg.org/specs/rfc9110.html#status.422)
"15.5.21. 422 Unprocessable Content

The 422 (Unprocessable Content) status code indicates that the server understands the content type of the request content (hence a 415 (Unsupported Media Type) status code is inappropriate), and the syntax of the request content is correct, but it was unable to process the contained instructions."

That suggest to me, that this test, as written, is incomplete, because the request content isn't processable by the endpoint.

Either delete this test, or make sure the content is processable.

[BUG] pip install -e "." fails

Describe the bug
A clear and concise description of what the bug is and what the main root cause error is. Test very thoroughly before submitting.

To Reproduce
Steps to reproduce the behavior:

  1. clone repository and navigate to root directory
    git clone https://github.com/kyegomez/swarms.git
    cd swarms

  2. setup python environment and activate it
    python3 -m venv venv
    source venv/bin/activate
    pip install --upgrade pip

  3. headless install
    pip install -e "."

  4. Fails with the following error: "INFO: pip is looking at multiple versions of swarms-cloud to determine which version is compatible with other requirements. This could take a while.
    ERROR: Could not find a version that satisfies the requirement sse-starlight (from swarms-cloud) (from versions: none)
    ERROR: No matching distribution found for sse-starlight"

Expected behavior
Successful install of swarms-cloud.

Screenshots
If applicable, add screenshots to help explain your problem.
Screenshot from 2024-03-11 14-00-31

Additional context
Problem resolves when updating the pyproject.toml file line 33 to sse-starlette = "*"
I suspect a simple typo and will submit a pull request to correct this error.

[BUG] test_func_wrapper - test_add_invalid_method - puzzle

In a container, with pytest-benchmark installed, python 3.10.13

pytest test_func_wrapper.py 
================================= test session starts =================================
platform linux -- Python 3.10.13, pytest-7.4.3, pluggy-1.3.0
benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /usr/src/swarm_cloud/tests
plugins: benchmark-4.0.0, time-machine-2.13.0, anyio-3.7.1
collected 17 items                                                                    

test_func_wrapper.py .FF..FFFFFFFFFFFF                                          [100%]

====================================== FAILURES =======================================
_______________________________ test_add_invalid_method _______________________________

func_api_wrapper = <swarms_cloud.func_api_wrapper.SwarmCloud object at 0x7fa99c933cd0>

    def test_add_invalid_method(func_api_wrapper):
>       with pytest.raises(ValueError):
E       Failed: DID NOT RAISE <class 'ValueError'>

test_func_wrapper.py:42: Failed
---------------------------------- Captured log call ----------------------------------
INFO     swarms_cloud.func_api_wrapper:func_api_wrapper.py:93 Error in test_endpoint: Invalid method: invalid

I've looked at the decorator code, and it should throw a ValueError for an invalid method, if I'm reading it correctly, so I don't know why this is failing. That it gets to the endpoint at all is the puzzle. The decorator shouldn't let it get that far.

[BUG] test_rate_limiter.py: fixture 'max_requests' not found

========================================== ERRORS ===========================================
_____________________ ERROR at setup of test_rate_limiter_logs_warnings _____________________
file /home/v/vswarms-cloud/tests/test_rate_limiter.py, line 65
def test_rate_limiter_logs_warnings(max_requests: int, time_span: int):
E fixture 'max_requests' not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, mock_time, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/v/vswarms-cloud/tests/test_rate_limiter.py:65
__________________ ERROR at setup of test_rate_limiter_catches_exceptions ___________________
file /home/v/vswarms-cloud/tests/test_rate_limiter.py, line 88
def test_rate_limiter_catches_exceptions(max_requests: int, time_span: int, mock_time):
E fixture 'max_requests' not found

  available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, mock_time, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
  use 'pytest --fixtures [testpath]' for help on them.

/home/v/vswarms-cloud/tests/test_rate_limiter.py:88

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

[BUG] assertion typo test_api_generator

From within a container, python 3.10.13

pytest test_api_generator.py 
================================ test session starts ================================
platform linux -- Python 3.10.13, pytest-7.4.3, pluggy-1.3.0
rootdir: /usr/src/swarm_cloud/tests
plugins: time-machine-2.13.0, anyio-3.7.1
collected 18 items                                                                  

test_api_generator.py F...F...EF.F.F...F                                      [100%]
===================================== FAILURES ======================================
___________________________ test_generate_api_key_default ___________________________

    def test_generate_api_key_default():
        api_key = generate_api_key()
        assert isinstance(api_key, str)
        assert api_key.startswith("sk-")
>       assert len(api_key) == 52  # Prefix (3) + 50 random characters
E       AssertionError: assert 53 == 52
E        +  where 53 = len('sk-Q1tO3ZJiS64yZ19CtVrGpzhaG5uz28U5q7la4GFzTwUCxnGakD')

test_api_generator.py:13: AssertionError

The fix is:

def test_generate_api_key_default():
    ...
    assert len(api_key) == 53  # Prefix (3) + 50 random characters

Replace 52 with 53 in the key length assertion.

[BUG] [Dockerfile][cogvlm.py] raise ValueError(f"Expected a cuda device, but got: {device}") ValueError: Expected a cuda device, but got: cpu

CUDA Version 12.1.1

Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

This container image and its contents are governed by the NVIDIA Deep Learning Container License.
By pulling and using the container, you accept the terms and conditions of this license:
https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license

A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience.

WARNING: The NVIDIA Driver was not detected.  GPU functionality will not be available.
   Use the NVIDIA Container Toolkit to start this container with GPU support; see
   https://docs.nvidia.com/datacenter/cloud-native/ .

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/__main__.py", line 4, in <module>
    uvicorn.main()
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/main.py", line 409, in main
    run(
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/main.py", line 575, in run
    server.run()
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/server.py", line 62, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/server.py", line 69, in serve
    config.load()
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/config.py", line 433, in load
    self.loaded_app = import_from_string(self.app)
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/importer.py", line 19, in import_from_string
    module = importlib.import_module(module_str)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/swarms-cloud/servers/cogvlm.py", line 34, in <module>
    with torch.cuda.device(DEVICE):
  File "/usr/local/lib/python3.10/dist-packages/torch/cuda/__init__.py", line 366, in __init__
    self.idx = _get_device_index(device, optional=True)
  File "/usr/local/lib/python3.10/dist-packages/torch/cuda/_utils.py", line 35, in _get_device_index
    raise ValueError(f"Expected a cuda device, but got: {device}")
ValueError: Expected a cuda device, but got: cpu
(base) kye@api:~/swarms-cloud$ 

[BUG] invalid test test_generate_api_key_invalid_prefix_type - should be removed

From within a container, python 3.10.13

pytest test_api_generator.py 
================================ test session starts ================================
platform linux -- Python 3.10.13, pytest-7.4.3, pluggy-1.3.0
rootdir: /usr/src/swarm_cloud/tests
plugins: time-machine-2.13.0, anyio-3.7.1
collected 18 items                                                                  

test_api_generator.py F...F...EF.F.F...F                                      [100%]
===================================== FAILURES ======================================
_____________________ test_generate_api_key_invalid_prefix_type _____________________

    def test_generate_api_key_invalid_prefix_type():
        with pytest.raises(ValueError):
>           generate_api_key(prefix=123)

This test is expecting to receive a value error for generating an api key with prefix 123. But, there is no standards for the values that an API key can take, so this test will never raise a Value Error, and should be removed.

[BUG] ModuleNotFoundError: No module named 'supabase' | ModuleNotFoundError: No module named 'sky'

CLIENT: Server listening on port 33823...
Received JSON data in run script
Error: No test ids received from stdin, could be an error or a run request without ids provided.
Running pytest with no test ids as args. Args being used: ['--rootdir', '/home/v/swarms-cloud']
============================= test session starts ==============================
platform linux -- Python 3.10.12, pytest-7.4.2, pluggy-1.3.0
rootdir: /home/v/swarms-cloud
plugins: anyio-3.7.1
collected 39 items / 2 errors

==================================== ERRORS ====================================
______________________ ERROR collecting tests/test_sky.py ______________________
ImportError while importing test module '/home/v/swarms-cloud/tests/test_sky.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_sky.py:2: in
from swarms_cloud.sky_api import SkyInterface
swarms_cloud/sky_api.py:1: in
import sky
E ModuleNotFoundError: No module named 'sky'
_________________ ERROR collecting tests/test_supabase_pro.py __________________
ImportError while importing test module '/home/v/swarms-cloud/tests/test_supabase_pro.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_supabase_pro.py:4: in
from supabase import Client
E ModuleNotFoundError: No module named 'supabase'
=============================== warnings summary ===============================
../.local/lib/python3.10/site-packages/PyPDF2/init.py:21
/home/v/.local/lib/python3.10/site-packages/PyPDF2/init.py:21: DeprecationWarning: PyPDF2 is deprecated. Please move to the pypdf library instead.
warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
ERROR tests/test_sky.py
ERROR tests/test_supabase_pro.py
!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!
========================= 1 warning, 2 errors in 2.41s =========================
Finished running tests!

[BUG] ImportError: cannot import name 'ClusterOwnerIdentitiesMismatchError'

CLIENT: Server listening on port 37931...
Received JSON data in run script
Error: No test ids received from stdin, could be an error or a run request without ids provided.
Running pytest with no test ids as args. Args being used: ['--rootdir', '/home/v/swarms-cloud']
============================= test session starts ==============================
platform linux -- Python 3.10.12, pytest-7.4.2, pluggy-1.3.0
rootdir: /home/v/swarms-cloud
plugins: anyio-3.7.1
collected 45 items / 1 error

==================================== ERRORS ====================================
______________________ ERROR collecting tests/test_sky.py ______________________
ImportError while importing test module '/home/v/swarms-cloud/tests/test_sky.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_sky.py:2: in
from swarms_cloud.sky_api import SkyInterface
swarms_cloud/sky_api.py:2: in
from sky.exceptions import (
E ImportError: cannot import name 'ClusterOwnerIdentitiesMismatchError' from 'sky.exceptions' (/home/v/.local/lib/python3.10/site-packages/sky/exceptions.py)
=============================== warnings summary ===============================
../.local/lib/python3.10/site-packages/PyPDF2/init.py:21
/home/v/.local/lib/python3.10/site-packages/PyPDF2/init.py:21: DeprecationWarning: PyPDF2 is deprecated. Please move to the pypdf library instead.
warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
ERROR tests/test_sky.py
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
========================= 1 warning, 1 error in 2.52s ==========================
Finished running tests!

[BUG] signup workflow comments

Signup does not mention that there will be an email to the account to verify.

The email comes from Kye Gomez, not a service account address. (verify@swarms.....)

After the email verification, The account information should be on a single page if possible. Multiple pages each increase the likelihood of bailing out of signup.
The job title should have 'Other' (with a brief text field), 'Founder', 'Entrepreneur'

Oauth2 should be added, soon.

The pricing is too hidden.

Billing information should be a top level menu, not hidden under 'settings'
Account
Billing
Organizations
Settings
Dark mode/light mode (for example)

Dashboard should be the landing page after the account creation, not what it is now (I don't remember what it is). The three buttons in this popup take you away from dashboard. Dashboard should be re-done to have these three buttons at the top.
Screenshot from 2024-05-01 12-10-42

[BUG] E ModuleNotFoundError: No module named 'model'

CLIENT: Server listening on port 43725...
Received JSON data in run script
Error: No test ids received from stdin, could be an error or a run request without ids provided.
Running pytest with no test ids as args. Args being used: ['--rootdir', '/home/v/swarms-cloud']
============================= test session starts ==============================
platform linux -- Python 3.10.12, pytest-7.4.2, pluggy-1.3.0
rootdir: /home/v/swarms-cloud
plugins: anyio-3.7.1
collected 5 items / 5 errors

==================================== ERRORS ====================================
_______________ ERROR collecting tests/test_agent_api_wrapper.py _______________
ImportError while importing test module '/home/v/swarms-cloud/tests/test_agent_api_wrapper.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_agent_api_wrapper.py:5: in
from swarms_cloud.main import agent_api_wrapper
swarms_cloud/init.py:3: in
from swarms_cloud.func_api_wrapper import api_wrapper, FuncAPIWrapper
swarms_cloud/func_api_wrapper.py:3: in
import model
E ModuleNotFoundError: No module named 'model'
_________________ ERROR collecting tests/test_api_generator.py _________________
ImportError while importing test module '/home/v/swarms-cloud/tests/test_api_generator.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_api_generator.py:7: in
from swarms_cloud.api_key_generator import generate_api_key
swarms_cloud/init.py:3: in
from swarms_cloud.func_api_wrapper import api_wrapper, FuncAPIWrapper
swarms_cloud/func_api_wrapper.py:3: in
import model
E ModuleNotFoundError: No module named 'model'
_________________ ERROR collecting tests/test_func_wrapper.py __________________
ImportError while importing test module '/home/v/swarms-cloud/tests/test_func_wrapper.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_func_wrapper.py:5: in
from swarms_cloud import FuncAPIWrapper, api_wrapper
swarms_cloud/init.py:3: in
from swarms_cloud.func_api_wrapper import api_wrapper, FuncAPIWrapper
swarms_cloud/func_api_wrapper.py:3: in
import model
E ModuleNotFoundError: No module named 'model'
______________________ ERROR collecting tests/test_sky.py ______________________
ImportError while importing test module '/home/v/swarms-cloud/tests/test_sky.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_sky.py:2: in
from swarms_cloud.sky_api import SkyInterface
swarms_cloud/init.py:3: in
from swarms_cloud.func_api_wrapper import api_wrapper, FuncAPIWrapper
swarms_cloud/func_api_wrapper.py:3: in
import model
E ModuleNotFoundError: No module named 'model'
_________________ ERROR collecting tests/test_supabase_pro.py __________________
ImportError while importing test module '/home/v/swarms-cloud/tests/test_supabase_pro.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_supabase_pro.py:5: in
from swarms_cloud.supabase_handler import SwarmCloudUsageLogger
swarms_cloud/init.py:3: in
from swarms_cloud.func_api_wrapper import api_wrapper, FuncAPIWrapper
swarms_cloud/func_api_wrapper.py:3: in
import model
E ModuleNotFoundError: No module named 'model'
=============================== warnings summary ===============================
../.local/lib/python3.10/site-packages/PyPDF2/init.py:21
/home/v/.local/lib/python3.10/site-packages/PyPDF2/init.py:21: DeprecationWarning: PyPDF2 is deprecated. Please move to the pypdf library instead.
warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
ERROR tests/test_agent_api_wrapper.py
ERROR tests/test_api_generator.py
ERROR tests/test_func_wrapper.py
ERROR tests/test_sky.py
ERROR tests/test_supabase_pro.py
!!!!!!!!!!!!!!!!!!! Interrupted: 5 errors during collection !!!!!!!!!!!!!!!!!!!!
========================= 1 warning, 5 errors in 1.68s =========================
Finished running tests!

[BUG]

Describe the bug
Error running project in container

(base) kye@api:~/swarms-cloud$ docker run --gpus all -p 8000:8000 newcogvlm
/usr/local/lib/python3.10/dist-packages/pydantic/_internal/_fields.py:151: UserWarning: Field "model_id" has conflict with protected namespace "model_".

You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.
  warnings.warn(
A new version of the following files was downloaded from https://huggingface.co/THUDM/cogvlm-chat-hf:
- configuration_cogvlm.py
. Make sure to double-check they do not contain any added malicious code. To avoid downloading new versions of the code file, you can pin a revision.
A new version of the following files was downloaded from https://huggingface.co/THUDM/cogvlm-chat-hf:
- visual.py
. Make sure to double-check they do not contain any added malicious code. To avoid downloading new versions of the code file, you can pin a revision.
A new version of the following files was downloaded from https://huggingface.co/THUDM/cogvlm-chat-hf:
- modeling_cogvlm.py
- visual.py
. Make sure to double-check they do not contain any added malicious code. To avoid downloading new versions of the code file, you can pin a revision.
========Use torch type as:torch.bfloat16 with device:cuda========


Downloading shards: 100%|██████████| 8/8 [05:07<00:00, 38.50s/it]
Loading checkpoint shards: 100%|██████████| 8/8 [00:05<00:00,  1.42it/s]
INFO:     Started server process [1]
INFO:     Waiting for application startup.
ERROR:    Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 734, in lifespan
    async with self.lifespan_context(app) as maybe_state:
  File "/usr/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
TypeError: 'coroutine' object is not an async iterator

/usr/local/lib/python3.10/dist-packages/uvicorn/lifespan/on.py:91: RuntimeWarning: coroutine 'lifespan' was never awaited
  return
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
ERROR:    Application startup failed. Exiting.

the whole message i even set all gpus```

[BUG] [Servers] [Qwen VL]

1 06:25:58.936 | DEBUG    | __main__:generate_stream_cogvlm:430 - ==== request ====
Describe what is in the image
INFO:     72.218.151.51:49747 - "POST /v1/chat/completions HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/home/kye/miniconda3/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 419, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kye/miniconda3/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kye/miniconda3/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/home/kye/miniconda3/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/kye/miniconda3/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "/home/kye/miniconda3/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "/home/kye/miniconda3/lib/python3.11/site-packages/starlette/middleware/cors.py", line 83, in __call__
    await self.app(scope, receive, send)
  File "/home/kye/miniconda3/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/home/kye/miniconda3/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/home/kye/miniconda3/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/home/kye/miniconda3/lib/python3.11/site-packages/starlette/routing.py", line 758, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/kye/miniconda3/lib/python3.11/site-packages/starlette/routing.py", line 778, in app
    await route.handle(scope, receive, send)
  File "/home/kye/miniconda3/lib/python3.11/site-packages/starlette/routing.py", line 299, in handle
    await self.app(scope, receive, send)
  File "/home/kye/miniconda3/lib/python3.11/site-packages/starlette/routing.py", line 79, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/home/kye/miniconda3/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/home/kye/miniconda3/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/home/kye/miniconda3/lib/python3.11/site-packages/starlette/routing.py", line 74, in app
    response = await func(request)
               ^^^^^^^^^^^^^^^^^^^
  File "/home/kye/miniconda3/lib/python3.11/site-packages/fastapi/routing.py", line 299, in app
    raise e
  File "/home/kye/miniconda3/lib/python3.11/site-packages/fastapi/routing.py", line 294, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kye/miniconda3/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kye/swarms-cloud/servers/qwen_api_openai_compatible.py", line 234, in create_chat_completion
    response = generate_cogvlm(model, tokenizer, gen_params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kye/swarms-cloud/servers/qwen_api_openai_compatible.py", line 349, in generate_cogvlm
    for response in generate_stream_cogvlm(model, tokenizer, params):
  File "/home/kye/miniconda3/lib/python3.11/site-packages/torch/utils/_contextlib.py", line 35, in generator_context
    response = gen.send(None)
               ^^^^^^^^^^^^^^
  File "/home/kye/swarms-cloud/servers/qwen_api_openai_compatible.py", line 432, in generate_stream_cogvlm
    input_by_model = model.build_conversation_input_ids(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kye/miniconda3/lib/python3.11/site-packages/torch/nn/modules/module.py", line 1688, in __getattr__
    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'QWenLMHeadModel' object has no attribute 'build_conversation_input_ids'

[BUG] ECS Container Missing Attribute

Describe the bug
service my-app-service2 was unable to place a task because no container instance met all of its requirements. The closest matching container-instance 476c4f3985624ef195cfa2ac13e78099 is missing an attribute required by your task. For more information, see the Troubleshooting section of the Amazon ECS Developer Guide.

To Reproduce
Steps to reproduce the behavior:

  1. Go to main.tf
  2. terraform apply
  3. Check cluster events
  4. Container is missing attribute

Expected behavior
Expected to run task to download and run docker image

Additional context
Any container I run is missing an attribute for the task

[BUG] invalid test test_generate_api_key_unexpected_error - test should be removed

From within a container, python 3.10.13

pytest test_api_generator.py 
================================ test session starts ================================
platform linux -- Python 3.10.13, pytest-7.4.3, pluggy-1.3.0
rootdir: /usr/src/swarm_cloud/tests
plugins: time-machine-2.13.0, anyio-3.7.1
collected 18 items                                                                  

test_api_generator.py F...F...EF.F.F...F                                      [100%]
===================================== FAILURES ======================================

______________________ test_generate_api_key_unexpected_error _______________________

    def test_generate_api_key_unexpected_error():
>       with pytest.raises(RuntimeError):
E       Failed: DID NOT RAISE <class 'RuntimeError'>

test_api_generator.py:34: Failed

This test is trying to create a runtime error by creating a key of length 100000. I think it doesn't make sense and should be deleted. An unexpected api key will be discovered when it isn't valid at the api call

[BUG] ModuleNotFoundError: No module named 'modal'

CLIENT: Server listening on port 35899...
Received JSON data in run script
Error: No test ids received from stdin, could be an error or a run request without ids provided.
Running pytest with no test ids as args. Args being used: ['--rootdir', '/home/v/swarms-cloud']
============================= test session starts ==============================
platform linux -- Python 3.10.12, pytest-7.4.2, pluggy-1.3.0
rootdir: /home/v/swarms-cloud
plugins: anyio-3.7.1
collected 5 items / 5 errors

==================================== ERRORS ====================================
_______________ ERROR collecting tests/test_agent_api_wrapper.py _______________
ImportError while importing test module '/home/v/swarms-cloud/tests/test_agent_api_wrapper.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_agent_api_wrapper.py:5: in
from swarms_cloud.main import agent_api_wrapper
swarms_cloud/init.py:3: in
from swarms_cloud.func_api_wrapper import api_wrapper, FuncAPIWrapper
swarms_cloud/func_api_wrapper.py:3: in
import modal
E ModuleNotFoundError: No module named 'modal'
_________________ ERROR collecting tests/test_api_generator.py _________________
ImportError while importing test module '/home/v/swarms-cloud/tests/test_api_generator.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_api_generator.py:7: in
from swarms_cloud.api_key_generator import generate_api_key
swarms_cloud/init.py:3: in
from swarms_cloud.func_api_wrapper import api_wrapper, FuncAPIWrapper
swarms_cloud/func_api_wrapper.py:3: in
import modal
E ModuleNotFoundError: No module named 'modal'
_________________ ERROR collecting tests/test_func_wrapper.py __________________
ImportError while importing test module '/home/v/swarms-cloud/tests/test_func_wrapper.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_func_wrapper.py:5: in
from swarms_cloud import FuncAPIWrapper, api_wrapper
swarms_cloud/init.py:3: in
from swarms_cloud.func_api_wrapper import api_wrapper, FuncAPIWrapper
swarms_cloud/func_api_wrapper.py:3: in
import modal
E ModuleNotFoundError: No module named 'modal'
______________________ ERROR collecting tests/test_sky.py ______________________
ImportError while importing test module '/home/v/swarms-cloud/tests/test_sky.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_sky.py:2: in
from swarms_cloud.sky_api import SkyInterface
swarms_cloud/init.py:3: in
from swarms_cloud.func_api_wrapper import api_wrapper, FuncAPIWrapper
swarms_cloud/func_api_wrapper.py:3: in
import modal
E ModuleNotFoundError: No module named 'modal'
_________________ ERROR collecting tests/test_supabase_pro.py __________________
ImportError while importing test module '/home/v/swarms-cloud/tests/test_supabase_pro.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_supabase_pro.py:5: in
from swarms_cloud.supabase_handler import SwarmCloudUsageLogger
swarms_cloud/init.py:3: in
from swarms_cloud.func_api_wrapper import api_wrapper, FuncAPIWrapper
swarms_cloud/func_api_wrapper.py:3: in
import modal
E ModuleNotFoundError: No module named 'modal'
=============================== warnings summary ===============================
../.local/lib/python3.10/site-packages/PyPDF2/init.py:21
/home/v/.local/lib/python3.10/site-packages/PyPDF2/init.py:21: DeprecationWarning: PyPDF2 is deprecated. Please move to the pypdf library instead.
warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
ERROR tests/test_agent_api_wrapper.py
ERROR tests/test_api_generator.py
ERROR tests/test_func_wrapper.py
ERROR tests/test_sky.py
ERROR tests/test_supabase_pro.py
!!!!!!!!!!!!!!!!!!! Interrupted: 5 errors during collection !!!!!!!!!!!!!!!!!!!!
========================= 1 warning, 5 errors in 1.76s =========================
Finished running tests!

[BUG] ModuleNotFoundError: No module named 'swarm_cloud'

CLIENT: Server listening on port 41489...
Received JSON data in run script
Error: No test ids received from stdin, could be an error or a run request without ids provided.
Running pytest with no test ids as args. Args being used: ['--rootdir', '/home/v/swarms-cloud']
============================= test session starts ==============================
platform linux -- Python 3.10.12, pytest-7.4.2, pluggy-1.3.0
rootdir: /home/v/swarms-cloud
plugins: anyio-3.7.1
collected 39 items / 2 errors

==================================== ERRORS ====================================
______________________ ERROR collecting tests/test_sky.py ______________________
ImportError while importing test module '/home/v/swarms-cloud/tests/test_sky.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_sky.py:2: in
from swarms_cloud.sky_api import SkyInterface
swarms_cloud/sky_api.py:2: in
from sky.exceptions import (
E ImportError: cannot import name 'ClusterOwnerIdentitiesMismatchError' from 'sky.exceptions' (/home/v/.local/lib/python3.10/site-packages/sky/exceptions.py)
_________________ ERROR collecting tests/test_supabase_pro.py __________________
ImportError while importing test module '/home/v/swarms-cloud/tests/test_supabase_pro.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/init.py:126: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/test_supabase_pro.py:5: in
from swarm_cloud.supabase_handler import SwarmCloudUsageLogger
E ModuleNotFoundError: No module named 'swarm_cloud'
=============================== warnings summary ===============================
../.local/lib/python3.10/site-packages/PyPDF2/init.py:21
/home/v/.local/lib/python3.10/site-packages/PyPDF2/init.py:21: DeprecationWarning: PyPDF2 is deprecated. Please move to the pypdf library instead.
warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
ERROR tests/test_sky.py
ERROR tests/test_supabase_pro.py
!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!
========================= 1 warning, 2 errors in 2.05s =========================
Finished running tests!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.