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

The function-gpu.yaml file for mmpose on pytorch (gpu with cu118) #8189

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

traditionalgithub
Copy link

@traditionalgithub traditionalgithub commented Jul 18, 2024

A very simple/naive addition of function-gpu.yaml to enable mmpose on gpu. Tested on a Linux Mint 21.3 x86_64 machine.

Motivation and context

mmpose can be easily deployed with the serverless/deployed_cpu.sh script, but the function-gpu.yaml is absense for gpu easy deployment. I did a simple/naive function-gpu.yaml based on modifying the function.yaml

How has this been tested?

This yaml on is tested on a Linux Mint 21.3 x86_64 machine. The branch tested on is the develop branch, however it is cloned and deployed a few weeks ago, so there might be some inconsistencies.

Checklist

  • I submit my changes into the develop branch
  • I have created a changelog fragment
    - [ ] I have updated the documentation accordingly
    - [ ] I have added tests to cover my changes
    - [ ] I have linked related issues (see GitHub docs)
    - [ ] I have increased versions of npm packages if it is necessary
    (cvat-canvas,
    cvat-core,
    cvat-data and
    cvat-ui)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

Summary by CodeRabbit

  • New Features
    • Enabled GPU support for mmpose to improve performance on compatible devices.

Copy link
Contributor

coderabbitai bot commented Jul 18, 2024

Walkthrough

The recent update introduces a new configuration file, functional-gpu.yaml, which enables the mmpose library to utilize GPU resources. This enhancement is aimed at significantly improving the performance of mmpose by leveraging GPU acceleration.

Changes

File Path Change Summary
changelog.d/fragment.j2 Added summary of changes related to the new configuration file
.../functional-gpu.yaml Introduced a new configuration enabling mmpose on GPU

Poem

In the code's swift dance with silicon might,
mmpose finds its wings, takes flight.
GPU’s hum in a rhythmic spree,
Efficiency blooms, as fast as can be.
A rabbit's joy, in bytes and light!
🌟🐇💻


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2490153 and 2e0e3b7.

Files selected for processing (2)
  • changelog.d/fragment.j2 (1 hunks)
  • serverless/pytorch/mmpose/hrnet32/nuclio/function-gpu.yaml (1 hunks)
Files not summarized due to errors (1)
  • serverless/pytorch/mmpose/hrnet32/nuclio/function-gpu.yaml: Error: Message exceeds token limit
Files skipped from review due to trivial changes (1)
  • changelog.d/fragment.j2
Additional context used
yamllint
serverless/pytorch/mmpose/hrnet32/nuclio/function-gpu.yaml

[error] 209-209: trailing spaces

(trailing-spaces)


[error] 210-210: trailing spaces

(trailing-spaces)

Additional comments not posted (3)
serverless/pytorch/mmpose/hrnet32/nuclio/function-gpu.yaml (3)

1-7: Metadata section looks good!

The metadata section is correctly formatted and includes essential information such as name, namespace, and annotations.


201-207: Triggers section looks good!

The triggers section is correctly formatted and includes essential information such as the HTTP trigger and its attributes.


213-218: Platform section looks good!

The platform section is correctly formatted and includes essential information such as restart policy and mount mode.

Comment on lines +209 to +212
resources:
limits:
nvidia.com/gpu: 1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove trailing spaces in the resources section.

The resources section is correctly formatted and includes essential information. However, there are trailing spaces that should be removed.

-  resources:                                                                                  
-    limits:                                                                                        
+  resources:
+    limits:
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
resources:
limits:
nvidia.com/gpu: 1
resources:
limits:
nvidia.com/gpu: 1
Tools
yamllint

[error] 209-209: trailing spaces

(trailing-spaces)


[error] 210-210: trailing spaces

(trailing-spaces)

Comment on lines +182 to +199
directives:
preCopy:
- kind: RUN
value: apt update && apt install -y git libgl1 --no-install-recommends && rm -rf /var/lib/apt/lists/*
- kind: WORKDIR
value: /opt/nuclio
- kind: RUN
#value: pip install openmim torch==2.0.0+cpu torchvision==0.15.1+cpu --extra-index-url https://download.pytorch.org/whl/cpu
#value: pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
value: pip install openmim torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1 --extra-index-url https://download.pytorch.org/whl/cu118
- kind: RUN
value: mim install mmcv==2.0.1 mmdet==3.2.0 mmpose==1.2.0
- kind: RUN
value: git clone -b v1.2.0 --depth=1 https://github.com/open-mmlab/mmpose.git
- kind: ADD
value: https://download.openmmlab.com/mmpose/v1/wholebody_2d_keypoint/ubody/td-hm_hrnet-w32_8xb64-210e_ubody-coco-256x192-7c227391_20230807.pth ./
- kind: ADD
value: https://download.openmmlab.com/mmpose/v1/projects/rtmpose/rtmdet_nano_8xb32-100e_coco-obj365-person-05d8511e.pth ./
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build directives look good but add a comment for apt update.

The build directives are correctly formatted and include essential commands. However, there is a potential security risk with the apt update command. Adding a comment to explain its necessity would be helpful.

+          # Updating package lists and installing dependencies
          value: apt update && apt install -y git libgl1 --no-install-recommends && rm -rf /var/lib/apt/lists/*
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
directives:
preCopy:
- kind: RUN
value: apt update && apt install -y git libgl1 --no-install-recommends && rm -rf /var/lib/apt/lists/*
- kind: WORKDIR
value: /opt/nuclio
- kind: RUN
#value: pip install openmim torch==2.0.0+cpu torchvision==0.15.1+cpu --extra-index-url https://download.pytorch.org/whl/cpu
#value: pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
value: pip install openmim torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1 --extra-index-url https://download.pytorch.org/whl/cu118
- kind: RUN
value: mim install mmcv==2.0.1 mmdet==3.2.0 mmpose==1.2.0
- kind: RUN
value: git clone -b v1.2.0 --depth=1 https://github.com/open-mmlab/mmpose.git
- kind: ADD
value: https://download.openmmlab.com/mmpose/v1/wholebody_2d_keypoint/ubody/td-hm_hrnet-w32_8xb64-210e_ubody-coco-256x192-7c227391_20230807.pth ./
- kind: ADD
value: https://download.openmmlab.com/mmpose/v1/projects/rtmpose/rtmdet_nano_8xb32-100e_coco-obj365-person-05d8511e.pth ./
directives:
preCopy:
- kind: RUN
+ # Updating package lists and installing dependencies
value: apt update && apt install -y git libgl1 --no-install-recommends && rm -rf /var/lib/apt/lists/*
- kind: WORKDIR
value: /opt/nuclio
- kind: RUN
#value: pip install openmim torch==2.0.0+cpu torchvision==0.15.1+cpu --extra-index-url https://download.pytorch.org/whl/cpu
#value: pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
value: pip install openmim torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1 --extra-index-url https://download.pytorch.org/whl/cu118
- kind: RUN
value: mim install mmcv==2.0.1 mmdet==3.2.0 mmpose==1.2.0
- kind: RUN
value: git clone -b v1.2.0 --depth=1 https://github.com/open-mmlab/mmpose.git
- kind: ADD
value: https://download.openmmlab.com/mmpose/v1/wholebody_2d_keypoint/ubody/td-hm_hrnet-w32_8xb64-210e_ubody-coco-256x192-7c227391_20230807.pth ./
- kind: ADD
value: https://download.openmmlab.com/mmpose/v1/projects/rtmpose/rtmdet_nano_8xb32-100e_coco-obj365-person-05d8511e.pth ./

Comment on lines +172 to +205
spec:
description: Whole Body points
runtime: 'python:3.8'
handler: main:handler
eventTimeout: 30s

build:
image: cvat.pth.mmpose.hrnet32
baseImage: python:3.8

directives:
preCopy:
- kind: RUN
value: apt update && apt install -y git libgl1 --no-install-recommends && rm -rf /var/lib/apt/lists/*
- kind: WORKDIR
value: /opt/nuclio
- kind: RUN
#value: pip install openmim torch==2.0.0+cpu torchvision==0.15.1+cpu --extra-index-url https://download.pytorch.org/whl/cpu
#value: pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
value: pip install openmim torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1 --extra-index-url https://download.pytorch.org/whl/cu118
- kind: RUN
value: mim install mmcv==2.0.1 mmdet==3.2.0 mmpose==1.2.0
- kind: RUN
value: git clone -b v1.2.0 --depth=1 https://github.com/open-mmlab/mmpose.git
- kind: ADD
value: https://download.openmmlab.com/mmpose/v1/wholebody_2d_keypoint/ubody/td-hm_hrnet-w32_8xb64-210e_ubody-coco-256x192-7c227391_20230807.pth ./
- kind: ADD
value: https://download.openmmlab.com/mmpose/v1/projects/rtmpose/rtmdet_nano_8xb32-100e_coco-obj365-person-05d8511e.pth ./

triggers:
myHttpTrigger:
maxWorkers: 2
kind: 'http'
workerAvailabilityTimeoutMilliseconds: 10000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spec section looks good but remove commented-out lines.

The spec section is correctly formatted and includes essential information. However, there are some commented-out lines in the build directives that should be removed for clarity.

-          #value: pip install openmim torch==2.0.0+cpu torchvision==0.15.1+cpu --extra-index-url https://download.pytorch.org/whl/cpu
-          #value: pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
spec:
description: Whole Body points
runtime: 'python:3.8'
handler: main:handler
eventTimeout: 30s
build:
image: cvat.pth.mmpose.hrnet32
baseImage: python:3.8
directives:
preCopy:
- kind: RUN
value: apt update && apt install -y git libgl1 --no-install-recommends && rm -rf /var/lib/apt/lists/*
- kind: WORKDIR
value: /opt/nuclio
- kind: RUN
#value: pip install openmim torch==2.0.0+cpu torchvision==0.15.1+cpu --extra-index-url https://download.pytorch.org/whl/cpu
#value: pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
value: pip install openmim torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1 --extra-index-url https://download.pytorch.org/whl/cu118
- kind: RUN
value: mim install mmcv==2.0.1 mmdet==3.2.0 mmpose==1.2.0
- kind: RUN
value: git clone -b v1.2.0 --depth=1 https://github.com/open-mmlab/mmpose.git
- kind: ADD
value: https://download.openmmlab.com/mmpose/v1/wholebody_2d_keypoint/ubody/td-hm_hrnet-w32_8xb64-210e_ubody-coco-256x192-7c227391_20230807.pth ./
- kind: ADD
value: https://download.openmmlab.com/mmpose/v1/projects/rtmpose/rtmdet_nano_8xb32-100e_coco-obj365-person-05d8511e.pth ./
triggers:
myHttpTrigger:
maxWorkers: 2
kind: 'http'
workerAvailabilityTimeoutMilliseconds: 10000
spec:
description: Whole Body points
runtime: 'python:3.8'
handler: main:handler
eventTimeout: 30s
build:
image: cvat.pth.mmpose.hrnet32
baseImage: python:3.8
directives:
preCopy:
- kind: RUN
value: apt update && apt install -y git libgl1 --no-install-recommends && rm -rf /var/lib/apt/lists/*
- kind: WORKDIR
value: /opt/nuclio
- kind: RUN
value: pip install openmim torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1 --extra-index-url https://download.pytorch.org/whl/cu118
- kind: RUN
value: mim install mmcv==2.0.1 mmdet==3.2.0 mmpose==1.2.0
- kind: RUN
value: git clone -b v1.2.0 --depth=1 https://github.com/open-mmlab/mmpose.git
- kind: ADD
value: https://download.openmmlab.com/mmpose/v1/wholebody_2d_keypoint/ubody/td-hm_hrnet-w32_8xb64-210e_ubody-coco-256x192-7c227391_20230807.pth ./
- kind: ADD
value: https://download.openmmlab.com/mmpose/v1/projects/rtmpose/rtmdet_nano_8xb32-100e_coco-obj365-person-05d8511e.pth ./
triggers:
myHttpTrigger:
maxWorkers: 2
kind: 'http'
workerAvailabilityTimeoutMilliseconds: 10000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant