|
#!/bin/bash |
|
JOB_URL_SCHEME=${JOB_URL_SCHEME:-"http://"} |
|
JOB_ID=${JOB_ID:-'localhost'} |
|
JOB_HOST=${JOB_HOST:-'local'} |
|
export HOME=/workspace |
|
cd /workspace |
|
|
|
|
|
git lfs install |
|
if [[ -z "$HF_TOKEN" || ! "$HF_TOKEN" =~ ^hf_ ]]; then |
|
export HF_TOKEN=${!#} |
|
unset ${!#} |
|
fi |
|
|
|
echo "HF_TOKEN: $HF_TOKEN" |
|
. /workspace/.bashrc |
|
. /workspace/.miniconda3/bin/activate |
|
export SHELL=/bin/bash |
|
|
|
|
|
|
|
|
|
if [ -f /workspace/.config/github-copilot/apps.json.enc ]; then |
|
openssl aes-256-cbc -a -d -md sha256 -pass pass:"$HF_TOKEN" -in /workspace/.config/github-copilot/apps.json.enc -out /workspace/.config/github-copilot/apps.json |
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ -f /workspace/.config/CFTOKEN.enc ]; then |
|
echo "Decrypting CFTOKEN" |
|
CFTOKEN_ENC=$(cat /workspace/.config/CFTOKEN.enc) |
|
echo "$CFTOKEN_ENC" | openssl aes-256-cbc -a -d -md sha256 -pass pass:"$HF_TOKEN" > /workspace/.config/cftoken |
|
export CFTOKEN=$(cat /workspace/.config/cftoken) |
|
/usr/local/bin/cloudflared --pidfile /tmp/cf.pid --autoupdate-freq 24h0m0s tunnel run --token $CFTOKEN & |
|
fi |
|
|
|
|
|
|
|
|
|
if [ -f /workspace/.config/kaggle.json.enc ]; then |
|
mkdir -p $HOME/.kaggle |
|
openssl aes-256-cbc -a -d -md sha256 -pass pass:"$HF_TOKEN" -in /workspace/.config/kaggle.json.enc -out /workspace/.kaggle/kaggle.json |
|
fi |
|
|
|
|
|
|
|
|
|
if [ -f /workspace/.config/oauth2.cfg.enc ]; then |
|
openssl aes-256-cbc -a -d -md sha256 -pass pass:"$HF_TOKEN" -in /workspace/.config/oauth2.cfg.enc -out /workspace/.config/oauth2.cfg |
|
oauth2-proxy --config /workspace/.config/oauth2.cfg & |
|
fi |
|
|
|
git clone https://huggingface.co/eltorio/IDEFICS3_ROCOv2 |
|
git clone https://huggingface.co/spaces/eltorio/Llama-3.2-3B-appreciation |
|
git config --global user.email "[email protected]" |
|
git config --global user.name "[email protected]" |
|
git config --global credential.helper store |
|
|
|
huggingface-cli login --add-to-git-credential --token $HF_TOKEN |
|
|
|
|
|
screen -dmS jupyter bash -c 'SHELL=/bin/bash jupyter lab --ip=0.0.0.0 --port=8080 --no-browser --allow-root \ |
|
--notebook-dir=/workspace \ |
|
--LabApp.token="" \ |
|
--LabApp.custom_display_url=${JOB_URL_SCHEME}${JOB_ID}-8080.${JOB_HOST} \ |
|
--LabApp.allow_remote_access=True \ |
|
--LabApp.allow_origin="*" \ |
|
--LabApp.disable_check_xsrf=True' |
|
|
|
echo "Jupyter Lab is running at ${JOB_URL_SCHEME}${JOB_ID}-8080.${JOB_HOST}" |
|
exec "$@" |