Repository navigation
fix: harden PositionGetter device cache, headless vis imports, GLB skyseg parity, and Unicode/glob paths - #120
Open
mlubbad wants to merge 1 commit into
Conversation
… and path safety Signed-off-by: Dr. Mohammed Lubbad <engmlubbad@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes five subtle cross-device, headless-import, GLB-export, and filesystem bugs noticed while running
lingbot-mapin headless batch and multi-device workflows:PositionGettercross-device cache collision (lingbot_map/layers/rope.py):PositionGetter.position_cachekeyed only on(height, width)(unlikeRotaryPositionEmbedding2D._compute_frequency_components, which includesdeviceanddtype). CallingPositionGetteron CPU (e.g. during tests or preprocessing) and then on CUDA/MPS returned cached CPU index tensors and raised a cross-deviceRuntimeErrorinsideF.embedding(positions, cos_comp).lingbot_map.visimport without optional[vis]extra (lingbot_map/vis/__init__.py):demo_render/batch_demo.pyand headless scripts importlingbot_map.vis.sky_segmentation/lingbot_map.vis.glb_export, which triggeredlingbot_map/vis/__init__.pyand unconditionally importedviser(PointCloudViewer), raisingModuleNotFoundError: No module named 'viser'on base installs without.[vis]. GuardedPointCloudViewerandviser_wrapperas optional imports.glb_export.pyduplicaterun_skyseg/segment_skydivergence + degeneratescene_scale(lingbot_map/vis/glb_export.py):glb_export.run_skysegreshaped inputs to(-1, 3, input_size[0], input_size[1])((W, H)transposed vssky_segmentation.run_skyseg's(H, W)) and divided by(max_value - min_value)without an epsilon guard (emittingNaNwarnings on uniform frames).glb_export.segment_skycalledos.makedirs(os.path.dirname(mask_filename), exist_ok=True)without guarding bare filenames (dirname == ""->FileNotFoundError) orimage is None.lingbot_map.vis.sky_segmentation, and clampedscene_scale >= 1e-3inpredictions_to_glbso degenerate/coincident point clouds do not pass zero radius/height totrimesh.creation.cone.image_folder="."cache naming, and non-ASCII image paths (lingbot_map/vis/sky_segmentation.py):image_folderwithglob.escape(...)in_list_image_filesso folder names containing literal[...](e.g.scan_[2026]) are not interpreted as character classes.sky_mask_dirviaos.path.abspath(image_folder).rstrip("/\\") + "_sky_masks"soimage_folder="."does not write to a hidden._sky_masksdirectory.np.fromfile+cv2.imdecode/cv2.imencode+.tofileso non-ASCII/Unicode paths work reliably across platforms._set_skip_append(False)reset (gct_stream.py,gct_stream_window.py,gct_stream_window_v2.py): Wrapped non-keyframeself.forward(...)calls intry ... finallyso a transient runtime error on a non-keyframe cannot leave_skip_append=Truestuck on the KV cache.Testing
tests/test_cache_vis_and_path_safety.pycovering all 6 cases (pytest -v tests/test_cache_vis_and_path_safety.py: 6 passed).#82,#85,#88,#115,#116) to avoid overlapping hunks.