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
2 changes: 1 addition & 1 deletion src/transformers/generation/continuous_batching.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def update_with_token(self, token_id: int) -> bool:
return False

def __repr__(self):
return f"RequestState(\n\trequest_id={self.request_id},\n\tstatus={self.status},\n\tout_tokens={self.generated_len()},\n\tquery_length={len(self.prompt_ids)}, \n\tremaining_tokens={len(self.remaining_prompt_ids)}, \n\tkv_length={self.position_offset}\n\tfull_prompt_lenght={len(self.full_prompt_ids)},\n\tallocated_blocks={self.allocated_blocks},\n\tgenerated_tokens={self.static_outputs}\n)"
return f"RequestState(\n\trequest_id={self.request_id},\n\tstatus={self.status},\n\tout_tokens={self.generated_len()},\n\tquery_length={len(self.prompt_ids)}, \n\tremaining_tokens={len(self.remaining_prompt_ids)}, \n\tkv_length={self.position_offset}\n\tfull_prompt_length={len(self.full_prompt_ids)},\n\tallocated_blocks={self.allocated_blocks},\n\tgenerated_tokens={self.static_outputs}\n)"

def to_generation_output(self):
"""Convert the request state to a GenerationOutput object."""
Expand Down
4 changes: 2 additions & 2 deletions src/transformers/models/mimi/modeling_mimi.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,10 @@ def _get_output_length(self, input_length: torch.LongTensor) -> torch.LongTensor
input_length = input_length + padding_left + padding_right

# conv
output_lenght = (
output_length = (
input_length + 2 * self.conv.padding[0] - self.conv.dilation[0] * (self.conv.kernel_size[0] - 1) - 1
) // self.conv.stride[0] + 1
return output_lenght
return output_length

def forward(self, hidden_states, padding_cache=None):
extra_padding = self._get_extra_padding_for_conv1d(hidden_states)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ def test_generation(self):
reproduce test expected outputs using original codebase: https://gist.github.com/eustlb/7a9aa6139d11e0103c6b65bac103da52

DISCLAIMER: we are testing for pretty short inputs. Indeed, reproducing correct expected outputs for longer is not possible
as implementation choices (qkv matrix in one linear for original code vs three for hf) create growing divergence with context lenght,
as implementation choices (qkv matrix in one linear for original code vs three for hf) create growing divergence with context length,
ultimately giving different outputs.
"""
processor = KyutaiSpeechToTextProcessor.from_pretrained(self.model_checkpoint)
Expand Down Expand Up @@ -747,7 +747,7 @@ def test_generation_batched(self):
reproduce test expected outputs using original codebase: https://gist.github.com/eustlb/b58c217c75124d405ec1c13877c7ece8

DISCLAIMER: we are testing for pretty short inputs. Indeed, reproducing correct expected outputs for longer is not possible
as implementation choices (qkv matrix in one linear for original code vs three for hf) create growing divergence with context lenght,
as implementation choices (qkv matrix in one linear for original code vs three for hf) create growing divergence with context length,
ultimately giving different outputs.
"""
processor = KyutaiSpeechToTextProcessor.from_pretrained(self.model_checkpoint)
Expand Down