Harsha001's picture
Card: add WikiText KL divergence
38858af verified
|
Raw History Blame Contribute Delete
4 kB
---
license: mit
base_model: baidu/Unlimited-SVG
base_model_relation: quantized
pipeline_tag: image-text-to-text
library_name: gguf
tags: [gguf, rocmfpx, amd, rocm, vulkan, strix-halo, quantized, svg, vectorization, deepseek-ocr]
---
# Unlimited-SVG, ROCmFPX GGUF
[baidu/Unlimited-SVG](https://huggingface.co/baidu/Unlimited-SVG) turns an image (an icon, a diagram, a chart, a
drawing or a photo) into SVG code. It is built on the DeepSeek-OCR design: a 3B mixture-of-experts text model (64
experts, 6 active) reads one 2048 x 2048 view of the image through the DeepEncoder vision tower and writes the SVG.
This repo has it quantized for the [ROCmFPX](https://github.com/HarshaVardhan3002/ROCmFPX) llama.cpp fork (low-bit
weight types for AMD GPUs, Vulkan and HIP/ROCm).
> The model file needs the `unlimited-svg` branch of
> [HarshaVardhan3002/ROCmFPX](https://github.com/HarshaVardhan3002/ROCmFPX/tree/unlimited-svg). Stock llama.cpp,
> LM Studio and Ollama will not load it. **These files were checked on the CPU and have not been tested on AMD
> hardware yet.**
>
> Not an official release of Baidu. All credit for the model goes to its authors.
## Files
| File | Size | Weights | KL divergence vs BF16 on SVG text (lower is better) | Same top token as BF16 |
|---|---:|---|---:|---:|
| `Unlimited-SVG-Q8_0_ROCMFPX.gguf` | 3.04 GB | ROCmFPX 8-bit (`Q8_0_ROCMFPX` with tensor scales), token embedding stock `Q8_0` | 0.0093 | 96.7% |
| `mmproj-Unlimited-SVG-F16.gguf` | 0.83 GB | vision tower and projector, F16 (load with `--mmproj`, always needed) | - | - |
- **Image test:** on two test images (shapes with a text label, and a bar chart with a title, value labels and axis
labels), the 8-bit file wrote the same SVG as BF16: the same elements and text, colors within a few units and
coordinates within 1 pixel.
- **No 6-bit file:** a 6-bit build (2.50 GB, KL divergence 0.017) wrote the chart's quarter labels twice, once in the
wrong place, so it was not uploaded. The model is small; the 8-bit file is the one to use.
- **Measured on:** the BF16 SVG outputs of the test images, 256-token chunks, against the BF16 GGUF, CPU.
On plain English text (40 chunks of 512 tokens of WikiText-2), which this model is not trained for, the 8-bit file
scores 0.039 (88.5% same top token) and the 6-bit build 0.068 (84.4%).
## How these were made
1. BF16 GGUF and F16 vision projector converted with the fork's `convert_hf_to_gguf.py` (branch `unlimited-svg`). The
projector stores the model's own preprocessing: one 2048 x 2048 global view, no tiles, gray padding (as in the
original `infer()` with `base_size = image_size = 2048`, `crop_mode = False`).
2. Tokenizer checked against the original: the same token ids for a sample SVG.
3. `LLAMA_ROCMFPX_TENSOR_SCALE=1 llama-quantize --token-embedding-type q8_0 --output-tensor-type q8_0_rocmfpx` from
the BF16 file. The tensor scale is a power-of-two scale per weight tensor; the runtime applies it, no setting is
needed to run the file.
## Run
```bash
git clone -b unlimited-svg https://github.com/HarshaVardhan3002/ROCmFPX && cd ROCmFPX
cmake -B build -DGGML_VULKAN=ON # or -DGGML_HIP=ON -DAMDGPU_TARGETS=gfx1151 (gfx1100 for RX 7900)
cmake --build build -j --target llama-mtmd-cli
build/bin/llama-mtmd-cli -m Unlimited-SVG-Q8_0_ROCMFPX.gguf --mmproj mmproj-Unlimited-SVG-F16.gguf -ngl 99 \
--jinja --image input.png -p "<__media__> SVG:" --temp 0 -n 30000 -c 32768 > output.svg
```
- `--jinja` is needed: the model's chat template is a plain one that only the Jinja engine reads.
- The prompt is the image followed by ` SVG:`, as in the original model.
- Temperature: 0 to 0.3 for icons, diagrams and drawings; 0.5 to 0.8 for photos (from the original model card).
- The SVG is written in a 1024 x 1024 frame; the image is fitted inside it with its aspect ratio kept.
- Detailed images can need many thousands of tokens; raise `-n` and `-c` for them.
## License
MIT, same as the base model. See `LICENSE`.