-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathset_hf_enviroments.sh
30 lines (23 loc) · 937 Bytes
/
set_hf_enviroments.sh
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
#!/bin/bash
# Backup the .bashrc if it exists
if [ -f ~/.bashrc ]; then
cp ~/.bashrc ~/.bashrc.backup
fi
# Create the cache directory if it doesn't exist
mkdir -p /dscilab_dungvo/workspace/huggingface_cache
# Update or add HF_HOME
sed -i '/^export HF_HOME=/d' ~/.bashrc
echo 'export HF_HOME=/dscilab_dungvo/workspace/huggingface_cache' >> ~/.bashrc
# Update or add HF_HUB_ENABLE_HF_TRANSFER
sed -i '/^export HF_HUB_ENABLE_HF_TRANSFER=/d' ~/.bashrc
echo 'export HF_HUB_ENABLE_HF_TRANSFER=1' >> ~/.bashrc
# # Update or add NCCL_LIBRARY
# sed -i '/^export NCCL_LIBRARY=/d' ~/.bashrc
# echo 'export NCCL_LIBRARY=/usr/lib/x86_64-linux-gnu/libnccl.so' >> ~/.bashrc
# # Update or add LD_PRELOAD
# sed -i '/^export LD_PRELOAD=/d' ~/.bashrc
# echo 'export LD_PRELOAD="/usr/local/lib/libmsamp_dist.so:\${NCCL_LIBRARY}:\${LD_PRELOAD}"' >> ~/.bashrc
# Source the .bashrc to apply changes
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi