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

Improving memmap type parser #663

Merged
merged 4 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- Changed default distributed training strategy from single-GPU to FSDP
- Fixed behavior of `effective_memmap_dtype` to prevent unrecognized dtypes to be parsed as `uint16`.

## [v0.4.0](https://github.com/allenai/OLMo/releases/tag/v0.4.0) - 2024-07-11

### Added

- Added clipping fix to `Optimizer` class to make it work with FSDP `no_shard` and DDP.
- Added tests to compare grad norm differences between torch optimizer and clipping and OLMo optimizer and clipping on both CPU and GPU.
- Expose memmap dtype in data config
- Expose memmap dtype in data config
- Added support for DDP training.
- Added caching to disk of HF datasets used in downstream evals
- Added FLOPs logging
Expand Down
17 changes: 7 additions & 10 deletions olmo/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,16 +588,13 @@ class DataConfig(BaseConfig):

@property
def effective_memmap_dtype(self):
if self.memmap_dtype == "uint8":
return np.uint8
if self.memmap_dtype == "uint16":
return np.uint16
elif self.memmap_dtype == "uint32":
return np.uint32
elif self.memmap_dtype == "uint64":
return np.uint64
# default to uint16 if not set
return np.uint16
try:
# getattr will check this is part of numpy module, while np.dtype will check
# if this is a valid numpy dtype.
np.dtype(dtype := getattr(np, self.memmap_dtype))
except (AttributeError, TypeError) as e:
raise TypeError(f"Value {self.memmap_dtype} is not a valid numpy type") from e
return dtype


class EvaluatorType(StrEnum):
Expand Down
Loading