[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2026-06-15 03:13:44 +00:00
commit 448e2251e6
4 changed files with 83 additions and 28 deletions

View file

@ -5,14 +5,17 @@ transformers sidecar before the first model cell, using the version the
notebook's own install cell asked for (recorded by the pip/uv shim). Safe no-op
outside IPython, when no version was requested, or once transformers is imported.
"""
try:
import os
# Tell the pip/uv shim it's running inside a notebook kernel, so a cell's
# `!pip install ...` / `!uv pip install ...` (which inherits this env) gets
# the safe-install behaviour. Unset everywhere else => shim is a passthrough.
os.environ["UNSLOTH_NB_SHIM"] = "1"
import unsloth_nb_compat
unsloth_nb_compat.register_ipython()
except Exception as _e: # never break a kernel because of the helper
import sys
print(f"[unsloth-nb] startup hook skipped: {_e!r}", file=sys.stderr)
print(f"[unsloth-nb] startup hook skipped: {_e!r}", file = sys.stderr)