├── example.py ├── package ├── main.py ├── __init__.py └── subfolder │ ├── main.py │ └── __init__.py ├── docs ├── applications │ ├── enterprise.md │ ├── customer_support.md │ └── marketing_agencies.md ├── .DS_Store ├── zeta │ ├── .DS_Store │ ├── index.md │ ├── nn │ │ ├── attention │ │ │ ├── base.md │ │ │ ├── flash_attention.md │ │ │ ├── multihead.md │ │ │ ├── multiquery.md │ │ │ └── flash2.md │ │ ├── biases │ │ │ ├── alibi.md │ │ │ ├── relative_bias.md │ │ │ └── xpos.md │ │ ├── utils │ │ │ └── helpers.md │ │ ├── embeddings │ │ │ ├── multiway.md │ │ │ ├── rope.md │ │ │ └── truncated_rope.md │ │ ├── architecture │ │ │ ├── decoder.md │ │ │ └── transformer.md │ │ └── modules │ │ │ ├── lora.md │ │ │ └── token_learner.md │ ├── tokenizers │ │ ├── language_tokenizer.md │ │ ├── multi_modal_tokenizer.md │ │ └── sentencepiece.md │ └── training │ │ ├── optimizers │ │ ├── sophia.md │ │ └── decoupled_lion.md │ │ ├── train.md │ │ └── nebula.md ├── assets │ ├── img │ │ ├── tools │ │ │ ├── toml.png │ │ │ ├── output.png │ │ │ └── poetry_setup.png │ │ ├── zetascale.png │ │ ├── swarmsbanner.png │ │ └── SwarmsLogoIcon.png │ └── css │ │ └── extra.css ├── demos.md ├── stylesheets │ └── extra.css ├── architecture.md ├── metric.md ├── overrides │ └── main.html ├── examples │ ├── index.md │ ├── query-webpage.md │ ├── count-tokens.md │ ├── talk-to-a-pdf.md │ ├── talk-to-a-webpage.md │ ├── load-and-query-pinecone.md │ ├── load-query-and-chat-marqo.md │ ├── talk-to-redshift.md │ ├── store-conversation-memory-in-dynamodb.md │ └── using-text-generation-web-ui.md ├── index.md ├── purpose.md ├── hiring.md ├── faq.md ├── contributing.md ├── bounties.md ├── roadmap.md └── flywheel.md ├── requirements.txt ├── scripts ├── tests.sh ├── test_name.sh ├── code_quality.sh └── merge_all_prs.sh ├── agorabanner.png ├── .github ├── workflows │ ├── ruff.yml │ ├── pull-request-links.yml │ ├── docs.yml │ ├── lints.yml │ ├── testing.yml │ ├── quality.yml │ ├── pr_request_checks.yml │ ├── label.yml │ ├── run_test.yml │ ├── welcome.yml │ ├── pylint.yml │ ├── docs_test.yml │ ├── unit-test.yml │ ├── python-publish.yml │ ├── code_quality_control.yml │ ├── stale.yml │ ├── cos_integration.yml │ └── test.yml ├── dependabot.yml ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── FUNDING.yml ├── PULL_REQUEST_TEMPLATE.yml └── labeler.yml ├── .readthedocs.yml ├── .pre-commit-config.yaml ├── Dockerfile ├── Makefile ├── LICENSE ├── pyproject.toml ├── README.md ├── .gitignore └── mkdocs.yml /example.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /package/main.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /package/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /package/subfolder/main.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/applications/enterprise.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /package/subfolder/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | torch 2 | zetascale 3 | swarms 4 | -------------------------------------------------------------------------------- /scripts/tests.sh: -------------------------------------------------------------------------------- 1 | find ./tests -name '*.py' -exec pytest {} \; -------------------------------------------------------------------------------- /agorabanner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyegomez/Python-Package-Template/HEAD/agorabanner.png -------------------------------------------------------------------------------- /docs/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyegomez/Python-Package-Template/HEAD/docs/.DS_Store -------------------------------------------------------------------------------- /docs/zeta/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyegomez/Python-Package-Template/HEAD/docs/zeta/.DS_Store -------------------------------------------------------------------------------- /docs/assets/img/tools/toml.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyegomez/Python-Package-Template/HEAD/docs/assets/img/tools/toml.png -------------------------------------------------------------------------------- /docs/assets/img/zetascale.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyegomez/Python-Package-Template/HEAD/docs/assets/img/zetascale.png -------------------------------------------------------------------------------- /docs/assets/img/swarmsbanner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyegomez/Python-Package-Template/HEAD/docs/assets/img/swarmsbanner.png -------------------------------------------------------------------------------- /docs/assets/img/tools/output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyegomez/Python-Package-Template/HEAD/docs/assets/img/tools/output.png -------------------------------------------------------------------------------- /docs/demos.md: -------------------------------------------------------------------------------- 1 | # Demo Ideas 2 | 3 | * GPT-4 4 | * Andromeda 5 | * Kosmos 6 | * LongNet 7 | * Text to video diffusion 8 | * Nebula 9 | -------------------------------------------------------------------------------- /docs/assets/img/SwarmsLogoIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyegomez/Python-Package-Template/HEAD/docs/assets/img/SwarmsLogoIcon.png -------------------------------------------------------------------------------- /docs/stylesheets/extra.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --md-primary-fg-color: #8315F9; 3 | --md-accent-fg-color: #00FFCE; 4 | } -------------------------------------------------------------------------------- /docs/assets/css/extra.css: -------------------------------------------------------------------------------- 1 | .md-typeset__table { 2 | min-width: 100%; 3 | } 4 | 5 | .md-typeset table:not([class]) { 6 | display: table; 7 | } -------------------------------------------------------------------------------- /docs/assets/img/tools/poetry_setup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyegomez/Python-Package-Template/HEAD/docs/assets/img/tools/poetry_setup.png -------------------------------------------------------------------------------- /.github/workflows/ruff.yml: -------------------------------------------------------------------------------- 1 | name: Ruff 2 | on: [ push, pull_request ] 3 | jobs: 4 | ruff: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v4 8 | - uses: chartboost/ruff-action@v1 9 | -------------------------------------------------------------------------------- /docs/architecture.md: -------------------------------------------------------------------------------- 1 | # Architecture 2 | * Simple file structure 3 | * Fluid API 4 | * Useful error handling that provides potential solutions and root cause error understanding 5 | * nn, tokenizers, models, training 6 | * -------------------------------------------------------------------------------- /.readthedocs.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | build: 4 | os: ubuntu-22.04 5 | tools: 6 | python: "3.11" 7 | 8 | mkdocs: 9 | configuration: mkdocs.yml 10 | 11 | python: 12 | install: 13 | - requirements: requirements.txt -------------------------------------------------------------------------------- /scripts/test_name.sh: -------------------------------------------------------------------------------- 1 | find ./tests -name "*.py" -type f | while read file 2 | do 3 | filename=$(basename "$file") 4 | dir=$(dirname "$file") 5 | if [[ $filename != test_* ]]; then 6 | mv "$file" "$dir/test_$filename" 7 | fi 8 | done -------------------------------------------------------------------------------- /docs/metric.md: -------------------------------------------------------------------------------- 1 | # The Golden Metric: 2 | 3 | * We need to figure out a single metric that determines if we're accomplishing our goal with zeta which is to build zetascale superintelligent AI models as fast as possible with minimal code. 4 | 5 | -------------------------------------------------------------------------------- /docs/overrides/main.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | 4 | 5 | {% block announce %} 6 |
7 | Star and contribute to Zeta on GitHub! 8 |
9 | {% endblock %} -------------------------------------------------------------------------------- /docs/examples/index.md: -------------------------------------------------------------------------------- 1 | This section of the documentation is dedicated to examples highlighting Zeta functionality. 2 | 3 | We try to keep all examples up to date, but if you think there is a bug please [submit a pull request](https://github.com/kyegomez/zeta-docs/tree/main/docs/examples). We are also more than happy to include new examples :) -------------------------------------------------------------------------------- /.github/workflows/pull-request-links.yml: -------------------------------------------------------------------------------- 1 | name: readthedocs/actions 2 | on: 3 | pull_request_target: 4 | types: 5 | - opened 6 | paths: 7 | - "docs/**" 8 | 9 | permissions: 10 | pull-requests: write 11 | 12 | jobs: 13 | pull-request-links: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: readthedocs/actions/preview@v1 17 | with: 18 | project-slug: swarms_torch -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates 2 | 3 | version: 2 4 | updates: 5 | - package-ecosystem: "github-actions" 6 | directory: "/" 7 | schedule: 8 | interval: "weekly" 9 | 10 | - package-ecosystem: "pip" 11 | directory: "/" 12 | schedule: 13 | interval: "weekly" 14 | 15 | -------------------------------------------------------------------------------- /.github/workflows/docs.yml: -------------------------------------------------------------------------------- 1 | name: Docs WorkFlow 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | - main 8 | - develop 9 | jobs: 10 | deploy: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | - uses: actions/setup-python@v5 15 | with: 16 | python-version: '3.10' 17 | - run: pip install mkdocs-material 18 | - run: pip install "mkdocstrings[python]" 19 | - run: mkdocs gh-deploy --force -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/ambv/black 3 | rev: 22.3.0 4 | hooks: 5 | - id: black 6 | - repo: https://github.com/charliermarsh/ruff-pre-commit 7 | rev: 'v0.0.255' 8 | hooks: 9 | - id: ruff 10 | args: [--fix] 11 | - repo: https://github.com/nbQA-dev/nbQA 12 | rev: 1.6.3 13 | hooks: 14 | - id: nbqa-black 15 | additional_dependencies: [ipython==8.12, black] 16 | - id: nbqa-ruff 17 | args: ["--ignore=I001"] 18 | additional_dependencies: [ipython==8.12, ruff] -------------------------------------------------------------------------------- /.github/workflows/lints.yml: -------------------------------------------------------------------------------- 1 | name: Linting 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | lint: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout code 14 | uses: actions/checkout@v4 15 | 16 | - name: Set up Python 17 | uses: actions/setup-python@v5 18 | with: 19 | python-version: '3.10' 20 | 21 | - name: Install dependencies 22 | run: pip install --no-cache-dir -r requirements.txt 23 | 24 | - name: Run linters 25 | run: pylint swarms_torch -------------------------------------------------------------------------------- /.github/workflows/testing.yml: -------------------------------------------------------------------------------- 1 | name: Unit Tests 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | test: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout code 14 | uses: actions/checkout@v4 15 | 16 | - name: Set up Python 17 | uses: actions/setup-python@v5 18 | with: 19 | python-version: '3.10' 20 | 21 | - name: Install dependencies 22 | run: pip install --no-cache-dir -r requirements.txt 23 | 24 | - name: Run unit tests 25 | run: pytest tests/ -------------------------------------------------------------------------------- /docs/examples/query-webpage.md: -------------------------------------------------------------------------------- 1 | ```python 2 | from zeta.artifacts import BaseArtifact 3 | from zeta.drivers import LocalVectorStoreDriver 4 | from zeta.loaders import WebLoader 5 | 6 | 7 | vector_store = LocalVectorStoreDriver() 8 | 9 | [ 10 | vector_store.upsert_text_artifact(a, namespace="zeta") 11 | for a in WebLoader(max_tokens=100).load("https://www.zeta.ai") 12 | ] 13 | 14 | results = vector_store.query( 15 | "creativity", 16 | count=3, 17 | namespace="zeta" 18 | ) 19 | 20 | values = [BaseArtifact.from_json(r.meta["artifact"]).value for r in results] 21 | 22 | print("\n\n".join(values)) 23 | ``` -------------------------------------------------------------------------------- /.github/workflows/quality.yml: -------------------------------------------------------------------------------- 1 | name: Quality 2 | 3 | on: 4 | push: 5 | branches: [ "main" ] 6 | pull_request: 7 | branches: [ "main" ] 8 | 9 | jobs: 10 | lint: 11 | runs-on: ubuntu-latest 12 | strategy: 13 | fail-fast: false 14 | steps: 15 | - name: Checkout actions 16 | uses: actions/checkout@v4 17 | with: 18 | fetch-depth: 0 19 | - name: Init environment 20 | uses: ./.github/actions/init-environment 21 | - name: Run linter 22 | run: | 23 | pylint `git diff --name-only --diff-filter=d origin/main HEAD | grep -E '\.py$' | tr '\n' ' '` -------------------------------------------------------------------------------- /.github/workflows/pr_request_checks.yml: -------------------------------------------------------------------------------- 1 | name: Pull Request Checks 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | test: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout code 14 | uses: actions/checkout@v4 15 | 16 | - name: Set up Python 17 | uses: actions/setup-python@v5 18 | with: 19 | python-version: '3.10' 20 | 21 | - name: Install dependencies 22 | run: pip install --no-cache-dir -r requirements.txt 23 | 24 | - name: Run tests and checks 25 | run: | 26 | pytest tests/ 27 | pylint swarms_torch -------------------------------------------------------------------------------- /.github/workflows/label.yml: -------------------------------------------------------------------------------- 1 | # This workflow will triage pull requests and apply a label based on the 2 | # paths that are modified in the pull request. 3 | # 4 | # To use this workflow, you will need to set up a .github/labeler.yml 5 | # file with configuration. For more information, see: 6 | # https://github.com/actions/labeler 7 | 8 | name: Labeler 9 | on: [pull_request_target] 10 | 11 | jobs: 12 | label: 13 | 14 | runs-on: ubuntu-latest 15 | permissions: 16 | contents: read 17 | pull-requests: write 18 | 19 | steps: 20 | - uses: actions/labeler@v5.0.0 21 | with: 22 | repo-token: "${{ secrets.GITHUB_TOKEN }}" 23 | -------------------------------------------------------------------------------- /.github/workflows/run_test.yml: -------------------------------------------------------------------------------- 1 | name: Python application test 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - uses: actions/checkout@v4 12 | - name: Set up Python 3.10 13 | uses: actions/setup-python@v5 14 | with: 15 | python-version: '3.10' 16 | - name: Install dependencies 17 | run: | 18 | python -m pip install --no-cache-dir --upgrade pip 19 | pip install pytest 20 | if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; fi 21 | - name: Run tests with pytest 22 | run: | 23 | pytest tests/ 24 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | # Zeta Docs 2 | 3 | Welcome to Zeta's Documentation! 4 | 5 | Zeta is a modular framework that enables for seamless, reliable, and fluid creation of zetascale AI models. 6 | 7 | ## Zeta 8 | 9 | 10 | 11 | Zeta provides you with reliable, high performance, and fast modular building blocks for building zeta scale neural nets at lightspeed with minimal code and a pythonic API. 12 | 13 | [Click here for Zeta Documentation →](zeta/) 14 | 15 | 16 | ## Examples 17 | 18 | Check out Zeta examples for building agents, data retrieval, and more. 19 | 20 | [Checkout Zeta examples →](examples/) 21 | -------------------------------------------------------------------------------- /.github/workflows/welcome.yml: -------------------------------------------------------------------------------- 1 | name: Welcome WorkFlow 2 | 3 | on: 4 | issues: 5 | types: [opened] 6 | pull_request_target: 7 | types: [opened] 8 | 9 | jobs: 10 | build: 11 | name: 👋 Welcome 12 | permissions: write-all 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/first-interaction@v1.3.0 16 | with: 17 | repo-token: ${{ secrets.GITHUB_TOKEN }} 18 | issue-message: "Hello there, thank you for opening an Issue ! 🙏🏻 The team was notified and they will get back to you asap." 19 | pr-message: "Hello there, thank you for opening an PR ! 🙏🏻 The team was notified and they will get back to you asap." -------------------------------------------------------------------------------- /.github/workflows/pylint.yml: -------------------------------------------------------------------------------- 1 | name: Pylint 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | strategy: 9 | matrix: 10 | python-version: ["3.9", "3.10"] 11 | steps: 12 | - uses: actions/checkout@v4 13 | - name: Set up Python ${{ matrix.python-version }} 14 | uses: actions/setup-python@v5 15 | with: 16 | python-version: ${{ matrix.python-version }} 17 | - name: Install dependencies 18 | run: | 19 | python -m pip install --no-cache-dir --upgrade pip 20 | pip install pylint 21 | - name: Analysing the code with pylint 22 | run: | 23 | pylint $(git ls-files '*.py') 24 | -------------------------------------------------------------------------------- /.github/workflows/docs_test.yml: -------------------------------------------------------------------------------- 1 | name: Documentation Tests 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | test: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout code 14 | uses: actions/checkout@v4 15 | 16 | - name: Set up Python 17 | uses: actions/setup-python@v5 18 | with: 19 | python-version: '3.10' 20 | 21 | - name: Install dependencies 22 | run: pip install --no-cache-dir -r requirements.txt 23 | 24 | - name: Build documentation 25 | run: make docs 26 | 27 | - name: Validate documentation 28 | run: sphinx-build -b linkcheck docs build/docs -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: 'kyegomez' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [kyegomez] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: #Nothing 14 | -------------------------------------------------------------------------------- /docs/examples/count-tokens.md: -------------------------------------------------------------------------------- 1 | To count tokens you can use Zeta events and the `TokenCounter` util: 2 | 3 | ```python 4 | from zeta import utils 5 | from zeta.events import ( 6 | StartPromptEvent, FinishPromptEvent, 7 | ) 8 | from zeta.structures import Agent 9 | 10 | 11 | token_counter = utils.TokenCounter() 12 | 13 | agent = Agent( 14 | event_listeners={ 15 | StartPromptEvent: [ 16 | lambda e: token_counter.add_tokens(e.token_count) 17 | ], 18 | FinishPromptEvent: [ 19 | lambda e: token_counter.add_tokens(e.token_count) 20 | ], 21 | } 22 | ) 23 | 24 | agent.run("tell me about large language models") 25 | agent.run("tell me about GPT") 26 | 27 | print(f"total tokens: {token_counter.tokens}") 28 | 29 | ``` -------------------------------------------------------------------------------- /.github/workflows/unit-test.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | 11 | build: 12 | 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - uses: actions/checkout@v4 17 | 18 | - name: Setup Python 19 | uses: actions/setup-python@v5 20 | with: 21 | python-version: '3.10' 22 | 23 | - name: Install dependencies 24 | run: pip install --no-cache-dir -r requirements.txt 25 | 26 | - name: Run Python unit tests 27 | run: python3 -m unittest tests/ 28 | 29 | - name: Verify that the Docker image for the action builds 30 | run: docker build . --file Dockerfile 31 | 32 | - name: Verify integration test results 33 | run: python3 -m unittest tests/ 34 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a detailed report on the bug and it's root cause. Conduct root cause error analysis 4 | title: "[BUG] " 5 | labels: bug 6 | assignees: kyegomez 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is and what the main root cause error is. Test very thoroughly before submitting. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Additional context** 27 | Add any other context about the problem here. 28 | -------------------------------------------------------------------------------- /.github/workflows/python-publish.yml: -------------------------------------------------------------------------------- 1 | 2 | name: Upload Python Package 3 | 4 | on: 5 | release: 6 | types: [published] 7 | 8 | permissions: 9 | contents: read 10 | 11 | jobs: 12 | deploy: 13 | 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v4 18 | - name: Set up Python 19 | uses: actions/setup-python@v5 20 | with: 21 | python-version: '3.10' 22 | - name: Install dependencies 23 | run: | 24 | python -m pip install --no-cache-dir --upgrade pip 25 | pip install build 26 | - name: Build package 27 | run: python -m build 28 | - name: Publish package 29 | uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 30 | with: 31 | user: __token__ 32 | password: ${{ secrets.PYPI_API_TOKEN }} -------------------------------------------------------------------------------- /.github/workflows/code_quality_control.yml: -------------------------------------------------------------------------------- 1 | name: Linting and Formatting 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | lint_and_format: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout code 14 | uses: actions/checkout@v4 15 | 16 | - name: Set up Python 17 | uses: actions/setup-python@v5 18 | with: 19 | python-version: '3.10' 20 | 21 | - name: Install dependencies 22 | run: pip install --no-cache-dir -r requirements.txt 23 | 24 | - name: Find Python files 25 | run: find swarms_torch -name "*.py" -type f -exec autopep8 --in-place --aggressive --aggressive {} + 26 | 27 | - name: Push changes 28 | uses: ad-m/github-push-action@master 29 | with: 30 | github_token: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | # This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. 2 | # 3 | # You can adjust the behavior by modifying this file. 4 | # For more information, see: 5 | # https://github.com/actions/stale 6 | name: Mark stale issues and pull requests 7 | 8 | on: 9 | schedule: 10 | - cron: '26 12 * * *' 11 | 12 | jobs: 13 | stale: 14 | 15 | runs-on: ubuntu-latest 16 | permissions: 17 | issues: write 18 | pull-requests: write 19 | 20 | steps: 21 | - uses: actions/stale@v9 22 | with: 23 | repo-token: ${{ secrets.GITHUB_TOKEN }} 24 | stale-issue-message: 'Stale issue message' 25 | stale-pr-message: 'Stale pull request message' 26 | stale-issue-label: 'no-issue-activity' 27 | stale-pr-label: 'no-pr-activity' -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # ================================== 2 | # Use an official Python runtime as a parent image 3 | FROM python:3.10-slim 4 | RUN apt-get update && apt-get -y install libgl1-mesa-dev libglib2.0-0 build-essential; apt-get clean 5 | RUN pip install opencv-contrib-python-headless 6 | 7 | # Set environment variables 8 | ENV PYTHONDONTWRITEBYTECODE 1 9 | ENV PYTHONUNBUFFERED 1 10 | 11 | # Set the working directory in the container 12 | WORKDIR /usr/src/zeta 13 | 14 | 15 | # Install Python dependencies 16 | # COPY requirements.txt and pyproject.toml if you're using poetry for dependency management 17 | COPY requirements.txt . 18 | RUN pip install --no-cache-dir --upgrade pip 19 | RUN pip install --no-cache-dir -r requirements.txt 20 | 21 | RUN pip install --no-cache-dir zetascale 22 | 23 | # Copy the rest of the application 24 | COPY . . 25 | 26 | -------------------------------------------------------------------------------- /scripts/code_quality.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Navigate to the directory containing the 'package' folder 4 | # cd /path/to/your/code/directory 5 | 6 | # Run autopep8 with max aggressiveness (-aaa) and in-place modification (-i) 7 | # on all Python files (*.py) under the 'package' directory. 8 | autopep8 --in-place --aggressive --aggressive --recursive --experimental --list-fixes package/ 9 | 10 | # Run black with default settings, since black does not have an aggressiveness level. 11 | # Black will format all Python files it finds in the 'package' directory. 12 | black --experimental-string-processing package/ 13 | 14 | # Run ruff on the 'package' directory. 15 | # Add any additional flags if needed according to your version of ruff. 16 | ruff --unsafe_fix 17 | 18 | # YAPF 19 | yapf --recursive --in-place --verbose --style=google --parallel package 20 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: style check_code_quality 2 | 3 | export PYTHONPATH = . 4 | check_dirs := src 5 | 6 | style: 7 | black $(check_dirs) 8 | isort --profile black $(check_dirs) 9 | 10 | check_code_quality: 11 | black --check $(check_dirs) 12 | isort --check-only --profile black $(check_dirs) 13 | # stop the build if there are Python syntax errors or undefined names 14 | flake8 $(check_dirs) --count --select=E9,F63,F7,F82 --show-source --statistics 15 | # exit-zero treats all errors as warnings. E203 for black, E501 for docstring, W503 for line breaks before logical operators 16 | flake8 $(check_dirs) --count --max-line-length=88 --exit-zero --ignore=D --extend-ignore=E203,E501,W503 --statistics 17 | 18 | publish: 19 | python setup.py sdist bdist_wheel 20 | twine upload -r testpypi dist/* -u ${PYPI_USERNAME} -p ${PYPI_TEST_PASSWORD} --verbose 21 | twine check dist/* 22 | twine upload dist/* -u ${PYPI_USERNAME} -p ${PYPI_PASSWORD} --verbose -------------------------------------------------------------------------------- /scripts/merge_all_prs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check if we are inside a Git repository 4 | if ! git rev-parse --git-dir > /dev/null 2>&1; then 5 | echo "Error: Must be run inside a Git repository." 6 | exit 1 7 | fi 8 | 9 | # Fetch all open pull requests 10 | echo "Fetching open PRs..." 11 | prs=$(gh pr list --state open --json number --jq '.[].number') 12 | 13 | # Check if there are PRs to merge 14 | if [ -z "$prs" ]; then 15 | echo "No open PRs to merge." 16 | exit 0 17 | fi 18 | 19 | echo "Found PRs: $prs" 20 | 21 | # Loop through each pull request number and merge it 22 | for pr in $prs; do 23 | echo "Attempting to merge PR #$pr" 24 | merge_output=$(gh pr merge $pr --auto --merge) 25 | merge_status=$? 26 | if [ $merge_status -ne 0 ]; then 27 | echo "Failed to merge PR #$pr. Error: $merge_output" 28 | else 29 | echo "Successfully merged PR #$pr" 30 | fi 31 | done 32 | 33 | echo "Processing complete." 34 | -------------------------------------------------------------------------------- /.github/workflows/cos_integration.yml: -------------------------------------------------------------------------------- 1 | name: Continuous Integration 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | test: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Checkout code 13 | uses: actions/checkout@v4 14 | 15 | - name: Set up Python 16 | uses: actions/setup-python@v5 17 | with: 18 | python-version: '3.10' 19 | 20 | - name: Install dependencies 21 | run: pip install --no-cache-dir -r requirements.txt 22 | 23 | - name: Run unit tests 24 | run: pytest tests/unit 25 | 26 | - name: Run integration tests 27 | run: pytest tests/integration 28 | 29 | - name: Run code coverage 30 | run: pytest --cov=swarms tests/ 31 | 32 | - name: Run linters 33 | run: pylint swarms 34 | 35 | - name: Build documentation 36 | run: make docs 37 | 38 | - name: Validate documentation 39 | run: sphinx-build -b linkcheck docs build/docs 40 | 41 | - name: Run performance tests 42 | run: pytest tests/performance -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.yml: -------------------------------------------------------------------------------- 1 |