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

Added dataset download files to write the dataset from the HF api to … #37

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

andrewkallai
Copy link

@andrewkallai andrewkallai commented Aug 10, 2024

Added dataset download files to write the dataset from the HF api to disk. Also added bash script to create tar files from the IR files on disk.

…disk. Also added bash script to create tar files from the IR files on disk.
Copy link

vercel bot commented Aug 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
llvm-ir-dataset-utils ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 15, 2024 10:26pm

Copy link
Contributor

@boomanaiden154 boomanaiden154 left a comment

Choose a reason for hiding this comment

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

Initial comments.

…de argparse functionality, elimination of global variables, and script execution layout.
Copy link
Contributor

@boomanaiden154 boomanaiden154 left a comment

Choose a reason for hiding this comment

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

Are you able to add a README.md or more info into the docstring in write_data_files.py with an example of how to use this?

Also, please take a look at the CI failures.

Copy link
Contributor

@boomanaiden154 boomanaiden154 left a comment

Choose a reason for hiding this comment

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

Couple stylistic things.

def get_args():
"""Function to return the provided storage argument for the script.

Returns: argparse.Namespace
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Can we have a type annotation for this?

tarinfo = tarfile.TarInfo(name=f'bc_files/file{x[0]+1+start_index}.bc')
file_obj = BytesIO(x[1])
tarinfo.size = file_obj.getbuffer().nbytes
tarinfo.mtime = time()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to set the time here?

Copy link
Author

Choose a reason for hiding this comment

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

The tar file will otherwise be created with an irregular modification time (e.g. the year 1969) and the tar will complain that the modification time is irregular.

tarinfo.mtime = time()
tar.addfile(tarinfo, fileobj=file_obj)

with parallel.parallel_backend('spark'):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment on the performance benefits of using the parallel backend?

end_index = file_indices[i]["end_index"]
dir_name = f'{storage}/{file_indices[i]["language"]}'
makedirs(dir_name, exist_ok=True)
thread = threading.Thread(
Copy link
Contributor

Choose a reason for hiding this comment

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

It would probably be more natural to use a ThreadPoolExecutor here, submit jobs, and get back futures?

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