forked from FrederikHennecke/DeepLearning4NLP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_gwdg.sh
executable file
·90 lines (72 loc) · 3.26 KB
/
setup_gwdg.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
# Function to check if conda is installed
check_conda_installed() {
if command -v conda &> /dev/null; then
echo "Conda is already installed."
else
echo "Conda is not installed. Installing Miniconda..."
install_miniconda
fi
}
# Function to install Miniconda
install_miniconda() {
echo "Downloading Miniconda installer..."
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O Miniconda3-latest.sh
echo "Running Miniconda installer..."
bash Miniconda3-latest.sh -b -p $HOME/miniconda
echo "Initializing Miniconda..."
eval "$($HOME/miniconda/bin/conda shell.bash hook)"
conda init
source ~/.bashrc
}
conda config --set channel_priority disabled
conda config --set allow_non_channel_urls True
conda update conda -c https://software.repos.intel.com/python/conda/ --override-channels
# Function to check if conda environment exists
check_conda_env() {
if conda env list | grep -q "dnlp"; then
echo "Conda environment 'dnlp' already exists."
else
echo "Conda environment 'dnlp' does not exist. Creating environment..."
conda env create -f dnlp.yml
fi
}
# Main script execution
check_conda_installed
check_conda_env
set -e
# Initialize Conda for the current shell
eval "$(conda shell.bash hook)"
echo "Activating conda environment 'dnlp'..."
source activate dnlp
echo $CONDA_DEFAULT_ENV
## Download spacy POS and NER tags
pip install "spacy[cuda-autodetect]>=3.5"
python -m spacy download en_core_web_sm
## Download model on login-node
python - <<EOF
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
model = BertModel.from_pretrained('bert-base-uncased')
EOF
python - <<EOF
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('bert-large-uncased')
model = BertModel.from_pretrained('bert-large-uncased')
EOF
python - <<EOF
from transformers import RobertaTokenizer, RobertaModel
tokenizer = RobertaTokenizer.from_pretrained('roberta-base')
model = RobertaModel.from_pretrained('roberta-base')
EOF
python - <<EOF
from transformers import AutoTokenizer, AutoModel, BartModel
tokenizer = AutoTokenizer.from_pretrained('facebook/bart-large')
model = BartModel.from_pretrained('facebook/bart-large')
EOF
python -c "from tokenizer import BertTokenizer; from bert import BertModel; BertTokenizer.from_pretrained('bert-base-uncased'); BertModel.from_pretrained('bert-base-uncased')"
python -c "from tokenizer import BertTokenizer; from bert import BertModel; BertTokenizer.from_pretrained('bert-large-uncased'); BertModel.from_pretrained('bert-large-uncased')"
# python -c "from transformers import BertTokenizer; BertTokenizer.from_pretrained('bert-large-uncased'); from transformers import BertModel; BertModel.from_pretrained('bert-large-uncased')"
python -c "from transformers import RobertaTokenizer; RobertaTokenizer.from_pretrained('roberta-base'); from transformers import RobertaModel; RobertaModel.from_pretrained('roberta-base')"
python -c "from transformers import AutoTokenizer, AutoModel; AutoTokenizer.from_pretrained('facebook/bart-large'); from transformers import BartModel; BartModel.from_pretrained('facebook/bart-large')"
python -c "import nltk; nltk.download('wordnet')"