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

[Release 0.3.0] Basic Readme and user-facing pathways #30

Merged
merged 16 commits into from
Apr 25, 2024

Conversation

dbogunowicz
Copy link
Contributor

@dbogunowicz dbogunowicz commented Apr 19, 2024

Feature Description

  • Adds a README.md that, among other fundamental information, presents how to load/save single weight files as well as how to load/save models using compressed-tensors (note, there is no mention of AutoModels for now, we merely mimic how safetensors saves and loads state_dict for models). Those functions are implemented and tested as a part of this PR.
  • Adds a examples/bitmask_compression.ipynb notebook, that explains in more detail how bitmask compression works
  • Adds a make command to build a wheel
  • Adds three user-facing functions load_compressed, save_compressed, save_compressed_model, that mimic the UI introduced by safetensors.
  • Adds an exhaustive set of tests to validate the aforementioned functionalities

User Facing Functions

load_compressed(
    compressed_tensors: Union[str, Path], # path to a single file or directory with multiple .safetensor files 
    compression_config: CompressionConfig = None,
    device: Optional[str] = "cpu",
) -> Generator[Tuple[str, Tensor], None, None]: # returns a generator for memory efficiency
...
def save_compressed(
    tensors: Dict[str, Tensor],
    save_path: Union[str, Path],
    compression_format: Optional[CompressionFormat] = None,
) -> None: # saves to disk
...
def save_compressed_model(
    model: torch.nn.Module,
    filename: str,
    compression_format: Optional[CompressionFormat] = None,
    force_contiguous: bool = True,
) -> None: # saves to disk

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@dbogunowicz dbogunowicz requested a review from mgoin April 19, 2024 15:56
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
src/compressed_tensors/config/base.py Show resolved Hide resolved
src/compressed_tensors/utils/helpers.py Outdated Show resolved Hide resolved
src/compressed_tensors/utils/helpers.py Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
src/compressed_tensors/utils/helpers.py Outdated Show resolved Hide resolved
tests/test_utils/test_helpers.py Show resolved Hide resolved
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@dbogunowicz dbogunowicz changed the base branch from main to signed-quat April 24, 2024 10:44
@dbogunowicz dbogunowicz changed the base branch from signed-quat to main April 24, 2024 10:44
@dbogunowicz dbogunowicz changed the title [UX] Basic Readme and user-facing pathways [Release 0.3.0] Basic Readme and user-facing pathways Apr 25, 2024
@dbogunowicz dbogunowicz requested a review from Satrat April 25, 2024 12:58
@dbogunowicz dbogunowicz merged commit d4787e2 into main Apr 25, 2024
2 checks passed
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.

4 participants