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

Add InfiniteBenchSum scenario and run spec #3409

Merged
merged 5 commits into from
Mar 6, 2025
Merged

Conversation

liamjxu
Copy link
Contributor

@liamjxu liamjxu commented Mar 6, 2025

No description provided.

@liamjxu liamjxu requested a review from yifanmai March 6, 2025 00:22
@liamjxu liamjxu self-assigned this Mar 6, 2025


@run_spec_function("infinite_bench_sum")
def get_infinite_bench_sum_spec(word_lower_bound: float = 0.0, word_upper_bound: float = 100e6) -> RunSpec:
Copy link
Collaborator

Choose a reason for hiding this comment

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

1e8 instead of 100e6 (also isn't 1e7 enough?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes 1e7 is enough; re 1e8 vs 100e6, was meant to make it easier to understand (100e6=100M, 30e3=30k, etc), but am fine with both.
Currently: changed to 1e7 in the latest change

scenario_spec = ScenarioSpec(
class_name="helm.benchmark.scenarios.infinite_bench_sum_scenario.InfiniteBenchSumScenario",
args={
"word_lower_bound": word_lower_bound,
Copy link
Collaborator

Choose a reason for hiding this comment

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

num_words_lower_bound or min_num_words

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to min_num_words

class_name="helm.benchmark.scenarios.infinite_bench_sum_scenario.InfiniteBenchSumScenario",
args={
"word_lower_bound": word_lower_bound,
"word_upper_bound": word_upper_bound,
Copy link
Collaborator

Choose a reason for hiding this comment

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

num_words_upper_bound or max_num_words

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to max_num_words

class InfiniteBenchSumScenario(Scenario):
"""InfiniteBenchSum

InfiniteBenchbenchmark tailored for evaluating the capabilities of language models to process,
Copy link
Collaborator

Choose a reason for hiding this comment

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

InfiniteBench benchmark

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Corrected



class InfiniteBenchSumScenario(Scenario):
"""InfiniteBenchSum
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a space between InfiniteBench and Sum?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, corrected

Comment on lines 55 to 57
dataset = dataset.map(lambda example: {"prompt": example["context"] + "\n\n" + example["input"]})
dataset = dataset.map(lambda example: {"prompt_wc": len(example["prompt"].split())})
dataset = dataset.filter(lambda example: self.word_lower_bound <= example["prompt_wc"] <= self.word_upper_bound)
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you just do this chained

(
dataset.map()
  .map()
  .filter()
)

Copy link
Contributor Author

@liamjxu liamjxu Mar 6, 2025

Choose a reason for hiding this comment

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

Yes, changed to this


assert isinstance(dataset, Dataset)

dataset = dataset.map(lambda example: {"prompt": example["context"] + "\n\n" + example["input"]})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't need this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed

assert isinstance(dataset, Dataset)

dataset = dataset.map(lambda example: {"prompt": example["context"] + "\n\n" + example["input"]})
dataset = dataset.map(lambda example: {"prompt_wc": len(example["prompt"].split())})
Copy link
Collaborator

Choose a reason for hiding this comment

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

def count_words:
    return len(re.split(r"\s+", text.strip()))

then do

{"prompt_wc": count_words(example["context"]) + count_words(example["input"])}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed

)

# Load the dataset with the specified features
dataset = load_dataset("xinrongzhang2022/InfiniteBench", split="longbook_sum_eng", features=ft)
Copy link
Collaborator

Choose a reason for hiding this comment

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

pin revision revision="90f0394333616266d9fe85824ceaf505093cbaa5"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Revision pinned

@liamjxu liamjxu requested a review from yifanmai March 6, 2025 03:00
@yifanmai yifanmai merged commit 185bc24 into main Mar 6, 2025
12 checks passed
@yifanmai yifanmai deleted the jialiang/long_context branch March 6, 2025 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants