"benchmark/git@developer.sourcefind.cn:change/sglang.git" did not exist on "62b362b1f134e449985208567adeecef363e1126"
Unverified Commit 6f1adc43 authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Fix group_lengths for short datasets (#12558)

parent 0a6b9048
...@@ -398,6 +398,7 @@ def main(): ...@@ -398,6 +398,7 @@ def main():
total_length = len(concatenated_examples[list(examples.keys())[0]]) total_length = len(concatenated_examples[list(examples.keys())[0]])
# We drop the small remainder, we could add padding if the model supported it instead of this drop, you can # We drop the small remainder, we could add padding if the model supported it instead of this drop, you can
# customize this part to your needs. # customize this part to your needs.
if total_length >= block_size:
total_length = (total_length // block_size) * block_size total_length = (total_length // block_size) * block_size
# Split by chunks of max_len. # Split by chunks of max_len.
result = { result = {
......
...@@ -431,6 +431,7 @@ if __name__ == "__main__": ...@@ -431,6 +431,7 @@ if __name__ == "__main__":
total_length = len(concatenated_examples[list(examples.keys())[0]]) total_length = len(concatenated_examples[list(examples.keys())[0]])
# We drop the small remainder, we could add padding if the model supported it instead of this drop, you can # We drop the small remainder, we could add padding if the model supported it instead of this drop, you can
# customize this part to your needs. # customize this part to your needs.
if total_length >= max_seq_length:
total_length = (total_length // max_seq_length) * max_seq_length total_length = (total_length // max_seq_length) * max_seq_length
# Split by chunks of max_len. # Split by chunks of max_len.
result = { result = {
......
...@@ -541,6 +541,7 @@ if __name__ == "__main__": ...@@ -541,6 +541,7 @@ if __name__ == "__main__":
total_length = len(concatenated_examples[list(examples.keys())[0]]) total_length = len(concatenated_examples[list(examples.keys())[0]])
# We drop the small remainder, we could add padding if the model supported it instead of this drop, you can # We drop the small remainder, we could add padding if the model supported it instead of this drop, you can
# customize this part to your needs. # customize this part to your needs.
if total_length >= expanded_inputs_length:
total_length = (total_length // expanded_inputs_length) * expanded_inputs_length total_length = (total_length // expanded_inputs_length) * expanded_inputs_length
# Split by chunks of max_len. # Split by chunks of max_len.
result = { result = {
......
...@@ -404,6 +404,7 @@ def main(): ...@@ -404,6 +404,7 @@ def main():
total_length = len(concatenated_examples[list(examples.keys())[0]]) total_length = len(concatenated_examples[list(examples.keys())[0]])
# We drop the small remainder, we could add padding if the model supported it instead of this drop, you can # We drop the small remainder, we could add padding if the model supported it instead of this drop, you can
# customize this part to your needs. # customize this part to your needs.
if total_length >= block_size:
total_length = (total_length // block_size) * block_size total_length = (total_length // block_size) * block_size
# Split by chunks of max_len. # Split by chunks of max_len.
result = { result = {
......
...@@ -343,6 +343,7 @@ def main(): ...@@ -343,6 +343,7 @@ def main():
total_length = len(concatenated_examples[list(examples.keys())[0]]) total_length = len(concatenated_examples[list(examples.keys())[0]])
# We drop the small remainder, we could add padding if the model supported it instead of this drop, you can # We drop the small remainder, we could add padding if the model supported it instead of this drop, you can
# customize this part to your needs. # customize this part to your needs.
if total_length >= block_size:
total_length = (total_length // block_size) * block_size total_length = (total_length // block_size) * block_size
# Split by chunks of max_len. # Split by chunks of max_len.
result = { result = {
......
...@@ -433,6 +433,7 @@ def main(): ...@@ -433,6 +433,7 @@ def main():
total_length = len(concatenated_examples[list(examples.keys())[0]]) total_length = len(concatenated_examples[list(examples.keys())[0]])
# We drop the small remainder, we could add padding if the model supported it instead of this drop, you can # We drop the small remainder, we could add padding if the model supported it instead of this drop, you can
# customize this part to your needs. # customize this part to your needs.
if total_length >= max_seq_length:
total_length = (total_length // max_seq_length) * max_seq_length total_length = (total_length // max_seq_length) * max_seq_length
# Split by chunks of max_len. # Split by chunks of max_len.
result = { result = {
......
...@@ -387,6 +387,7 @@ def main(): ...@@ -387,6 +387,7 @@ def main():
total_length = len(concatenated_examples[list(examples.keys())[0]]) total_length = len(concatenated_examples[list(examples.keys())[0]])
# We drop the small remainder, we could add padding if the model supported it instead of this drop, you can # We drop the small remainder, we could add padding if the model supported it instead of this drop, you can
# customize this part to your needs. # customize this part to your needs.
if total_length >= max_seq_length:
total_length = (total_length // max_seq_length) * max_seq_length total_length = (total_length // max_seq_length) * max_seq_length
# Split by chunks of max_len. # Split by chunks of max_len.
result = { result = {
......
...@@ -406,6 +406,7 @@ def main(): ...@@ -406,6 +406,7 @@ def main():
total_length = len(concatenated_examples[list(examples.keys())[0]]) total_length = len(concatenated_examples[list(examples.keys())[0]])
# We drop the small remainder, we could add padding if the model supported it instead of this drop, you can # We drop the small remainder, we could add padding if the model supported it instead of this drop, you can
# customize this part to your needs. # customize this part to your needs.
if total_length >= max_seq_length:
total_length = (total_length // max_seq_length) * max_seq_length total_length = (total_length // max_seq_length) * max_seq_length
# Split by chunks of max_len. # Split by chunks of max_len.
result = { result = {
......
...@@ -405,6 +405,7 @@ def main(): ...@@ -405,6 +405,7 @@ def main():
total_length = len(concatenated_examples[list(examples.keys())[0]]) total_length = len(concatenated_examples[list(examples.keys())[0]])
# We drop the small remainder, we could add padding if the model supported it instead of this drop, you can # We drop the small remainder, we could add padding if the model supported it instead of this drop, you can
# customize this part to your needs. # customize this part to your needs.
if total_length >= block_size:
total_length = (total_length // block_size) * block_size total_length = (total_length // block_size) * block_size
# Split by chunks of max_len. # Split by chunks of max_len.
result = { result = {
......
...@@ -466,6 +466,7 @@ def main(): ...@@ -466,6 +466,7 @@ def main():
total_length = len(concatenated_examples[list(examples.keys())[0]]) total_length = len(concatenated_examples[list(examples.keys())[0]])
# We drop the small remainder, we could add padding if the model supported it instead of this drop, you can # We drop the small remainder, we could add padding if the model supported it instead of this drop, you can
# customize this part to your needs. # customize this part to your needs.
if total_length >= max_seq_length:
total_length = (total_length // max_seq_length) * max_seq_length total_length = (total_length // max_seq_length) * max_seq_length
# Split by chunks of max_len. # Split by chunks of max_len.
result = { result = {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment