Skip to content

Commit

Permalink
Merge pull request #15 from kornia/migrate-to-uv
Browse files Browse the repository at this point in the history
migrate environment installs to uv
  • Loading branch information
johnnv1 authored Apr 16, 2024
2 parents 66968c4 + f2ef93c commit 661874e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
17 changes: 13 additions & 4 deletions .github/actions/env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,33 @@ runs:
with:
python-version: ${{ inputs.python-version }}

- name: Install UV
shell: bash
run: pip install uv

- if: ${{ contains(fromJson('["nightly"]'), inputs.pytorch-version ) }}
name: Install PyTorch nightly
shell: bash
run: pip install numpy --pre torch[dynamo] ${{ inputs.extra-deps }} --force-reinstall --extra-index-url https://download.pytorch.org/whl/nightly/cpu/
run: uv pip install --system numpy --pre torch[dynamo] ${{ inputs.extra-deps }} --force-reinstall --extra-index-url https://download.pytorch.org/whl/nightly/cpu/

- if: ${{ contains(fromJson('["nightly"]'), inputs.pytorch-version ) == false}}
name: Install pytorch
shell: bash
run: pip install torch==${{ inputs.pytorch-version }} ${{ inputs.extra-deps }} --index-url https://download.pytorch.org/whl/cpu
run: |
if [ "$RUNNER_OS" == "Linux" ] || [ "$RUNNER_OS" == "Windows" ]; then
uv pip install --system torch==${{ inputs.pytorch-version }}+cpu ${{ inputs.extra-deps }} --find-links https://download.pytorch.org/whl/torch_stable.html
else
uv pip install --system torch==${{ inputs.pytorch-version }} ${{ inputs.extra-deps }} --find-links https://download.pytorch.org/whl/torch_stable.html
fi
- if: ${{ contains(fromJson('["1.9.1"]'), inputs.pytorch-version) }}
name: Install accelerate for old torchs
shell: bash
run: pip install accelerate==0.20.3
run: uv pip install --system accelerate==0.20.3

- name: Install Kornia dev
shell: bash
run: pip install .[dev,x]
run: uv pip install --system --editable .[dev,x]

- name: Check torch version
shell: bash
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,13 @@ jobs:
with:
python-version: ${{ inputs.python-version }}

- name: Install UV
shell: bash
run: pip install uv

- name: Install dev dependencies
shell: bash
run: pip install -r ./requirements/requirements-dev.txt
run: uv pip install --system -r ./requirements/requirements-dev.txt

- name: Run coverage
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:

- name: Install docs deps
shell: bash -l {0}
# TODO: run: uv pip install --system --editable .[docs]
run: pip install -e .[docs]

- name: Build Documentation
Expand Down

0 comments on commit 661874e

Please sign in to comment.