Skip to content

Fix EfficientNet-B3 training failure due to SSL certificate error when downloading weights#6392

Draft
itallix with Copilot wants to merge 3 commits into
developfrom
copilot/fix-efficientnet-b3-training-error
Draft

Fix EfficientNet-B3 training failure due to SSL certificate error when downloading weights#6392
itallix with Copilot wants to merge 3 commits into
developfrom
copilot/fix-efficientnet-b3-training-error

Conversation

Copilot AI commented May 6, 2026

Copy link
Copy Markdown
Contributor

EfficientNet-B3 training fails with CERTIFICATE_VERIFY_FAILED because TorchvisionBackbone unconditionally triggers a download from https://download.pytorch.org/models/ via torchvision's weight enum mechanism — even when the weights are already pre-downloaded locally by BaseWeightsService. The pre-downloaded path was silently ignored (there was a TODO comment acknowledging this gap).

Changes

TorchvisionBackbone (backbones/torchvision.py)

  • Added pretrained_weights_path: str | Path | None = None parameter
  • When a valid local path is provided, creates the model without weights then loads state dict from disk — skipping the torchvision download entirely

TV model wrappers (TVModelMulticlassCls, TVModelMultilabelCls, TVModelHLabelCls)

  • Propagate pretrained_weights_path: str | None = None down to TorchvisionBackbone

GetiTuneTrainer (getitune_trainer.py)

  • Added _inject_pretrained_weights_path() static method: uses inspect.signature to check if the model class accepts pretrained_weights_path, then injects the pre-downloaded path into model_cfg["init_args"]
  • Calls this in train_model() when has_parent_revision=False, resolving the existing TODO referencing this issue
  • Catches specific exceptions (ImportError, AttributeError, ValueError) with a warning fallback so non-TV models are unaffected

How to test

  • Train an EfficientNet-B3 classification model from scratch in an environment where https://download.pytorch.org is unreachable or SSL verification fails — training should succeed using the locally pre-downloaded weights
  • Verify that other models (e.g., YOLOX, EfficientNet-B0) continue to work unchanged — the injection is a no-op when the model class lacks the pretrained_weights_path parameter

Checklist

  • The PR title and description are clear and descriptive
  • I have manually tested the changes
  • All changes are covered by automated tests
  • All related issues are linked to this PR (if applicable)
  • Documentation has been updated (if applicable)

Copilot AI linked an issue May 6, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix EfficientNet-B3 training failure with certificate verification Fix EfficientNet-B3 training failure due to SSL certificate error when downloading weights May 6, 2026
Copilot AI requested a review from itallix May 6, 2026 09:50
Copilot finished work on behalf of itallix May 6, 2026 09:50
Copilot AI and others added 3 commits May 7, 2026 09:54
…cal path

- Add pretrained_weights_path parameter to TorchvisionBackbone that loads
  weights from a local file instead of downloading from PyTorch servers
- Add pretrained_weights_path parameter to TVModelMulticlassCls,
  TVModelMultilabelCls, and TVModelHLabelCls that is passed through to backbone
- Add _inject_pretrained_weights_path static method to GetiTuneTrainer that
  checks if the model class supports pretrained_weights_path and injects the
  pre-downloaded weights path into model init_args when training from scratch
- Call _inject_pretrained_weights_path in train_model when has_parent_revision=False
  to resolve the TODO comment referencing this issue
- Add tests for _inject_pretrained_weights_path and train_model without parent revision

Agent-Logs-Url: https://github.com/open-edge-platform/training_extensions/sessions/9e58cbd2-c6ef-47e3-a528-64a237272cbe

Co-authored-by: itallix <1437853+itallix@users.noreply.github.com>
@itallix itallix force-pushed the copilot/fix-efficientnet-b3-training-error branch from d31952d to d022957 Compare May 7, 2026 07:54
@github-actions github-actions Bot added TEST Any changes in tests Geti Backend Issues related to the Geti application server Geti Library Issues related to Geti Library (OTX) labels May 7, 2026
@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown

🐳 Docker image sizes

Device Size
cpu 3579.9 MB (3.50 GB)
xpu 10548.5 MB (10.30 GB)
cuda 10184.7 MB (9.95 GB)

@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown

📊 Test coverage report

Metric Coverage
Lines 59.3%
Functions 80.4%
Branches 88.2%
Statements 59.3%

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 70.58824% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ing/models/classification/backbones/torchvision.py 54.54% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@kprokofi

kprokofi commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

@itallix
Are we going to update this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Geti Backend Issues related to the Geti application server Geti Library Issues related to Geti Library (OTX) TEST Any changes in tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Training fails when downloading weights - CERTIFICATE_VERIFY_FAILED

4 participants