Skip to content
Closed
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
3 changes: 2 additions & 1 deletion tensorrt_llm/_torch/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import transformers
from packaging import version

from .modeling_auto import AutoModelForCausalLM
from .modeling_bert import BertForSequenceClassification
Expand Down Expand Up @@ -89,7 +90,7 @@
"Cohere2ForCausalLM",
]

if transformers.__version__ >= "4.45.1":
if version.parse(transformers.__version__) >= version.parse("4.45.1"):
from .modeling_mllama import MllamaForConditionalGeneration # noqa

__all__.append("MllamaForConditionalGeneration")
Expand Down
4 changes: 3 additions & 1 deletion tensorrt_llm/_torch/speculative/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from typing import TYPE_CHECKING, List, Optional, Type

import torch
from packaging import version
from torch import nn

from tensorrt_llm.logger import logger
Expand Down Expand Up @@ -517,7 +518,8 @@ def __init__(self, use_separate_draft_kv_cache: bool = False):
super().__init__()
self.guided_decoder: Optional["CapturableGuidedDecoder"] = None
self.force_num_accepted_tokens = get_force_num_accepted_tokens()
self.use_flashinfer = IS_FLASHINFER_AVAILABLE and flashinfer.__version__ >= "0.6.4"
self.use_flashinfer = IS_FLASHINFER_AVAILABLE and version.parse(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One semantic difference worth being aware of: PEP 440 orders pre-releases/dev builds below their base release, so a nightly like 0.6.4.dev20260101 now evaluates False where the string compare gave True. Harmless with the pinned flashinfer-python==0.6.9, but if someone runs a nightly at the boundary the flashinfer path will silently turn off.

flashinfer.__version__) >= version.parse("0.6.4")
self.seed: Optional[torch.Tensor] = None
self.offset: Optional[torch.Tensor] = None
self.use_separate_draft_kv_cache = use_separate_draft_kv_cache
Expand Down
4 changes: 3 additions & 1 deletion tensorrt_llm/tools/multimodal_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from time import time

import yaml
from packaging import version

# isort: off
import torch
Expand Down Expand Up @@ -1406,7 +1407,8 @@ class VisionAttentionOpt(VisionAttention):

def __init__(self, config: Qwen2VLVisionConfig):
# Fallback for compatibility with older transformers versions (for certain nvbugs/tests)
if transformers.__version__ >= '4.53.0':
if version.parse(
transformers.__version__) >= version.parse('4.53.0'):
super().__init__(config)
self.head_dim = config.embed_dim // config.num_heads
else:
Expand Down