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

Set output-ngrams to default to true and update README #1776

Merged
merged 5 commits into from
Aug 12, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 2 additions & 1 deletion scripts/data_overlap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ This needs to be run from the data overlap directory; i.e. cd scripts/data_overl

Usage:

python [compute_data_overlap_metrics.py OR run_data_overlap_beam.py] --input-data <input_data> --scenario-data <scenario_data> --output-stats <output_stats> --input-format <input_format>
python [compute_data_overlap_metrics.py OR run_data_overlap_beam.py] --input-data <input_data> --scenario-data <scenario_data> --output-stats <output_stats> --input-format <input_format>
Copy link
Contributor

Choose a reason for hiding this comment

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

delete trailing space?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleted, thanks


For instance, you can call this with The Pile, e.g. have:
input_data = 00.jsonl (download https://pile.eleuther.ai/)
scenario_data = (example included with repo, but can use HELM to generate)
output_stats = arbitrary output file name, e.g. "output_stats"
input_format = the_pile

If you don't want to output the ngrams that are overlapping in test set to a separate "{output_stats}_ngrams" file, you can pass --no-output-ngrams.

There are additional optional args:
--normalization default
Expand Down
2 changes: 1 addition & 1 deletion scripts/data_overlap/common/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def get_data_overlap_args() -> Any:
required=True,
help="The format of your input file for your training data, e.g. raw, custom, the_pile",
)
parser.add_argument("--output-ngrams", type=bool, default=False, help="Whether to output ngrams")
parser.add_argument("--no-output-ngrams", type=bool, default=False, help="Pass to not output ngrams")
parser.add_argument(
"--tags",
type=str,
Expand Down
4 changes: 2 additions & 2 deletions scripts/data_overlap/compute_data_overlap_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,10 @@ def compute_document_data_overlap(
stats_key_to_input_ids=stats_key_to_input_ids,
stats_key_to_reference_ids=stats_key_to_reference_ids,
entry_overlap_key_to_ngram_counts=entry_overlap_key_to_ngram_counts,
output_ngrams=args.output_ngrams,
output_ngrams=not args.no_output_ngrams,
)

if args.output_ngrams:
if not args.no_output_ngrams:
all_entry_overlap_ngrams = []
with open(f"{args.output_stats}_ngrams", "w") as f:
for entry_overlap_key in entry_overlap_key_to_ngram_counts:
Expand Down
Loading