CompactAI commited on
Commit
c0bd9f9
Β·
verified Β·
1 Parent(s): e99d24b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +45 -27
README.md CHANGED
@@ -1,65 +1,83 @@
1
  ---
2
  license: mit
3
  ---
4
-
5
  # ZipPlus Model Card
6
- **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.**
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
 
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.