(EasyDel Former) is a utility library designed to simplify and enhance the development in JAX
Project description
eformer (EasyDel Former)
eformer (EasyDel Former) is a utility library designed to simplify and enhance the development of machine learning models using JAX. It provides a comprehensive collection of tools for distributed computing, custom data structures, numerical optimization, and high-performance operations. Eformer aims to make it easier to build, scale, and optimize models efficiently while leveraging JAX's capabilities for high-performance computing.
Project Structure Overview
The library is organized into several core modules:
aparser: Advanced argument parsing utilities with dataclass integrationcommon_types: Shared type definitions and sharding constantsescale: Distributed sharding and parallelism utilitiesexecutor: Execution management and hardware-specific optimizationsjaximus: Custom PyTree implementations and structured array utilitiesmpric: Mixed precision training and dynamic scaling infrastructureoptimizers: Flexible optimizer configuration and factory patternspytree: Enhanced tree manipulation and transformation utilities
Key Features
1. Mixed Precision Training (mpric)
Advanced mixed precision utilities supporting float8, float16, and bfloat16 with dynamic loss scaling, enabling faster training and reduced memory footprint.
2. Distributed Sharding (escale)
Tools for efficient sharding and distributed computation in JAX, allowing you to scale your models across multiple devices with various sharding strategies:
- Data Parallelism (
DP) - Fully Sharded Data Parallel (
FSDP) - Tensor Parallelism (
TP) - Expert Parallelism (
EP) - Sequence Parallelism (
SP)
3. Custom PyTrees (jaximus)
Enhanced utilities for creating custom PyTrees and ArrayValue objects, updated from Equinox, providing flexible data structures for your models.
4. Optimizer Factory
A flexible factory for creating and configuring optimizers like AdamW, Adafactor, Lion, and RMSProp, making it easy to experiment with different optimization strategies.
API Documentation
For detailed API references and usage examples, see:
- Argument Parser (
aparser) - Sharding Utilities (
escale) - Execution Management (
executor) - Mixed Precision Infrastructure (
mpric)
Installation
You can install eformer via pip:
pip install eformer
Getting Started
Mixed Precision Handler with mpric
from eformer.mpric import PrecisionHandler
# Create a handler with float8 compute precision
handler = PrecisionHandler(
policy="p=f32,c=f8_e4m3,o=f32", # params in f32, compute in float8, output in f32
use_dynamic_scale=True
)
Custom PyTree Implementation
import jax
from eformer.jaximus import ArrayValue, implicit
class Array8B(ArrayValue):
scale: jax.Array
weight: jax.Array
def __init__(self, array: jax.Array):
self.weight, self.scale = quantize_row_q8_0(array)
def materialize(self):
return dequantize_row_q8_0(self.weight, self.scale)
array = jax.random.normal(jax.random.key(0), (256, 64), "f2")
qarray = Array8B(array)
Contributing
We welcome contributions! Please read our Contributing Guidelines to get started.
License
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file eformer-0.0.82.tar.gz.
File metadata
- Download URL: eformer-0.0.82.tar.gz
- Upload date:
- Size: 196.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc3966b51c8aeccb1ee06c3be9e66d9899593ad5388f0c4ce1955759c63ae2bc
|
|
| MD5 |
020c8ed19196d35fe334be4bc46f0aa1
|
|
| BLAKE2b-256 |
7fbf3026dbb26b1f072d7830d1e3ac03bbf099eeb02c270b784d9fdad20fc3e4
|
File details
Details for the file eformer-0.0.82-py3-none-any.whl.
File metadata
- Download URL: eformer-0.0.82-py3-none-any.whl
- Upload date:
- Size: 247.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
267defc30fc215eb693465bf09223e8f7e5426bce90ab74beae52ebbd644510a
|
|
| MD5 |
05831e886d63bd0e2c615c1e085a8e0a
|
|
| BLAKE2b-256 |
d7249e67cb898898c85aa724c2154a0de976744532ffba5c7bb9b6510c9493c8
|