예제 #1
0
def episodes_from_fns(fns, limit=None, split='dev'):
    use_scripts = (scripted_tell in fns) or (scripted_tell_before_peek in fns)
    if scripted_tell_after_peek in fns:
        use_scripts = True
        run_from = codraw_data.get_scenes_and_scripts_with_peek(split)
    elif use_scripts:
        run_from = codraw_data.get_scenes_and_scripts(split)
    else:
        run_from = codraw_data.get_scenes(split)

    if limit is not None:
        run_from = run_from[:limit]

    sims = []
    with torch.no_grad():
        for run_from_single in run_from:
            if use_scripts:
                episode = Episode.run_script(run_from_single, fns)
            else:
                episode = Episode.run(run_from_single, fns)
            yield episode