Download evaluation/prepare_runtime.py from davidwdw/b1k_model: direct link, hf CLI and curl.
- Browser
- Download file 2.87 kB
-
https://huggingface.co/davidwdw/b1k_model/resolve/main/evaluation/prepare_runtime.py
- Command line
-
hf download hf://davidwdw/b1k_model/evaluation/prepare_runtime.py
-
curl -L -o prepare_runtime.py https://huggingface.co/davidwdw/b1k_model/resolve/main/evaluation/prepare_runtime.py
2.87 kB
| """Prepare a local RGB-only inference adapter; preserve source/patch provenance.""" | |
| import ast | |
| import difflib | |
| import hashlib | |
| import json | |
| import subprocess | |
| from pathlib import Path | |
| ROOT=Path(__file__).resolve().parent | |
| SOL=ROOT/'behavior-1k-solution' | |
| ARCHIVE=Path('/home/eai/Documents/Codex/2026-09-18/b1k-chat-part1-b1k-gui-jsonl/work/source') | |
| patches=[] | |
| for name in ['src/b1k/models/pi_behavior.py','src/b1k/models/pi_behavior_config.py']: | |
| src=(ARCHIVE/name).read_text() | |
| out=src | |
| if name.endswith('/pi_behavior.py'): | |
| out=out.replace('from b1k.models import spatial_da3 as _spatial_da3\n','') | |
| start=out.index(' spatial_inject=spatial_inject,') | |
| end=out.index(' )\n', start) | |
| out=out[:start]+out[end:] | |
| out=out.replace(' self.config = config\n', ' self.config = config\n assert config.da3 is None and not config.use_spatial_action_cross_attention and not config.use_skill_conditioning, "RGB-only evaluation adapter"\n',1) | |
| out=out.replace(', banks=_prefix_banks)', ')') | |
| out='\n'.join(x for x in out.split('\n') if x.strip() not in {'banks=_prefix_banks,','banks=spatial_banks,'}) | |
| marker=' L = self.action_correlation_cholesky.value\n Sigma = L @ L.T' | |
| out=out.replace(marker," if hasattr(self, '_eval_correction'):\n assert O_indices.shape == (128,) and U_indices.shape == (832,)\n return {'O_indices': O_indices, 'U_indices': U_indices, 'correction_matrix': self._eval_correction.value}\n\n"+marker) | |
| ast.parse(out) | |
| (SOL/name).write_text(out) | |
| patches.extend(difflib.unified_diff(src.splitlines(True),out.splitlines(True),fromfile='archived/'+name,tofile='runtime/'+name)) | |
| for name in ['src/b1k/policies/b1k_policy.py','src/b1k/shared/eval_b1k_wrapper.py']: | |
| p=SOL/name | |
| src=subprocess.check_output(['git','-C',str(SOL),'show','HEAD:'+name],text=True) | |
| out=src.replace('from omnigibson.learning.utils.eval_utils import PROPRIOCEPTION_INDICES','from b1k_eval_contract import PROPRIOCEPTION_INDICES') | |
| p.write_text(out) | |
| patches.extend(difflib.unified_diff(src.splitlines(True),out.splitlines(True),fromfile='upstream/'+name,tofile='runtime/'+name)) | |
| # Copy exact evaluator proprioception constant without importing the simulator in the policy process. | |
| p=Path('/home/eai/code/b1k/OmniGibson/omnigibson/eval/utils/eval_utils.py') | |
| src=p.read_text(); tree=ast.parse(src) | |
| node=next(n for n in tree.body if isinstance(n,ast.Assign) and any(isinstance(t,ast.Name) and t.id=='PROPRIOCEPTION_INDICES' for t in n.targets)) | |
| (ROOT/'b1k_eval_contract.py').write_text('from collections import OrderedDict\nimport numpy as np\n'+ast.get_source_segment(src,node)+'\n') | |
| (ROOT/'runtime_adapter.patch').write_text(''.join(patches)) | |
| print('Prepared no-DA3 runtime and recorded adapter patch.') | |