fastframes-l-video-components / validate_decoder.py
gatilin's picture
Document FastFrames-L component bundle and tests
be2154d verified
Raw History Blame Contribute Delete
1.21 kB
import json,sys,pathlib,torch
from safetensors.torch import load_file
sys.path.insert(0,str(pathlib.Path(__file__).resolve().parent))
from fastframes.models.pixel_decoder import BridgedPixelDecoder
root=pathlib.Path(__file__).resolve().parent;torch.manual_seed(11);torch.set_num_threads(4)
with torch.device('meta'):m=BridgedPixelDecoder()
s=load_file(str(root/'pixel_decoder.safetensors'));res=m.load_state_dict(s,strict=True,assign=True);assert not res.missing_keys and not res.unexpected_keys;m=m.float().eval()
with torch.inference_mode():
x=torch.randn(1,4,5120);e=torch.randn(1,1,1,5120);o=m(x,e,torch.tensor([[1,2,2]]));assert o.shape==(1,4,3,32,32) and torch.isfinite(o).all()
report={'passed':True,'scope':'FastFrames-L BridgedPixelDecoder only','strict_load':True,'tensors':len(s),'source_full_file_sha256':'75e6c99c358a3d8b87476add2c732b0853aef76279bae4c807a6157e95555f55','input_shape':list(x.shape),'output_shape':list(o.shape),'output_std':float(o.std()),'device':'CPU float32','inputs':'synthetic features, not real video generation','full_dit_or_kv_refiner_forward_tested':False};(root/'validation_decoder.json').write_text(json.dumps(report,indent=2)+'\n');print(json.dumps(report),flush=True)