# Copyright 2025 SGLang Team # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== # Adapted from https://huggingface.co/nvidia/NVIDIA-Nemotron-Nano-12B-v2-VL-BF16/blob/cb5a65ff10232128389d882d805fa609427544f1/configuration.py from typing import Any from transformers.configuration_utils import PretrainedConfig from sglang.srt.configs.nemotron_h import NemotronHConfig from sglang.srt.configs.radio import RadioConfig from sglang.srt.multimodal.internvl_utils import IMAGENET_MEAN, IMAGENET_STD def float_triplet(seq: Any): a, b, c = tuple(seq) assert ( isinstance(a, float) and isinstance(b, float) and isinstance(c, float) ), "expected three floats" return a, b, c class NemotronH_Nano_VL_V2_Config(PretrainedConfig): model_type = "NemotronH_Nano_VL_V2" is_composition = True def __init__( self, vision_config=None, llm_config=None, force_image_size: int = 512, patch_size: int = 16, downsample_ratio=0.5, template=None, ps_version="v2", image_tag_type="internvl", projector_hidden_size=4096, vit_hidden_size=1280, video_pruning_rate: float = 0.0, video_context_token: str = "