Skip to content

docs: add Cosmos3 Reasoner Transformers notebook#241

Open
OasisYang wants to merge 2 commits into
NVIDIA:mainfrom
OasisYang:docs/cosmos3-reasoner-transformers-notebook
Open

docs: add Cosmos3 Reasoner Transformers notebook#241
OasisYang wants to merge 2 commits into
NVIDIA:mainfrom
OasisYang:docs/cosmos3-reasoner-transformers-notebook

Conversation

@OasisYang

Copy link
Copy Markdown

Add run_with_transformers.ipynb so all four Reasoner backends (Cosmos Framework, vLLM, NIM, Transformers) ship a notebook. Also add the matching "Notebook walkthrough" subsection to the Run with Transformers section of the reasoner README for parity with the other backends.

Add run_with_transformers.ipynb so all four Reasoner backends (Cosmos
Framework, vLLM, NIM, Transformers) ship a notebook. The notebook mirrors
the in-process Diffusers notebook flow: dedicated venv, registered
`Cosmos3 Transformers (Python 3.13)` kernel, then loads
Cosmos3OmniForConditionalGeneration in process and runs the image and
video examples via a small run_reasoner helper.

Also add the matching "Notebook walkthrough" subsection to the Run with
Transformers section of the reasoner README for parity with the other
backends.

Verified on a GB200 box: the notebook's model-load + image + video cells
execute end-to-end with correct outputs; structure passes nbformat.validate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
"if \"COSMOS3_TRANSFORMERS_VENV\" not in os.environ:\n",
" raise RuntimeError(\"Run the Restore Environment cell after switching to the Transformers kernel.\")\n",
"\n",
"expected_python = (Path(os.environ[\"COSMOS3_TRANSFORMERS_VENV\"]) / \"bin\" / \"python\").resolve()\n",

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.

I ran the notebook with codex to check if any potential issue, below is the codex suggestion for reference, if confirm not an issue then can ignore my comment:

The problem is .resolve() follows shortcuts/symlinks. A virtual environment’s bin/python is often just a shortcut to the real system Python. So both paths can become the same real Python path even when the notebook is not actually using the right virtual environment.
So the check might say “looks good” when the user is still on the wrong Jupyter kernel. Then the next cells could fail later with missing packages, wrong torch, wrong transformers, etc.
A better check would be something like:
"
expected_venv = Path(os.environ["COSMOS3_TRANSFORMERS_VENV"]).resolve()
current_venv = Path(sys.prefix).resolve()

if current_venv != expected_venv:
raise RuntimeError(...)
"
That checks the active environment itself, not just where the Python executable ultimately points.

@qmiao-hub

Copy link
Copy Markdown
Collaborator

The layout of where notebook will be added, and the description of notebook in README.md looks good.

Added one comment based on codex check, if confirm not an issue then it is good.

I did not run through the notebook end-2-end, just reviewed where the notebook where be added, and description added in Readme, plus codex check notebook syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants