Update README.md
Browse files
README.md
CHANGED
|
@@ -1,65 +1,83 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
---
|
| 4 |
-
|
| 5 |
# ZipPlus Model Card
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
| 8 |
|
| 9 |
## What is this
|
| 10 |
-
|
|
|
|
|
|
|
| 11 |
```
|
| 12 |
-
file.txt β [ByteGRU + Range Coding] β file.txt.zpng.png β [
|
| 13 |
```
|
| 14 |
-
|
|
|
|
| 15 |
|
| 16 |
## Model Details
|
| 17 |
-
|
| 18 |
-
- **
|
| 19 |
-
- **
|
|
|
|
| 20 |
- **Entropy coding**: Range coding via Constriction
|
| 21 |
-
- **Output format**: PNG where payload
|
| 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
|
| 39 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
### Decompress
|
| 41 |
|
| 42 |
```bash
|
| 43 |
-
python inference.py decompress myfile.zpng.png -o restored.txt
|
| 44 |
```
|
| 45 |
-
Done. Your file is back. Hopefully.
|
| 46 |
|
| 47 |
-
|
| 48 |
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
## Performance
|
| 52 |
|
| 53 |
-
|
|
|
|
|
|
|
| 54 |
|
| 55 |
## Warnings
|
| 56 |
|
| 57 |
-
- **
|
| 58 |
-
- **
|
| 59 |
-
- **
|
| 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
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
---
|
|
|
|
| 4 |
# ZipPlus Model Card
|
| 5 |
+
|
| 6 |
+
**A pre-trained 4-layer GRU model for neural file compression. Each compressed file contains its own adapted model β no external model needed to decompress.**
|
| 7 |
+
|
| 8 |
+
This is a pre-trained ByteGRU model for [Zip+](https://github.com/CompactAIOfficial/ZipPlus).
|
| 9 |
|
| 10 |
## What is this
|
| 11 |
+
|
| 12 |
+
Zip+ compresses any file into a PNG image using a neural network (GRU + range coding). Each compressed file embeds its own adapted model:
|
| 13 |
+
|
| 14 |
```
|
| 15 |
+
file.txt β [ByteGRU + Range Coding] β file.txt.zpng.png β [embedded model] β file.txt
|
| 16 |
```
|
| 17 |
+
|
| 18 |
+
**Every PNG is self-contained** β decompress even if you lose the original model file!
|
| 19 |
|
| 20 |
## Model Details
|
| 21 |
+
|
| 22 |
+
- **Architecture**: 4-layer GRU over byte embeddings
|
| 23 |
+
- **Embedding dim**: 64 β Hidden dim: 512
|
| 24 |
+
- **Trained on**: FineWeb-Edu (10BT of educational web text) + adaptive per-file training
|
| 25 |
- **Entropy coding**: Range coding via Constriction
|
| 26 |
+
- **Output format**: PNG where payload + model live in RGB pixel bytes
|
| 27 |
- **Magic header**: `ZPNG` (first 4 bytes)
|
| 28 |
+
|
| 29 |
## Requirements
|
| 30 |
+
|
| 31 |
- Python 3.10+
|
| 32 |
+
- PyTorch (CUDA recommended)
|
| 33 |
- Constriction (`pip install constriction`)
|
| 34 |
- Pillow
|
| 35 |
- numpy
|
| 36 |
+
- huggingface_hub
|
| 37 |
+
|
| 38 |
```bash
|
| 39 |
+
pip install torch constriction pillow numpy huggingface_hub
|
| 40 |
```
|
| 41 |
+
|
| 42 |
## Quick Start
|
| 43 |
|
| 44 |
+
### Compress a file (with auto-adaptation)
|
| 45 |
|
| 46 |
```bash
|
| 47 |
+
python inference.py compress myfile.txt -o myfile.zpng.png
|
| 48 |
```
|
| 49 |
+
|
| 50 |
+
- Automatically adapts model to your file (50 steps)
|
| 51 |
+
- Embeds adapted model in PNG for self-contained decoding
|
| 52 |
+
|
| 53 |
### Decompress
|
| 54 |
|
| 55 |
```bash
|
| 56 |
+
python inference.py decompress myfile.zpng.png -o restored.txt
|
| 57 |
```
|
|
|
|
| 58 |
|
| 59 |
+
Loads the model embedded in the PNG β no external files needed!
|
| 60 |
|
| 61 |
+
### Training (optional)
|
| 62 |
+
|
| 63 |
+
```bash
|
| 64 |
+
python train.py --grid 128 --steps 10000
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
Auto-downloads FineWeb-Edu if no corpus specified.
|
| 68 |
|
| 69 |
## Performance
|
| 70 |
|
| 71 |
+
- Text files: ~5-20% of original size
|
| 72 |
+
- Works best on files > 10KB
|
| 73 |
+
- Smaller files: embedding overhead (~21MB) may exceed compression gains
|
| 74 |
|
| 75 |
## Warnings
|
| 76 |
|
| 77 |
+
- **Embedding adds ~21MB** to output β worth it for large files
|
| 78 |
+
- **GPU recommended** for training and compression
|
| 79 |
+
- **Lossless** β verified via SHA256 checksums
|
| 80 |
+
|
| 81 |
## License
|
| 82 |
|
| 83 |
+
MIT. I'm not liable if this eats your thesis/pixels/anything.
|
|
|
|
|
|