Skip to content
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

add python3.6 support #489

Merged
merged 18 commits into from
Jun 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ jobs:
run: >
pip install yolov5==6.1.3 norfair==1.0.0

- name: Install Transformers(4.20.0)
run: >
pip install transformers==4.20.0

- name: Install Layer (0.10.*)
run: >
pip install -U "layer>=0.10.0,<0.11.0"
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/ci_torch1.10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.7, 3.8, 3.9]
python-version: [3.6, 3.7, 3.8, 3.9]
fail-fast: false

steps:
Expand Down Expand Up @@ -73,9 +73,9 @@ jobs:
pip install torch==1.10.2+cpu torchvision==0.11.3+cpu
-f https://download.pytorch.org/whl/torch_stable.html

- name: Install PyTorch on MacOS
- name: Install PyTorch(1.10.1) and TorchVision(0.11.2) on MacOS
if: matrix.operating-system == 'macos-latest'
run: pip install torch==1.10.2 torchvision==0.11.3
run: pip install torch==1.10.1 torchvision==0.11.2

- name: Install MMDetection(2.25.0) with MMCV(1.5.3)
run: >
Expand All @@ -90,7 +90,15 @@ jobs:
run: >
python -m pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch1.10/index.html

- name: Install Transformers(4.20.0)
if: >
matrix.python-version != '3.6'
run: >
pip install transformers==4.20.0

- name: Install Layer (0.10.*)
if: >
matrix.python-version != '3.6'
run: >
pip install -U "layer>=0.10.0,<0.11.0"

Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/package_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.7, 3.8, 3.9]
python-version: [3.6, 3.7, 3.8, 3.9]
fail-fast: false

steps:
Expand Down Expand Up @@ -50,17 +50,17 @@ jobs:
- name: Update pip
run: python -m pip install --upgrade pip

- name: Install PyTorch on Linux and Windows
- name: Install PyTorch(1.10.2) and TorchVision(0.11.3) on Linux and Windows
if: >
matrix.operating-system == 'ubuntu-latest' ||
matrix.operating-system == 'windows-latest'
run: >
pip install torch==1.10.2+cpu torchvision==0.11.3+cpu
-f https://download.pytorch.org/whl/torch_stable.html

- name: Install PyTorch on MacOS
- name: Install PyTorch(1.10.1) and TorchVision(0.11.2) on MacOS
if: matrix.operating-system == 'macos-latest'
run: pip install torch==1.10.2 torchvision==0.11.3
run: pip install torch==1.10.1 torchvision==0.11.2

- name: Install MMDetection(2.25.0) with MMCV(1.5.3)
run: >
Expand All @@ -75,7 +75,15 @@ jobs:
run: >
python -m pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch1.10/index.html

- name: Install Transformers(4.20.0)
if: >
matrix.python-version != '3.6'
run: >
pip install transformers==4.20.0

- name: Install Layer (0.10.*)
if: >
matrix.python-version != '3.6'
run: >
pip install -U "layer>=0.10.0,<0.11.0"

Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ opencv-python>=4.2.0.32
shapely>=1.8.0
tqdm>=4.48.2
pillow>=8.2.0
pybboxes
pybboxes==0.1.1
pyyaml
fire
terminaltables
requests
click==8.0.4
click==8.0.4
7 changes: 3 additions & 4 deletions sahi/auto_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
TorchVisionDetectionModel,
Yolov5DetectionModel,
)
from sahi.utils.import_utils import check_requirements

MODEL_TYPE_TO_MODEL_CLASS_NAME = {
"mmdet": MmdetDetectionModel,
Expand Down Expand Up @@ -78,6 +79,7 @@ def from_local(
)

@staticmethod
@check_requirements(["layer"])
def from_layer(
model_path: str,
no_cache: bool = False,
Expand Down Expand Up @@ -115,10 +117,7 @@ def from_layer(
ImportError: If Layer is not installed in your environment
ValueError: If model path does not match expected pattern: organization_name/project_name/models/model_name
"""
try:
import layer
except ImportError:
raise ImportError('Please run "pip install layer -U" ' "to load models from Layer.")
import layer

layer_model = layer.get_model(name=model_path, no_cache=no_cache).get_train()
if layer_model.__class__.__module__ in ["yolov5.models.common", "models.common"]:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_version():
long_description_content_type="text/markdown",
url="https://github.com/obss/sahi",
packages=setuptools.find_packages(exclude=["demo", "docs", "resources", "tests"]),
python_requires=">=3.7",
python_requires=">=3.6",
install_requires=get_requirements(),
extras_require={
"tests": ["pytest", "mmdet", "norfair", "layer"],
Expand Down
Loading