Buckets:
| import json, os | |
| import numpy as np, pandas as pd, torch | |
| from huggingface_hub import snapshot_download | |
| R=snapshot_download('sassoshots/ltx-curves-poc', repo_type='dataset') | |
| man=pd.read_parquet(os.path.join(R,'manifest.parquet')) | |
| root='/work/poc_training' | |
| os.makedirs(root+'/videos',exist_ok=True); os.makedirs(root+'/curve_conditions',exist_ok=True) | |
| for d in ['latents','conditions','curve_conditions']: | |
| os.makedirs(root+'/preprocessed_data/'+d,exist_ok=True) | |
| import shutil | |
| rows=[] | |
| for i,r in man.iterrows(): | |
| cid=r['clip_id'] | |
| shutil.copy(os.path.join(R,cid+'.mp4'), root+'/videos/'+cid+'.mp4') | |
| rows.append({'video': 'videos/'+cid+'.mp4', 'caption': f"{r['prefix']} footage, dynamics score {r['dyn_score']:.2f}"}) | |
| z=np.stack([np.load(os.path.join(R,cid+'.npz'))[k] for k in ['motion','luminance','luminance_global','saturation','salience']],1).astype('float32') | |
| sid='latent_'+cid | |
| torch.save({'sample_id':sid,'curve':z}, root+f'/curve_conditions/{sid}.pt') | |
| json.dump(rows, open(root+'/dataset.json','w')) | |
| print('PREPARED', len(rows), 'clips; curves:', len(os.listdir(root+'/curve_conditions'))) | |
Xet Storage Details
- Size:
- 1.12 kB
- Xet hash:
- 078b995562b355ad165336122e300124bc9896c2051b3705255dc70e89c2aa57
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.