Skip to content

fix(cosmos3/nim): document Git LFS for example media and fail fast on LFS pointers - #438

Merged
pengcuo merged 3 commits into
NVIDIA:mainfrom
aishmadise:fix/nim-git-lfs-pointer-check
Dec 3, 2026
Merged

pengcuo merged 3 commits into
NVIDIA:mainfrom
aishmadise:fix/nim-git-lfs-pointer-check

Conversation

@aishmadise

Copy link
Copy Markdown
Contributor

Problem

The example images and videos under .agents/skills/cookbooks/cosmos3/ are stored with Git LFS (via the *.mp4, *.jpg, *.png rules in .gitattributes). Cloning without Git LFS leaves ~130-byte text pointers in their place. The top-level README installs git-lfs, but none of the NIM cookbook pages mention it, so someone starting from the cookbook can end up sending pointer files to the NIM. media_to_data_url() checks that the file exists and has a supported extension, then base64-encodes whatever is on disk, so a pointer passes both checks.

The cosmos3-inference-nim agent skill (#384) already tells agents to materialise LFS inputs; this brings the same guidance to the human-facing cookbook README and adds a guard in the shared helper.

Change

  • nim/README.md: a short note under "Use an Existing NIM Endpoint" to install git-lfs and pull the cookbook assets before running examples.
  • nim/examples/common.py: media_to_data_url() raises a clear ValueError when the file is a Git LFS pointer, instead of sending it. This covers every example that uses the helper.

Testing

Fresh clone without Git LFS (media files are pointers), using the pinned client environment (uv sync --locked in nim/), running from .agents/skills/cookbooks/cosmos3/nim:

uv run python -c "import sys; sys.path.insert(0, 'examples'); from pathlib import Path; from common import media_to_data_url; print(media_to_data_url(Path('../generator/transfer/assets/edge/control_edge.mp4'))[:70])"

Before (the pointer text is encoded and would be sent as video; the base64 decodes to version https://git-lfs.github.com/s):

data:video/mp4;base64,dmVyc2lvbiBodHRwczovL2dpdC1sZnMuZ2l0aHViLmNvbS9z

After:

ValueError: .agents/skills/cookbooks/cosmos3/generator/transfer/assets/edge/control_edge.mp4 is a Git LFS pointer, not the media file. Install git-lfs, then run `git lfs pull` from the repository root.

A regular (non-pointer) file still encodes normally. just lint passes. Not tested end to end against a running NIM.

I ran into this while working through the NIM cookbook on a fresh Brev instance.

… LFS pointers

Signed-off-by: Aishwarya Madisetty <aishwarya9869@gmail.com>
@aishmadise
aishmadise marked this pull request as draft November 26, 2026 03:23
@aishmadise
aishmadise marked this pull request as ready for review November 26, 2026 03:25
@yaoxu-crypto yaoxu-crypto added the Skill New skill or updating existing skill label Dec 3, 2026

@satishra-ai satishra-ai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to merge. The base encoded Git LFS pointers as media. The fix rejected the pointer with an actionable error, and the hydrated MP4 encoded correctly with a matching checksum.

@pengcuo
pengcuo merged commit 41611db into NVIDIA:main Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skill New skill or updating existing skill

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants