File size: 1,100 Bytes
8c587c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""Validate the complete vLLM engine configuration before loading weights."""
import argparse
import json
import os
from pathlib import Path

from decision_vllm_engine import llm_options


def main() -> None:
    """Resolve model metadata and engine arguments using the inference configuration."""
    parser = argparse.ArgumentParser()
    parser.add_argument('model')
    parser.add_argument('--output', type=Path)
    args = parser.parse_args()
    os.environ['VLLM_ENABLE_V1_MULTIPROCESSING'] = '0'
    from vllm.engine.arg_utils import EngineArgs

    config = EngineArgs(**llm_options(args.model)).create_engine_config()
    if config.model_config.hf_text_config.is_causal is not False:
        raise ValueError('Full-attention configuration must be bidirectional')
    report = {'stage': 'engine_configuration_verified', 'passed': True,
              'is_causal': False, 'max_model_len': config.model_config.max_model_len}
    if args.output:
        args.output.write_text(json.dumps(report, indent=2) + '\n')
    print(json.dumps(report), flush=True)


if __name__ == '__main__':
    main()