Stereo_Depth / sh /env.sh
LLDDSS's picture
Upload folder using huggingface_hub (part 6)
11b82ca verified
Raw History Blame Contribute Delete
2.05 kB
# Shared interpreter for every script here. Source, do not execute.
#
# Inference runs in the Spatial_VLM conda env (transformers 5.7, torch 2.8).
# Qwen3.5 (model_type qwen3_5) does not exist in the base env's transformers
# 4.51, so a silent fallback to `python` would let the Qwen2.5 sweeps pass and
# then fail halfway through the grid. The interpreter is therefore required,
# not preferred: a missing one is an error here rather than a confusing failure
# four hours in. Override deliberately with PYTHON_BIN=...
SPATIAL_VLM_PYTHON=${SPATIAL_VLM_PYTHON:-/home/disheng/miniconda3/envs/Spatial_VLM/bin/python}
PYTHON_BIN=${PYTHON_BIN:-${SPATIAL_VLM_PYTHON}}
if [[ ! -x "${PYTHON_BIN}" ]]; then
echo "ERROR: interpreter not found or not executable: ${PYTHON_BIN}" >&2
echo " Inference needs the Spatial_VLM env (transformers 5.7, torch 2.8)." >&2
echo " Set PYTHON_BIN=/path/to/python to use a different one." >&2
exit 1
fi
# Confirm the env can actually serve this grid. Costs one interpreter start per
# sweep, which is nothing against the run, and turns a wrong env into a clear
# message up front. CHECK_ENV=false to skip.
check_env() {
[[ "${CHECK_ENV:-true}" == "true" ]] || return 0
"${PYTHON_BIN}" - <<'PY' || exit 1
import sys
try:
import torch, transformers
except Exception as exc: # noqa: BLE001
sys.exit(f"ERROR: cannot import torch/transformers: {exc}")
# qwen3_5 is the model_type behind Qwen3.5-4B and -4B-Base; it does not
# exist before transformers 5.x.
try:
from transformers.models import qwen3_5 # noqa: F401
except ImportError:
sys.exit(
f"ERROR: transformers {transformers.__version__} at {sys.executable}\n"
" has no qwen3_5 support, so the Qwen3.5 sweeps cannot run.\n"
" Use the Spatial_VLM env (transformers 5.7)."
)
print(f"env ok: python {sys.version.split()[0]}, torch {torch.__version__}, "
f"transformers {transformers.__version__}, "
f"cuda {'yes' if torch.cuda.is_available() else 'NO'}")
PY
}