forked from huggingface/alignment-handbook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05a064a
commit 3528a23
Showing
12 changed files
with
721 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# for slurm use | ||
get_unused_port() { | ||
# Well-known ports end at 1023. On Linux, dynamic ports start at 32768 | ||
# (see /proc/sys/net/ipv4/ip_local_port_range). | ||
local MIN_PORT=10001 | ||
local MAX_PORT=32767 | ||
|
||
local USED_PORTS=$(netstat -a -n -t | tail -n +3 | tr -s ' ' | \ | ||
cut -d ' ' -f 4 | sed 's/.*:\([0-9]\+\)$/\1/' | sort -n | uniq) | ||
|
||
# Generate random port numbers within the search range (inclusive) until we | ||
# find one that isn't in use. | ||
local RAN_PORT | ||
while | ||
RAN_PORT=$(shuf -i 10001-32767 -n 1) | ||
[[ "$USED_PORTS" =~ $RAN_PORT ]] | ||
do | ||
continue | ||
done | ||
|
||
echo $RAN_PORT | ||
} | ||
|
||
init_node_info() { | ||
export PRIMARY=$(hostname -s) | ||
SECONDARIES=$(scontrol show hostnames $SLURM_JOB_NODELIST | \ | ||
grep -v $PRIMARY) | ||
|
||
ALL_NODES="$PRIMARY $SECONDARIES" | ||
export PRIMARY_PORT=$(get_unused_port) | ||
echo $PRIMARY $SECONDARIES $PRIMARY_PORT | ||
} | ||
|
||
init_node_info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
#!/usr/bin/env python | ||
# coding=utf-8 | ||
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. | ||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
#!/usr/bin/env python | ||
# coding=utf-8 | ||
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. | ||
# | ||
|
Oops, something went wrong.