|
7 | 7 | <h2>Disk-to-GPU Tensor loading at up to 25Gbps without GDS</h2> |
8 | 8 | </div> |
9 | 9 |
|
| 10 | +## Updates |
| 11 | + |
| 12 | +- **2025-11-25**: Now supports **multiple data types per checkpoint** with no regressions in speed! |
| 13 | + |
10 | 14 | <div align="center"> |
11 | 15 | <picture> |
12 | 16 | <source media="(prefers-color-scheme: dark)" srcset="https://github.com/fal-ai/flashpack/blob/main/media/benchmark-white.png?raw=true"> |
@@ -89,3 +93,95 @@ model = nn.Module(...) |
89 | 93 | pack_to_file(model, flashpack_path) # write state dict to file |
90 | 94 | assign_from_file(model, flashpack_path) # load state dict from file |
91 | 95 | ``` |
| 96 | + |
| 97 | +# CLI Commands |
| 98 | + |
| 99 | +FlashPack provides a command-line interface for converting, inspecting, and reverting flashpack files. |
| 100 | + |
| 101 | +## `flashpack convert` |
| 102 | + |
| 103 | +Convert a model to a flashpack file. |
| 104 | + |
| 105 | +```bash |
| 106 | +flashpack convert <path_or_repo_id> [destination_path] [options] |
| 107 | +``` |
| 108 | + |
| 109 | +**Arguments:** |
| 110 | +- `path_or_repo_id` - Local path or Hugging Face repository ID |
| 111 | +- `destination_path` - (Optional) Output path for the flashpack file |
| 112 | + |
| 113 | +**Options:** |
| 114 | +| Option | Description | |
| 115 | +|--------|-------------| |
| 116 | +| `--subfolder` | Subfolder of the model (for repo_id) | |
| 117 | +| `--variant` | Model variant (for repo_id) | |
| 118 | +| `--dtype` | Target dtype for the flashpack file. When omitted, no type changes are made | |
| 119 | +| `--ignore-names` | Tensor names to ignore (can be specified multiple times) | |
| 120 | +| `--ignore-prefixes` | Tensor prefixes to ignore (can be specified multiple times) | |
| 121 | +| `--ignore-suffixes` | Tensor suffixes to ignore (can be specified multiple times) | |
| 122 | +| `--use-transformers` | Load the path as a transformers model | |
| 123 | +| `--use-diffusers` | Load the path as a diffusers model | |
| 124 | +| `-v, --verbose` | Enable verbose output | |
| 125 | + |
| 126 | +**Examples:** |
| 127 | +```bash |
| 128 | +# Convert a local model |
| 129 | +flashpack convert ./my_model ./my_model.flashpack |
| 130 | + |
| 131 | +# Convert from Hugging Face |
| 132 | +flashpack convert stabilityai/stable-diffusion-xl-base-1.0 --subfolder unet --use-diffusers |
| 133 | + |
| 134 | +# Convert with specific dtype |
| 135 | +flashpack convert ./my_model ./my_model.flashpack --dtype float16 |
| 136 | +``` |
| 137 | + |
| 138 | +## `flashpack revert` |
| 139 | + |
| 140 | +Revert a flashpack file back to safetensors or torch format. |
| 141 | + |
| 142 | +```bash |
| 143 | +flashpack revert <path> [destination_path] [options] |
| 144 | +``` |
| 145 | + |
| 146 | +**Arguments:** |
| 147 | +- `path` - Path to the flashpack file |
| 148 | +- `destination_path` - (Optional) Output path for the reverted file |
| 149 | + |
| 150 | +**Options:** |
| 151 | +| Option | Description | |
| 152 | +|--------|-------------| |
| 153 | +| `-v, --verbose` | Enable verbose output | |
| 154 | + |
| 155 | +**Example:** |
| 156 | +```bash |
| 157 | +flashpack revert ./my_model.flashpack ./my_model.safetensors |
| 158 | +``` |
| 159 | + |
| 160 | +## `flashpack metadata` |
| 161 | + |
| 162 | +Print the metadata of a flashpack file. |
| 163 | + |
| 164 | +```bash |
| 165 | +flashpack metadata <path> [options] |
| 166 | +``` |
| 167 | + |
| 168 | +**Arguments:** |
| 169 | +- `path` - Path to the flashpack file |
| 170 | + |
| 171 | +**Options:** |
| 172 | +| Option | Description | |
| 173 | +|--------|-------------| |
| 174 | +| `-i, --show-index` | Show the tensor index | |
| 175 | +| `-j, --json` | Output metadata in JSON format | |
| 176 | + |
| 177 | +**Examples:** |
| 178 | +```bash |
| 179 | +# View basic metadata |
| 180 | +flashpack metadata ./my_model.flashpack |
| 181 | + |
| 182 | +# View metadata with tensor index |
| 183 | +flashpack metadata ./my_model.flashpack --show-index |
| 184 | + |
| 185 | +# Output as JSON |
| 186 | +flashpack metadata ./my_model.flashpack --json |
| 187 | +``` |
0 commit comments