|
| 1 | +# Copyright (C) 2025 Robotec.AI |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +from pathlib import Path |
| 16 | + |
| 17 | +from rai_bench import ( |
| 18 | + define_benchmark_logger, |
| 19 | + parse_vlm_benchmark_args, |
| 20 | +) |
| 21 | +from rai_bench.utils import get_llm_for_benchmark |
| 22 | +from rai_bench.vlm_benchmark import get_spatial_tasks, run_benchmark |
| 23 | + |
| 24 | +if __name__ == "__main__": |
| 25 | + args = parse_vlm_benchmark_args() |
| 26 | + experiment_dir = Path(args.out_dir) |
| 27 | + experiment_dir.mkdir(parents=True, exist_ok=True) |
| 28 | + bench_logger = define_benchmark_logger(out_dir=experiment_dir) |
| 29 | + try: |
| 30 | + tasks = get_spatial_tasks() |
| 31 | + for task in tasks: |
| 32 | + task.set_logger(bench_logger) |
| 33 | + |
| 34 | + llm = get_llm_for_benchmark( |
| 35 | + model_name=args.model_name, |
| 36 | + vendor=args.vendor, |
| 37 | + ) |
| 38 | + run_benchmark( |
| 39 | + llm=llm, |
| 40 | + out_dir=experiment_dir, |
| 41 | + tasks=tasks, |
| 42 | + bench_logger=bench_logger, |
| 43 | + ) |
| 44 | + except Exception as e: |
| 45 | + bench_logger.critical( |
| 46 | + msg=f"Benchmark failed with error: {e}", |
| 47 | + exc_info=True, |
| 48 | + ) |
0 commit comments