Download paper_export/evidence/code/suite/create_tasks.py from CharlesZhang-USTC/snf_experiments: direct link, hf CLI and curl.
- Browser
- Download file 4.42 kB
-
https://huggingface.co/CharlesZhang-USTC/snf_experiments/resolve/main/paper_export/evidence/code/suite/create_tasks.py
- Command line
-
hf download hf://CharlesZhang-USTC/snf_experiments/paper_export/evidence/code/suite/create_tasks.py
-
curl -L -o create_tasks.py https://huggingface.co/CharlesZhang-USTC/snf_experiments/resolve/main/paper_export/evidence/code/suite/create_tasks.py
4.42 kB
| """Create transparent author-curated prompts, not a disguised public benchmark.""" | |
| import argparse | |
| import json | |
| from pathlib import Path | |
| SCENES=[ | |
| ('a ceramic mug on a wooden table','a red ceramic mug on a wooden table'), | |
| ('a bicycle beside a brick wall','a blue bicycle beside a brick wall'), | |
| ('a small dog sitting on a sofa','a small dog sitting on a green sofa'), | |
| ('a glass vase with flowers','a glass vase with yellow flowers'), | |
| ('a sailboat on a calm lake','a sailboat with a red sail on a calm lake'), | |
| ('a toy robot on a desk','a yellow toy robot on a desk'), | |
| ('a running shoe on a white pedestal','a purple running shoe on a white pedestal'), | |
| ('a car parked on a quiet street','a red car parked on a quiet street'), | |
| ('a tree in a grassy field','a tree with autumn leaves in a grassy field'), | |
| ('a bowl of fruit on a kitchen counter','a bowl of oranges on a kitchen counter'), | |
| ('a lamp in a reading room','a blue lamp in a reading room'), | |
| ('a chair near a window','a green chair near a window')] | |
| STYLES=['A studio photograph of ','A watercolor illustration of ','A cinematic photograph of ','A detailed oil painting of ','A clean 3D rendering of '] | |
| MOTIONS=[('walking forward','walking forward with large arm swings'),('walking in a circle','walking in a circle with small steps'), | |
| ('running forward','running forward with a high knee lift'),('turning left while walking','turning left while walking slowly'), | |
| ('jumping in place','jumping in place with arms raised'),('waving one hand','waving both hands'), | |
| ('bending forward','bending forward deeply'),('squatting down and standing up','squatting down and standing up with arms extended'), | |
| ('dancing with side steps','dancing with side steps and broad arm movements'),('kicking forward','kicking forward with the right leg'), | |
| ('punching forward','punching forward with both hands in alternation'),('stretching the arms','stretching the arms above the head')] | |
| CONTEXTS=['A person is ','An adult is ','A dancer is ','A young person is ','An athlete is '] | |
| def create(): | |
| tasks=[] | |
| for i,(style,pair) in enumerate((s,p) for s in STYLES for p in SCENES): | |
| tasks.append(dict(id=f'image_{i:03}',models=['meissonic','sd35','showo'],prompt=style+pair[0],reference_prompt=style+pair[1], | |
| reference_seed=4242+i,target_box=[.25,.25,.75,.75],split='test',reference_kind='model_generated',benchmark='author_curated_v1')) | |
| for i,(context,pair) in enumerate((s,p) for s in CONTEXTS for p in MOTIONS): | |
| tasks.append(dict(id=f'temporal_{i:03}',models=['momask','self_forcing'],prompt=context+pair[0]+'.',reference_prompt=context+pair[1]+'.', | |
| reference_seed=6242+i,target_time=[.5,.8],split='test',reference_kind='model_generated',benchmark='author_curated_v1')) | |
| # Different scenes/actions, rather than moving test examples into dev. | |
| dev=[('a patterned umbrella lying on a bench','a red umbrella lying on a bench'),('a backpack leaning against a rock','a yellow backpack leaning against a rock'), | |
| ('a teapot on a shelf','a blue teapot on a shelf'),('a helmet on a workbench','a green helmet on a workbench')] | |
| for i,pair in enumerate(dev): | |
| tasks.append(dict(id=f'dev_image_{i}',models=['meissonic','sd35','showo'],prompt='A photograph of '+pair[0],reference_prompt='A photograph of '+pair[1], | |
| target_box=[.25,.25,.75,.75],split='dev',reference_kind='model_generated',benchmark='author_curated_v1')) | |
| devmotion=[('a person stepping backwards','a person stepping backwards with arms outstretched'),('a person crawling','a person crawling quickly'), | |
| ('a person sitting down','a person sitting down with one arm raised'),('a person balancing on one foot','a person balancing on one foot with hands on hips')] | |
| for i,pair in enumerate(devmotion): | |
| tasks.append(dict(id=f'dev_temporal_{i}',models=['momask','self_forcing'],prompt=pair[0],reference_prompt=pair[1],target_time=[.5,.8], | |
| split='dev',reference_kind='model_generated',benchmark='author_curated_v1')) | |
| return tasks | |
| if __name__=='__main__': | |
| p=argparse.ArgumentParser();p.add_argument('--output',default='/data/tasks.curated.jsonl');args=p.parse_args() | |
| path=Path(args.output);path.parent.mkdir(parents=True,exist_ok=True) | |
| path.write_text(''.join(json.dumps(t)+'\n' for t in create()),encoding='utf-8');print(path) | |