Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-tests-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run-gpu-tests:
name: Testing
if: github.event_name == 'push' || !github.event.pull_request.draft
timeout-minutes: 35
timeout-minutes: 40
runs-on: Roboflow-GPU-VM-Runner
steps:
- name: πŸ–₯️ Print GPU information
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

---

## [1.6.2] β€” 2026-03-27

### Added

- `RFDETR.predict(shape=...)` β€” optional `(height, width)` tuple overrides the default square inference resolution; useful when matching a non-square ONNX export. Both dimensions must be positive integers divisible by `patch_size Γ— num_windows` as determined by the model configuration. (#866)

### Changed

- `ModelConfig.device` and `RFDETR.train(device=...)` now accept `torch.device` objects and indexed device strings such as `"cuda:0"`. Values are normalized to canonical torch-style strings. `RFDETR.train()` warns when an unmapped device type is passed to PyTorch Lightning auto-detection. (#872)

### Fixed

- Fixed ONNX export ignoring an explicit `patch_size` argument: `export()` and `predict()` now resolve `patch_size` from `model_config` by default, validate it strictly (positive integer, not bool), and enforce that `(H, W)` dimensions are divisible by `patch_size Γ— num_windows`. (#876)
- Fixed ONNX export for models with dynamic batch dimensions β€” replaced `H_.expand(N_)` with `torch.full` for Python-int spatial dims to eliminate tracer failures. (#871)

---

## [1.6.1] β€” 2026-03-25

### Deprecated
Expand Down
9 changes: 9 additions & 0 deletions docs/tutorials/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ Use the resources below to learn how to train, build with, and deploy RF-DETR mo

[:octicons-arrow-right-24: Read the tutorial](https://blog.roboflow.com/how-to-deploy-rf-detr-to-an-nvidia-jetson/)

- **Deploy RF-DETR with LitServe [Lightning AI Studio]**

---

![](https://blog.roboflow.com/content/images/size/w1000/format/webp/2025/03/img-blog-nycerebro--2--min.png)
Learn how to deploy RF-DETR as a scalable inference server using LitServe, the AI model serving framework from Lightning AI.

[:octicons-arrow-right-24: Open the Studio](https://lightning.ai/bhimrajyadav/studios/deploy-rf-detr-a-sota-real-time-object-detection-model-using-litserve)

- **Train and Deploy RF-DETR Models with Roboflow**

---
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "rfdetr"
version = "1.6.1"
version = "1.6.2"
description = "RF-DETR"
readme = "README.md"
authors = [
Expand Down
29 changes: 28 additions & 1 deletion src/rfdetr/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ class ModelConfig(BaseConfig):
amp: bool = True
num_classes: int = 90
pretrain_weights: Optional[str] = None
device: Literal["cpu", "cuda", "mps"] = DEVICE
# torch.device values are accepted at validation time and normalized to string.
device: str = DEVICE
resolution: int
group_detr: int = 13
gradient_checkpointing: bool = False
Expand All @@ -94,6 +95,32 @@ def expand_path(cls, v: Optional[str]) -> Optional[str]:
return v
return os.path.realpath(os.path.expanduser(v))

@field_validator("device", mode="before")
@classmethod
def _normalize_device(cls, v: Any) -> str:
"""Normalize supported device inputs to a canonical torch-style string.

Args:
v: Device specifier provided by callers. Supported values are
``str`` (for example ``"cpu"``, ``"cuda"``, ``"cuda:1"``)
and ``torch.device``.

Returns:
Canonical string form of the parsed device (for example ``"cuda:1"``).

Raises:
ValueError: If a string value cannot be parsed as a valid torch device.
ValueError: If ``v`` is not a string or ``torch.device``.
"""
if isinstance(v, torch.device):
return str(v)
if isinstance(v, str):
try:
return str(torch.device(v))
except (TypeError, ValueError, RuntimeError) as exc:
raise ValueError(f"Invalid device specifier: {v!r}.") from exc
raise ValueError("device must be a string or torch.device.")


class RFDETRBaseConfig(ModelConfig):
"""
Expand Down
Loading
Loading