Duplicate from nvidia/diffusiongemma-26B-A4B-it-NVFP4
Browse filesCo-authored-by: Juhi Mittal <juhim@users.noreply.huggingface.co>
- .gitattributes +36 -0
- .quant_summary.txt +0 -0
- README.md +159 -0
- apache_2.0_license.md +204 -0
- chat_template.jinja +363 -0
- config.json +175 -0
- generation_config.json +19 -0
- hf_quant_config.json +20 -0
- model-00001-of-00002.safetensors +3 -0
- model-00002-of-00002.safetensors +3 -0
- model.safetensors.index.json +0 -0
- processor_config.json +75 -0
- tokenizer.json +3 -0
- tokenizer_config.json +96 -0
.gitattributes
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
.quant_summary.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
README.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
---
|
| 3 |
+
pipeline_tag: text-generation
|
| 4 |
+
base_model: google/diffusiongemma-26B-A4B-it
|
| 5 |
+
license: apache-2.0
|
| 6 |
+
license_name: apache-license-2.0
|
| 7 |
+
license_link: https://ai.google.dev/gemma/apache_2
|
| 8 |
+
tags:
|
| 9 |
+
- nvidia
|
| 10 |
+
- ModelOpt
|
| 11 |
+
- DiffusionGemma-26B-A4B-IT
|
| 12 |
+
- quantized
|
| 13 |
+
- NVFP4
|
| 14 |
+
- nvfp4
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# Model Overview
|
| 18 |
+
|
| 19 |
+
## Description:
|
| 20 |
+
DiffusionGemma 26B A4B IT is an open-weights multimodal generative model developed by Google DeepMind that processes text, image, and video inputs to produce text output via discrete diffusion. Built on the Gemma 4 26B A4B Mixture-of-Experts (MoE) architecture with 25.2B total parameters and 3.8B active parameters, the model employs an encoder-decoder design with bidirectional attention that generates tokens in parallel 256-token blocks, enabling high-speed generation exceeding 1,100 tokens per second at low batch sizes on NVIDIA Hopper H100 (FP8). DiffusionGemma 26B A4B IT supports a 256K token context window, configurable thinking (reasoning) mode, native function calling, and multilingual inference across 35+ languages.
|
| 21 |
+
The NVIDIA DiffusionGemma 26B A4B IT NVFP4 model is quantized with [Model Optimizer](https://github.com/NVIDIA/Model-Optimizer).
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
This model is ready for commercial and non-commercial use. <br>
|
| 25 |
+
|
| 26 |
+
## Third-Party Community Consideration
|
| 27 |
+
This model is not owned or developed by NVIDIA. This model has been developed and built to a third-party's requirements for this application and use case; see link to Non-NVIDIA [DiffusionGemma 26B A4B Model Card](https://huggingface.co/google/diffusiongemma-26B-A4B-it).
|
| 28 |
+
|
| 29 |
+
## License/Terms of Use:
|
| 30 |
+
SPDX-FileCopyrightText: Copyright (c) <year> NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
| 31 |
+
SPDX-License-Identifier: Apache-2.0
|
| 32 |
+
|
| 33 |
+
Governing Terms: [Apache 2.0](https://huggingface.co/nvidia/diffusiongemma-26B-A4B-it-NVFP4/blob/main/apache_2.0_license.md) [Gemma Terms of Use](https://ai.google.dev/gemma/terms) and [Gemma Prohibited Use Policy](https://ai.google.dev/gemma/prohibited_use_policy).
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
### Deployment Geography:
|
| 37 |
+
Global
|
| 38 |
+
|
| 39 |
+
### Use Case:
|
| 40 |
+
**Use Case:** DiffusionGemma 26B A4B IT is designed for developers, researchers, and enterprises requiring high-speed multimodal text generation. Supported use cases include conversational AI and chatbots, text summarization, code generation and step-by-step reasoning, image and document understanding (OCR, chart comprehension, PDF parsing, screen and UI parsing), video content analysis, agentic workflows with native function calling, and multilingual NLP tasks across 35+ languages.
|
| 41 |
+
|
| 42 |
+
### Release Date:
|
| 43 |
+
Hugging Face 06/10/2026 via https://huggingface.co/nvidia/DiffusionGemma-26B-A4B-IT-NVFP4
|
| 44 |
+
|
| 45 |
+
## Model Architecture:
|
| 46 |
+
**Architecture Type:** Transformer
|
| 47 |
+
**Network Architecture:** Mixture-of-Experts
|
| 48 |
+
**Total Parameters:** 25.2B
|
| 49 |
+
**Active Parameters:** 3.8B
|
| 50 |
+
**Vocabulary Size:** 262,144
|
| 51 |
+
**Base Model:** Gemma 4 26B A4B
|
| 52 |
+
|
| 53 |
+
### Input:
|
| 54 |
+
**Input Types:** Text, Image, Video
|
| 55 |
+
**Input Formats:** String, Red, Green, Blue (RGB), Video (MP4/WebM)
|
| 56 |
+
**Input Parameters:** One-Dimensional (1D), Two-Dimensional (2D), Three-Dimensional (3D)
|
| 57 |
+
**Other Input Properties:** Images support variable aspect ratios and resolutions via a configurable visual token budget (70, 140, 280, 560, or 1120 tokens per image); place image content before text for optimal multimodal performance. Videos are processed as frame sequences up to 60 seconds at 1 frame per second.
|
| 58 |
+
**Input Context Length (ISL):** 262,144
|
| 59 |
+
|
| 60 |
+
### Output:
|
| 61 |
+
**Output Types:** Text
|
| 62 |
+
**Output Format:** String
|
| 63 |
+
**Output Parameters:** One-Dimensional (1D)
|
| 64 |
+
**Other Output Properties:** Text is generated in parallel 256-token canvas blocks via diffusion sampling with adaptive stopping; supports native function calling and structured JSON output formatting.
|
| 65 |
+
|
| 66 |
+
Our AI models are designed and/or optimized to run on NVIDIA GPU-accelerated systems. By leveraging NVIDIA's hardware (e.g. GPU cores) and software frameworks (e.g., CUDA libraries), the model achieves faster training and inference times compared to CPU-only solutions.
|
| 67 |
+
|
| 68 |
+
## Software Integration:
|
| 69 |
+
**Runtime Engine(s):**
|
| 70 |
+
* vLLM
|
| 71 |
+
|
| 72 |
+
**Supported Hardware Microarchitecture Compatibility:**
|
| 73 |
+
* NVIDIA Blackwell
|
| 74 |
+
* NVIDIA Hopper(H100)
|
| 75 |
+
|
| 76 |
+
**Preferred Operating System(s):**
|
| 77 |
+
* Linux
|
| 78 |
+
|
| 79 |
+
The integration of foundation and fine-tuned models into AI systems requires additional testing using use-case-specific data to ensure safe and effective deployment. Following the V-model methodology, iterative testing and validation at both unit and system levels are essential to mitigate risks, meet technical and functional requirements, and ensure compliance with safety and ethical standards before deployment.
|
| 80 |
+
|
| 81 |
+
## Model Version(s):
|
| 82 |
+
This model is NVFP4 quantized with nvidia-modelopt
|
| 83 |
+
|
| 84 |
+
## Training and Evaluation Datasets:
|
| 85 |
+
|
| 86 |
+
We calibrated the model using the dataset noted below, and performed evaluation using the benchmarks noted under Evaluation Datasets.
|
| 87 |
+
We did not perform training or testing for this Model Optimizer release. The methods noted under Training and Testing Datasets below represent the data collection and labeling methods used by the third-party to train and test the underlying DiffusionGemma 26B A4B model.<br>
|
| 88 |
+
|
| 89 |
+
## Calibration Dataset:
|
| 90 |
+
**Link:** [cnn_dailymail](https://huggingface.co/datasets/abisee/cnn_dailymail), [Nemotron-Post-Training-Dataset-v2](https://huggingface.co/datasets/nvidia/Nemotron-Post-Training-Dataset-v2)
|
| 91 |
+
**Data Collection Method by dataset:** Automated.
|
| 92 |
+
**Labeling Method by dataset:** Automated.
|
| 93 |
+
**Properties:** The `cnn_dailymail` dataset contains English-language news articles and summaries. `Nemotron-Post-Training-Dataset-v2` is a post-training dataset curated by NVIDIA containing multi-turn conversations across diverse topics.
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
## Training Dataset:
|
| 97 |
+
**Data Modality:** Text, Image
|
| 98 |
+
**Text Training Data Size:** Undisclosed
|
| 99 |
+
**Image Training Data Size:** Undisclosed
|
| 100 |
+
**Training Data Collection:** Hybrid: Automated, Human
|
| 101 |
+
**Training Labeling:** Hybrid: Automated, Human
|
| 102 |
+
**Training Properties:** Large-scale, diverse pre-training corpus spanning web documents, code, mathematics, and images across 140+ languages with a data collection cutoff of January 2025. Preprocessing includes CSAM filtering, sensitive personal information removal, and content quality filtering aligned with Google's AI policies.
|
| 103 |
+
|
| 104 |
+
## Evaluation Dataset:
|
| 105 |
+
**Datasets:** GPQA Diamond, AIME 2025, MMLU Pro, GSM8K, HumanEval, MMLU-0 Shot, IFEval
|
| 106 |
+
**Data Collection Method by dataset:** Hybrid, Automated, Human
|
| 107 |
+
**Labeling Method by dataset:** Hybrid, Automated, Human
|
| 108 |
+
**Properties:** GPQA Diamond contains 448 graduate-level multiple-choice questions written by domain experts in biology, physics, and chemistry; AIME 2025 contains problems from the American Invitational Mathematics Examination; MMLU Pro is a multi-task language understanding benchmark with challenging multiple-choice questions across diverse academic domains
|
| 109 |
+
|
| 110 |
+
## Inference:
|
| 111 |
+
**Engine:** vLLM
|
| 112 |
+
|
| 113 |
+
**Test Hardware:** NVIDIA Blackwell B100
|
| 114 |
+
|
| 115 |
+
## Post Training Quantization
|
| 116 |
+
This model was obtained by quantizing the weights and activations of Gemma-26B-A4B-IT to NVFP4 data type, ready for inference with vLLM. This optimization reduces the number of bits per parameter from 16 to 4, reducing disk size and GPU memory requirements significantly.
|
| 117 |
+
|
| 118 |
+
## Usage
|
| 119 |
+
To serve this checkpoint with [vLLM](https://hub.docker.com/layers/vllm/vllm-openai/gemma-x86_64-cu130), you can launch the docker image `vllm/vllm-openai:gemma` and run the sample command below:
|
| 120 |
+
|
| 121 |
+
```
|
| 122 |
+
VLLM_USE_V2_MODEL_RUNNER=1
|
| 123 |
+
vllm serve nvidia/diffusiongemma-26B-A4B-IT-NVFP4
|
| 124 |
+
--trust-remote-code
|
| 125 |
+
--max-num-seqs 4
|
| 126 |
+
--attention-backend TRITON_ATTN
|
| 127 |
+
--enable-auto-tool-choice
|
| 128 |
+
--tool-call-parser gemma4
|
| 129 |
+
--reasoning-parser gemma4
|
| 130 |
+
--override-generation-config '{"max_new_tokens": null}'
|
| 131 |
+
--default-chat-template-kwargs '{"enable_thinking":true}'
|
| 132 |
+
```
|
| 133 |
+
Disclaimer: The vllm serve commands below are tentative and subject to change until the supporting vLLM image is publicly released. To check whether the image is live, see the vLLM releases page (https://github.com/vllm-project/vllm/releases) or the vllm/vllm-openai:gemma4 tags on Docker Hub.
|
| 134 |
+
|
| 135 |
+
### Evaluation
|
| 136 |
+
|
| 137 |
+
The accuracy benchmark results (with thinking enabled) compared to the BF16 baseline are presented in the table below:
|
| 138 |
+
|
| 139 |
+
| Benchmark | Baseline (Full Precision) | NVFP4 |
|
| 140 |
+
|---|---|---|
|
| 141 |
+
| GPQA Diamond | 69.4% | 68.6% |
|
| 142 |
+
| AIME 2025 | 68.33% | 67.33% |
|
| 143 |
+
| GSM8K | 94.54% | 94.01% |
|
| 144 |
+
| IFEval | 94.01% | 94.56% |
|
| 145 |
+
| HumanEval | 94.09% | 95.00% |
|
| 146 |
+
| MMMLU 0 Shot | 88.50% | 88.13% |
|
| 147 |
+
| MMLU Pro | 81.0% | 80.7% |
|
| 148 |
+
|
| 149 |
+
> Benchmarking parameters: default temperature, top_p settings as in [orginal MC](https://huggingface.co/google/diffusiongemma-26B-A4B-it)
|
| 150 |
+
|
| 151 |
+
## Model Limitations:
|
| 152 |
+
The base model was trained on data that contains toxic language and societal biases originally crawled from the internet. Therefore, the model may amplify those biases and return toxic responses especially when prompted with toxic prompts. The model may generate answers that may be inaccurate, omit key information, or include irrelevant or redundant text producing socially unacceptable or undesirable text, even if the prompt itself does not include anything explicitly offensive.
|
| 153 |
+
|
| 154 |
+
## Ethical Considerations
|
| 155 |
+
NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. Developers should work with their internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse.
|
| 156 |
+
|
| 157 |
+
Please make sure you have proper rights and permissions for all input image and video content; if image or video includes people, personal health information, or intellectual property, the image or video generated will not blur or maintain proportions of image subjects included.
|
| 158 |
+
|
| 159 |
+
Please report model quality, risk, security vulnerabilities or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/)
|
apache_2.0_license.md
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright (c) <year> NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
Apache License
|
| 5 |
+
Version 2.0, January 2004
|
| 6 |
+
http://www.apache.org/licenses/
|
| 7 |
+
|
| 8 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 9 |
+
|
| 10 |
+
1. Definitions.
|
| 11 |
+
|
| 12 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 13 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 14 |
+
|
| 15 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 16 |
+
the copyright owner that is granting the License.
|
| 17 |
+
|
| 18 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 19 |
+
other entities that control, are controlled by, or are under common
|
| 20 |
+
control with that entity. For the purposes of this definition,
|
| 21 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 22 |
+
direction or management of such entity, whether by contract or
|
| 23 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 24 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 25 |
+
|
| 26 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 27 |
+
exercising permissions granted by this License.
|
| 28 |
+
|
| 29 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 30 |
+
including but not limited to software source code, documentation
|
| 31 |
+
source, and configuration files.
|
| 32 |
+
|
| 33 |
+
"Object" form shall mean any form resulting from mechanical
|
| 34 |
+
transformation or translation of a Source form, including but
|
| 35 |
+
not limited to compiled object code, generated documentation,
|
| 36 |
+
and conversions to other media types.
|
| 37 |
+
|
| 38 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 39 |
+
Object form, made available under the License, as indicated by a
|
| 40 |
+
copyright notice that is included in or attached to the work
|
| 41 |
+
(an example is provided in the Appendix below).
|
| 42 |
+
|
| 43 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 44 |
+
form, that is based on (or derived from) the Work and for which the
|
| 45 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 46 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 47 |
+
of this License, Derivative Works shall not include works that remain
|
| 48 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 49 |
+
the Work and Derivative Works thereof.
|
| 50 |
+
|
| 51 |
+
"Contribution" shall mean any work of authorship, including
|
| 52 |
+
the original version of the Work and any modifications or additions
|
| 53 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 54 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 55 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 56 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 57 |
+
means any form of electronic, verbal, or written communication sent
|
| 58 |
+
to the Licensor or its representatives, including but not limited to
|
| 59 |
+
communication on electronic mailing lists, source code control systems,
|
| 60 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 61 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 62 |
+
excluding communication that is conspicuously marked or otherwise
|
| 63 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 64 |
+
|
| 65 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 66 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 67 |
+
subsequently incorporated within the Work.
|
| 68 |
+
|
| 69 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 70 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 71 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 72 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 73 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 74 |
+
Work and such Derivative Works in Source or Object form.
|
| 75 |
+
|
| 76 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 77 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 78 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 79 |
+
(except as stated in this section) patent license to make, have made,
|
| 80 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 81 |
+
where such license applies only to those patent claims licensable
|
| 82 |
+
by such Contributor that are necessarily infringed by their
|
| 83 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 84 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 85 |
+
institute patent litigation against any entity (including a
|
| 86 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 87 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 88 |
+
or contributory patent infringement, then any patent licenses
|
| 89 |
+
granted to You under this License for that Work shall terminate
|
| 90 |
+
as of the date such litigation is filed.
|
| 91 |
+
|
| 92 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 93 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 94 |
+
modifications, and in Source or Object form, provided that You
|
| 95 |
+
meet the following conditions:
|
| 96 |
+
|
| 97 |
+
(a) You must give any other recipients of the Work or
|
| 98 |
+
Derivative Works a copy of this License; and
|
| 99 |
+
|
| 100 |
+
(b) You must cause any modified files to carry prominent notices
|
| 101 |
+
stating that You changed the files; and
|
| 102 |
+
|
| 103 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 104 |
+
that You distribute, all copyright, patent, trademark, and
|
| 105 |
+
attribution notices from the Source form of the Work,
|
| 106 |
+
excluding those notices that do not pertain to any part of
|
| 107 |
+
the Derivative Works; and
|
| 108 |
+
|
| 109 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 110 |
+
distribution, then any Derivative Works that You distribute must
|
| 111 |
+
include a readable copy of the attribution notices contained
|
| 112 |
+
within such NOTICE file, excluding those notices that do not
|
| 113 |
+
pertain to any part of the Derivative Works, in at least one
|
| 114 |
+
of the following places: within a NOTICE text file distributed
|
| 115 |
+
as part of the Derivative Works; within the Source form or
|
| 116 |
+
documentation, if provided along with the Derivative Works; or,
|
| 117 |
+
within a display generated by the Derivative Works, if and
|
| 118 |
+
wherever such third-party notices normally appear. The contents
|
| 119 |
+
of the NOTICE file are for informational purposes only and
|
| 120 |
+
do not modify the License. You may add Your own attribution
|
| 121 |
+
notices within Derivative Works that You distribute, alongside
|
| 122 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 123 |
+
that such additional attribution notices cannot be construed
|
| 124 |
+
as modifying the License.
|
| 125 |
+
|
| 126 |
+
You may add Your own copyright statement to Your modifications and
|
| 127 |
+
may provide additional or different license terms and conditions
|
| 128 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 129 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 130 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 131 |
+
the conditions stated in this License.
|
| 132 |
+
|
| 133 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 134 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 135 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 136 |
+
this License, without any additional terms or conditions.
|
| 137 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 138 |
+
the terms of any separate license agreement you may have executed
|
| 139 |
+
with Licensor regarding such Contributions.
|
| 140 |
+
|
| 141 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 142 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 143 |
+
except as required for reasonable and customary use in describing the
|
| 144 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 145 |
+
|
| 146 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 147 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 148 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 149 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 150 |
+
implied, including, without limitation, any warranties or conditions
|
| 151 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 152 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 153 |
+
appropriateness of using or redistributing the Work and assume any
|
| 154 |
+
risks associated with Your exercise of permissions under this License.
|
| 155 |
+
|
| 156 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 157 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 158 |
+
unless required by applicable law (such as deliberate and grossly
|
| 159 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 160 |
+
liable to You for damages, including any direct, indirect, special,
|
| 161 |
+
incidental, or consequential damages of any character arising as a
|
| 162 |
+
result of this License or out of the use or inability to use the
|
| 163 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 164 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 165 |
+
other commercial damages or losses), even if such Contributor
|
| 166 |
+
has been advised of the possibility of such damages.
|
| 167 |
+
|
| 168 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 169 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 170 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 171 |
+
or other liability obligations and/or rights consistent with this
|
| 172 |
+
License. However, in accepting such obligations, You may act only
|
| 173 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 174 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 175 |
+
defend, and hold each Contributor harmless for any liability
|
| 176 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 177 |
+
of your accepting any such warranty or additional liability.
|
| 178 |
+
|
| 179 |
+
END OF TERMS AND CONDITIONS
|
| 180 |
+
|
| 181 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 182 |
+
|
| 183 |
+
To apply the Apache License to your work, attach the following
|
| 184 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 185 |
+
replaced with your own identifying information. (Don't include
|
| 186 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 187 |
+
comment syntax for the file format. We also recommend that a
|
| 188 |
+
file or class name and description of purpose be included on the
|
| 189 |
+
same "printed page" as the copyright notice for easier
|
| 190 |
+
identification within third-party archives.
|
| 191 |
+
|
| 192 |
+
Copyright [yyyy] [name of copyright owner]
|
| 193 |
+
|
| 194 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 195 |
+
you may not use this file except in compliance with the License.
|
| 196 |
+
You may obtain a copy of the License at
|
| 197 |
+
|
| 198 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 199 |
+
|
| 200 |
+
Unless required by applicable law or agreed to in writing, software
|
| 201 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 202 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 203 |
+
See the License for the specific language governing permissions and
|
| 204 |
+
limitations under the License.
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,363 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- macro format_parameters(properties, required, filter_keys=false) -%}
|
| 2 |
+
{%- set standard_keys = ['description', 'type', 'properties', 'required', 'nullable'] -%}
|
| 3 |
+
{%- set ns = namespace(found_first=false) -%}
|
| 4 |
+
{%- for key, value in properties | dictsort -%}
|
| 5 |
+
{%- set add_comma = false -%}
|
| 6 |
+
{%- if not filter_keys or key not in standard_keys -%}
|
| 7 |
+
{%- if ns.found_first %},{% endif -%}
|
| 8 |
+
{%- set ns.found_first = true -%}
|
| 9 |
+
{{ key }}:{
|
| 10 |
+
{%- if value['description'] -%}
|
| 11 |
+
description:<|"|>{{ value['description'] }}<|"|>
|
| 12 |
+
{%- set add_comma = true -%}
|
| 13 |
+
{%- endif -%}
|
| 14 |
+
{%- if value['type'] | upper == 'STRING' -%}
|
| 15 |
+
{%- if value['enum'] -%}
|
| 16 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 17 |
+
enum:{{ format_argument(value['enum']) }}
|
| 18 |
+
{%- endif -%}
|
| 19 |
+
{%- elif value['type'] | upper == 'ARRAY' -%}
|
| 20 |
+
{%- if value['items'] is mapping and value['items'] -%}
|
| 21 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 22 |
+
items:{
|
| 23 |
+
{%- set ns_items = namespace(found_first=false) -%}
|
| 24 |
+
{%- for item_key, item_value in value['items'] | dictsort -%}
|
| 25 |
+
{%- if item_value is not none -%}
|
| 26 |
+
{%- if ns_items.found_first %},{% endif -%}
|
| 27 |
+
{%- set ns_items.found_first = true -%}
|
| 28 |
+
{%- if item_key == 'properties' -%}
|
| 29 |
+
properties:{
|
| 30 |
+
{%- if item_value is mapping -%}
|
| 31 |
+
{{- format_parameters(item_value, value['items']['required'] | default([])) -}}
|
| 32 |
+
{%- endif -%}
|
| 33 |
+
}
|
| 34 |
+
{%- elif item_key == 'required' -%}
|
| 35 |
+
required:[
|
| 36 |
+
{%- for req_item in item_value -%}
|
| 37 |
+
<|"|>{{- req_item -}}<|"|>
|
| 38 |
+
{%- if not loop.last %},{% endif -%}
|
| 39 |
+
{%- endfor -%}
|
| 40 |
+
]
|
| 41 |
+
{%- elif item_key == 'type' -%}
|
| 42 |
+
{%- if item_value is string -%}
|
| 43 |
+
type:{{ format_argument(item_value | upper) }}
|
| 44 |
+
{%- else -%}
|
| 45 |
+
type:{{ format_argument(item_value | map('upper') | list) }}
|
| 46 |
+
{%- endif -%}
|
| 47 |
+
{%- else -%}
|
| 48 |
+
{{ item_key }}:{{ format_argument(item_value) }}
|
| 49 |
+
{%- endif -%}
|
| 50 |
+
{%- endif -%}
|
| 51 |
+
{%- endfor -%}
|
| 52 |
+
}
|
| 53 |
+
{%- endif -%}
|
| 54 |
+
{%- endif -%}
|
| 55 |
+
{%- if value['nullable'] %}
|
| 56 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 57 |
+
nullable:true
|
| 58 |
+
{%- endif -%}
|
| 59 |
+
{%- if value['type'] | upper == 'OBJECT' -%}
|
| 60 |
+
{%- if value['properties'] is defined and value['properties'] is mapping -%}
|
| 61 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 62 |
+
properties:{
|
| 63 |
+
{{- format_parameters(value['properties'], value['required'] | default([])) -}}
|
| 64 |
+
}
|
| 65 |
+
{%- elif value is mapping -%}
|
| 66 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 67 |
+
properties:{
|
| 68 |
+
{{- format_parameters(value, value['required'] | default([]), filter_keys=true) -}}
|
| 69 |
+
}
|
| 70 |
+
{%- endif -%}
|
| 71 |
+
{%- if value['required'] -%}
|
| 72 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 73 |
+
required:[
|
| 74 |
+
{%- for item in value['required'] | default([]) -%}
|
| 75 |
+
<|"|>{{- item -}}<|"|>
|
| 76 |
+
{%- if not loop.last %},{% endif -%}
|
| 77 |
+
{%- endfor -%}
|
| 78 |
+
]
|
| 79 |
+
{%- endif -%}
|
| 80 |
+
{%- endif -%}
|
| 81 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 82 |
+
type:<|"|>{{ value['type'] | upper }}<|"|>}
|
| 83 |
+
{%- endif -%}
|
| 84 |
+
{%- endfor -%}
|
| 85 |
+
{%- endmacro -%}
|
| 86 |
+
{%- macro format_function_declaration(tool_data) -%}
|
| 87 |
+
declaration:{{- tool_data['function']['name'] -}}{description:<|"|>{{- tool_data['function']['description'] -}}<|"|>
|
| 88 |
+
{%- set params = tool_data['function']['parameters'] -%}
|
| 89 |
+
{%- if params -%}
|
| 90 |
+
,parameters:{
|
| 91 |
+
{%- if params['properties'] -%}
|
| 92 |
+
properties:{ {{- format_parameters(params['properties'], params['required']) -}} },
|
| 93 |
+
{%- endif -%}
|
| 94 |
+
{%- if params['required'] -%}
|
| 95 |
+
required:[
|
| 96 |
+
{%- for item in params['required'] -%}
|
| 97 |
+
<|"|>{{- item -}}<|"|>
|
| 98 |
+
{{- ',' if not loop.last -}}
|
| 99 |
+
{%- endfor -%}
|
| 100 |
+
],
|
| 101 |
+
{%- endif -%}
|
| 102 |
+
{%- if params['type'] -%}
|
| 103 |
+
type:<|"|>{{- params['type'] | upper -}}<|"|>}
|
| 104 |
+
{%- endif -%}
|
| 105 |
+
{%- endif -%}
|
| 106 |
+
{%- if 'response' in tool_data['function'] -%}
|
| 107 |
+
{%- set response_declaration = tool_data['function']['response'] -%}
|
| 108 |
+
,response:{
|
| 109 |
+
{%- if response_declaration['description'] -%}
|
| 110 |
+
description:<|"|>{{- response_declaration['description'] -}}<|"|>,
|
| 111 |
+
{%- endif -%}
|
| 112 |
+
{%- if response_declaration['type'] | upper == 'OBJECT' -%}
|
| 113 |
+
type:<|"|>{{- response_declaration['type'] | upper -}}<|"|>}
|
| 114 |
+
{%- endif -%}
|
| 115 |
+
{%- endif -%}
|
| 116 |
+
}
|
| 117 |
+
{%- endmacro -%}
|
| 118 |
+
{%- macro format_argument(argument, escape_keys=True) -%}
|
| 119 |
+
{%- if argument is string -%}
|
| 120 |
+
{{- '<|"|>' + argument + '<|"|>' -}}
|
| 121 |
+
{%- elif argument is boolean -%}
|
| 122 |
+
{{- 'true' if argument else 'false' -}}
|
| 123 |
+
{%- elif argument is mapping -%}
|
| 124 |
+
{{- '{' -}}
|
| 125 |
+
{%- set ns = namespace(found_first=false) -%}
|
| 126 |
+
{%- for key, value in argument | dictsort -%}
|
| 127 |
+
{%- if ns.found_first %},{% endif -%}
|
| 128 |
+
{%- set ns.found_first = true -%}
|
| 129 |
+
{%- if escape_keys -%}
|
| 130 |
+
{{- '<|"|>' + key + '<|"|>' -}}
|
| 131 |
+
{%- else -%}
|
| 132 |
+
{{- key -}}
|
| 133 |
+
{%- endif -%}
|
| 134 |
+
:{{- format_argument(value, escape_keys=escape_keys) -}}
|
| 135 |
+
{%- endfor -%}
|
| 136 |
+
{{- '}' -}}
|
| 137 |
+
{%- elif argument is sequence -%}
|
| 138 |
+
{{- '[' -}}
|
| 139 |
+
{%- for item in argument -%}
|
| 140 |
+
{{- format_argument(item, escape_keys=escape_keys) -}}
|
| 141 |
+
{%- if not loop.last %},{% endif -%}
|
| 142 |
+
{%- endfor -%}
|
| 143 |
+
{{- ']' -}}
|
| 144 |
+
{%- else -%}
|
| 145 |
+
{{- argument -}}
|
| 146 |
+
{%- endif -%}
|
| 147 |
+
{%- endmacro -%}
|
| 148 |
+
{%- macro strip_thinking(text) -%}
|
| 149 |
+
{%- set ns = namespace(result='') -%}
|
| 150 |
+
{%- for part in text.split('<channel|>') -%}
|
| 151 |
+
{%- if '<|channel>' in part -%}
|
| 152 |
+
{%- set ns.result = ns.result + part.split('<|channel>')[0] -%}
|
| 153 |
+
{%- else -%}
|
| 154 |
+
{%- set ns.result = ns.result + part -%}
|
| 155 |
+
{%- endif -%}
|
| 156 |
+
{%- endfor -%}
|
| 157 |
+
{{- ns.result | trim -}}
|
| 158 |
+
{%- endmacro -%}
|
| 159 |
+
|
| 160 |
+
{%- macro format_tool_response_block(tool_name, response) -%}
|
| 161 |
+
{{- '<|tool_response>' -}}
|
| 162 |
+
{%- if response is mapping -%}
|
| 163 |
+
{{- 'response:' + tool_name + '{' -}}
|
| 164 |
+
{%- for key, value in response | dictsort -%}
|
| 165 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 166 |
+
{%- if not loop.last %},{% endif -%}
|
| 167 |
+
{%- endfor -%}
|
| 168 |
+
{{- '}' -}}
|
| 169 |
+
{%- else -%}
|
| 170 |
+
{{- 'response:' + tool_name + '{value:' + format_argument(response, escape_keys=False) + '}' -}}
|
| 171 |
+
{%- endif -%}
|
| 172 |
+
{{- '<tool_response|>' -}}
|
| 173 |
+
{%- endmacro -%}
|
| 174 |
+
|
| 175 |
+
{%- set ns = namespace(prev_message_type=None) -%}
|
| 176 |
+
{%- set loop_messages = messages -%}
|
| 177 |
+
{{- bos_token -}}
|
| 178 |
+
{#- Handle System/Tool Definitions Block -#}
|
| 179 |
+
{%- if (enable_thinking is defined and enable_thinking) or tools or messages[0]['role'] in ['system', 'developer'] -%}
|
| 180 |
+
{{- '<|turn>system\n' -}}
|
| 181 |
+
{#- Inject Thinking token at the very top of the FIRST system turn -#}
|
| 182 |
+
{%- if enable_thinking is defined and enable_thinking -%}
|
| 183 |
+
{{- '<|think|>\n' -}}
|
| 184 |
+
{%- set ns.prev_message_type = 'think' -%}
|
| 185 |
+
{%- endif -%}
|
| 186 |
+
{%- if messages[0]['role'] in ['system', 'developer'] -%}
|
| 187 |
+
{%- if messages[0]['content'] is string -%}
|
| 188 |
+
{{- messages[0]['content'] | trim -}}
|
| 189 |
+
{%- elif messages[0]['content'] is sequence -%}
|
| 190 |
+
{%- for item in messages[0]['content'] -%}
|
| 191 |
+
{{- item['text'] | trim + ' '-}}
|
| 192 |
+
{%- endfor -%}
|
| 193 |
+
{%- endif -%}
|
| 194 |
+
{%- set loop_messages = messages[1:] -%}
|
| 195 |
+
{%- endif -%}
|
| 196 |
+
{%- if tools -%}
|
| 197 |
+
{%- for tool in tools %}
|
| 198 |
+
{{- '<|tool>' -}}
|
| 199 |
+
{{- format_function_declaration(tool) | trim -}}
|
| 200 |
+
{{- '<tool|>' -}}
|
| 201 |
+
{%- endfor %}
|
| 202 |
+
{%- set ns.prev_message_type = 'tool' -%}
|
| 203 |
+
{%- endif -%}
|
| 204 |
+
{{- '<turn|>\n' -}}
|
| 205 |
+
{%- endif %}
|
| 206 |
+
|
| 207 |
+
{#- Pre-scan: find last user message index for reasoning guard -#}
|
| 208 |
+
{%- set ns_turn = namespace(last_user_idx=-1) -%}
|
| 209 |
+
{%- for i in range(loop_messages | length) -%}
|
| 210 |
+
{%- if loop_messages[i]['role'] == 'user' -%}
|
| 211 |
+
{%- set ns_turn.last_user_idx = i -%}
|
| 212 |
+
{%- endif -%}
|
| 213 |
+
{%- endfor -%}
|
| 214 |
+
|
| 215 |
+
{#- Loop through messages -#}
|
| 216 |
+
{%- for message in loop_messages -%}
|
| 217 |
+
{%- if message['role'] != 'tool' -%}
|
| 218 |
+
{%- set ns.prev_message_type = None -%}
|
| 219 |
+
{%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%}
|
| 220 |
+
{#- Detect continuation: suppress duplicate <|turn>model when previous non-tool message was also assistant -#}
|
| 221 |
+
{%- set prev_nt = namespace(role=None, found=false) -%}
|
| 222 |
+
{%- if loop.index0 > 0 -%}
|
| 223 |
+
{%- for j in range(loop.index0 - 1, -1, -1) -%}
|
| 224 |
+
{%- if not prev_nt.found -%}
|
| 225 |
+
{%- if loop_messages[j]['role'] != 'tool' -%}
|
| 226 |
+
{%- set prev_nt.role = loop_messages[j]['role'] -%}
|
| 227 |
+
{%- set prev_nt.found = true -%}
|
| 228 |
+
{%- endif -%}
|
| 229 |
+
{%- endif -%}
|
| 230 |
+
{%- endfor -%}
|
| 231 |
+
{%- endif -%}
|
| 232 |
+
{%- set continue_same_model_turn = (role == 'model' and prev_nt.role == 'assistant') -%}
|
| 233 |
+
{%- if not continue_same_model_turn -%}
|
| 234 |
+
{{- '<|turn>' + role + '\n' }}
|
| 235 |
+
{%- endif -%}
|
| 236 |
+
|
| 237 |
+
{#- Render reasoning/reasoning_content as thinking channel -#}
|
| 238 |
+
{%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%}
|
| 239 |
+
{%- if thinking_text and loop.index0 > ns_turn.last_user_idx and message.get('tool_calls') -%}
|
| 240 |
+
{{- '<|channel>thought\n' + thinking_text + '\n<channel|>' -}}
|
| 241 |
+
{%- endif -%}
|
| 242 |
+
|
| 243 |
+
{%- if message['tool_calls'] -%}
|
| 244 |
+
{%- for tool_call in message['tool_calls'] -%}
|
| 245 |
+
{%- set function = tool_call['function'] -%}
|
| 246 |
+
{{- '<|tool_call>call:' + function['name'] + '{' -}}
|
| 247 |
+
{%- if function['arguments'] is mapping -%}
|
| 248 |
+
{%- set ns_args = namespace(found_first=false) -%}
|
| 249 |
+
{%- for key, value in function['arguments'] | dictsort -%}
|
| 250 |
+
{%- if ns_args.found_first %},{% endif -%}
|
| 251 |
+
{%- set ns_args.found_first = true -%}
|
| 252 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 253 |
+
{%- endfor -%}
|
| 254 |
+
{%- elif function['arguments'] is string -%}
|
| 255 |
+
{{- function['arguments'] -}}
|
| 256 |
+
{%- endif -%}
|
| 257 |
+
{{- '}<tool_call|>' -}}
|
| 258 |
+
{%- endfor -%}
|
| 259 |
+
{%- set ns.prev_message_type = 'tool_call' -%}
|
| 260 |
+
{%- endif -%}
|
| 261 |
+
|
| 262 |
+
{%- set ns_tr_out = namespace(flag=false) -%}
|
| 263 |
+
{%- if message.get('tool_responses') -%}
|
| 264 |
+
{#- Legacy: tool_responses embedded on the assistant message (Google/Gemma native) -#}
|
| 265 |
+
{%- for tool_response in message['tool_responses'] -%}
|
| 266 |
+
{{- format_tool_response_block(tool_response['name'] | default('unknown'), tool_response['response']) -}}
|
| 267 |
+
{%- set ns_tr_out.flag = true -%}
|
| 268 |
+
{%- set ns.prev_message_type = 'tool_response' -%}
|
| 269 |
+
{%- endfor -%}
|
| 270 |
+
{%- elif message.get('tool_calls') -%}
|
| 271 |
+
{#- OpenAI Chat Completions: forward-scan consecutive role:tool messages -#}
|
| 272 |
+
{%- set ns_tool_scan = namespace(stopped=false) -%}
|
| 273 |
+
{%- for k in range(loop.index0 + 1, loop_messages | length) -%}
|
| 274 |
+
{%- if ns_tool_scan.stopped -%}
|
| 275 |
+
{%- elif loop_messages[k]['role'] != 'tool' -%}
|
| 276 |
+
{%- set ns_tool_scan.stopped = true -%}
|
| 277 |
+
{%- else -%}
|
| 278 |
+
{%- set follow = loop_messages[k] -%}
|
| 279 |
+
{#- Resolve tool_call_id to function name -#}
|
| 280 |
+
{%- set ns_tname = namespace(name=follow.get('name') | default('unknown')) -%}
|
| 281 |
+
{%- for tc in message['tool_calls'] -%}
|
| 282 |
+
{%- if tc.get('id') == follow.get('tool_call_id') -%}
|
| 283 |
+
{%- set ns_tname.name = tc['function']['name'] -%}
|
| 284 |
+
{%- endif -%}
|
| 285 |
+
{%- endfor -%}
|
| 286 |
+
{#- Handle content as string or content-parts array -#}
|
| 287 |
+
{%- set tool_body = follow.get('content') -%}
|
| 288 |
+
{%- if tool_body is string -%}
|
| 289 |
+
{{- format_tool_response_block(ns_tname.name, tool_body) -}}
|
| 290 |
+
{%- elif tool_body is sequence and tool_body is not string -%}
|
| 291 |
+
{%- set ns_txt = namespace(s='') -%}
|
| 292 |
+
{%- for part in tool_body -%}
|
| 293 |
+
{%- if part.get('type') == 'text' -%}
|
| 294 |
+
{%- set ns_txt.s = ns_txt.s + (part.get('text') | default('')) -%}
|
| 295 |
+
{%- endif -%}
|
| 296 |
+
{%- endfor -%}
|
| 297 |
+
{{- format_tool_response_block(ns_tname.name, ns_txt.s) -}}
|
| 298 |
+
{%- for part in tool_body -%}
|
| 299 |
+
{%- if part.get('type') == 'image' -%}
|
| 300 |
+
{{- '<|image|>' -}}
|
| 301 |
+
{%- elif part.get('type') == 'audio' -%}
|
| 302 |
+
{{- '<|audio|>' -}}
|
| 303 |
+
{%- elif part.get('type') == 'video' -%}
|
| 304 |
+
{{- '<|video|>' -}}
|
| 305 |
+
{%- endif -%}
|
| 306 |
+
{%- endfor -%}
|
| 307 |
+
{%- else -%}
|
| 308 |
+
{{- format_tool_response_block(ns_tname.name, tool_body) -}}
|
| 309 |
+
{%- endif -%}
|
| 310 |
+
{%- set ns_tr_out.flag = true -%}
|
| 311 |
+
{%- set ns.prev_message_type = 'tool_response' -%}
|
| 312 |
+
{%- endif -%}
|
| 313 |
+
{%- endfor -%}
|
| 314 |
+
{%- endif -%}
|
| 315 |
+
|
| 316 |
+
{%- set captured_content -%}
|
| 317 |
+
{%- if message['content'] is string -%}
|
| 318 |
+
{%- if role == 'model' -%}
|
| 319 |
+
{{- strip_thinking(message['content']) -}}
|
| 320 |
+
{%- else -%}
|
| 321 |
+
{{- message['content'] | trim -}}
|
| 322 |
+
{%- endif -%}
|
| 323 |
+
{%- elif message['content'] is sequence -%}
|
| 324 |
+
{%- for item in message['content'] -%}
|
| 325 |
+
{%- if item['type'] == 'text' -%}
|
| 326 |
+
{%- if role == 'model' -%}
|
| 327 |
+
{{- strip_thinking(item['text']) -}}
|
| 328 |
+
{%- else -%}
|
| 329 |
+
{{- item['text'] | trim -}}
|
| 330 |
+
{%- endif -%}
|
| 331 |
+
{%- elif item['type'] == 'image' -%}
|
| 332 |
+
{{- '<|image|>' -}}
|
| 333 |
+
{%- set ns.prev_message_type = 'image' -%}
|
| 334 |
+
{%- elif item['type'] == 'audio' -%}
|
| 335 |
+
{{- '<|audio|>' -}}
|
| 336 |
+
{%- set ns.prev_message_type = 'audio' -%}
|
| 337 |
+
{%- elif item['type'] == 'video' -%}
|
| 338 |
+
{{- '<|video|>' -}}
|
| 339 |
+
{%- set ns.prev_message_type = 'video' -%}
|
| 340 |
+
{%- endif -%}
|
| 341 |
+
{%- endfor -%}
|
| 342 |
+
{%- endif -%}
|
| 343 |
+
{%- endset -%}
|
| 344 |
+
|
| 345 |
+
{{- captured_content -}}
|
| 346 |
+
{%- set has_content = captured_content | trim | length > 0 -%}
|
| 347 |
+
|
| 348 |
+
{%- if ns.prev_message_type == 'tool_call' and not ns_tr_out.flag -%}
|
| 349 |
+
{{- '<|tool_response>' -}}
|
| 350 |
+
{%- elif not (ns_tr_out.flag and not has_content) -%}
|
| 351 |
+
{{- '<turn|>\n' -}}
|
| 352 |
+
{%- endif -%}
|
| 353 |
+
{%- endif -%}
|
| 354 |
+
{%- endfor -%}
|
| 355 |
+
|
| 356 |
+
{%- if add_generation_prompt -%}
|
| 357 |
+
{%- if ns.prev_message_type != 'tool_response' and ns.prev_message_type != 'tool_call' -%}
|
| 358 |
+
{{- '<|turn>model\n' -}}
|
| 359 |
+
{%- if not enable_thinking | default(false) -%}
|
| 360 |
+
{{- '<|channel>thought\n<channel|>' -}}
|
| 361 |
+
{%- endif -%}
|
| 362 |
+
{%- endif -%}
|
| 363 |
+
{%- endif -%}
|
config.json
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"DiffusionGemmaForBlockDiffusion"
|
| 4 |
+
],
|
| 5 |
+
"boi_token_id": 255999,
|
| 6 |
+
"canvas_length": 256,
|
| 7 |
+
"dtype": "bfloat16",
|
| 8 |
+
"eoi_token_id": 258882,
|
| 9 |
+
"eos_token_id": [
|
| 10 |
+
1,
|
| 11 |
+
106
|
| 12 |
+
],
|
| 13 |
+
"image_token_id": 258880,
|
| 14 |
+
"initializer_range": 0.02,
|
| 15 |
+
"model_type": "diffusion_gemma",
|
| 16 |
+
"text_config": {
|
| 17 |
+
"attention_bias": false,
|
| 18 |
+
"attention_dropout": 0.0,
|
| 19 |
+
"bos_token_id": 2,
|
| 20 |
+
"dtype": "bfloat16",
|
| 21 |
+
"eos_token_id": 1,
|
| 22 |
+
"final_logit_softcapping": 30.0,
|
| 23 |
+
"global_head_dim": 512,
|
| 24 |
+
"head_dim": 256,
|
| 25 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 26 |
+
"hidden_size": 2816,
|
| 27 |
+
"initializer_range": 0.02,
|
| 28 |
+
"intermediate_size": 2112,
|
| 29 |
+
"layer_types": [
|
| 30 |
+
"sliding_attention",
|
| 31 |
+
"sliding_attention",
|
| 32 |
+
"sliding_attention",
|
| 33 |
+
"sliding_attention",
|
| 34 |
+
"sliding_attention",
|
| 35 |
+
"full_attention",
|
| 36 |
+
"sliding_attention",
|
| 37 |
+
"sliding_attention",
|
| 38 |
+
"sliding_attention",
|
| 39 |
+
"sliding_attention",
|
| 40 |
+
"sliding_attention",
|
| 41 |
+
"full_attention",
|
| 42 |
+
"sliding_attention",
|
| 43 |
+
"sliding_attention",
|
| 44 |
+
"sliding_attention",
|
| 45 |
+
"sliding_attention",
|
| 46 |
+
"sliding_attention",
|
| 47 |
+
"full_attention",
|
| 48 |
+
"sliding_attention",
|
| 49 |
+
"sliding_attention",
|
| 50 |
+
"sliding_attention",
|
| 51 |
+
"sliding_attention",
|
| 52 |
+
"sliding_attention",
|
| 53 |
+
"full_attention",
|
| 54 |
+
"sliding_attention",
|
| 55 |
+
"sliding_attention",
|
| 56 |
+
"sliding_attention",
|
| 57 |
+
"sliding_attention",
|
| 58 |
+
"sliding_attention",
|
| 59 |
+
"full_attention"
|
| 60 |
+
],
|
| 61 |
+
"max_position_embeddings": 262144,
|
| 62 |
+
"model_type": "diffusion_gemma_text",
|
| 63 |
+
"moe_intermediate_size": 704,
|
| 64 |
+
"num_attention_heads": 16,
|
| 65 |
+
"num_experts": 128,
|
| 66 |
+
"num_global_key_value_heads": 2,
|
| 67 |
+
"num_hidden_layers": 30,
|
| 68 |
+
"num_key_value_heads": 8,
|
| 69 |
+
"pad_token_id": 0,
|
| 70 |
+
"rms_norm_eps": 1e-06,
|
| 71 |
+
"rope_parameters": {
|
| 72 |
+
"full_attention": {
|
| 73 |
+
"partial_rotary_factor": 0.25,
|
| 74 |
+
"rope_theta": 1000000.0,
|
| 75 |
+
"rope_type": "proportional"
|
| 76 |
+
},
|
| 77 |
+
"sliding_attention": {
|
| 78 |
+
"rope_theta": 10000.0,
|
| 79 |
+
"rope_type": "default"
|
| 80 |
+
}
|
| 81 |
+
},
|
| 82 |
+
"sliding_window": 1024,
|
| 83 |
+
"tie_word_embeddings": true,
|
| 84 |
+
"top_k_experts": 8,
|
| 85 |
+
"use_bidirectional_attention": "vision",
|
| 86 |
+
"vocab_size": 262144
|
| 87 |
+
},
|
| 88 |
+
"tie_word_embeddings": true,
|
| 89 |
+
"transformers_version": "5.8.0.dev0",
|
| 90 |
+
"vision_config": {
|
| 91 |
+
"_name_or_path": "",
|
| 92 |
+
"architectures": null,
|
| 93 |
+
"attention_bias": false,
|
| 94 |
+
"attention_dropout": 0.0,
|
| 95 |
+
"chunk_size_feed_forward": 0,
|
| 96 |
+
"default_output_length": 280,
|
| 97 |
+
"dtype": "bfloat16",
|
| 98 |
+
"global_head_dim": 72,
|
| 99 |
+
"head_dim": 72,
|
| 100 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 101 |
+
"hidden_size": 1152,
|
| 102 |
+
"id2label": {
|
| 103 |
+
"0": "LABEL_0",
|
| 104 |
+
"1": "LABEL_1"
|
| 105 |
+
},
|
| 106 |
+
"initializer_range": 0.02,
|
| 107 |
+
"intermediate_size": 4304,
|
| 108 |
+
"is_encoder_decoder": false,
|
| 109 |
+
"label2id": {
|
| 110 |
+
"LABEL_0": 0,
|
| 111 |
+
"LABEL_1": 1
|
| 112 |
+
},
|
| 113 |
+
"max_position_embeddings": 131072,
|
| 114 |
+
"model_type": "gemma4_vision",
|
| 115 |
+
"num_attention_heads": 16,
|
| 116 |
+
"num_hidden_layers": 27,
|
| 117 |
+
"num_key_value_heads": 16,
|
| 118 |
+
"output_attentions": false,
|
| 119 |
+
"output_hidden_states": false,
|
| 120 |
+
"patch_size": 16,
|
| 121 |
+
"pooling_kernel_size": 3,
|
| 122 |
+
"position_embedding_size": 10240,
|
| 123 |
+
"problem_type": null,
|
| 124 |
+
"return_dict": true,
|
| 125 |
+
"rms_norm_eps": 1e-06,
|
| 126 |
+
"rope_parameters": {
|
| 127 |
+
"rope_theta": 100.0,
|
| 128 |
+
"rope_type": "default"
|
| 129 |
+
},
|
| 130 |
+
"standardize": true,
|
| 131 |
+
"use_clipped_linears": false
|
| 132 |
+
},
|
| 133 |
+
"vision_soft_tokens_per_image": 280,
|
| 134 |
+
"quantization_config": {
|
| 135 |
+
"config_groups": {
|
| 136 |
+
"group_0": {
|
| 137 |
+
"input_activations": {
|
| 138 |
+
"dynamic": false,
|
| 139 |
+
"num_bits": 4,
|
| 140 |
+
"type": "float",
|
| 141 |
+
"group_size": 16
|
| 142 |
+
},
|
| 143 |
+
"weights": {
|
| 144 |
+
"dynamic": false,
|
| 145 |
+
"num_bits": 4,
|
| 146 |
+
"type": "float",
|
| 147 |
+
"group_size": 16
|
| 148 |
+
},
|
| 149 |
+
"targets": [
|
| 150 |
+
"Linear"
|
| 151 |
+
]
|
| 152 |
+
}
|
| 153 |
+
},
|
| 154 |
+
"ignore": [
|
| 155 |
+
"lm_head",
|
| 156 |
+
"*embed_vision*",
|
| 157 |
+
"*mlp*",
|
| 158 |
+
"*router*",
|
| 159 |
+
"*self_attn*",
|
| 160 |
+
"*self_conditioning*",
|
| 161 |
+
"*vision_tower*"
|
| 162 |
+
],
|
| 163 |
+
"quant_algo": "NVFP4",
|
| 164 |
+
"kv_cache_scheme": {
|
| 165 |
+
"dynamic": false,
|
| 166 |
+
"num_bits": 8,
|
| 167 |
+
"type": "float"
|
| 168 |
+
},
|
| 169 |
+
"producer": {
|
| 170 |
+
"name": "modelopt",
|
| 171 |
+
"version": "0.45.0.dev127+ga3a02ca5b.d20260608"
|
| 172 |
+
},
|
| 173 |
+
"quant_method": "modelopt"
|
| 174 |
+
}
|
| 175 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"confidence_threshold": 0.005,
|
| 3 |
+
"eos_token_id": [
|
| 4 |
+
1,
|
| 5 |
+
106,
|
| 6 |
+
50
|
| 7 |
+
],
|
| 8 |
+
"max_denoising_steps": 48,
|
| 9 |
+
"max_new_tokens": 256,
|
| 10 |
+
"pad_token_id": 0,
|
| 11 |
+
"sampler_config": {
|
| 12 |
+
"_cls_name": "EntropyBoundSamplerConfig",
|
| 13 |
+
"entropy_bound": 0.1
|
| 14 |
+
},
|
| 15 |
+
"stability_threshold": 1,
|
| 16 |
+
"t_max": 0.8,
|
| 17 |
+
"t_min": 0.4,
|
| 18 |
+
"transformers_version": "5.8.0.dev0"
|
| 19 |
+
}
|
hf_quant_config.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"producer": {
|
| 3 |
+
"name": "modelopt",
|
| 4 |
+
"version": "0.45.0.dev127+ga3a02ca5b.d20260608"
|
| 5 |
+
},
|
| 6 |
+
"quantization": {
|
| 7 |
+
"quant_algo": "NVFP4",
|
| 8 |
+
"kv_cache_quant_algo": "FP8",
|
| 9 |
+
"group_size": 16,
|
| 10 |
+
"exclude_modules": [
|
| 11 |
+
"lm_head",
|
| 12 |
+
"*embed_vision*",
|
| 13 |
+
"*mlp*",
|
| 14 |
+
"*router*",
|
| 15 |
+
"*self_attn*",
|
| 16 |
+
"*self_conditioning*",
|
| 17 |
+
"*vision_tower*"
|
| 18 |
+
]
|
| 19 |
+
}
|
| 20 |
+
}
|
model-00001-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:24f1257810848d296cc42fd2f6186c8dd6c2a562482c4c1bc8463a087a2c6554
|
| 3 |
+
size 10002097536
|
model-00002-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5015731988fbfc21042032ed9ea4c9af335bfe70bcd7529d09b8f2438d5fdd0e
|
| 3 |
+
size 8821758352
|
model.safetensors.index.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
processor_config.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"audio_ms_per_token": 40,
|
| 3 |
+
"audio_seq_length": 750,
|
| 4 |
+
"feature_extractor": {
|
| 5 |
+
"dither": 0.0,
|
| 6 |
+
"feature_extractor_type": "Gemma4AudioFeatureExtractor",
|
| 7 |
+
"feature_size": 128,
|
| 8 |
+
"fft_length": 512,
|
| 9 |
+
"fft_overdrive": false,
|
| 10 |
+
"frame_length": 320,
|
| 11 |
+
"hop_length": 160,
|
| 12 |
+
"input_scale_factor": 1.0,
|
| 13 |
+
"max_frequency": 8000.0,
|
| 14 |
+
"mel_floor": 0.001,
|
| 15 |
+
"min_frequency": 0.0,
|
| 16 |
+
"padding_side": "right",
|
| 17 |
+
"padding_value": 0.0,
|
| 18 |
+
"per_bin_mean": null,
|
| 19 |
+
"per_bin_stddev": null,
|
| 20 |
+
"preemphasis": 0.0,
|
| 21 |
+
"preemphasis_htk_flavor": true,
|
| 22 |
+
"return_attention_mask": true,
|
| 23 |
+
"sampling_rate": 16000
|
| 24 |
+
},
|
| 25 |
+
"image_processor": {
|
| 26 |
+
"do_convert_rgb": true,
|
| 27 |
+
"do_normalize": false,
|
| 28 |
+
"do_rescale": true,
|
| 29 |
+
"do_resize": true,
|
| 30 |
+
"image_mean": [
|
| 31 |
+
0.0,
|
| 32 |
+
0.0,
|
| 33 |
+
0.0
|
| 34 |
+
],
|
| 35 |
+
"image_processor_type": "Gemma4ImageProcessor",
|
| 36 |
+
"image_seq_length": 280,
|
| 37 |
+
"image_std": [
|
| 38 |
+
1.0,
|
| 39 |
+
1.0,
|
| 40 |
+
1.0
|
| 41 |
+
],
|
| 42 |
+
"max_soft_tokens": 280,
|
| 43 |
+
"patch_size": 16,
|
| 44 |
+
"pooling_kernel_size": 3,
|
| 45 |
+
"resample": 3,
|
| 46 |
+
"rescale_factor": 0.00392156862745098
|
| 47 |
+
},
|
| 48 |
+
"image_seq_length": 280,
|
| 49 |
+
"processor_class": "Gemma4Processor",
|
| 50 |
+
"video_processor": {
|
| 51 |
+
"do_convert_rgb": true,
|
| 52 |
+
"do_normalize": true,
|
| 53 |
+
"do_rescale": true,
|
| 54 |
+
"do_resize": true,
|
| 55 |
+
"do_sample_frames": true,
|
| 56 |
+
"image_mean": [
|
| 57 |
+
0.0,
|
| 58 |
+
0.0,
|
| 59 |
+
0.0
|
| 60 |
+
],
|
| 61 |
+
"image_std": [
|
| 62 |
+
1.0,
|
| 63 |
+
1.0,
|
| 64 |
+
1.0
|
| 65 |
+
],
|
| 66 |
+
"max_soft_tokens": 70,
|
| 67 |
+
"num_frames": 32,
|
| 68 |
+
"patch_size": 16,
|
| 69 |
+
"pooling_kernel_size": 3,
|
| 70 |
+
"resample": 3,
|
| 71 |
+
"rescale_factor": 0.00392156862745098,
|
| 72 |
+
"return_metadata": false,
|
| 73 |
+
"video_processor_type": "Gemma4VideoProcessor"
|
| 74 |
+
}
|
| 75 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0f
|
| 3 |
+
size 32169626
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"audio_token": "<|audio|>",
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"boa_token": "<|audio>",
|
| 5 |
+
"boi_token": "<|image>",
|
| 6 |
+
"bos_token": "<bos>",
|
| 7 |
+
"eoa_token": "<audio|>",
|
| 8 |
+
"eoc_token": "<channel|>",
|
| 9 |
+
"eoi_token": "<image|>",
|
| 10 |
+
"eos_token": "<eos>",
|
| 11 |
+
"eot_token": "<turn|>",
|
| 12 |
+
"escape_token": "<|\"|>",
|
| 13 |
+
"etc_token": "<tool_call|>",
|
| 14 |
+
"etd_token": "<tool|>",
|
| 15 |
+
"etr_token": "<tool_response|>",
|
| 16 |
+
"extra_special_tokens": [
|
| 17 |
+
"<|video|>"
|
| 18 |
+
],
|
| 19 |
+
"image_token": "<|image|>",
|
| 20 |
+
"is_local": true,
|
| 21 |
+
"local_files_only": false,
|
| 22 |
+
"mask_token": "<mask>",
|
| 23 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 24 |
+
"model_specific_special_tokens": {
|
| 25 |
+
"audio_token": "<|audio|>",
|
| 26 |
+
"boa_token": "<|audio>",
|
| 27 |
+
"boi_token": "<|image>",
|
| 28 |
+
"eoa_token": "<audio|>",
|
| 29 |
+
"eoc_token": "<channel|>",
|
| 30 |
+
"eoi_token": "<image|>",
|
| 31 |
+
"eot_token": "<turn|>",
|
| 32 |
+
"escape_token": "<|\"|>",
|
| 33 |
+
"etc_token": "<tool_call|>",
|
| 34 |
+
"etd_token": "<tool|>",
|
| 35 |
+
"etr_token": "<tool_response|>",
|
| 36 |
+
"image_token": "<|image|>",
|
| 37 |
+
"soc_token": "<|channel>",
|
| 38 |
+
"sot_token": "<|turn>",
|
| 39 |
+
"stc_token": "<|tool_call>",
|
| 40 |
+
"std_token": "<|tool>",
|
| 41 |
+
"str_token": "<|tool_response>",
|
| 42 |
+
"think_token": "<|think|>"
|
| 43 |
+
},
|
| 44 |
+
"pad_token": "<pad>",
|
| 45 |
+
"padding_side": "left",
|
| 46 |
+
"processor_class": "Gemma4Processor",
|
| 47 |
+
"response_schema": {
|
| 48 |
+
"properties": {
|
| 49 |
+
"content": {
|
| 50 |
+
"type": "string"
|
| 51 |
+
},
|
| 52 |
+
"role": {
|
| 53 |
+
"const": "assistant"
|
| 54 |
+
},
|
| 55 |
+
"thinking": {
|
| 56 |
+
"type": "string"
|
| 57 |
+
},
|
| 58 |
+
"tool_calls": {
|
| 59 |
+
"items": {
|
| 60 |
+
"properties": {
|
| 61 |
+
"function": {
|
| 62 |
+
"properties": {
|
| 63 |
+
"arguments": {
|
| 64 |
+
"additionalProperties": {},
|
| 65 |
+
"type": "object",
|
| 66 |
+
"x-parser": "gemma4-tool-call"
|
| 67 |
+
},
|
| 68 |
+
"name": {
|
| 69 |
+
"type": "string"
|
| 70 |
+
}
|
| 71 |
+
},
|
| 72 |
+
"type": "object",
|
| 73 |
+
"x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})"
|
| 74 |
+
},
|
| 75 |
+
"type": {
|
| 76 |
+
"const": "function"
|
| 77 |
+
}
|
| 78 |
+
},
|
| 79 |
+
"type": "object"
|
| 80 |
+
},
|
| 81 |
+
"type": "array",
|
| 82 |
+
"x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>"
|
| 83 |
+
}
|
| 84 |
+
},
|
| 85 |
+
"type": "object",
|
| 86 |
+
"x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?P<content>(?:(?!\\<turn\\|\\>)(?!\\<\\|tool_response\\>).)+)?(?:\\<turn\\|\\>|\\<\\|tool_response\\>)?"
|
| 87 |
+
},
|
| 88 |
+
"soc_token": "<|channel>",
|
| 89 |
+
"sot_token": "<|turn>",
|
| 90 |
+
"stc_token": "<|tool_call>",
|
| 91 |
+
"std_token": "<|tool>",
|
| 92 |
+
"str_token": "<|tool_response>",
|
| 93 |
+
"think_token": "<|think|>",
|
| 94 |
+
"tokenizer_class": "GemmaTokenizer",
|
| 95 |
+
"unk_token": "<unk>"
|
| 96 |
+
}
|