1from hivg_infer import HiSVGInferencePipeline
2
3pipeline = HiSVGInferencePipeline(
4 model_path="xingxm/HiVG-3B-Base",
5 coord_range=234,
6 temperature=0.7,
7 top_p=0.9,
8 max_new_tokens=4096,
9)
10
11# Image-to-SVG
12result = pipeline.img2svg("path/to/your_image.png")
13if result["success"]:
14 print(result["svg"])
15
16# Text-to-SVG
17result = pipeline.text2svg("A minimalist black phone icon with an outline style")
18if result["success"]:
19 with open("output.svg", "w") as f:
20 f.write(result["svg"])Note: For detailed inference code, data preprocessing, and the hierarchical SVG tokenizer/detokenizer, please visit the project page and the associated code repository.
1@article{xing2026hivg,
2 title={Hierarchical SVG Tokenization: Learning Compact Visual Programs for Scalable Vector Graphics Modeling},
3 author={Ximing Xing and Ziteng Xue and Zhenxi Li and Weicong Liang and Linqing Wang and Zhantao Yang and Tiankai Hang and Zijin Yin and Qinglin Lu and Chunyu Wang and Qian Yu},
4 journal={arXiv preprint arXiv:2604.05072},
5 year={2026}
6}