Instructions to use AgenticFinLab/PyFi-QwenVL-3B-COT-47K with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use AgenticFinLab/PyFi-QwenVL-3B-COT-47K with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("/home/yuxuanzhao/LLaMA-Factory/models/qwen2_5-vl-3B-Instruct") model = PeftModel.from_pretrained(base_model, "AgenticFinLab/PyFi-QwenVL-3B-COT-47K") - Transformers
How to use AgenticFinLab/PyFi-QwenVL-3B-COT-47K with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AgenticFinLab/PyFi-QwenVL-3B-COT-47K") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("AgenticFinLab/PyFi-QwenVL-3B-COT-47K", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AgenticFinLab/PyFi-QwenVL-3B-COT-47K with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AgenticFinLab/PyFi-QwenVL-3B-COT-47K" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AgenticFinLab/PyFi-QwenVL-3B-COT-47K", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AgenticFinLab/PyFi-QwenVL-3B-COT-47K
- SGLang
How to use AgenticFinLab/PyFi-QwenVL-3B-COT-47K with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "AgenticFinLab/PyFi-QwenVL-3B-COT-47K" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AgenticFinLab/PyFi-QwenVL-3B-COT-47K", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "AgenticFinLab/PyFi-QwenVL-3B-COT-47K" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AgenticFinLab/PyFi-QwenVL-3B-COT-47K", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use AgenticFinLab/PyFi-QwenVL-3B-COT-47K with Docker Model Runner:
docker model run hf.co/AgenticFinLab/PyFi-QwenVL-3B-COT-47K
| base_model: Qwen/Qwen2.5-VL-3B-Instruct | |
| library_name: peft | |
| pipeline_tag: image-text-to-text | |
| license: apache-2.0 | |
| tags: | |
| - finance | |
| - lora | |
| - vision-language | |
| - qwen | |
| # PyFi-QwenVL-3B-47K | |
| This model is a fine-tuned LoRA adapter for [Qwen2.5-VL-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-VL-3B-Instruct), specialized for financial image understanding. It was introduced as part of the PyFi framework. | |
| ## Model Details | |
| - **Developed by:** Yuqun Zhang, Yuxuan Zhao, Sijia Chen (AgenticFinLab) | |
| - **Model type:** Vision-Language Model (LoRA Adapter) | |
| - **Base Model:** [Qwen/Qwen2.5-VL-3B-Instruct](https://huggingface.co/Qwen/Qwen2.5-VL-3B-Instruct) | |
| - **Language(s):** English | |
| - **License:** Apache 2.0 | |
| - **Paper:** [PyFi: Toward Pyramid-like Financial Image Understanding for VLMs via Adversarial Agents](https://arxiv.org/abs/2512.14735) | |
| - **Repository:** [https://github.com/AgenticFinLab/PyFi](https://github.com/AgenticFinLab/PyFi) | |
| ## Summary | |
| PyFi (Pyramid-like Financial Image Understanding) is a framework designed to enhance Visual Language Models (VLMs) in understanding complex financial images through adversarial agents. The framework enables VLMs to reason through question chains in a progressive, simple-to-complex manner across six hierarchical capability levels: | |
| 1. **Perception**: Basic visual understanding | |
| 2. **Data Extraction**: Foundational information retrieval | |
| 3. **Calculation Analysis**: Numerical analysis tasks | |
| 4. **Pattern Recognition**: Identifying trends and patterns | |
| 5. **Logical Reasoning**: Complex logical analysis | |
| 6. **Decision Support**: Strategic decision-making assistance | |
| This specific checkpoint was fine-tuned on approximately 47,000 question-answer chains from the **PyFi-600K** dataset. In this version ("w/o CoT"), only the question and answer from the final sample in each chain were used during training to target the ultimate reasoning goal. | |
| ## Training Details | |
| The model was fine-tuned with the following configuration: | |
| - **Optimizer**: AdamW | |
| - **Learning Rate**: $1.0 \times 10^{-4}$ | |
| - **Learning Rate Schedule**: Cosine scheduling with warmup ratio of 0.1 | |
| - **Training Epochs**: 1 | |
| - **Batch Size**: Effective batch size of 8 | |
| - **PEFT**: LoRA with full-module adaptation | |
| - **Hardware**: 4x NVIDIA RTX 5090 GPUs | |
| ## Citation | |
| If you use PyFi in your research, please cite: | |
| ```bibtex | |
| @article{pyfi2025, | |
| title={PyFi: Toward Pyramid-like Financial Image Understanding for VLMs via Adversarial Agents}, | |
| author={Zhang, Yuqun and Zhao, Yuxuan and Chen, Sijia}, | |
| journal={arXiv preprint arXiv:2512.14735}, | |
| year={2025} | |
| } | |
| ``` | |
| ## Contact | |
| For questions or inquiries, please contact: | |
| - **Email**: Yuqun Zhang ([research@yuqunzhang.com](mailto:research@yuqunzhang.com)) or Yuxuan Zhao ([yx.zhao129@gmail.com](mailto:yx.zhao129@gmail.com)) | |
| - **GitHub Issues**: [https://github.com/AgenticFinLab/PyFi/issues](https://github.com/AgenticFinLab/PyFi/issues) |