From ea07ae641842f60b3f82f36cd9adbb9d11adaaa9 Mon Sep 17 00:00:00 2001 From: henrytsui000 Date: Thu, 11 Jul 2024 00:16:25 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=F0=9F=91=B7=20[Add]=20A=20workflow=20for?= =?UTF-8?q?=20deploying=20docker=20image?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker.yaml | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/docker.yaml diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml new file mode 100644 index 0000000..f9eeaa3 --- /dev/null +++ b/.github/workflows/docker.yaml @@ -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: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ secrets.DOCKER_USERNAME }}/yolo + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: docker + file: docker/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Image digest + run: echo ${{ steps.meta.outputs.digest }} From a56a51f260d2b7a36c96b98daa8cc0993c45ef2d Mon Sep 17 00:00:00 2001 From: henrytsui000 Date: Thu, 11 Jul 2024 00:26:38 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E2=9C=85=20[Fix]=20test=20of=20dataset,=20?= =?UTF-8?q?order=20is=20not=20important?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_tools/test_data_loader.py | 2 +- tests/test_tools/test_dataset_preparation.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_tools/test_data_loader.py b/tests/test_tools/test_data_loader.py index 16a7edb..789c876 100644 --- a/tests/test_tools/test_data_loader.py +++ b/tests/test_tools/test_data_loader.py @@ -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) diff --git a/tests/test_tools/test_dataset_preparation.py b/tests/test_tools/test_dataset_preparation.py index f906c39..e0f3e70 100644 --- a/tests/test_tools/test_dataset_preparation.py +++ b/tests/test_tools/test_dataset_preparation.py @@ -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(): From 77181eef77ff38ec5fdd2196515afa50ab50b430 Mon Sep 17 00:00:00 2001 From: henrytsui000 Date: Thu, 11 Jul 2024 00:39:26 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=92=9A=20[Fix]=20docker=20deploy=20bu?= =?UTF-8?q?gs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index f9eeaa3..18d1e99 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -32,7 +32,7 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v4 with: - context: docker + context: . file: docker/Dockerfile push: true tags: ${{ steps.meta.outputs.tags }} From 4056352916e62dfdb5174626857c9b85660a60bd Mon Sep 17 00:00:00 2001 From: henrytsui000 Date: Thu, 11 Jul 2024 01:23:36 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=92=9A=20[Fix]=20MPS=20CI=20bugs,=20e?= =?UTF-8?q?nable=20using=20MPS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yolo/utils/model_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yolo/utils/model_utils.py b/yolo/utils/model_utils.py index a6d880d..174c51e 100644 --- a/yolo/utils/model_utils.py +++ b/yolo/utils/model_utils.py @@ -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 From 5c7528771a33c5bf7055877b880e0bfc7ff8bc93 Mon Sep 17 00:00:00 2001 From: henrytsui000 Date: Thu, 11 Jul 2024 01:25:34 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=92=9A=20[Update]=20CI=20workflow,=20?= =?UTF-8?q?const=20dockerhub=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 18d1e99..5282bc9 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -20,14 +20,14 @@ jobs: - name: Log in to Docker Hub uses: docker/login-action@v2 with: - username: ${{ secrets.DOCKER_USERNAME }} + username: henrytsui000 password: ${{ secrets.DOCKER_PASSWORD }} - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v4 with: - images: ${{ secrets.DOCKER_USERNAME }}/yolo + images: henrytsui000/yolo - name: Build and push Docker image uses: docker/build-push-action@v4