dagger / code /1027_run /setup_fix8.sh
yqi19's picture
Upload code/1027_run/setup_fix8.sh with huggingface_hub
e57c6ac verified
Raw History Blame Contribute Delete
2.79 kB
#!/usr/bin/env bash
# Fix: install python-dateutil in simfoundry + download full behavior-1k-assets (has /systems)
set -uo pipefail
ROOT=/lustre/fsw/portfolios/nvr/users/jtremblay/yu
CONDA=$ROOT/miniconda3
SPY=$CONDA/envs/simfoundry/bin/python
B1K=$ROOT/SimFoundry/deps/BEHAVIOR-1K
DS=$B1K/datasets
LOG=$ROOT/1027_run/logs/setup_fix8.log
mkdir -p $ROOT/1027_run/logs
exec > >(tee -a $LOG) 2>&1
export PATH=$CONDA/bin:/usr/local/bin:/usr/bin:/bin
export HOME=/root
export HF_TOKEN=<YOUR_HF_TOKEN>
source $CONDA/etc/profile.d/conda.sh
log() { echo "== $(date '+%F %T') $*"; }
# ── 1. Fix missing python-dateutil (matplotlib dep) in simfoundry ─────────────
log "Installing python-dateutil in simfoundry env"
$SPY -m pip install --no-cache-dir "python-dateutil>=2.8"
log "pip exit $?"
# Verify matplotlib now works
$SPY -c "import matplotlib; print('matplotlib', matplotlib.__version__)" && log "matplotlib OK"
# ── 2. Download full behavior-1k-assets (contains /systems) ──────────────────
if [ ! -d $DS/behavior-1k-assets/systems ]; then
log "Downloading full behavior-1k-assets (no systems dir found)..."
export OMNIGIBSON_DATA_PATH=$DS
# Remove the incomplete install so OmniGibson won't skip it
rm -rf $DS/behavior-1k-assets
$SPY -c "
import os
os.environ['OMNIGIBSON_DATA_PATH'] = '$DS'
os.environ['HF_TOKEN'] = os.environ.get('HF_TOKEN', '')
# Use hf_hub_download directly to get the latest zip (not the rc1 version)
import zipfile, tempfile, shutil
from huggingface_hub import hf_hub_download
print('Downloading behavior-1k-assets.zip (latest)...')
tmpdir = tempfile.mkdtemp()
local_path = hf_hub_download(
repo_id='behavior-1k/zipped-datasets',
filename='behavior-1k-assets.zip',
repo_type='dataset',
local_dir=tmpdir,
token=os.environ.get('HF_TOKEN'),
)
print(f'Downloaded to {local_path}, extracting...')
target = '$DS/behavior-1k-assets'
os.makedirs(target, exist_ok=True)
with zipfile.ZipFile(local_path, 'r') as z:
z.extractall(target)
shutil.rmtree(tmpdir)
print('Extraction done')
import os as _os
print('Contents:', _os.listdir(target))
"
log "download/extract exit $?"
else
log "behavior-1k-assets/systems already present, skipping download"
fi
log "Verifying systems dir:"
ls $DS/behavior-1k-assets/ 2>/dev/null
ls $DS/behavior-1k-assets/systems/ 2>/dev/null | head -5
# ── 3. Quick import check ─────────────────────────────────────────────────────
log "Checking omnigibson import..."
OMNIGIBSON_DATA_PATH=$DS OMNI_KIT_ACCEPT_EULA=YES \
$SPY -c "import omnigibson; print('omnigibson import OK')" 2>&1 | tail -3
log "ALL DONE"