ZipPlus / README.md
CompactAI's picture
Update README.md
e99d24b verified
|
raw
history blame
2.2 kB
metadata
license: mit

ZipPlus Model Card

A pre-trained 4-layer GRU model for neural file compression. Compress any file into a PNG image using a neural network and extract it back. This is a pre-trained ByteGRU model for Zip+ - use this instead of training your own.

What is this

This model compresses any file into a PNG image using a neural network (GRU + range coding) and extracts it back. The compressed files look like weird colorful static - perfect for confusing anyone who peeks at your folder.

file.txt → [ByteGRU + Range Coding] → file.txt.zpng.png → [ByteGRU + Range Coding] → file.txt

The PNG contains a special ZPNG magic header, so random images won't decompress. Your cat photos are safe. Mostly.

Model Details

  • Architecture: 2-layer GRU over byte embeddings
  • Embedding dim: 64 → Hidden dim: 256
  • Trained on: A variety of file types
  • Entropy coding: Range coding via Constriction
  • Output format: PNG where payload lives in RGB pixel bytes
  • Magic header: ZPNG (first 4 bytes)

Requirements

  • Python 3.10+
  • PyTorch
  • Constriction (pip install constriction)
  • Pillow
  • numpy
pip install torch constriction pillow numpy

Quick Start

Compress a file

python inference.py compress myfile.txt -o myfile.zpng.png -m model.pt

Decompress

python inference.py decompress myfile.zpng.png -o restored.txt -m model.pt

Done. Your file is back. Hopefully.

Interactive Menu

Just run python compressor.py -m model.pt for the menu. It's vaguely intuitive if you squint.

Performance

Compression ratio varies. Text files compress okay. Binary files? Less okay. Random data? It might actually grow. That's the fun part.

Warnings

  • Don't lose this model. Without the model file, your .zpng.png files are colorful but useless.
  • Lossiness is possible. If the compression produces artifacts, restored files may differ. Check with checksums.
  • GPU recommended. CPU inference is tolerable.

License

MIT. I'm not liable if this eats your thesis/pixels/anything.

Use it because it's amusing. Or don't