MCPcopy Create free account
hub / github.com/MotrixLab/ViMoGen / main

Function main

mbench/launch/evaluate.py:48–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46
47
48def main():
49 args = parse_args()
50
51 print(f'args: {args}')
52 device = torch.device("cuda")
53 my_MBench = MBench(device, args.full_json_dir, args.output_path)
54
55 print(f'start evaluation')
56
57 current_time = datetime.now().strftime('%Y-%m-%d-%H:%M:%S')
58
59 kwargs = {}
60
61 prompt = []
62
63 if (args.prompt_file is not None) and (args.prompt != "None"):
64 raise Exception("--prompt_file and --prompt cannot be used together")
65 if (args.prompt_file is not None or args.prompt != "None") and (not args.mode=='custom_input'):
66 raise Exception("must set --mode=custom_input for using external prompt")
67
68 if args.prompt_file:
69 with open(args.prompt_file, 'r') as f:
70 prompt = json.load(f)
71 assert type(prompt) == dict, "Invalid prompt file format. The correct format is {\"video_path\": prompt, ... }"
72 elif args.prompt != "None":
73 prompt = [args.prompt]
74
75 kwargs['imaging_quality_preprocessing_mode'] = args.imaging_quality_preprocessing_mode
76
77 my_VBench.evaluate(
78 videos_path = args.videos_path,
79 name = f'results_{current_time}',
80 prompt_list=prompt, # pass in [] to read prompt from filename
81 dimension_list = args.dimension,
82 local=args.load_ckpt_from_local,
83 read_frame=args.read_frame,
84 mode=args.mode,
85 **kwargs
86 )
87 print('done')
88
89
90if __name__ == "__main__":

Callers 1

evaluate.pyFile · 0.70

Calls 3

MBenchClass · 0.85
evaluateMethod · 0.80
parse_argsFunction · 0.70

Tested by

no test coverage detected