Instructions to use DIYIN/Youtu-LLM-A7B-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DIYIN/Youtu-LLM-A7B-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="DIYIN/Youtu-LLM-A7B-Base", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("DIYIN/Youtu-LLM-A7B-Base", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use DIYIN/Youtu-LLM-A7B-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "DIYIN/Youtu-LLM-A7B-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "DIYIN/Youtu-LLM-A7B-Base", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/DIYIN/Youtu-LLM-A7B-Base
- SGLang
How to use DIYIN/Youtu-LLM-A7B-Base 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 "DIYIN/Youtu-LLM-A7B-Base" \ --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": "DIYIN/Youtu-LLM-A7B-Base", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "DIYIN/Youtu-LLM-A7B-Base" \ --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": "DIYIN/Youtu-LLM-A7B-Base", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use DIYIN/Youtu-LLM-A7B-Base with Docker Model Runner:
docker model run hf.co/DIYIN/Youtu-LLM-A7B-Base
Download processing_youtu_vl_moe.py from DIYIN/Youtu-LLM-A7B-Base: direct link, hf CLI and curl.
- Browser
- Download file 1.79 kB
-
https://huggingface.co/DIYIN/Youtu-LLM-A7B-Base/resolve/main/processing_youtu_vl_moe.py
- Command line
-
hf download hf://DIYIN/Youtu-LLM-A7B-Base/processing_youtu_vl_moe.py
-
curl -L -o processing_youtu_vl_moe.py https://huggingface.co/DIYIN/Youtu-LLM-A7B-Base/resolve/main/processing_youtu_vl_moe.py
1.79 kB
| # coding=utf-8 | |
| """ | |
| UTU-VL MoE 处理器(适配 transformers 5.3) | |
| 直接复用 Qwen3VLProcessor,UTU-VL MoE 使用与 V4 相同的图像处理流程和 tokenizer 特殊 token 设置。 | |
| - image_token_id = 128017 (<|image_pad|>) | |
| - video_token_id = 128040 (<|place▁holder▁no▁40|>, 与 Stage3 VIDEO_TOKEN_ID 一致;128032 在 union tokenizer 中是字面量 |DSML|) | |
| """ | |
| from transformers.models.qwen3_vl import Qwen3VLProcessor | |
| class YoutuVLMoEProcessor(Qwen3VLProcessor): | |
| """ | |
| UTU-VL MoE processor. | |
| It is intentionally a thin Qwen3VLProcessor subclass with UTU-VL token | |
| aliases populated on the tokenizer. | |
| """ | |
| image_token = "<|image_pad|>" | |
| video_token = "<|place▁holder▁no▁40|>" | |
| vision_start_token = "<|vision_start|>" | |
| vision_end_token = "<|vision_end|>" | |
| tokenizer_class = ("PreTrainedTokenizerFast",) | |
| def __init__(self, image_processor=None, tokenizer=None, video_processor=None, chat_template=None, **kwargs): | |
| if tokenizer is not None: | |
| tokenizer.image_token = self.image_token | |
| tokenizer.video_token = self.video_token | |
| tokenizer.vision_start_token = self.vision_start_token | |
| tokenizer.vision_end_token = self.vision_end_token | |
| tokenizer.image_token_id = tokenizer.convert_tokens_to_ids(self.image_token) | |
| tokenizer.video_token_id = tokenizer.convert_tokens_to_ids(self.video_token) | |
| tokenizer.vision_start_token_id = tokenizer.convert_tokens_to_ids(self.vision_start_token) | |
| tokenizer.vision_end_token_id = tokenizer.convert_tokens_to_ids(self.vision_end_token) | |
| super().__init__(image_processor, tokenizer, video_processor, chat_template=chat_template, **kwargs) | |
| __all__ = ["YoutuVLMoEProcessor"] | |