Adds ALL files needed for Dockerfile build:
- qwen3_6_scripts/ (baseline patches + our optimizations)
- vllm/ (full vllm package)
- paged_attention_v2_pytorch.py (V2 with single-bmm optimization)
- Dockerfile + computility-run.yaml
Our optimizations vs baseline:
1. paged_attn.py: pre-gathered context KV (eliminates 194 gather calls),
Triton try/fallback, V2 heuristic, threshold 32K→64K
2. paged_attention_v2_pytorch.py: fills NotImplementedError,
single-bmm Phase 1 (195 launches → 3)
3. patch_enable_triton.py: HAS_TRITON=True with safety fallback
4. patch_triton_tuning.py: BLOCK=64, NUM_WARPS=4 for BI-V100
5. computility-run.yaml: gpu-memory-utilization 0.9→0.95,
max-num-batched-tokens 8192→16384
This repo can now be submitted to dev.modelhub.org.cn as-is.
52 lines
1.8 KiB
Python
52 lines
1.8 KiB
Python
# Adapted from
|
|
# https://huggingface.co/OpenGVLab/InternVL2-1B/blob/main/configuration_internvl_chat.py
|
|
# --------------------------------------------------------
|
|
# InternVL
|
|
# Copyright (c) 2024 OpenGVLab
|
|
# Licensed under The MIT License [see LICENSE for details]
|
|
# --------------------------------------------------------
|
|
from transformers.configuration_utils import PretrainedConfig
|
|
|
|
|
|
class InternVLChatConfig(PretrainedConfig):
|
|
model_type = 'internvl_chat'
|
|
is_composition = True
|
|
|
|
def __init__(self,
|
|
vision_config=None,
|
|
llm_config=None,
|
|
use_backbone_lora=0,
|
|
use_llm_lora=0,
|
|
select_layer=-1,
|
|
force_image_size=None,
|
|
downsample_ratio=0.5,
|
|
template=None,
|
|
dynamic_image_size=False,
|
|
use_thumbnail=False,
|
|
ps_version='v1',
|
|
min_dynamic_patch=1,
|
|
max_dynamic_patch=6,
|
|
**kwargs):
|
|
super().__init__(**kwargs)
|
|
|
|
if vision_config is None:
|
|
vision_config = {}
|
|
|
|
if llm_config is None:
|
|
llm_config = {}
|
|
|
|
self.vision_config = PretrainedConfig(**vision_config)
|
|
self.text_config = PretrainedConfig(**llm_config)
|
|
|
|
self.use_backbone_lora = use_backbone_lora
|
|
self.use_llm_lora = use_llm_lora
|
|
self.select_layer = select_layer
|
|
self.force_image_size = force_image_size
|
|
self.downsample_ratio = downsample_ratio
|
|
self.template = template
|
|
self.dynamic_image_size = dynamic_image_size
|
|
self.use_thumbnail = use_thumbnail
|
|
self.ps_version = ps_version # pixel shuffle version
|
|
self.min_dynamic_patch = min_dynamic_patch
|
|
self.max_dynamic_patch = max_dynamic_patch
|