Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions medarc_rl/slurm_templates/one_node_rl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ export HF_HUB_OFFLINE={{ 1 if hf_hub_offline else 0 }}
export HF_HOME="$HF_CACHE_DIR"
export MEDARC_SINGLE_GPU={{ 1 if single_gpu else 0 }}

_d="$HF_CACHE_DIR"; while [ ! -e "$_d" ]; do _d="$(dirname "$_d")"; done
HF_CACHE_GROUP="$(stat -c '%G' "$_d")"; unset _d

if ! id -Gn | grep -qw "$HF_CACHE_GROUP"; then
echo "ERROR: user is not a member of group $HF_CACHE_GROUP (required by $HF_CACHE_DIR)" >&2
exit 1
fi

if [ "$(id -gn)" != "$HF_CACHE_GROUP" ]; then
exec sg "$HF_CACHE_GROUP" "$0" "$@"
fi

mkdir -p "$OUTPUT_DIR/slurm" "$OUTPUT_DIR/torchrun"

if [ -f "$PROJECT_DIR/.env" ]; then
Expand Down
12 changes: 12 additions & 0 deletions medarc_rl/slurm_templates/one_node_sft.j2
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ export HF_CACHE_DIR="{{ hf_cache_dir }}"
export HF_HUB_OFFLINE={{ 1 if hf_hub_offline else 0 }}
export HF_HOME="$HF_CACHE_DIR"

_d="$HF_CACHE_DIR"; while [ ! -e "$_d" ]; do _d="$(dirname "$_d")"; done
HF_CACHE_GROUP="$(stat -c '%G' "$_d")"; unset _d

if ! id -Gn | grep -qw "$HF_CACHE_GROUP"; then
echo "ERROR: user is not a member of group $HF_CACHE_GROUP (required by $HF_CACHE_DIR)" >&2
exit 1
fi

if [ "$(id -gn)" != "$HF_CACHE_GROUP" ]; then
exec sg "$HF_CACHE_GROUP" "$0" "$@"
fi

mkdir -p "$OUTPUT_DIR/slurm" "$OUTPUT_DIR/torchrun"

if [ -f "$PROJECT_DIR/.env" ]; then
Expand Down