[Diffusion] Use current_platform instead of hardcoded "cuda" in cosmos3 guardrails (#34612)

Co-authored-by: ronnie_zheng <zl19940307@163.com>
This commit is contained in:
Arseniy Mironov
2026-08-19 15:26:28 +03:00
committed by GitHub
co-authored by ronnie_zheng
parent 574274660f
commit c57ada81e1
2 changed files with 8 additions and 1 deletions
@@ -44,6 +44,12 @@ pip install "cosmos-guardrail==0.3.1"
`cosmos-guardrail` downloads gated NVIDIA guardrail weights, so pass a Hugging Face token if your environment needs one. If the package is not installed, SGLang skips Cosmos3 guardrails and logs a warning. To disable Cosmos3 guardrails for local experiments, set `SGLANG_DISABLE_COSMOS3_GUARDRAILS=1` before starting the server.
There may be problems loading the Cosmos-1.0-Guardrail weights on Ascend NPU. If the *_pickle.UnpicklingError* error occurs during startup, you should change ```weight_only=True``` to ```weights_only=False``` parameter in *cosmos_guardrail/cosmos_utils.py*:
```
#!/usr/bin/env bash
COSMOS_GUARDRAIL_DIR="$(dirname "$(python -c 'import cosmos_guardrail; print(cosmos_guardrail.__file__)')")"
sed -i 's/weights_only=True/weights_only=False/g' "$COSMOS_GUARDRAIL_DIR/cosmos_utils.py"
```
## 3. Serve Cosmos3
Serve `Cosmos3-Nano` directly from the Hugging Face model ID: