-
Notifications
You must be signed in to change notification settings - Fork 182
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
ci: 👷 release,test-release,dep actions and pyproject.toml added #43
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2219417
ci: 👷 release,test-release,dep actions and pyproject.toml added
onuralpszr 3e1893f
test: 🧪 tox file added for multi version tests locally
onuralpszr 25bfb57
ci: 👷 pytest action added and cosmetic refactor for actions
onuralpszr 734980d
fix: 🐞 add torch before install for flash-attn
onuralpszr 08ce3d4
chore: pyproject.toml and gitignore updated
onuralpszr d1919fc
feat: ✨ simple maestro version command added for quick run check
onuralpszr aa9e9eb
feat: ✨ add CHANGELOG.md and update README.md and pyproject.toml
onuralpszr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: 2 | ||
updates: | ||
# GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
commit-message: | ||
prefix: ⬆️ | ||
# Python | ||
- package-ecosystem: "pip" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
commit-message: | ||
prefix: ⬆️ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
name: Docs WorkFlow | ||
name: 📚 Docs WorkFlow | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
- develop | ||
branches: [main, develop] | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
- name: 🛎️ Checkout | ||
uses: actions/checkout@v3 | ||
- name: 🐍 Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.x | ||
- run: pip install mkdocs-material | ||
- run: pip install "mkdocstrings[python]" | ||
- run: mkdocs gh-deploy --force | ||
- name: 📦 Install dependencies | ||
run: | | ||
pip install mkdocs-material "mkdocstrings[python]" | ||
- name: 🚀 Deploy Docs | ||
run: mkdocs gh-deploy --force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Test WorkFlow | ||
|
||
on: | ||
pull_request: | ||
branches: [main, develop] | ||
|
||
jobs: | ||
build-dev-test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
python-version: ["3.9", "3.10", "3.11", "3.12"] | ||
steps: | ||
- name: 🛎️ Checkout | ||
uses: actions/checkout@v4 | ||
- name: 🐍 Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
check-latest: true | ||
|
||
- name: 📦 Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install torch | ||
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then | ||
if [[ "${{ matrix.python-version }}" == "3.10" ]]; then | ||
pip install https://github.com/Dao-AILab/flash-attention/releases/download/v2.6.3/flash_attn-2.6.3+cu123torch2.4cxx11abiTRUE-cp310-cp310-linux_x86_64.whl | ||
elif [[ "${{ matrix.python-version }}" == "3.11" ]]; then | ||
pip install https://github.com/Dao-AILab/flash-attention/releases/download/v2.6.3/flash_attn-2.6.3+cu123torch2.4cxx11abiTRUE-cp311-cp311-linux_x86_64.whl | ||
elif [[ "${{ matrix.python-version }}" == "3.12" ]]; then | ||
pip install https://github.com/Dao-AILab/flash-attention/releases/download/v2.6.3/flash_attn-2.6.3+cu123torch2.4cxx11abiTRUE-cp312-cp312-linux_x86_64.whl | ||
elif [[ "${{ matrix.python-version }}" == "3.8" ]]; then | ||
pip install https://github.com/Dao-AILab/flash-attention/releases/download/v2.6.3/flash_attn-2.6.3+cu123torch2.4cxx11abiTRUE-cp38-cp38-linux_x86_64.whl | ||
elif [[ "${{ matrix.python-version }}" == "3.9" ]]; then | ||
pip install https://github.com/Dao-AILab/flash-attention/releases/download/v2.6.3/flash_attn-2.6.3+cu123torch2.4cxx11abiTRUE-cp39-cp39-linux_x86_64.whl | ||
fi | ||
fi | ||
pip install . | ||
pip install pytest | ||
|
||
- name: 🧪 Test | ||
run: "python -m pytest ./test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Multimodal Maestro Releases to PyPi | ||
on: | ||
push: | ||
tags: | ||
- '[0-9]+.[0-9]+[0-9]+.[0-9]' | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.10"] | ||
steps: | ||
- name: 🛎️ Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
- name: 🐍 Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: 🏗️ Build source and wheel distributions | ||
run: | | ||
python -m pip install --upgrade build twine | ||
python -m build | ||
twine check --strict dist/* | ||
- name: 🚀 Publish to PyPi | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: ${{ secrets.PYPI_USERNAME }} | ||
password: ${{ secrets.PYPI_PASSWORD }} | ||
- name: 🚀 Publish to Test-PyPi | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
user: ${{ secrets.PYPI_TEST_USERNAME }} | ||
password: ${{ secrets.PYPI_TEST_PASSWORD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Multimodal Maestro Test Releases to PyPi | ||
on: | ||
push: | ||
tags: | ||
- '[0-9]+.[0-9]+[0-9]+.[0-9]+a[0-9]' | ||
- '[0-9]+.[0-9]+[0-9]+.[0-9]+b[0-9]' | ||
- '[0-9]+.[0-9]+[0-9]+.[0-9]+rc[0-9]' | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
build-n-publish: | ||
name: Build and publish to PyPI | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.10"] | ||
steps: | ||
- name: 🛎️ Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
- name: 🐍 Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: 🏗️ Build source and wheel distributions | ||
run: | | ||
python -m pip install --upgrade build twine | ||
python -m build | ||
twine check --strict dist/* | ||
- name: 🚀 Publish distribution to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: ${{ secrets.PYPI_USERNAME }} | ||
password: ${{ secrets.PYPI_PASSWORD }} | ||
- name: 🚀 Publish to Test-PyPi | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
user: ${{ secrets.PYPI_TEST_USERNAME }} | ||
password: ${{ secrets.PYPI_TEST_PASSWORD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,3 +132,6 @@ dmypy.json | |
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# Mac OS X | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
# CHANGELOGS | ||
|
||
## multimodal-maestro-0.1.0 | ||
|
||
### 🚀 Added | ||
|
||
- [`SegmentAnythingMarkGenerator`](https://roboflow.github.io/multimodal-maestro/markers/#multimodalmaestro.markers.sam.SegmentAnythingMarkGenerator) allowing the generation of segmentation marks. | ||
- [`MarkVisualizer`](https://roboflow.github.io/multimodal-maestro/visualizers/#multimodalmaestro.visualizers.MarkVisualizer) allowing to visualize the generated marks. | ||
- [`prompt_image`](https://roboflow.github.io/multimodal-maestro/lmms/#multimodalmaestro.lmms.gpt4.prompt_image) allowing for convenient GPT-4 Vision API querying. | ||
- 🤗 Hugging Face Set-of-Mark [space](https://huggingface.co/spaces/Roboflow/SoM). | ||
|
||
```python | ||
>>> import cv2 | ||
>>> import torch | ||
>>> import multimodalmaesto as mm | ||
|
||
>>> image = cv2.imread("...") | ||
|
||
>>> generator = mm.SegmentAnythingMarkGenerator() | ||
>>> visualizer = mm.MarkVisualizer() | ||
|
||
>>> marks = generator.generate(image=image) | ||
>>> marks = mm.refine_marks(marks=marks) | ||
|
||
>>> image_prompt = visualizer.visualize(image=image, marks=marks) | ||
>>> text_prompt = "Find dog." | ||
|
||
>>> response = mm.prompt_image(api_key=api_key, image=image_prompt, prompt=text_prompt) | ||
>>> response | ||
|
||
"The dog is prominently featured in the center of the image with the label [9]." | ||
|
||
>>> masks = mm.extract_relevant_masks(text=response, detections=refined_marks) | ||
|
||
{'6': array([ | ||
[False, False, False, ..., False, False, False], | ||
[False, False, False, ..., False, False, False], | ||
[False, False, False, ..., False, False, False], | ||
..., | ||
[ True, True, True, ..., False, False, False], | ||
[ True, True, True, ..., False, False, False], | ||
[ True, True, True, ..., False, False, False]]) | ||
} | ||
``` | ||
|
||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
[build-system] | ||
requires = ["setuptools", "setuptools-scm", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "maestro" | ||
version = "0.2.0rc3" | ||
description = "Visual Prompting for Large Multimodal Models (LMMs)" | ||
readme = "README.md" | ||
authors = [ | ||
{name = "Roboflow", email = "[email protected]"} | ||
] | ||
license = {file = "LICENSE"} | ||
keywords = ["roboflow","maestro","multimodal-maestro","transformers", "torch", "accelerate", "multimodal", "lmm", "vision", "nlp", "prompting"] | ||
requires-python = ">=3.9,<3.13" | ||
classifiers = [ | ||
"Development Status :: 3 - Alpha", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Education", | ||
"Intended Audience :: Science/Research", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Topic :: Software Development", | ||
"Topic :: Scientific/Engineering", | ||
"Topic :: Scientific/Engineering :: Artificial Intelligence", | ||
"Typing :: Typed", | ||
"Operating System :: Microsoft :: Windows", | ||
"Operating System :: POSIX :: Linux", | ||
"Operating System :: MacOS" | ||
] | ||
|
||
dependencies = [ | ||
"supervision~=0.24.0rc1", | ||
"requests>=2.31.0,<=2.32.3", | ||
"transformers~=4.44.2", | ||
"torch~=2.4.0", | ||
"accelerate~=0.33.0", | ||
"sentencepiece~=0.2.0", | ||
"peft~=0.12.0", | ||
"flash-attn~=2.6.3; sys_platform != 'darwin'", | ||
"einops~=0.8.0", | ||
"timm~=1.0.9", | ||
"typer~=0.12.5" | ||
] | ||
|
||
[project.urls] | ||
Homepage = "https://roboflow.github.io/multimodal-maestro/" | ||
Documentation = "https://roboflow.github.io/multimodal-maestro/" | ||
Repository = "https://github.com/roboflow/multimodal-maestro" | ||
Issues = "https://github.com/roboflow/multimodal-maestro/issues" | ||
Changelog = "https://github.com/roboflow/multimodal-maestro/blob/main/CHANGELOG.md" | ||
|
||
|
||
[project.optional-dependencies] | ||
docs = [ | ||
"mkdocs-material~=9.5.33", | ||
"mkdocstrings[python]>=0.20.0,<0.25.2" | ||
] | ||
dev = [ | ||
"pytest~=8.3.2", | ||
"black~=24.8.0", | ||
"pre-commit~=3.8.0", | ||
"mypy~=1.11.2", | ||
"flake8~=7.1.1", | ||
"tox~=4.18.1" | ||
] | ||
|
||
[project.scripts] | ||
maestro = "maestro.cli.main:app" | ||
|
||
[tool.setuptools] | ||
include-package-data = true # include non-python files in the package (default) | ||
|
||
[tool.setuptools.packages.find] | ||
where = ["."] | ||
exclude = ["cookbooks", "docs", "docs.*", "test", "test.*", "mkdocs", "mkdocs.*"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this break when torch is bumped to next version given flashattn is fixed to 2.4?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we need to update here, or I can lock pytorch in here and we can update when we wanted to as well. But source installation was breaking in action and I checked documentation of flash-attention it was asking other packages and cuda-toolkit to be present plus they also have certain version lock as you can see in pre-made as wheels