Ravenveil commited on
Commit
7775651
·
verified ·
1 Parent(s): c22e5e9

Upload folder using huggingface_hub

Browse files
rebuild_manual/REBUILD.md ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # OVOW on H100-1 (CUDA 13.0 机器) 重建手册 2026-10-19
2
+
3
+ ## 位置
4
+ - 仓库: ~/jiayin/OVOW (github.com/yisuanwang/OVOW)
5
+ - conda: ~/miniconda3, 环境 ovow-opg / ovow-sam3 / ovow-motion
6
+ - CUDA 工具链: ~/jiayin/cuda121 (nvcc 12.1 + cudart/cccl/cusparse 12.4 headers + cusolverDn.h 补丁)
7
+ 与 ~/jiayin/cuda124 (12.4 全套, motion 用)
8
+ - 权重: OVOW/ckpts (OnePoseViaGen 20G, hy3dgen 70G, moge 1.2G, sam3 3.4G 社区镜像 bodhicitta/sam3)
9
+ - Qwen3-VL-8B 本地: OVOW/model/Qwen3-VL-8B-Instruct (魔搭下载)
10
+ - EgoDex test: ~/jiayin/EgoDex/test (17.3G zip 解压, 源 ml-site.cdn-apple.com/datasets/egodex/test.zip)
11
+ - Blender: ~/jiayin/opt/blender-4.2.3
12
+
13
+ ## 关键坑(按出现顺序)
14
+ 1. 根分区 / 100% 满 → TMPDIR/PIP_CACHE_DIR 全指到 ~/jiayin
15
+ 2. build_cuda_exts.sh 硬编码 /tmp/ovow_exts → 已 sed 成 $HOME/jiayin/tmp/ovow_exts
16
+ 3. pip 隔离构建环境无 torch/pybind11 → 全部 --no-build-isolation + 预装 ninja pybind11 editables hatchling
17
+ 4. nvcc 13.0 vs torch cu121/cu124 → conda 自建 cuda121/cuda124 前缀(所有包必须钉版本,不钉会混入 13.x)
18
+ 5. cusolverDn.h 无版本守卫引用 CUDA>=12.8 类型 → 补丁 #if CUDART_VERSION >= 12080 (见 patches/)
19
+ 6. 链接缺 -lcuda/-lnvrtc → libcuda.so 链到 /usr/local/cuda-13.0/lib64/stubs + cuda-nvrtc=12.1
20
+ 7. Hunyuan3D-2 仓库搬家 → tencent/Hunyuan3D-2 (原 Tencent-Hunyuan)
21
+ 8. sam3 gated → 社区镜像 bodhicitta/sam3 字节级一致
22
+ 9. custom_rasterizer 缺 C++ 内核 → 从 Tencent-Hunyuan/Hunyuan3D-2 sparse-checkout 补 lib/
23
+ 10. flex_gemm Autotuner 不兼容 triton 3.0.0 → 补丁去掉 do_bench 参数 (见 patches/)
24
+ 11. utils3d master 改名 intrinsics_from_fov_xy → 钉 c5daf6f6c244d251f252102d09e9b7bcef791a38
25
+ 12. 版本回钉: trimesh==4.5.3 (5.x 点云丢点), matplotlib==3.7.5 (cm.get_cmap), pycolmap==3.11.1,
26
+ transformers==4.57.1 (v5 要 torch>=2.6), rembg==2.0.57+onnxruntime-gpu (2.0.85 拖 numpy2),
27
+ numpy==1.26.4 全程守住
28
+ 13. mycpp cmake 缺 Boost → conda install boost-cpp + CMAKE_PREFIX_PATH 指向 conda 与 pybind11
29
+ 14. 运行时: 仓库根 ln -s ckpts checkpoints (引擎按 CWD 相对路径找权重); run_video 的 --out 要绝对路径;
30
+ --name 不能是纯数字(会被当 step 号); 视频软链会沿用目标 basename, 要 cp
31
+ 15. 视频链 Qwen 本地后端要 --qwen-label-category-mode legacy; ffmpeg conda 装进 opg env
32
+
33
+ ## 复现命令
34
+ 见 scripts/ (按编号顺序执行); verify_envs.sh 验证全部扩展 import。
35
+
36
+ ## 已验证产物
37
+ - 单图链: outputs/image_pipeline_*/desk_banana/scene_anim_blender_physics_with_deform.glb
38
+ - EgoDex 视频全 4D 链: outputs/egodex_p1/ws/egodex_case8_20261019_105538_*/video_pipeline_*/egodex_case8/
39
+ scene_anim_blender_physics_with_deform.glb + fullscene_deform_objseq_textured_left_rgb_right_split10_h264.mp4
rebuild_manual/env.example ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # OVOW 机器相关配置 —— 复制为 .env 并按你的机器填写。
2
+ # configs/paths.sh 会自动 source 本file;其余路径默认装在 OVOW 仓库根下,无需改。
3
+
4
+ # --- conda 各环境的 python 解释器 ---
5
+ # 用 `bash environment/create_envs.sh` 建环境,结束时会打印这 3 个路径,粘贴过来即可。
6
+ # (也可按将要创建的 env 路径预先填好;configure/setup 展开占位符前必须已填。)
7
+ OPG_PY="$HOME/miniconda3/envs/ovow-opg/bin/python"
8
+ SAM3_PY="$HOME/miniconda3/envs/ovow-sam3/bin/python"
9
+ MOTION_PY="$HOME/miniconda3/envs/ovow-motion/bin/python"
10
+ # 可选步骤(默认未启用)
11
+ FLUX_PY="$HOME/miniconda3/envs/ovow-flux/bin/python"
12
+ HDR_PY="$HOME/miniconda3/envs/ovow-hdr/bin/python"
13
+ QWEN_PY="$OPG_PY" # Qwen 标注走 API,用 opg 环境即可
14
+ # ROMAV2_PY="$HOME/miniconda3/envs/ovow-romav2/bin/python" # 可选:RoMaV2 scale-recovery 子进程独立 env(torch2.8);默认进程内(OPG_ROMAV2_INPROC=1),无需另建
15
+
16
+ # --- Qwen 物体标注(step1)---
17
+ # 默认走 DashScope API(下面二选一:直接写 key,或指向一个含 sk-... 的file)。
18
+ # 没有 DashScope 账号?设 QWEN_BACKEND=local 走本地 Qwen3-VL(需 GPU 显存,
19
+ # 图片链路默认自动从 HF 拉 Qwen/Qwen3-VL-8B-Instruct;也可用
20
+ # masking/download_qwen3_vl_8b_hf_mirror.sh 预下载后以 --qwen-model 指定)。
21
+ DASHSCOPE_API_KEY=""
22
+ APIKEY_FILE=""
23
+ QWEN_BACKEND="local"
24
+
25
+ # --- 数据 / 输出(默认在仓库内 examples/ 与 outputs/,可改成你的目录)---
26
+ # DATA_VIDEO="/path/to/your/videos"
27
+ # DATA_IMAGE="/path/to/your/images"
28
+ # OVOW_OUTPUTS="/path/to/outputs"
29
+ # TORCH_HOME="/path/to/cache/torch" # torch.hub cache; needs facebookresearch_dinov2_main for offline demos
30
+
31
+ # --- 引擎与依赖位置(默认装在仓库根下;一般不用改)---
32
+ # ENGINE_DIR="$OVOW_ROOT/engine"
33
+ # CKPTS="$OVOW_ROOT/ckpts"
34
+
35
+ # --- Blender(step 10/13/14/17/18 合成与渲染;硬依赖)---
36
+ # 默认假设 `blender` 在 PATH 上;便携版填绝对路径,必要时补 lib 目录。
37
+ BLENDER_BIN="$HOME/jiayin/opt/blender-4.2.3-linux-x64/blender"
38
+ # BLENDER_LIB="/opt/blender-4.x/lib"
39
+
40
+ # --- 默认 GPU ---
41
+ OVOW_GPU="4"
rebuild_manual/patches/cusolverDn.h.CUDART12080-guard ADDED
The diff for this file is too large to render. See raw diff
 
rebuild_manual/patches/flex_gemm_autotuner_triton30.py ADDED
@@ -0,0 +1,408 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import builtins
2
+ from typing import *
3
+ import os
4
+ import json
5
+ import importlib
6
+ import pkgutil
7
+ import torch
8
+ import triton
9
+ import time
10
+ import inspect
11
+ from filelock import FileLock
12
+ from .. import (
13
+ AUTOSAVE_AUTOTUNE_CACHE,
14
+ AUTOTUNE_CACHE_PATH,
15
+ )
16
+
17
+
18
+ class TritonPersistentCacheAutotuner(triton.runtime.Autotuner):
19
+ def __init__(
20
+ self,
21
+ fn,
22
+ arg_names,
23
+ configs,
24
+ key,
25
+ reset_to_zero,
26
+ restore_value,
27
+ pre_hook=None,
28
+ post_hook=None,
29
+ prune_configs_by: Dict = None,
30
+ warmup=None,
31
+ rep=None,
32
+ use_cuda_graph=False,
33
+ do_bench=None,
34
+ ):
35
+ super().__init__(
36
+ fn,
37
+ arg_names,
38
+ configs,
39
+ key,
40
+ reset_to_zero,
41
+ restore_value,
42
+ pre_hook,
43
+ post_hook,
44
+ prune_configs_by,
45
+ warmup,
46
+ rep,
47
+ use_cuda_graph,
48
+ )
49
+
50
+ def run(self, *args, **kwargs):
51
+ self.nargs = dict(zip(self.arg_names, args))
52
+ used_cached_result = True
53
+ if len(self.configs) > 1:
54
+ all_args = {**self.nargs, **kwargs}
55
+ _args = {k: v for (k, v) in all_args.items() if k in self.arg_names}
56
+ key = [_args[key] for key in self.keys if key in _args]
57
+ for _, arg in _args.items():
58
+ if hasattr(arg, "dtype"):
59
+ key.append(str(arg.dtype))
60
+ key = str(tuple(key))
61
+ if key not in self.cache:
62
+ # prune configs
63
+ used_cached_result = False
64
+ pruned_configs = self.prune_configs(kwargs)
65
+ bench_start = time.time()
66
+ timings = {config: self._bench(*args, config=config, **kwargs) for config in pruned_configs}
67
+ bench_end = time.time()
68
+ self.bench_time = bench_end - bench_start
69
+ self.cache[key] = builtins.min(timings, key=timings.get)
70
+ full_nargs = {**self.nargs, **kwargs, **self.cache[key].all_kwargs()}
71
+ self.pre_hook(full_nargs, reset_only=True)
72
+ self.configs_timings = timings
73
+ config = self.cache[key]
74
+ else:
75
+ config = self.configs[0]
76
+ self.best_config = config
77
+ if os.getenv("TRITON_PRINT_AUTOTUNING", None) == "1" and not used_cached_result:
78
+ print(f"Triton autotuning for function {self.base_fn.__name__} finished after "
79
+ f"{self.bench_time:.2f}s; best config selected: {self.best_config};")
80
+ if AUTOSAVE_AUTOTUNE_CACHE and not used_cached_result:
81
+ save_autotune_cache()
82
+ if config.pre_hook is not None:
83
+ full_nargs = {**self.nargs, **kwargs, **config.all_kwargs()}
84
+ config.pre_hook(full_nargs)
85
+ ret = self.fn.run(
86
+ *args,
87
+ **kwargs,
88
+ **config.all_kwargs(),
89
+ )
90
+ self.nargs = None
91
+ return ret
92
+
93
+ def prune_configs(self, kwargs):
94
+ pruned_configs = self.configs
95
+ if self.early_config_prune:
96
+ pruned_configs = self.early_config_prune(self.configs, self.nargs, **kwargs)
97
+ if self.perf_model:
98
+ top_k = self.configs_top_k
99
+ if isinstance(top_k, float) and top_k <= 1.0:
100
+ top_k = int(len(self.configs) * top_k)
101
+ if len(pruned_configs) > top_k:
102
+ est_timing = {
103
+ config: self.perf_model(
104
+ **self.nargs,
105
+ **kwargs,
106
+ **config.all_kwargs(),
107
+ )
108
+ for config in pruned_configs
109
+ }
110
+ pruned_configs = sorted(est_timing.keys(), key=lambda x: est_timing[x])[:top_k]
111
+ return pruned_configs
112
+
113
+ def warmup(self, *args, **kwargs):
114
+ self.nargs = dict(zip(self.arg_names, args))
115
+ ret = []
116
+ for config in self.prune_configs(kwargs):
117
+ ret.append(self.fn.warmup(
118
+ *args,
119
+ **kwargs,
120
+ **config.all_kwargs(),
121
+ ))
122
+ self.nargs = None
123
+ return ret
124
+
125
+
126
+ def triton_autotune(configs, key, prune_configs_by=None, reset_to_zero=None, restore_value=None, pre_hook=None, post_hook=None,
127
+ warmup=None, rep=None, use_cuda_graph=False, do_bench=None):
128
+ """
129
+ Decorator for auto-tuning a :code:`triton.jit`'d function.
130
+
131
+ .. highlight:: python
132
+ .. code-block:: python
133
+
134
+ @triton_autotune(configs=[
135
+ triton.Config(kwargs={'BLOCK_SIZE': 128}, num_warps=4),
136
+ triton.Config(kwargs={'BLOCK_SIZE': 1024}, num_warps=8),
137
+ ],
138
+ key=['x_size'] # the two above configs will be evaluated anytime
139
+ # the value of x_size changes
140
+ )
141
+ @triton.jit
142
+ def kernel(x_ptr, x_size, **META):
143
+ BLOCK_SIZE = META['BLOCK_SIZE']
144
+ :note: When all the configurations are evaluated, the kernel will run multiple times.
145
+ This means that whatever value the kernel updates will be updated multiple times.
146
+ To avoid this undesired behavior, you can use the `reset_to_zero` argument, which
147
+ resets the value of the provided tensor to `zero` before running any configuration.
148
+
149
+ If the environment variable :code:`TRITON_PRINT_AUTOTUNING` is set to
150
+ :code:`"1"`, Triton will print a message to stdout after autotuning each
151
+ kernel, including the time spent autotuning and the best configuration.
152
+
153
+ :param configs: a list of :code:`triton.Config` objects
154
+ :type configs: list[triton.Config]
155
+ :param key: a list of argument names whose change in value will trigger the evaluation of all provided configs.
156
+ :type key: list[str]
157
+ :param prune_configs_by: a dict of functions that are used to prune configs, fields:
158
+ 'perf_model': performance model used to predicate running time with different configs, returns running time
159
+ 'top_k': number of configs to bench
160
+ 'early_config_prune'(optional): a function used to do early prune (eg, num_stages). It takes configs:List[Config] as its input, and returns pruned configs.
161
+ :param reset_to_zero: a list of argument names whose value will be reset to zero before evaluating any configs.
162
+ :type reset_to_zero: list[str]
163
+ :param restore_value: a list of argument names whose value will be restored after evaluating any configs.
164
+ :type restore_value: list[str]
165
+ :param pre_hook: a function that will be called before the kernel is called.
166
+ This overrides the default pre_hook used for 'reset_to_zero' and 'restore_value'.
167
+ 'kwargs': a dict of all arguments passed to the kernel.
168
+ 'reset_only': a boolean indicating whether the pre_hook is called to reset the values only, without a corresponding post_hook.
169
+ :type pre_hook: lambda args, reset_only
170
+ :param post_hook: a function that will be called after the kernel is called.
171
+ This overrides the default post_hook used for 'restore_value'.
172
+ 'kwargs': a dict of all arguments passed to the kernel.
173
+ 'exception': the exception raised by the kernel in case of a compilation or runtime error.
174
+ :type post_hook: lambda args, exception
175
+ :param warmup: warmup time (in ms) to pass to benchmarking (deprecated).
176
+ :type warmup: int
177
+ :param rep: repetition time (in ms) to pass to benchmarking (deprecated).
178
+ :type rep: int
179
+ :param do_bench: a benchmark function to measure the time of each run.
180
+ :type do_bench: lambda fn, quantiles
181
+ """
182
+
183
+ def decorator(fn):
184
+ return TritonPersistentCacheAutotuner(
185
+ fn, fn.arg_names, configs, key, reset_to_zero, restore_value, pre_hook=pre_hook,
186
+ post_hook=post_hook, prune_configs_by=prune_configs_by, warmup=warmup, rep=rep,
187
+ use_cuda_graph=use_cuda_graph
188
+ )
189
+
190
+ return decorator
191
+
192
+
193
+ class PersistentCacheAutoTuner:
194
+ def __init__(
195
+ self,
196
+ kernel,
197
+ configs=None,
198
+ key=None,
199
+ config_fn=None,
200
+ key_fn=None,
201
+ warmup=3,
202
+ runs=10,
203
+ verbose=False,
204
+ ):
205
+ """
206
+ AutoTuner is a wrapper class for a kernel that automatically tunes the kernel parameters to achieve the best performance.
207
+
208
+ Args:
209
+ kernel: A callable object that takes in input arguments and returns the output.
210
+ configs: A list of Config objects that define the possible kernel parameters and their values.
211
+ key: A list of argument names that retune the kernel on change.
212
+ config_fn: A function that takes in the input arguments and returns configs to be used for autotuning.
213
+ key_fn: A function that takes in the input arguments and returns the key used to cache the tuning results.
214
+ Once the key changes, the autotuning will be rerun.
215
+ warmup: The number of warmup runs to discard before measuring the execution time.
216
+ runs: The number of runs to measure the execution time.
217
+ verbose: Whether to print the autotuning results.
218
+ """
219
+ assert config_fn or configs, "Either configs or config_fn must be provided"
220
+ assert key_fn or key, "Either key or key_fn must be provided"
221
+ self.kernel = kernel
222
+ self.configs = configs
223
+ self.key = key
224
+ self.config_fn = config_fn
225
+ self.key_fn = key_fn
226
+ self.warmup = warmup
227
+ self.runs = runs
228
+ self.verbose = verbose or os.getenv('FLEX_GEMM_AUTOTUNER_VERBOSE', '0') == '1'
229
+ self.kernel_arg_names = inspect.getfullargspec(kernel).args
230
+ self.cache = {}
231
+
232
+ def _args_to_kwargs(self, args, kwargs):
233
+ # Convert args to kwargs
234
+ arg_names = self.kernel_arg_names
235
+ arg_dict = dict(zip(arg_names, args))
236
+ arg_dict.update(kwargs)
237
+ return arg_dict
238
+
239
+ def __call__(self, *args, **kwargs):
240
+ arg_dict = self._args_to_kwargs(args, kwargs)
241
+
242
+ # Determine key
243
+ key = self.key_fn(*args, **kwargs) if self.key_fn else tuple(arg_dict[k] for k in self.key)
244
+ key = str(key)
245
+
246
+ # If key changes, rerun autotune
247
+ used_cached_result = True
248
+ if key not in self.cache:
249
+ used_cached_result = False
250
+ if self.verbose:
251
+ print(f"Running autotuning for {self.kernel.__name__} with key {key}")
252
+ configs = self.configs if self.configs else self.config_fn(*args, **kwargs)
253
+ if self.verbose:
254
+ print(f"Configs: {configs}")
255
+ best_config = self._benchmark(args, kwargs, configs)
256
+ if self.verbose:
257
+ print(f"Best config for {self.kernel.__name__} with key {key}: {best_config}")
258
+ self.cache[key] = best_config
259
+
260
+ if AUTOSAVE_AUTOTUNE_CACHE and not used_cached_result:
261
+ save_autotune_cache()
262
+
263
+ # Run the kernel with the best config
264
+ return self.kernel(*args, **kwargs, **self.cache[key])
265
+
266
+ def _benchmark(self, args, kwargs, configs):
267
+ best_time = float('inf')
268
+ best_config = None
269
+
270
+ if len(configs) == 1:
271
+ best_config = configs[0]
272
+ else:
273
+ for config in configs:
274
+ # Run the kernel and measure execution time
275
+ for _ in range(self.warmup):
276
+ self.kernel(*args, **kwargs, **config)
277
+ torch.cuda.synchronize()
278
+ start = time.time()
279
+ for _ in range(self.runs):
280
+ self.kernel(*args, **kwargs, **config)
281
+ torch.cuda.synchronize()
282
+ elapsed = (time.time() - start) / self.runs
283
+ if self.verbose:
284
+ print(f"Config {config}: {elapsed} seconds")
285
+ # Update the best config if the execution time is better
286
+ if elapsed < best_time:
287
+ best_time = elapsed
288
+ best_config = config
289
+
290
+ return best_config
291
+
292
+
293
+ def autotune(
294
+ configs=None,
295
+ key=None,
296
+ config_fn=None,
297
+ key_fn=None,
298
+ warmup=3,
299
+ runs=10,
300
+ verbose=False
301
+ ):
302
+ def decorator(kernel):
303
+ return PersistentCacheAutoTuner(kernel, configs, key, config_fn, key_fn, warmup, runs, verbose)
304
+ return decorator
305
+
306
+
307
+ def walk_package(package_name, fn):
308
+ try:
309
+ package = importlib.import_module(package_name)
310
+ except ModuleNotFoundError:
311
+ print(f"Package {package_name} not found.")
312
+ return
313
+
314
+ if not hasattr(package, '__path__'):
315
+ print(f"{package_name} is not a package.")
316
+ return
317
+
318
+ for _, module_name, is_pkg in pkgutil.iter_modules(package.__path__):
319
+ full_module_name = f"{package_name}.{module_name}"
320
+ if is_pkg:
321
+ walk_package(full_module_name, fn)
322
+ else:
323
+ fn(full_module_name)
324
+
325
+
326
+ def get_autotune_cache():
327
+ cache = {}
328
+ device_name = torch.cuda.get_device_name()
329
+ if device_name not in cache:
330
+ cache[device_name] = {}
331
+
332
+ def save_cache(full_module_name):
333
+ module = importlib.import_module(full_module_name)
334
+ for attr_name, attr in module.__dict__.items():
335
+ cache_key = f"{full_module_name}.{attr_name}"
336
+ if isinstance(attr, PersistentCacheAutoTuner):
337
+ cache[device_name][cache_key] = attr.cache
338
+ elif isinstance(attr, TritonPersistentCacheAutotuner):
339
+ cache[device_name][cache_key] = {k: v.__dict__ for k, v in attr.cache.items()}
340
+
341
+ walk_package('flex_gemm', save_cache)
342
+
343
+ return cache
344
+
345
+
346
+ def save_autotune_cache(path=None):
347
+ path = path or AUTOTUNE_CACHE_PATH
348
+ lock_path = path + ".lock"
349
+
350
+ with FileLock(lock_path):
351
+ if os.path.exists(path):
352
+ with open(path, 'r') as f:
353
+ cache = json.load(f)
354
+ else:
355
+ cache = {}
356
+ # Merge existing cache with new cache
357
+ cache.update(get_autotune_cache())
358
+
359
+ tmp_path = path + ".tmp"
360
+ with open(tmp_path, 'w') as f:
361
+ json.dump(cache, f, indent=4)
362
+ f.flush()
363
+ os.fsync(f.fileno())
364
+ os.replace(tmp_path, path)
365
+
366
+
367
+ def load_autotune_cache(path_or_cache=None):
368
+ cache = None
369
+
370
+ # Preserve path-based loading, but allow callers to provide a preloaded cache object.
371
+ if path_or_cache is None or isinstance(path_or_cache, (str, os.PathLike)):
372
+ path = path_or_cache or AUTOTUNE_CACHE_PATH
373
+ lock_path = path + ".lock"
374
+
375
+ if not os.path.exists(path):
376
+ return
377
+
378
+ with FileLock(lock_path):
379
+ with open(path, 'r') as f:
380
+ cache = json.load(f)
381
+ elif isinstance(path_or_cache, Mapping):
382
+ cache = path_or_cache
383
+ else:
384
+ raise TypeError("load_autotune_cache expects a path or a mapping")
385
+
386
+ if cache is None:
387
+ return
388
+
389
+ device_name = torch.cuda.get_device_name()
390
+ if device_name not in cache and "*" not in cache:
391
+ return
392
+ if "*" in cache and device_name not in cache:
393
+ device_name = "*"
394
+
395
+ def load_cache(full_module_name):
396
+ module = importlib.import_module(full_module_name)
397
+ for attr_name, attr in module.__dict__.items():
398
+ cache_key = f"{full_module_name}.{attr_name}"
399
+ if isinstance(attr, PersistentCacheAutoTuner):
400
+ if cache_key in cache[device_name]:
401
+ attr.cache = cache[device_name][cache_key]
402
+ elif isinstance(attr, TritonPersistentCacheAutotuner):
403
+ if cache_key in cache[device_name]:
404
+ for k, v in cache[device_name][cache_key].items():
405
+ attr.cache[k] = triton.runtime.Config(None)
406
+ attr.cache[k].__dict__.update(v)
407
+
408
+ walk_package('flex_gemm', load_cache)
rebuild_manual/scripts/fix_da3.sh ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -uo pipefail
3
+ source ~/miniconda3/etc/profile.d/conda.sh
4
+ export TMPDIR=$HOME/jiayin/tmp PIP_CACHE_DIR=$HOME/jiayin/pipcache
5
+ cd ~/jiayin/OVOW
6
+ conda activate ovow-opg
7
+ export CUDA_HOME=$HOME/jiayin/cuda121 PATH=$HOME/jiayin/cuda121/bin:$PATH
8
+ export CPATH=$HOME/jiayin/cuda121/include:$CONDA_PREFIX/include:$CONDA_PREFIX/include/eigen3:${CPATH:-}
9
+ pip install hatchling hatch-vcs editables
10
+ pip install -e engine/oneposeviagen/DA3 --no-build-isolation && echo DA3_OK || echo FAIL_DA3
11
+ conda deactivate; echo DONE
rebuild_manual/scripts/fix_envs.sh ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -uo pipefail
3
+ source ~/miniconda3/etc/profile.d/conda.sh
4
+ export TMPDIR=$HOME/jiayin/tmp
5
+ export PIP_CACHE_DIR=$HOME/jiayin/pipcache
6
+ cd ~/jiayin/OVOW
7
+ # motion 前置:先装 mesh_processor 来源包,再跑 requirements
8
+ conda env list | grep -q '^ovow-motion ' && { conda activate ovow-motion; pip install -e third_party/Motion324/scripts/hy3dgen/texgen/differentiable_renderer; conda deactivate; }
9
+ bash environment/create_envs.sh all
rebuild_manual/scripts/fix_envs3.sh ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -uo pipefail
3
+ source ~/miniconda3/etc/profile.d/conda.sh
4
+ export TMPDIR=$HOME/jiayin/tmp PIP_CACHE_DIR=$HOME/jiayin/pipcache
5
+ cd ~/jiayin/OVOW
6
+ echo '=== opg: pre-build diso ==='
7
+ conda activate ovow-opg
8
+ pip install diso --no-build-isolation || pip install diso
9
+ conda deactivate
10
+ echo '=== motion: pybind11 + req without mesh_processor + editable ==='
11
+ conda activate ovow-motion
12
+ pip install pybind11
13
+ grep -v '^mesh_processor==' environment/requirements-motion.txt > /tmp/req-motion-nm.txt
14
+ pip install -r /tmp/req-motion-nm.txt
15
+ pip install -e third_party/Motion324/scripts/hy3dgen/texgen/differentiable_renderer --no-build-isolation
16
+ conda deactivate
17
+ echo '=== rerun official create_envs ==='
18
+ bash environment/create_envs.sh all
rebuild_manual/scripts/fix_envs4.sh ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -uo pipefail
3
+ source ~/miniconda3/etc/profile.d/conda.sh
4
+ export TMPDIR=$HOME/jiayin/tmp PIP_CACHE_DIR=$HOME/jiayin/pipcache
5
+ cd ~/jiayin/OVOW
6
+ echo '=== toolchains ==='
7
+ conda create -y -p $HOME/jiayin/cuda121 -c nvidia cuda-nvcc=12.1 cuda-cudart-dev=12.1 cuda-libraries-dev=12.1 > /dev/null 2>&1 || conda create -y -p $HOME/jiayin/cuda121 -c nvidia cuda-nvcc=12.1 cuda-cudart-dev=12.1
8
+ conda create -y -p $HOME/jiayin/cuda124 -c nvidia cuda-nvcc=12.4 cuda-cudart-dev=12.4 cuda-libraries-dev=12.4 > /dev/null 2>&1 || conda create -y -p $HOME/jiayin/cuda124 -c nvidia cuda-nvcc=12.4 cuda-cudart-dev=12.4
9
+ ls $HOME/jiayin/cuda121/bin/nvcc $HOME/jiayin/cuda124/bin/nvcc || exit 1
10
+ echo '=== opg ==='
11
+ conda activate ovow-opg
12
+ export CUDA_HOME=$HOME/jiayin/cuda121 PATH=$HOME/jiayin/cuda121/bin:$PATH
13
+ pip install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 --index-url https://download.pytorch.org/whl/cu121
14
+ pip install diso --no-build-isolation
15
+ pip install pybind11
16
+ conda deactivate
17
+ echo '=== motion ==='
18
+ conda activate ovow-motion
19
+ export CUDA_HOME=$HOME/jiayin/cuda124 PATH=$HOME/jiayin/cuda124/bin:$PATH
20
+ pip install torch==2.4.1+cu124 torchvision==0.19.1+cu124 --index-url https://download.pytorch.org/whl/cu124
21
+ pip install pybind11
22
+ pip install diso --no-build-isolation 2>/dev/null || true
23
+ pip install -e third_party/Motion324/scripts/hy3dgen/texgen/differentiable_renderer --no-build-isolation
24
+ pip install -e third_party/Motion324/scripts/hy3dgen/texgen/custom_rasterizer --no-build-isolation
25
+ grep -v '^mesh_processor==' environment/requirements-motion.txt > $HOME/jiayin/tmp/req-motion-nm.txt
26
+ pip install -r $HOME/jiayin/tmp/req-motion-nm.txt
27
+ conda deactivate
28
+ echo '=== official scripts rerun ==='
29
+ export CUDA_HOME=$HOME/jiayin/cuda121 PATH=$HOME/jiayin/cuda121/bin:$PATH
30
+ bash environment/create_envs.sh opg
31
+ bash environment/create_envs.sh motion
rebuild_manual/scripts/fix_envs5.sh ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -uo pipefail
3
+ source ~/miniconda3/etc/profile.d/conda.sh
4
+ export TMPDIR=$HOME/jiayin/tmp PIP_CACHE_DIR=$HOME/jiayin/pipcache
5
+ export CCPLUG=1
6
+ CUDA_CCCL=$HOME/jiayin/cuda121/targets/x86_64-linux/include/cccl
7
+ cd ~/jiayin/OVOW
8
+ echo '=== opg ==='
9
+ conda activate ovow-opg
10
+ export CUDA_HOME=$HOME/jiayin/cuda121 PATH=$HOME/jiayin/cuda121/bin:$PATH CPATH=$HOME/jiayin/cuda121/include:${CPATH:-}
11
+ pip install ninja
12
+ pip install diso --no-build-isolation && echo DISO_OK
13
+ pip install -r environment/requirements-opg.txt
14
+ bash environment/build_cuda_exts.sh
15
+ for p in Amodal3R fpose fpose/fpose/bundlesdf/mycuda SpaTrackerV2 trellis DA3 SAM2-in-video; do pip install -e engine/oneposeviagen/$p; done
16
+ conda deactivate
17
+ echo '=== motion ==='
18
+ conda activate ovow-motion
19
+ export CUDA_HOME=$HOME/jiayin/cuda124 PATH=$HOME/jiayin/cuda124/bin:$PATH CPATH=$HOME/jiayin/cuda124/include:${CPATH:-}
20
+ pip install ninja
21
+ pip install diso --no-build-isolation 2>&1 | tail -1
22
+ pip install -e third_party/Motion324/scripts/hy3dgen/texgen/custom_rasterizer --no-build-isolation && echo RASTER_OK
23
+ pip install -r $HOME/jiayin/tmp/req-motion-nm.txt 2>&1 | tail -3
24
+ conda deactivate
25
+ echo DONE_ALL
rebuild_manual/scripts/fix_envs7.sh ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -uo pipefail
3
+ source ~/miniconda3/etc/profile.d/conda.sh
4
+ export TMPDIR=$HOME/jiayin/tmp PIP_CACHE_DIR=$HOME/jiayin/pipcache
5
+ T=$HOME/jiayin/tmp/ovow_exts
6
+ cd ~/jiayin/OVOW
7
+ echo '=== opg ==='
8
+ conda activate ovow-opg
9
+ export CUDA_HOME=$HOME/jiayin/cuda121 PATH=$HOME/jiayin/cuda121/bin:$PATH CPATH=$HOME/jiayin/cuda121/include:${CPATH:-}
10
+ pip install ninja pybind11
11
+ pip install kaolin==0.18.0 -f https://nvidia-kaolin.s3.us-east-2.amazonaws.com/torch-2.4.1_cu121.html && echo KAOLIN_OK
12
+ pip install --no-deps pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py311_cu121_pyt241/download.html && echo P3D_OK || pip install --no-build-isolation git+https://github.com/facebookresearch/pytorch3d.git
13
+ pip install --no-build-isolation git+https://github.com/JeffreyXiang/diffoctreerast.git && echo DOR_OK
14
+ pip install --no-build-isolation git+https://github.com/EasternJournalist/utils3d.git
15
+ [ -d $T/mip-splatting ] || git clone https://github.com/autonomousvision/mip-splatting.git $T/mip-splatting
16
+ pip install --no-build-isolation $T/mip-splatting/submodules/diff-gaussian-rasterization/ && echo DGR_OK
17
+ pip install --no-build-isolation $T/mip-splatting/submodules/simple-knn/ && echo SK_OK
18
+ for p in Amodal3R fpose fpose/fpose/bundlesdf/mycuda SpaTrackerV2 trellis DA3 SAM2-in-video; do pip install -e engine/oneposeviagen/$p --no-build-isolation || echo FAIL_$p; done
19
+ pip install flash-attn --no-build-isolation || echo FAIL_flashattn
20
+ pip install --no-build-isolation git+https://github.com/JeffreyXiang/CuMesh.git || echo FAIL_cumesh
21
+ [ -d $T/nvdiffrec ] || git clone -b renderutils https://github.com/JeffreyXiang/nvdiffrec.git $T/nvdiffrec
22
+ pip install --no-build-isolation $T/nvdiffrec || echo FAIL_nvdiffrec
23
+ pip install --no-build-isolation -e engine/oneposeviagen/TRELLIS2/o-voxel || echo FAIL_ovoxel
24
+ conda deactivate
25
+ echo '=== motion ==='
26
+ conda activate ovow-motion
27
+ export CUDA_HOME=$HOME/jiayin/cuda124 PATH=$HOME/jiayin/cuda124/bin:$PATH CPATH=$HOME/jiayin/cuda124/include:${CPATH:-}
28
+ pip install ninja pybind11
29
+ pip show mesh_processor >/dev/null 2>&1 || pip install -e third_party/Motion324/scripts/hy3dgen/texgen/differentiable_renderer --no-build-isolation && echo DR_OK
30
+ pip show custom_rasterizer >/dev/null 2>&1 || pip install -e third_party/Motion324/scripts/hy3dgen/texgen/custom_rasterizer --no-build-isolation && echo RASTER_OK
31
+ conda deactivate
32
+ echo SEVEN_DONE
rebuild_manual/scripts/fix_envs8.sh ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -uo pipefail
3
+ source ~/miniconda3/etc/profile.d/conda.sh
4
+ export TMPDIR=$HOME/jiayin/tmp PIP_CACHE_DIR=$HOME/jiayin/pipcache
5
+ T=$HOME/jiayin/tmp/ovow_exts
6
+ cd ~/jiayin/OVOW
7
+ conda activate ovow-opg
8
+ export CUDA_HOME=$HOME/jiayin/cuda121 PATH=$HOME/jiayin/cuda121/bin:$PATH
9
+ export CPATH=$HOME/jiayin/cuda121/include:${CPATH:-}
10
+ export CPATH=$CPATH
11
+ pip install ninja pybind11
12
+ pip install --no-build-isolation git+https://github.com/JeffreyXiang/CuMesh.git && echo CUMESH_OK
13
+ for p in fpose fpose/fpose/bundlesdf/mycuda DA3 SAM2-in-video Amodal3R SpaTrackerV2 trellis; do pip install -e engine/oneposeviagen/$p --no-build-isolation && echo OK_$p || echo FAIL_$p; done
14
+ pip install --no-build-isolation git+https://github.com/facebookresearch/pytorch3d.git && echo P3D_OK || echo FAIL_pytorch3d
15
+ [ -d $T/nvdiffrec ] || git clone -b renderutils https://github.com/JeffreyXiang/nvdiffrec.git $T/nvdiffrec
16
+ pip install --no-build-isolation $T/nvdiffrec && echo NVDIFFREC_OK || echo FAIL_nvdiffrec
17
+ pip install --no-build-isolation -e engine/oneposeviagen/TRELLIS2/o-voxel && echo OVOXEL_OK || echo FAIL_ovoxel
18
+ pip install flash-attn --no-build-isolation && echo FLASH_OK || echo FAIL_flashattn
19
+ conda deactivate
20
+ echo EIGHT_DONE
rebuild_manual/scripts/fix_last2.sh ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -uo pipefail
3
+ source ~/miniconda3/etc/profile.d/conda.sh
4
+ export TMPDIR=$HOME/jiayin/tmp PIP_CACHE_DIR=$HOME/jiayin/pipcache
5
+ cd ~/jiayin/OVOW
6
+ conda activate ovow-opg
7
+ export CUDA_HOME=$HOME/jiayin/cuda121 PATH=$HOME/jiayin/cuda121/bin:$PATH
8
+ export CPATH=$HOME/jiayin/cuda121/include:$CONDA_PREFIX/include:$CONDA_PREFIX/include/eigen3:${CPATH:-}
9
+ pip install -e engine/oneposeviagen/DA3 --no-build-isolation && echo DA3_OK || echo FAIL_DA3
10
+ pip install -e engine/oneposeviagen/TRELLIS2/o-voxel --no-build-isolation && echo OVOXEL_OK || echo FAIL_ovoxel
11
+ conda deactivate
12
+ echo LAST_DONE
rebuild_manual/scripts/verify_envs.sh ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ source ~/miniconda3/etc/profile.d/conda.sh
3
+ conda activate ovow-opg
4
+ export CUDA_HOME=$HOME/jiayin/cuda121
5
+ python -c "
6
+ import torch
7
+ ok=[]
8
+ for m in ['diso','pytorch3d','cumesh','flex_gemm','o_voxel','kaolin','flash_attn','diff_gaussian_rasterization','simple_knn','diffoctreerast','utils3d','lightglue','sam2']:
9
+ try:
10
+ __import__(m); ok.append(m+':OK')
11
+ except Exception as e:
12
+ ok.append(m+':FAIL '+str(e)[:60])
13
+ print('\n'.join(ok))
14
+ "
15
+ python -c 'import da3; print("da3:OK")' 2>/dev/null || python -c 'import depth_anything_3; print("da3(pkg):OK")' 2>/dev/null || echo da3:IMPORT_NAME_UNKNOWN
16
+ conda deactivate
17
+ conda activate ovow-motion
18
+ python -c 'import torch; import mesh_processor; print("motion mesh_processor:OK")'
19
+ conda deactivate
20
+ conda activate ovow-sam3
21
+ python -c 'import sam3; print("sam3:OK")' 2>/dev/null || echo sam3:CHECK_NAME