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 Megatron .bin file sharding and unsharding scripts #45

Merged
merged 4 commits into from
Jan 4, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
cleanup unsharding script
  • Loading branch information
haileyschoelkopf committed Jan 1, 2023
commit 011a473f6dae5bfef99915074d166276a0210f62
10 changes: 0 additions & 10 deletions utils/unshard_memmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,10 @@ def unshard(
print(shard_filename)
shard_memmap = np.memmap(shard_filename, mode="r", order="C")

#if full_idx_map is None:
# full_idx_map = shard_memmap
#else:
# full_idx_map = np.concatenate([full_idx_map, shard_memmap])
size = SHARD_SIZE if not (i == num_shards - 1) else final_shard_size
full_idx_map[i * SHARD_SIZE: (i * SHARD_SIZE) + size] = shard_memmap

del shard_memmap
print(full_idx_map.shape)

# write full file
with open(os.path.join(output_dir, base_filename) + ".bin", "wb+") as out_full_file:
full_idx_map.tofile(out_full_file)


if __name__ == "__main__":

Expand Down