Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor dead code - Removing all flash_xxx.py files. #2166

Merged
merged 22 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Removing more dead code.
  • Loading branch information
Narsil committed Jul 4, 2024
commit 24bbd7b822dbbb987d7270352e24ec49a5f65e78
9 changes: 5 additions & 4 deletions server/text_generation_server/models/causal_lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,10 +627,11 @@ def fallback(
def batch_type(self) -> Type[CausalLMBatch]:
return CausalLMBatch

def decode(self, generated_ids: List[int]) -> str:
return self.tokenizer.decode(
generated_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
# This is not used anymore
# def decode(self, generated_ids: List[int]) -> str:
# return self.tokenizer.decode(
# generated_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False
# )
OlivierDehaene marked this conversation as resolved.
Show resolved Hide resolved

def forward(
self, input_ids, attention_mask, position_ids, past_key_values: Optional = None
Expand Down
1 change: 1 addition & 0 deletions server/text_generation_server/models/flash_causal_lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,7 @@ def __init__(
aliases=None,
# Used for Santacoder override of config
num_kv_heads=None,
skip_special_tokens: bool = True,
):
self.process_group, rank, world_size = initialize_torch_distributed()
if torch.cuda.is_available():
Expand Down
9 changes: 5 additions & 4 deletions server/text_generation_server/models/seq2seq_lm.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,10 +668,11 @@ def fallback(
def batch_type(self) -> Type[Seq2SeqLMBatch]:
return Seq2SeqLMBatch

def decode(self, decoder_ids: List[int]) -> str:
return self.tokenizer.decode(
decoder_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
# Not used anymore
# def decode(self, decoder_ids: List[int]) -> str:
# return self.tokenizer.decode(
# decoder_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False
# )
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# Not used anymore
# def decode(self, decoder_ids: List[int]) -> str:
# return self.tokenizer.decode(
# decoder_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False
# )

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Isn't thtat surprising that it's not used anymore ?

Shouldn't we have those flags be used somewhere for those models ? Do we have test that cover the raison d'être of this code ?

Copy link
Member

Choose a reason for hiding this comment

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

I think this code was to allow models to specify the value of skip_special_tokens. For example for santacoder, you needed the fill in the middle special tokens to correctly display the outputs.


def forward(
self,
Expand Down