()
| 499 | return [x, y, z, yaw] |
| 500 | |
| 501 | def main(): |
| 502 | eval_info = "configs/eval_test.json" |
| 503 | |
| 504 | f = open(eval_info, 'r') |
| 505 | all_eval_info = json.loads(f.read()) |
| 506 | f.close() |
| 507 | |
| 508 | # Load model |
| 509 | model_name_or_path="IPEC-COMMUNITY/openfly-agent-7b" |
| 510 | processor = AutoProcessor.from_pretrained(model_name_or_path) |
| 511 | policy = AutoModelForVision2Seq.from_pretrained( |
| 512 | model_name_or_path, |
| 513 | attn_implementation="flash_attention_2", # [Optional] Requires `flash_attn` |
| 514 | torch_dtype=torch.bfloat16, |
| 515 | low_cpu_mem_usage=True, |
| 516 | trust_remote_code=True, |
| 517 | ).to("cuda:0") |
| 518 | |
| 519 | # Test metrics |
| 520 | acc = 0 |
| 521 | stop = 0 |
| 522 | data_num = 0 |
| 523 | MAX_STEP = 100 |
| 524 | |
| 525 | # Group by environment type |
| 526 | env_groups = {} |
| 527 | for item in all_eval_info: |
| 528 | env_type = item["image_path"].split("/")[0] # Get environment type |
| 529 | if env_type not in env_groups: |
| 530 | env_groups[env_type] = [] |
| 531 | env_groups[env_type].append(item) |
| 532 | |
| 533 | # Process each environment type sequentially |
| 534 | for env_name, eval_info in env_groups.items(): |
| 535 | print(f"Starting evaluation of environment: {env_name}, with {len(eval_info)} data entries") |
| 536 | time.sleep(5) |
| 537 | |
| 538 | # Create appropriate environment bridge based on environment type |
| 539 | if "airsim" in env_name: |
| 540 | env_bridge = AirsimBridge(env_name) |
| 541 | pos_ratio = 1.0 |
| 542 | elif "ue" in env_name: |
| 543 | env_bridge = UEBridge(ue_ip="127.0.0.1", ue_port="9000", env_name=env_name) |
| 544 | pos_ratio = 1.0 |
| 545 | elif "gs" in env_name: |
| 546 | env_bridge = GSBridge(env_name) |
| 547 | pos_ratio = 5.15 |
| 548 | else: |
| 549 | print(f"Unknown environment type: {env_name}, skipping") |
| 550 | continue |
| 551 | |
| 552 | # Evaluate all data for current environment |
| 553 | for idx, item in enumerate(eval_info): |
| 554 | acts = [] # Reset action list |
| 555 | data_num += 1 |
| 556 | pos_list = item['pos'] |
| 557 | text = item['gpt_instruction'] |
| 558 | start_postion = pos_list[0] |
no test coverage detected