Overseas access: www.kdjingpai.com
Bookmark Us
Current Position:fig. beginning " AI Answers

如何在本地电脑上安装和运行 SmolDocling?

2025-08-28 1.5 K

安装 SmolDocling 需遵循以下步骤:

  • environmental preparation:确保已安装 Python 3.8+,建议使用虚拟环境
  • Installation of dependencies: Execute command pip install torch transformers docling_core
  • GPU acceleration(可选):安装 CUDA 版 PyTorch 以提升速度,可通过 torch.cuda.is_available() 检测支持情况

使用流程分为五个阶段:

  1. 图片加载: Use load_image() 函数导入待处理图片
  2. 模型初始化:通过 Hugging Face 自动下载模型权重(需首次联网)
  3. Document Conversion:使用特定 prompt 模板生成 DocTags
  4. format conversion:可将 DocTags 输出为 Markdown 等常用格式
  5. Advanced Optimization:GPU 用户可启用 flash_attention_2 加速处理

注意处理大图片时可能需调整 max_new_tokens 参数(默认 8192),建议首次使用时打印中间结果进行调试。

Recommended

Can't find AI tools? Try here!

Just type in the keyword Accessibility Bing SearchYou can quickly find all the AI tools on this site.

Top

en_USEnglish