From 4b476b88b5d92669a07d4c7c373a5529c3e24bce Mon Sep 17 00:00:00 2001 From: Wayner Barrios Date: Wed, 2 Sep 2026 09:40:36 -0500 Subject: [PATCH] fix(ci): avoid HOL scanner Unicode false positives --- .../references/zerogpu-and-publishing.md | 10 +++++----- skills/huggingface-spaces/SKILL.md | 2 +- skills/huggingface-spaces/references/zerogpu.md | 2 +- skills/huggingface-zerogpu/SKILL.md | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/skills/huggingface-lora-space-builder/references/zerogpu-and-publishing.md b/skills/huggingface-lora-space-builder/references/zerogpu-and-publishing.md index 05df4dd..8a16b84 100644 --- a/skills/huggingface-lora-space-builder/references/zerogpu-and-publishing.md +++ b/skills/huggingface-lora-space-builder/references/zerogpu-and-publishing.md @@ -52,7 +52,7 @@ Typical durations: ### Authentication — check first, ask only if needed -Don't ask for a token reflexively. Check whether the user is already authenticated, and only prompt if there's no usable session. +Don't ask for a token reflexively. Check whether the user has an authenticated session, and only prompt if there's no usable session. ```python from huggingface_hub import HfApi, get_token @@ -71,13 +71,13 @@ def resolve_auth(): Decision tree: -- **User already authenticated and the LoRA repo is public**: use the existing token. Confirm the username with the user before publishing ("I'll publish to `{username}` — confirm?"). -- **User already authenticated and the LoRA repo is private**: try `api.repo_info(repo_id, token=cached)`. If it succeeds, the existing token has the right scope — proceed. If it fails (token doesn't have access to that repo), ask for a token with broader access. +- **User has an authenticated session and the LoRA repo is public**: use the existing token. Confirm the username with the user before publishing ("I'll publish to `{username}` — confirm?"). +- **User has an authenticated session and the LoRA repo is private**: try `api.repo_info(repo_id, token=cached)`. If it succeeds, the existing token has the right scope — proceed. If it fails (token doesn't have access to that repo), ask for a token with broader access. - **No cached token**: ask the user. One ask, with the explanation: "I need a Hugging Face access token with **write** scope. Create one at https://huggingface.co/settings/tokens. Paste it here." The same token will be reused for publishing. The default flow on a Hugging Face Space, in a logged-in user's local environment with `huggingface-cli login`, or in any environment with `HF_TOKEN` set, will *not* require asking the user for a token. Asking is the fallback, not the default. -### Reading the LoRA repo +### Inspecting the LoRA repo ```python from huggingface_hub import HfApi, ModelCard @@ -193,4 +193,4 @@ These happen during `create_repo` or `upload_file`, *before* the Space build pip - **Diffusers version too old for the pipeline class.** The base model was released after the latest pinned diffusers. Fix: change `requirements.txt` from `diffusers` to `git+https://github.com/huggingface/diffusers`. - **CUDA OOM on first request.** The model is too big for the 48GB VRAM available on the default `large` size. Solutions, in order of preference: pick a smaller or quantized variant (FP8, smaller checkpoint); request `@spaces.GPU(size="xlarge")` to get the full 96GB (costs 2× quota and queues longer); enable model offloading (`pipe.enable_model_cpu_offload()` — conflicts with ZeroGPU's process model, last resort only). - **`cache_examples=True` failure.** Build-time GPU isn't available on ZeroGPU. Fix: add `cache_mode="lazy"` so caching happens on first user click instead of at build. -- **Free-tier user, hardware not allocated.** Space falls back to CPU. The build succeeds but inference is unusably slow. Fix: user upgrades to PRO, or removes `hardware: zero-a10g` and lives with CPU. \ No newline at end of file +- **Free-tier user, hardware not allocated.** Space falls back to CPU. The build succeeds but inference is unusably slow. Fix: user upgrades to PRO, or removes `hardware: zero-a10g` and lives with CPU. diff --git a/skills/huggingface-spaces/SKILL.md b/skills/huggingface-spaces/SKILL.md index c81dd6d..9015092 100644 --- a/skills/huggingface-spaces/SKILL.md +++ b/skills/huggingface-spaces/SKILL.md @@ -220,7 +220,7 @@ Order of operations: 1. Read the logs: `hf spaces logs --build --follow` (build error) or `hf spaces logs --follow` (runtime error). Find the **first** error, not the last. 2. Grep [`references/known-errors.md`](references/known-errors.md) for the error string. Check if this is a known issue before trying your own fix — most common ZeroGPU / Gradio / dependency errors have a 1–2 line fix there. -3. Iterate using the cheapest rung from [`references/debugging.md`](references/debugging.md). The vast majority of issues resolve with log-reading + smoke-test loops; interactive dev mode + SSH is a heavy-hammer last resort. +3. Iterate using the cheapest rung from [`references/debugging.md`](references/debugging.md). The vast majority of issues resolve with log inspection + smoke-test loops; interactive dev mode + SSH is a heavy-hammer last resort. If you solve an error that wasn't in the known-errors list, suggest the user PR it back to this skill so future runs benefit. diff --git a/skills/huggingface-spaces/references/zerogpu.md b/skills/huggingface-spaces/references/zerogpu.md index d25cbf7..99a14a2 100644 --- a/skills/huggingface-spaces/references/zerogpu.md +++ b/skills/huggingface-spaces/references/zerogpu.md @@ -169,7 +169,7 @@ Handlers run **concurrently by default**. Three rules: 1. **No mutable global state.** Handlers writing to a module-level dict / list race each other. 2. **No fixed output paths.** Two concurrent calls writing to `output.png` clobber each other (and leak data across users). Use `tempfile.NamedTemporaryFile(suffix=...)`. -3. **Read-only globals are safe** — models, tokenizers, configs loaded once and only read inside handlers. +3. **Globals used without mutation are safe** — models, tokenizers, configs loaded once and only accessed inside handlers. ## Process isolation and pickle diff --git a/skills/huggingface-zerogpu/SKILL.md b/skills/huggingface-zerogpu/SKILL.md index 080f7e3..9b40936 100644 --- a/skills/huggingface-zerogpu/SKILL.md +++ b/skills/huggingface-zerogpu/SKILL.md @@ -201,7 +201,7 @@ Three rules. Full treatment with examples in `references/concurrency.md`. 1. **No mutable global state.** Concurrent requests overwrite each other. 2. **No fixed file paths for outputs.** Concurrent requests clobber the same file. Use `tempfile` for unique paths. -3. **Read-only globals are safe.** Model objects, tokenizers, configs loaded once at startup and only read during requests are safe and encouraged. +3. **Globals used without mutation are safe.** Model objects, tokenizers, configs loaded once at startup and only accessed during requests are safe and encouraged. ## Call Granularity @@ -260,7 +260,7 @@ GRADIO_CACHE_EXAMPLES=true GRADIO_CACHE_MODE=lazy python app.py ### `python_version` pin in README frontmatter -Pinning `python_version` is **effectively required** for ZeroGPU. The runtime default is currently Python 3.10, so a local environment using 3.11+ will fail to install on the Space without an explicit pin. Pin to a ZeroGPU-supported version (3.12 is a reasonable default); the authoritative supported list lives in the [ZeroGPU docs](https://huggingface.co/docs/hub/spaces-zerogpu) — do not hardcode the full list, refer to the docs. +Pinning `python_version` is **effectively required** for ZeroGPU. The runtime default is currently Python 3.10, so a local setup using 3.11+ will fail to install on the Space without an explicit pin. Pin to a ZeroGPU-supported version (3.12 is a reasonable default); the authoritative supported list lives in the [ZeroGPU docs](https://huggingface.co/docs/hub/spaces-zerogpu) — do not hardcode the full list, refer to the docs. ```yaml # README.md frontmatter