"""generate() with precomputed proxy features must equal generate() from pixels, bit for bit. Loads the candidate adapter (service/eden5090.py), renders 12 chunks with the browser-free capture, and generates them twice from the same seed: once from the stacked condition frames (the model encodes them), once from the features the capture thread produced. Deferred cache commit is on in both runs. """ import hashlib, json, os, sys from pathlib import Path import numpy as np import torch EDEN = Path('/root/autodl-tmp/edenlive') os.environ.update(EDEN_DEFER_CACHE_COMMIT='1', EDEN_GAMES_ROOT=str(EDEN / 'EdenLive/realtime/games')) from loguru import logger logger.remove(); logger.add(sys.stderr, level='WARNING') import eden5090 assert eden5090.__file__.endswith('service/eden5090.py'), eden5090.__file__ from eden.apps.game2v.game_timeline import GameTimeline from flashdreams.infra.config import derive_config from PIL import Image, ImageOps import native_capture capture = native_capture.NativeSceneRenderer('eiffel-assault', width=960, height=544) timeline = GameTimeline('eiffel-assault') chunks = [] for c in range(13): ev = [{'action': 'enter', 'phase': 'down'}, {'action': 'enter', 'phase': 'up'}] if c == 0 else \ [{'action': 'w', 'phase': 'down'}] if c == 3 else [{'action': 'w', 'phase': 'up'}] if c == 7 else [] packet = capture.render_chunk(timeline.begin_chunk(9 if c == 0 else 12, 24), drain_events=lambda e=ev: e) pixels = torch.stack([f.condition_frame for f in packet.frames if f.condition_frame is not None]).permute(0, 3, 1, 2).contiguous() chunks.append((pixels, native_capture.FEATURES.pop(packet.chunk_id))) capture.close() chunks = chunks[1:] # the generated rollout below opens on 12-frame chunks app = eden5090.create_app() H, W = app.defaults.pixel_height, app.defaults.pixel_width P = EDEN / 'diagnostics/eiffel-instruction-20261026' prompt = json.loads((P / 'report.json').read_text())['prompts']['day'] pipe = derive_config(app.pipeline_config, diffusion_model={'seed': 42}).setup().to('cuda').eval() image = torch.from_numpy(np.array(ImageOps.fit(Image.open(P / 'reference.png').convert('RGB'), (W, H)))) image = image.permute(2, 0, 1).unsqueeze(0).to('cuda', torch.bfloat16).div_(127.5).sub_(1) outputs = {} try: for mode in ('pixels', 'features'): torch.manual_seed(42); torch.cuda.manual_seed_all(42) cache = pipe.initialize_cache([prompt], image=image) hashes = [] for i, (pixels, features) in enumerate(chunks): control = pixels if mode == 'pixels' else native_capture.ProxyFeatures(features) out = pipe.generate(i, cache, control) torch.cuda.synchronize() hashes.append(hashlib.sha256(out.float().cpu().numpy().tobytes()).hexdigest()) pipe.commit_pending_cache() outputs[mode] = hashes finally: pipe.close() same = sum(a == b for a, b in zip(outputs['pixels'], outputs['features'])) print(json.dumps(dict(chunks=len(chunks), identical_outputs=f'{same}/{len(chunks)}')))