File size: 1,553 Bytes
44fc622
 
 
 
 
 
500cbfa
 
44fc622
 
e235434
 
44fc622
 
 
 
 
e235434
 
500cbfa
 
 
 
 
 
 
44fc622
e235434
 
44fc622
 
 
 
 
7971fe4
44fc622
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
JOB_URL_SCHEME=${JOB_URL_SCHEME:-"http://"}
JOB_ID=${JOB_ID:-'localhost'}
JOB_HOST=${JOB_HOST:-'local'}
export HOME=/workspace
cd /workspace

# Install git lfs
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

# Decode apps.json.enc file
# encoded with: openssl aes-256-cbc -base64 -md sha256 -pass pass:"$HF_TOKEN" -in apps.json -out apps.json.enc
# decode with: openssl aes-256-cbc -a -d -md sha256 -pass pass:"$HF_TOKEN" -in apps.json.enc -out apps.json
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

git clone https://huggingface.co/eltorio/IDEFICS3_ROCOv2
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 "$@"