Skip to content

Commit

Permalink
🔀 [Merge] branch 'DOCKER' of github.com:WongKinYiu/yolov9mit into DOCKER
Browse files Browse the repository at this point in the history
  • Loading branch information
henrytsui000 committed Jul 10, 2024
2 parents dbe7505 + 6db27bb commit a984cc6
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 3 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Docker Image Deploy to DockerHub

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: henrytsui000
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: henrytsui000/yolo

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: docker/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Image digest
run: echo ${{ steps.meta.outputs.digest }}
2 changes: 1 addition & 1 deletion tests/test_tools/test_data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ def test_directory_stream_data_loader_frame(directory_stream_data_loader: Stream
frame, rev_tensor, origin_frame = next(iter(directory_stream_data_loader))
assert frame.shape == (1, 3, 640, 640)
assert rev_tensor.shape == (1, 5)
assert origin_frame.size == (480, 640)
assert origin_frame.size == (480, 640) or origin_frame.size == (512, 640)
3 changes: 2 additions & 1 deletion tests/test_tools/test_dataset_preparation.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def test_prepare_dataset(train_cfg: Config):
assert len(os.listdir(data_type)) == 5

annotations_path = Path("tests/data/annotations")
assert os.listdir(annotations_path) == ["instances_val.json", "instances_train.json"]
assert "instances_val.json" in os.listdir(annotations_path)
assert "instances_train.json" in os.listdir(annotations_path)


def test_prepare_weight():
Expand Down
2 changes: 1 addition & 1 deletion yolo/utils/model_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def get_device(device_spec: Union[str, int, List[int]]) -> torch.device:
device_spec = initialize_distributed()
if torch.cuda.is_available() and "cuda" in str(device_spec):
return torch.device(device_spec), ddp_flag
if not torch.cuda.is_available() and not torch.backends.mps.is_available():
if not torch.cuda.is_available():
if device_spec != "cpu":
logger.warning(f"❎ Device spec: {device_spec} not support, Choosing CPU instead")
return torch.device("cpu"), False
Expand Down

0 comments on commit a984cc6

Please sign in to comment.