transformers - 💡(How to fix) Fix incompatibility with torch 2.4.1

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

rfdetr-1 | Traceback (most recent call last): rfdetr-1 | File "/app/test.py", line 1, in <module> rfdetr-1 | from rfdetr import RFDETRMedium rfdetr-1 | File "/usr/local/lib/python3.12/dist-packages/rfdetr/init.py", line 50, in <module> rfdetr-1 | from rfdetr.detr import RFDETR rfdetr-1 | File "/usr/local/lib/python3.12/dist-packages/rfdetr/detr.py", line 40, in <module> rfdetr-1 | from rfdetr.inference import ModelContext, _build_model_context rfdetr-1 | File "/usr/local/lib/python3.12/dist-packages/rfdetr/inference.py", line 17, in <module> rfdetr-1 | from rfdetr.models import PostProcess, build_model rfdetr-1 | File "/usr/local/lib/python3.12/dist-packages/rfdetr/models/init.py", line 19, in <module> rfdetr-1 | from rfdetr.models.lwdetr import build_criterion_from_config, build_model, build_model_from_config rfdetr-1 | File "/usr/local/lib/python3.12/dist-packages/rfdetr/models/lwdetr.py", line 32, in <module> rfdetr-1 | from rfdetr.models.backbone import build_backbone rfdetr-1 | File "/usr/local/lib/python3.12/dist-packages/rfdetr/models/backbone/init.py", line 15, in <module> rfdetr-1 | from rfdetr.models.backbone.backbone import Backbone rfdetr-1 | File "/usr/local/lib/python3.12/dist-packages/rfdetr/models/backbone/backbone.py", line 21, in <module> rfdetr-1 | from rfdetr.models.backbone.dinov2 import DinoV2 rfdetr-1 | File "/usr/local/lib/python3.12/dist-packages/rfdetr/models/backbone/dinov2.py", line 17, in <module> rfdetr-1 | from rfdetr.models.backbone.dinov2_with_windowed_attn import ( rfdetr-1 | File "/usr/local/lib/python3.12/dist-packages/rfdetr/models/backbone/dinov2_with_windowed_attn.py", line 51, in <module> rfdetr-1 | from transformers.modeling_utils import PreTrainedModel rfdetr-1 | File "/usr/local/lib/python3.12/dist-packages/transformers/modeling_utils.py", line 69, in <module> rfdetr-1 | from .integrations.finegrained_fp8 import ALL_FP8_EXPERTS_FUNCTIONS rfdetr-1 | File "/usr/local/lib/python3.12/dist-packages/transformers/integrations/finegrained_fp8.py", line 45, in <module> rfdetr-1 | _UE8M0_SF_DTYPE = torch.float8_e8m0fnu rfdetr-1 | ^^^^^^^^^^^^^^^^^^^^ rfdetr-1 | File "/usr/local/lib/python3.12/dist-packages/torch/init.py", line 2216, in getattr rfdetr-1 | raise AttributeError(f"module '{name}' has no attribute '{name}'") rfdetr-1 | AttributeError: module 'torch' has no attribute 'float8_e8m0fnu'

Code Example

rfdetr-1  | Traceback (most recent call last):
rfdetr-1  |   File "/app/test.py", line 1, in <module>
rfdetr-1  |     from rfdetr import RFDETRMedium
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/rfdetr/__init__.py", line 50, in <module>
rfdetr-1  |     from rfdetr.detr import RFDETR
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/rfdetr/detr.py", line 40, in <module>
rfdetr-1  |     from rfdetr.inference import ModelContext, _build_model_context
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/rfdetr/inference.py", line 17, in <module>
rfdetr-1  |     from rfdetr.models import PostProcess, build_model
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/rfdetr/models/__init__.py", line 19, in <module>
rfdetr-1  |     from rfdetr.models.lwdetr import build_criterion_from_config, build_model, build_model_from_config
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/rfdetr/models/lwdetr.py", line 32, in <module>
rfdetr-1  |     from rfdetr.models.backbone import build_backbone
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/rfdetr/models/backbone/__init__.py", line 15, in <module>
rfdetr-1  |     from rfdetr.models.backbone.backbone import Backbone
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/rfdetr/models/backbone/backbone.py", line 21, in <module>
rfdetr-1  |     from rfdetr.models.backbone.dinov2 import DinoV2
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/rfdetr/models/backbone/dinov2.py", line 17, in <module>
rfdetr-1  |     from rfdetr.models.backbone.dinov2_with_windowed_attn import (
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/rfdetr/models/backbone/dinov2_with_windowed_attn.py", line 51, in <module>
rfdetr-1  |     from transformers.modeling_utils import PreTrainedModel
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/transformers/modeling_utils.py", line 69, in <module>
rfdetr-1  |     from .integrations.finegrained_fp8 import ALL_FP8_EXPERTS_FUNCTIONS
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/transformers/integrations/finegrained_fp8.py", line 45, in <module>
rfdetr-1  |     _UE8M0_SF_DTYPE = torch.float8_e8m0fnu
rfdetr-1  |                       ^^^^^^^^^^^^^^^^^^^^
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/torch/__init__.py", line 2216, in __getattr__
rfdetr-1  |     raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
rfdetr-1  | AttributeError: module 'torch' has no attribute 'float8_e8m0fnu'

---

FROM nvcr.io/nvidia/tensorrt:26.05-py3
ARG DEBIAN_FRONTEND=noninteractive

# Install dependencies
RUN apt-get update && apt-get install libgl1 -y
RUN --mount=type=cache,target=/root/.cache/pip \
    pip install torch==2.4.1 torchvision==0.19.1 --index-url https://download.pytorch.org/whl/cu124
RUN pip install rfdetr

---

from rfdetr import RFDETRMedium
model = RFDETRMedium()
RAW_BUFFERClick to expand / collapse

System Info

When I tested the latest version of transformers 5.10.2, I got the error: AttributeError: module 'torch' has no attribute 'float8_e8m0fnu'.

here is the full log:

rfdetr-1  | Traceback (most recent call last):
rfdetr-1  |   File "/app/test.py", line 1, in <module>
rfdetr-1  |     from rfdetr import RFDETRMedium
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/rfdetr/__init__.py", line 50, in <module>
rfdetr-1  |     from rfdetr.detr import RFDETR
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/rfdetr/detr.py", line 40, in <module>
rfdetr-1  |     from rfdetr.inference import ModelContext, _build_model_context
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/rfdetr/inference.py", line 17, in <module>
rfdetr-1  |     from rfdetr.models import PostProcess, build_model
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/rfdetr/models/__init__.py", line 19, in <module>
rfdetr-1  |     from rfdetr.models.lwdetr import build_criterion_from_config, build_model, build_model_from_config
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/rfdetr/models/lwdetr.py", line 32, in <module>
rfdetr-1  |     from rfdetr.models.backbone import build_backbone
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/rfdetr/models/backbone/__init__.py", line 15, in <module>
rfdetr-1  |     from rfdetr.models.backbone.backbone import Backbone
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/rfdetr/models/backbone/backbone.py", line 21, in <module>
rfdetr-1  |     from rfdetr.models.backbone.dinov2 import DinoV2
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/rfdetr/models/backbone/dinov2.py", line 17, in <module>
rfdetr-1  |     from rfdetr.models.backbone.dinov2_with_windowed_attn import (
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/rfdetr/models/backbone/dinov2_with_windowed_attn.py", line 51, in <module>
rfdetr-1  |     from transformers.modeling_utils import PreTrainedModel
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/transformers/modeling_utils.py", line 69, in <module>
rfdetr-1  |     from .integrations.finegrained_fp8 import ALL_FP8_EXPERTS_FUNCTIONS
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/transformers/integrations/finegrained_fp8.py", line 45, in <module>
rfdetr-1  |     _UE8M0_SF_DTYPE = torch.float8_e8m0fnu
rfdetr-1  |                       ^^^^^^^^^^^^^^^^^^^^
rfdetr-1  |   File "/usr/local/lib/python3.12/dist-packages/torch/__init__.py", line 2216, in __getattr__
rfdetr-1  |     raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
rfdetr-1  | AttributeError: module 'torch' has no attribute 'float8_e8m0fnu'

Who can help?

No response

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

dockerfile:

FROM nvcr.io/nvidia/tensorrt:26.05-py3
ARG DEBIAN_FRONTEND=noninteractive

# Install dependencies
RUN apt-get update && apt-get install libgl1 -y
RUN --mount=type=cache,target=/root/.cache/pip \
    pip install torch==2.4.1 torchvision==0.19.1 --index-url https://download.pytorch.org/whl/cu124
RUN pip install rfdetr

python code:

from rfdetr import RFDETRMedium
model = RFDETRMedium()

Expected behavior

it should run without errors

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

it should run without errors

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING