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

skip the character count of the input text > 2048 #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions eval/utils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ def encode_sequences(self, sequences: List[str], response_with: str='') -> List[

assert isinstance(sequences, list) and isinstance(sequences[0], str)

# Due to the model's maximum input length limitation of 2048, we need to ensure that the character count of the input text <= 2048.
max_sequence_length = 2048
sequences = [sentence[:max_sequence_length] if len(sentence) > max_sequence_length else sentence for sentence in sequences]
# Due to the model's maximum input length limitation of 2048, we need to skip the character count of the input text > 2048.
max_sequence_length = 2048
padding_token = "<PAD>" # Choose an appropriate padding token
sequences = [sentence if len(sentence) <= max_sequence_length else [padding_token] for sentence in sequences]


special_encoding = get_special_encoding()
Expand Down