utils#
- class olmo_core.utils.StrEnum(value)[source]#
-
This is equivalent to Python’s
enum.StrEnumsince version 3.11. We include this here for compatibility with older version of Python.
- olmo_core.utils.wait_for(condition, description, timeout=10.0)[source]#
Wait for the condition function to return True.
- olmo_core.utils.apply_to_tensors(fn, container)[source]#
Recursively apply
fnto all tensors in a container.- Return type:
- olmo_core.utils.get_grad_norm(params, norm_type)[source]#
Return the gradient norm of parameters, where the gradients are viewed as a single vector.
The returned norm is in FP32 even if parameters/gradients are in a low precision. This is because the downstream use of this return value is a reduction across ranks.
- Return type:
- olmo_core.utils.same_storage(x, y)[source]#
Check if two tensors share the same storage.
- Return type: