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

update benchmark_models cli #238

Merged
merged 2 commits into from
Jul 30, 2024

Conversation

wenzhe-log10
Copy link
Collaborator

save file with --file only, to md, csv, or jsonl based on file extension

* save file with --file only, to md, csv, or jsonl based on file extension
@wenzhe-log10 wenzhe-log10 requested review from kxtran and nqn July 30, 2024 04:23
Copy link
Collaborator

@kxtran kxtran left a comment

Choose a reason for hiding this comment

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

LGTM % comments

Comment on lines 407 to 414
if path.suffix.lower() == ".csv":
# save the dataframe to a csv file
all_df.to_csv(path, index=False)
rich.print(f"Dataframe saved to csv file: {path}")
elif path.suffix.lower() == ".jsonl":
all_df.to_json(path, orient="records", lines=True)
rich.print(f"Dataframe saved to jsonl file: {path}")
elif path.suffix.lower() == ".md":
Copy link
Collaborator

Choose a reason for hiding this comment

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

we could extract the path.suffix.lower() to be in a variable

Copy link
Collaborator Author

@wenzhe-log10 wenzhe-log10 Jul 30, 2024

Choose a reason for hiding this comment

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

done. reuse the name ext_name at ln 312.

Comment on lines 407 to 414
if path.suffix.lower() == ".csv":
# save the dataframe to a csv file
all_df.to_csv(path, index=False)
rich.print(f"Dataframe saved to csv file: {path}")
elif path.suffix.lower() == ".jsonl":
all_df.to_json(path, orient="records", lines=True)
rich.print(f"Dataframe saved to jsonl file: {path}")
elif path.suffix.lower() == ".md":
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we also add the else case to raise Error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we have checked the extension name at the beginning of the func (ln 310-316), so no need to check again here.

@wenzhe-log10 wenzhe-log10 merged commit 7611486 into main Jul 30, 2024
1 of 2 checks passed
@wenzhe-log10 wenzhe-log10 deleted the wenzhe/benchmark_model_save_file_with_suffix branch July 30, 2024 19:10
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