Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,65 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# ZipPlus2048 Model Card
|
| 6 |
+
**A pre-trained 2-layer GRU model for neural file compression. Compress any file into a PNG image using a neural network and extract it back.**
|
| 7 |
+
This is a pre-trained ByteGRU model for [Zip+](https://github.com/CompactAIOfficial/ZipPlus) - use this instead of training your own.
|
| 8 |
+
|
| 9 |
+
## What is this
|
| 10 |
+
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.
|
| 11 |
+
```
|
| 12 |
+
file.txt → [ByteGRU + Range Coding] → file.txt.zpng.png → [ByteGRU + Range Coding] → file.txt
|
| 13 |
+
```
|
| 14 |
+
**The PNG contains a special `ZPNG` magic header**, so random images won't decompress. Your cat photos are safe. Mostly.
|
| 15 |
+
|
| 16 |
+
## Model Details
|
| 17 |
+
- **Architecture**: 2-layer GRU over byte embeddings
|
| 18 |
+
- **Embedding dim**: 64 → Hidden dim: 256
|
| 19 |
+
- **Trained on**: A variety of file types
|
| 20 |
+
- **Entropy coding**: Range coding via Constriction
|
| 21 |
+
- **Output format**: PNG where payload lives in RGB pixel bytes
|
| 22 |
+
- **Magic header**: `ZPNG` (first 4 bytes)
|
| 23 |
+
-
|
| 24 |
+
## Requirements
|
| 25 |
+
- Python 3.10+
|
| 26 |
+
- PyTorch
|
| 27 |
+
- Constriction (`pip install constriction`)
|
| 28 |
+
- Pillow
|
| 29 |
+
- numpy
|
| 30 |
+
```bash
|
| 31 |
+
pip install torch constriction pillow numpy
|
| 32 |
+
```
|
| 33 |
+
## Quick Start
|
| 34 |
+
|
| 35 |
+
### Compress a file
|
| 36 |
+
|
| 37 |
+
```bash
|
| 38 |
+
python inference.py compress myfile.txt -o myfile.zpng.png -m model.pt
|
| 39 |
+
```
|
| 40 |
+
### Decompress
|
| 41 |
+
|
| 42 |
+
```bash
|
| 43 |
+
python inference.py decompress myfile.zpng.png -o restored.txt -m model.pt
|
| 44 |
+
```
|
| 45 |
+
Done. Your file is back. Hopefully.
|
| 46 |
+
|
| 47 |
+
## Interactive Menu
|
| 48 |
+
|
| 49 |
+
Just run `python compressor.py -m model.pt` for the menu. It's vaguely intuitive if you squint.
|
| 50 |
+
|
| 51 |
+
## Performance
|
| 52 |
+
|
| 53 |
+
Compression ratio varies. Text files compress okay. Binary files? Less okay. Random data? It might actually grow. That's the fun part.
|
| 54 |
+
|
| 55 |
+
## Warnings
|
| 56 |
+
|
| 57 |
+
- **Don't lose this model**. Without the model file, your `.zpng.png` files are colorful but useless.
|
| 58 |
+
- **Lossiness is possible**. If the compression produces artifacts, restored files may differ. Check with checksums.
|
| 59 |
+
- **GPU recommended**. CPU inference is tolerable.
|
| 60 |
+
-
|
| 61 |
+
## License
|
| 62 |
+
|
| 63 |
+
MIT. I'm not liable if this eats your thesis/pixels/anything.
|
| 64 |
+
---
|
| 65 |
+
Use it because it's amusing. Or don't
|