diff --git a/.github/RELEASE_GUIDE.md b/.github/RELEASE_GUIDE.md new file mode 100644 index 0000000..6200940 --- /dev/null +++ b/.github/RELEASE_GUIDE.md @@ -0,0 +1,320 @@ +# Release Guide + +This guide explains how to use the CI/CD workflows for nnInteractive Slicer Server. + +## ๐Ÿ”ง Initial Setup + +### Step 1: Set Up Trusted Publishing for PyPI/TestPyPI + +The workflows use **Trusted Publishing** (OpenID Connect) - the modern, secure way to publish to PyPI without API tokens. + +#### For TestPyPI (test releases): + +**Set up Trusted Publisher on TestPyPI** (before package exists): + +1. Go to: https://test.pypi.org/manage/account/publishing/ +2. Scroll to **"Pending publishers"** section +3. Click **"Add a new pending publisher"** +4. Fill in: + - **PyPI Project Name**: `nninteractive-slicer-server` + - **Owner**: `coendevente` (your GitHub username/org) + - **Repository name**: `SlicerNNInteractive` + - **Workflow filename**: `test-release.yml` + - **Environment name**: `test` +5. Click **"Add"** + +This creates a "reservation" that allows your GitHub workflow to create and publish the package automatically on first release. + +#### For PyPI (production releases): + +**Set up Trusted Publisher on PyPI** (before package exists): + +1. Go to: https://pypi.org/manage/account/publishing/ +2. Scroll to **"Pending publishers"** section +3. Click **"Add a new pending publisher"** +4. Fill in: + - **PyPI Project Name**: `nninteractive-slicer-server` + - **Owner**: `coendevente` (your GitHub username/org) + - **Repository name**: `SlicerNNInteractive` + - **Workflow filename**: `release.yml` + - **Environment name**: `production` +5. Click **"Add"** + +This creates a "reservation" that allows your GitHub workflow to create and publish the package automatically on first release. + +**Benefits of Trusted Publishing:** +- โœ… No API tokens to manage or rotate +- โœ… More secure (automatic OIDC authentication) +- โœ… Scoped to specific workflows and repositories +- โœ… Recommended by PyPI + +### Step 2: Create GitHub Environments + +Go to **Settings โ†’ Environments** and create two environments: + +1. **`test`** - For test releases (TestPyPI, Docker test tags) +2. **`production`** - For production releases (PyPI, Docker official tags) + +#### Optional: Add Production Protection + +For the `production` environment, you can add protection rules: +- โœ… **Required reviewers**: Require manual approval before production deploys +- โœ… **Deployment branches**: Limit to `main` branch only (already enforced by workflow) + +This adds an extra safety layer for production releases. + +### Step 3: Add Docker Hub Secrets + +Add Docker Hub credentials to both environments: + +#### For `test` environment: + +**Settings โ†’ Environments โ†’ test โ†’ Add secret** + +1. **DOCKERHUB_USERNAME** + - Your Docker Hub username (e.g., `coendevente`) + +2. **DOCKERHUB_TOKEN** + - Go to https://hub.docker.com/settings/security + - Create a new access token + - Add it to the `test` environment + +#### For `production` environment: + +**Settings โ†’ Environments โ†’ production โ†’ Add secret** + +1. **DOCKERHUB_USERNAME** + - Your Docker Hub username (same as above) + +2. **DOCKERHUB_TOKEN** + - Same Docker Hub access token as above (or create a separate one for production) + +## ๐Ÿ“‹ Workflows Overview + +### 1. CI Workflow (`.github/workflows/ci.yml`) + +**Triggers:** All pushes and PRs to `main` or `develop` branches + +**What it does:** +- Runs tests +- Builds the Python package (without publishing) +- Builds the Docker image (without pushing) +- Checks version consistency between `pyproject.toml` and git tags + +**No setup required** - runs automatically on PRs. + +--- + +### 2. Test Release Workflow (`.github/workflows/test-release.yml`) + +**Triggers:** Tags matching `test-v*` (e.g., `test-v0.2.1-beta`) + +**What it does:** +- Publishes to **TestPyPI** (https://test.pypi.org) +- Pushes Docker image with tags: + - `coendevente/nninteractive:test-0.2.1-beta` + - `coendevente/nninteractive:test-latest` +- Creates a GitHub prerelease + +**Use this for:** Testing the release pipeline on feature branches + +#### Example Usage: + +```bash +# On your feature branch (e.g., 'feature/new-model') +git add . +git commit -m "Add new model support" + +# Create a test release tag +git tag test-v0.2.1-beta1 +git push origin test-v0.2.1-beta1 + +# GitHub Actions will publish to TestPyPI and Docker Hub with test tags +``` + +#### Testing the Published Packages: + +```bash +# Test PyPI package +pip install --index-url https://test.pypi.org/simple/ \ + --extra-index-url https://pypi.org/simple/ \ + nninteractive-slicer-server==0.2.1-beta1 + +# Test Docker image +docker pull coendevente/nninteractive:test-0.2.1-beta1 +docker run coendevente/nninteractive:test-0.2.1-beta1 +``` + +--- + +### 3. Production Release Workflow (`.github/workflows/release.yml`) + +**Triggers:** Tags matching `v*.*.*` (e.g., `v0.2.1`) **on main branch only** + +**What it does:** +- Verifies tag is on `main` branch +- Verifies version in `pyproject.toml` matches the tag +- Publishes to **PyPI** (https://pypi.org) +- Pushes Docker image with tags: + - `coendevente/nninteractive:0.2.1` + - `coendevente/nninteractive:latest` +- Creates an official GitHub release with changelog + +**Use this for:** Official production releases + +#### Pre-Release Checklist: + +1. **Ensure you're on main branch:** + ```bash + git checkout main + git pull origin main + ``` + +2. **Update version in `server/pyproject.toml`:** + ```toml + version = "0.2.1" + ``` + +3. **Commit the version bump:** + ```bash + git add server/pyproject.toml + git commit -m "Bump version to 0.2.1" + git push origin main + ``` + +4. **Create and push the release tag:** + ```bash + git tag v0.2.1 + git push origin v0.2.1 + ``` + +5. **GitHub Actions takes over:** + - Validates everything + - Publishes to PyPI and Docker Hub + - Creates GitHub release + +6. **Verify the release:** + ```bash + # Check PyPI + pip install nninteractive-slicer-server==0.2.1 + + # Check Docker Hub + docker pull coendevente/nninteractive:0.2.1 + ``` + +## ๐ŸŽฏ Common Workflows + +### Scenario 1: Testing a new feature + +```bash +# On feature branch +git checkout -b feature/new-feature +# ... make changes ... +git add . +git commit -m "Add new feature" +git push origin feature/new-feature + +# Test the release pipeline +git tag test-v0.3.0-alpha1 +git push origin test-v0.3.0-alpha1 + +# Verify on TestPyPI and Docker Hub test tags +# If good, merge to main and do production release +``` + +### Scenario 2: Production release + +```bash +# On main branch +git checkout main +git pull + +# Update version in server/pyproject.toml to 0.3.0 +vim server/pyproject.toml + +git add server/pyproject.toml +git commit -m "Bump version to 0.3.0" +git push origin main + +# Create release +git tag v0.3.0 +git push origin v0.3.0 + +# Done! Check GitHub Actions for progress +``` + +### Scenario 3: Hotfix release + +```bash +# Create hotfix branch from main +git checkout main +git pull +git checkout -b hotfix/critical-bug + +# Fix the bug +git add . +git commit -m "Fix critical bug in inference" + +# Test with test release first +git tag test-v0.2.2 +git push origin test-v0.2.2 + +# Verify the fix works, then merge to main +git checkout main +git merge hotfix/critical-bug + +# Update version and release +vim server/pyproject.toml # Change to 0.2.2 +git add server/pyproject.toml +git commit -m "Bump version to 0.2.2" +git push origin main + +git tag v0.2.2 +git push origin v0.2.2 +``` + +## โŒ Common Errors + +### "Tag must be on main branch" +- Production tags (v*) can only be created from main branch +- Use test tags (test-v*) for feature branches + +### "Version mismatch between pyproject.toml and tag" +- Update `server/pyproject.toml` to match your tag version +- If tagging v0.2.1, pyproject.toml should have version = "0.2.1" + +### "Invalid credentials for PyPI" +- Check that PYPI_API_TOKEN or TEST_PYPI_API_TOKEN is correctly set +- Regenerate tokens if needed + +### "Docker Hub authentication failed" +- Verify DOCKERHUB_USERNAME and DOCKERHUB_TOKEN are correct +- Ensure you're using an access token, not your password + +## ๐Ÿ“ฆ Version Numbering + +Follow semantic versioning (semver): + +- **Major** (v1.0.0): Breaking changes +- **Minor** (v0.2.0): New features, backward compatible +- **Patch** (v0.2.1): Bug fixes, backward compatible + +For test releases, use descriptive suffixes: +- `test-v0.3.0-alpha1`: Early alpha testing +- `test-v0.3.0-beta1`: Feature-complete beta +- `test-v0.3.0-rc1`: Release candidate + +## ๐Ÿ” Monitoring Releases + +- **GitHub Actions**: Check the Actions tab for workflow runs +- **PyPI**: https://pypi.org/project/nninteractive-slicer-server/ +- **TestPyPI**: https://test.pypi.org/project/nninteractive-slicer-server/ +- **Docker Hub**: https://hub.docker.com/r/coendevente/nninteractive + +## ๐Ÿ†˜ Need Help? + +If you encounter issues: +1. Check the GitHub Actions logs for detailed error messages +2. Verify all secrets are correctly configured +3. Ensure version numbers match between pyproject.toml and tags +4. Make sure production tags are created from main branch diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2c98c76 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,110 @@ +name: CI + +on: + push: + branches: + - main + - develop + pull_request: + branches: + - main + - develop + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + python -m pip install build pytest + + - name: Build package + run: | + cd server + python -m build + + - name: Verify build artifacts + run: | + ls -lh server/dist/ + echo "โœ… Package built successfully" + + docker-build: + runs-on: ubuntu-latest + steps: + - name: Free up disk space + run: | + # Free up disk space on GitHub Actions runner + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/ghc + sudo rm -rf /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force + df -h + + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Docker image (no push) + uses: docker/build-push-action@v5 + with: + context: ./server + file: ./server/Dockerfile + push: false + tags: nninteractive:test + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Verify Docker build + run: echo "โœ… Docker image built successfully" + + version-check: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Check version consistency + run: | + cd server + # Extract version from pyproject.toml + PYPROJECT_VERSION=$(grep -E '^version = ' pyproject.toml | sed -E 's/version = "(.*)"/\1/') + echo "Version in pyproject.toml: $PYPROJECT_VERSION" + + # Get latest git tag (if exists) + LATEST_TAG=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n1 || echo "none") + + if [ "$LATEST_TAG" != "none" ]; then + TAG_VERSION=${LATEST_TAG#v} + echo "Latest git tag: $LATEST_TAG (version: $TAG_VERSION)" + + if [ "$PYPROJECT_VERSION" != "$TAG_VERSION" ]; then + echo "โš ๏ธ Warning: Version mismatch detected!" + echo " pyproject.toml: $PYPROJECT_VERSION" + echo " Latest tag: $TAG_VERSION" + echo "" + echo "This is OK for development, but ensure they match before creating a release tag." + else + echo "โœ… Versions are consistent" + fi + else + echo "โ„น๏ธ No release tags found yet" + fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..097e85c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,212 @@ +name: Release + +on: + push: + tags: + - 'v*.*.*' + +jobs: + verify-tag: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.get_version.outputs.version }} + steps: + - name: Check out code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Verify tag is on main branch + run: | + BRANCHES=$(git branch -r --contains ${{ github.ref }}) + echo "Branches containing this tag:" + echo "$BRANCHES" + + if ! echo "$BRANCHES" | grep -q 'origin/main'; then + echo "โŒ Error: Tag must be on main branch" + echo "Current branches: $BRANCHES" + exit 1 + fi + echo "โœ… Tag is on main branch" + + - name: Get version from tag + id: get_version + run: | + VERSION=${GITHUB_REF#refs/tags/v} + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "๐Ÿ“ฆ Release version: $VERSION" + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Verify version matches pyproject.toml + run: | + cd server + PYPROJECT_VERSION=$(grep -E '^version = ' pyproject.toml | sed -E 's/version = "(.*)"/\1/') + TAG_VERSION=${{ steps.get_version.outputs.version }} + + echo "Version in pyproject.toml: $PYPROJECT_VERSION" + echo "Version from git tag: $TAG_VERSION" + + if [ "$PYPROJECT_VERSION" != "$TAG_VERSION" ]; then + echo "โŒ Error: Version mismatch!" + echo " pyproject.toml: $PYPROJECT_VERSION" + echo " Git tag: v$TAG_VERSION" + echo "" + echo "Please update pyproject.toml to match the tag version before releasing." + exit 1 + fi + echo "โœ… Versions match" + + publish-pypi: + runs-on: ubuntu-latest + needs: verify-tag + environment: production + permissions: + id-token: write # Required for trusted publishing + contents: read + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + python -m pip install build twine + + - name: Build package + run: | + cd server + python -m build + + - name: Check package + run: | + cd server + twine check dist/* + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: server/dist/ + print-hash: true + + - name: Verify publication + run: | + echo "โœ… Published to PyPI!" + echo "" + echo "Install with:" + echo " pip install nninteractive-slicer-server==${{ needs.verify-tag.outputs.version }}" + + publish-docker: + runs-on: ubuntu-latest + needs: verify-tag + environment: production + steps: + - name: Free up disk space + run: | + # Free up disk space on GitHub Actions runner + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/ghc + sudo rm -rf /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force + df -h + + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: ./server + file: ./server/Dockerfile + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/nninteractive:${{ needs.verify-tag.outputs.version }} + ${{ secrets.DOCKERHUB_USERNAME }}/nninteractive:latest + cache-from: type=gha + cache-to: type=gha,mode=max + platforms: linux/amd64 + + - name: Verify publication + run: | + echo "โœ… Published to Docker Hub!" + echo "" + echo "Pull with:" + echo " docker pull ${{ secrets.DOCKERHUB_USERNAME }}/nninteractive:${{ needs.verify-tag.outputs.version }}" + echo " docker pull ${{ secrets.DOCKERHUB_USERNAME }}/nninteractive:latest" + + create-github-release: + runs-on: ubuntu-latest + needs: [verify-tag, publish-pypi, publish-docker] + permissions: + contents: write + steps: + - name: Check out code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Generate changelog + id: changelog + run: | + # Get previous tag + PREVIOUS_TAG=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sed -n '2p') + + if [ -z "$PREVIOUS_TAG" ]; then + echo "No previous tag found, using all commits" + CHANGELOG=$(git log --pretty=format:"- %s (%h)" --no-merges) + else + echo "Generating changelog from $PREVIOUS_TAG to ${{ github.ref_name }}" + CHANGELOG=$(git log $PREVIOUS_TAG..${{ github.ref_name }} --pretty=format:"- %s (%h)" --no-merges) + fi + + # Save to file to handle multiline + echo "$CHANGELOG" > /tmp/changelog.txt + echo "changelog_file=/tmp/changelog.txt" >> $GITHUB_OUTPUT + + - name: Create GitHub release + uses: softprops/action-gh-release@v1 + with: + name: "Release ${{ needs.verify-tag.outputs.version }}" + body: | + ## ๐Ÿš€ Release ${{ needs.verify-tag.outputs.version }} + + ### Installation + + **PyPI:** + ```bash + pip install nninteractive-slicer-server==${{ needs.verify-tag.outputs.version }} + ``` + + **Docker:** + ```bash + docker pull ${{ secrets.DOCKERHUB_USERNAME }}/nninteractive:${{ needs.verify-tag.outputs.version }} + # Or use :latest tag + docker pull ${{ secrets.DOCKERHUB_USERNAME }}/nninteractive:latest + ``` + + ### Changes + + $(cat ${{ steps.changelog.outputs.changelog_file }}) + + --- + **Full Changelog**: https://github.com/${{ github.repository }}/compare/v${{ needs.verify-tag.outputs.version }}...HEAD + draft: false + prerelease: false diff --git a/.github/workflows/test-release.yml b/.github/workflows/test-release.yml new file mode 100644 index 0000000..48fa477 --- /dev/null +++ b/.github/workflows/test-release.yml @@ -0,0 +1,145 @@ +name: Test Release + +on: + push: + tags: + - 'test-v*' + +jobs: + publish-test-pypi: + runs-on: ubuntu-latest + environment: test + permissions: + id-token: write # Required for trusted publishing + contents: read + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Extract version from tag + run: | + VERSION=${GITHUB_REF#refs/tags/test-v} + echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "๐Ÿ“ฆ Publishing test version: $VERSION" + + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + python -m pip install build twine + + - name: Build package + run: | + cd server + python -m build + + - name: Check package + run: | + cd server + twine check dist/* + + - name: Publish to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + packages-dir: server/dist/ + print-hash: true + + - name: Installation test instructions + run: | + echo "โœ… Published to TestPyPI!" + echo "" + echo "To test installation:" + echo " pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ nninteractive-slicer-server==${{ env.VERSION }}" + + publish-test-docker: + runs-on: ubuntu-latest + environment: test + steps: + - name: Free up disk space + run: | + # Free up disk space on GitHub Actions runner + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/ghc + sudo rm -rf /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force + df -h + + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Extract version from tag + run: | + VERSION=${GITHUB_REF#refs/tags/test-v} + echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "๐Ÿณ Building Docker test version: $VERSION" + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: ./server + file: ./server/Dockerfile + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/nninteractive:test-${{ env.VERSION }} + ${{ secrets.DOCKERHUB_USERNAME }}/nninteractive:test-latest + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Docker test instructions + run: | + echo "โœ… Published to Docker Hub!" + echo "" + echo "To test Docker image:" + echo " docker pull ${{ secrets.DOCKERHUB_USERNAME }}/nninteractive:test-${{ env.VERSION }}" + echo " docker run ${{ secrets.DOCKERHUB_USERNAME }}/nninteractive:test-${{ env.VERSION }}" + + create-test-release: + runs-on: ubuntu-latest + needs: [publish-test-pypi, publish-test-docker] + permissions: + contents: write + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Extract version from tag + run: | + VERSION=${GITHUB_REF#refs/tags/test-v} + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Create GitHub test release + uses: softprops/action-gh-release@v1 + with: + name: "Test Release ${{ env.VERSION }}" + body: | + ๐Ÿงช **Test Release ${{ env.VERSION }}** + + This is a test release for validation purposes. + + **Installation:** + ```bash + # PyPI test package + pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ nninteractive-slicer-server==${{ env.VERSION }} + + # Docker test image + docker pull ${{ secrets.DOCKERHUB_USERNAME }}/nninteractive:test-${{ env.VERSION }} + ``` + + **โš ๏ธ Note:** This is a test release and should not be used in production. + prerelease: true + draft: false diff --git a/.gitignore b/.gitignore index f7b27c1..f0e9d77 100644 --- a/.gitignore +++ b/.gitignore @@ -86,4 +86,6 @@ temp/ *.pth log.out -.nninteractive_weights \ No newline at end of file +.nninteractive_weights + +uv.lock \ No newline at end of file diff --git a/server/Dockerfile b/server/Dockerfile index ea97f8a..f124641 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -1,6 +1,7 @@ FROM nvidia/cuda:12.1.0-devel-ubuntu20.04 -RUN apt-get update && apt-get install -y wget +RUN apt-get update && apt-get install -y wget && \ + apt-get clean && rm -rf /var/lib/apt/lists/* RUN useradd -m user @@ -25,14 +26,18 @@ RUN /bin/bash -c "\ RUN echo "Conda env nnInteractive created" -RUN /opt/conda/envs/nnInteractive/bin/python3.12 -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cu126 +RUN /opt/conda/envs/nnInteractive/bin/python3.12 -m pip uninstall -y torch torchvision torchaudio + +RUN /opt/conda/envs/nnInteractive/bin/python3.12 -m pip install --no-cache-dir \ + torch==2.8.0 torchvision torchaudio \ + --index-url https://download.pytorch.org/whl/cu128 WORKDIR /opt/server COPY nninteractive_slicer_server/main.py main.py COPY requirements.txt requirements.txt -RUN /opt/conda/envs/nnInteractive/bin/python3.12 -m pip install -r requirements.txt +RUN /opt/conda/envs/nnInteractive/bin/python3.12 -m pip install --no-cache-dir -r requirements.txt RUN chown -R user:user /opt/server diff --git a/server/nninteractive_slicer_server/main.py b/server/nninteractive_slicer_server/main.py index 4ce5ea8..3746602 100644 --- a/server/nninteractive_slicer_server/main.py +++ b/server/nninteractive_slicer_server/main.py @@ -435,4 +435,5 @@ def main(): if __name__ == "__main__": + print(f"torch.__version__: {torch.__version__}") main() diff --git a/server/pyproject.toml b/server/pyproject.toml index 12e5a0a..8fa3dc6 100644 --- a/server/pyproject.toml +++ b/server/pyproject.toml @@ -16,7 +16,7 @@ dependencies = [ "nninteractive==1.0.1", "fastapi==0.111.0", "numpy==2.2.3", - "torch==2.6.0", + "torch==2.8.0", "Pillow==11.1.0", "transformers==4.49.0", "xxhash==3.5.0" diff --git a/server/requirements.txt b/server/requirements.txt index 0249852..a1cf73b 100644 --- a/server/requirements.txt +++ b/server/requirements.txt @@ -1,7 +1,7 @@ -nninteractive==1.0.1 -fastapi==0.111.0 -numpy==2.2.3 -torch==2.6.0 -Pillow==11.1.0 -transformers==4.49.0 -xxhash==3.5.0 \ No newline at end of file +nninteractive>=1.0.1,<2.0.0 +fastapi>=0.111.0,<0.112.0 +numpy>=2.2.3,<3.0.0 +torch>=2.8.0,<2.9.0 +Pillow>=11.1.0,<12.0.0 +transformers>=4.49.0,<4.50.0 +xxhash>=3.5.0,<4.0.0 \ No newline at end of file