Skip to content
Open
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
Empty file added -image-text-to-text
Empty file.
1 change: 1 addition & 0 deletions src/transformers/models/auto/modeling_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,7 @@ class _BaseModelWithGenerate(PreTrainedModel, GenerationMixin):
("video_llama_3", "VideoLlama3ForConditionalGeneration"),
("vipllava", "VipLlavaForConditionalGeneration"),
("vision-encoder-decoder", "VisionEncoderDecoderModel"),

]
)

Expand Down
17 changes: 16 additions & 1 deletion src/transformers/models/parakeet/tokenization_parakeet_fast.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@
from typing import Optional, Union

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...tokenization_utils_base import PreTrainedTokenizerBase

class ParakeetCTCTokenizer(PreTrainedTokenizerBase):
def __init__(self, vocab_file=None, **kwargs):
super().__init__()
self.vocab_file = vocab_file

def _tokenize(self, text):
return text.split()

def _convert_token_to_id(self, token):
return 0

def _convert_id_to_token(self, index):
return ""
Comment on lines +21 to +34
Copy link
Member

Choose a reason for hiding this comment

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

same here, we can set the slow tokenizer to None if the model has only fast tokenizer (e..g see Chameleon)



class ParakeetTokenizerFast(PreTrainedTokenizerFast):
Expand Down Expand Up @@ -51,4 +66,4 @@ def _decode(
)


__all__ = ["ParakeetTokenizerFast"]
__all__ = ["ParakeetTokenizerFast", "ParakeetCTCTokenizer"]
13 changes: 12 additions & 1 deletion src/transformers/models/perception_lm/modeling_perception_lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,21 @@
from ...generation import GenerationMixin
from ...modeling_outputs import BaseModelOutputWithPast, ModelOutput
from ...modeling_utils import PreTrainedModel
from ...configuration_utils import PretrainedConfig
from ...utils import auto_docstring, can_return_tuple
from ..auto import AutoModel
from .configuration_perception_lm import PerceptionLMConfig

class PerceptionEncoder(PreTrainedModel):
config_class = PretrainedConfig

def __init__(self, config):
super().__init__(config)
self.dummy_layer = None

def forward(self, x):
return x

Comment on lines +38 to +47
Copy link
Member

Choose a reason for hiding this comment

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

i don't think this is what we want to do. If the model does not exist, we should delete it from modeling_auto which is the case for perception LM


class PerceptionLMAdaptiveAvgPooling(nn.Module):
def __init__(self, pooling_ratio=2):
Expand Down Expand Up @@ -484,4 +495,4 @@ def prepare_inputs_for_generation(
return model_inputs


__all__ = ["PerceptionLMForConditionalGeneration", "PerceptionLMPreTrainedModel", "PerceptionLMModel"]
__all__ = ["PerceptionLMForConditionalGeneration", "PerceptionLMPreTrainedModel", "PerceptionLMModel", "PerceptionEncoder"]