forked from LargeWorldModel/LWM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtpu_vm_setup.sh
executable file
·170 lines (140 loc) · 4.05 KB
/
tpu_vm_setup.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#! /bin/bash
sudo umount /mnt/ramdisk
sudo rm -rf /mnt/ramdisk
sudo mkdir /mnt/ramdisk
sudo mount -t tmpfs -o size=10G tmpfs /mnt/ramdisk
sudo apt-get update && sudo apt-get install -y \
build-essential \
python-is-python3 \
tmux \
htop \
git \
nodejs \
bmon \
p7zip-full \
nfs-common \
ffmpeg
# Update pip
pip install --upgrade pip
pip uninstall -y tux
# Python dependencies
cat > $HOME/tpu_requirements.txt <<- EndOfFile
-f https://storage.googleapis.com/jax-releases/libtpu_releases.html
jax[tpu]==0.4.23
tensorflow-cpu==2.11.0
tensorboard-plugin-profile
flax==0.7.0
optax==0.1.7
chex==0.1.82
einops
--extra-index-url https://download.pytorch.org/whl/cpu
torch==2.0.0
torchvision==0.15.0
transformers==4.29.2
datasets==2.13.0
tqdm
ml_collections
wandb
requests
gcsfs
typing-extensions
sentencepiece
tux @ git+https://github.com/lhao499/tux.git
Pillow
ipdb
imageio[ffmpeg]
tiktoken
EndOfFile
pip install --upgrade -r $HOME/tpu_requirements.txt
# vim configurations
cat > $HOME/.vimrc <<- EndOfFile
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set backspace=indent,eol,start
syntax on
EndOfFile
# tmux configurations
cat > $HOME/.tmux.conf <<- EndOfFile
bind r source-file ~/.tmux.conf \; display-message "█▓░ ~/.tmux.conf reloaded."
# Enable colors, https://github.com/tmux/tmux/wiki/FAQ
set -g default-terminal "tmux-256color"
# start with window 1 (instead of 0)
set -g base-index 1
setw -g pane-base-index 1
set -g prefix C-a
set -g set-titles on
set -g set-titles-string '#(whoami)::#h::#(curl ipecho.net/plain;echo)'
# Status bar customization
set -g status-interval 5
set -g status-left-length 90
set -g status-right-length 60
set -g status-justify left
# send the prefix to client inside window (ala nested sessions)
bind-key a send-prefix
bind-key x kill-pane
# auto reorder
set-option -g renumber-windows on
# default window name
set -g status-left "#[fg=green,bg=colour236] #S "
# default statusbar colors
set-option -g status-style fg=yellow,dim,bg=colour235
# default window title colors
set-window-option -g window-status-style fg=yellow,bg=colour236,dim
# active window title colors
set-window-option -g window-status-current-style fg=brightred,bg=colour236
# basename as window title https://stackoverflow.com/a/37136828
set-window-option -g window-status-current-format '#{window_index} #{pane_current_command} #(echo "#{pane_current_path}" | rev | cut -d'/' -f-3 | rev)'
set-window-option -g window-status-format '#{window_index} #{pane_current_command} #(echo "#{pane_current_path}" | rev | cut -d'/' -f-3 | rev)'
# pane border
set-option -g pane-border-style fg=white #base2
set-option -g pane-active-border-style fg=brightcyan #base1
# enable mouse click
set -g mouse on
# keep window on
set -g remain-on-exit on
# Longer scrollback history
set -g history-limit 50000
# Scroll position indicator
set -g mode-style bg=colour235,fg=colour245
# SSH agent forwarding
# set-environment -g SSH_AUTH_SOCK $SSH_AUTH_SOCK
if-shell '[ -n $SSH_AUTH_SOCK ]' " \
set-option -sg update-environment \"DISPLAY WINDOWID XAUTHORITY\"; \
setenv -g SSH_AUTH_SOCK /tmp/ssh_auth_sock_tmux; \
run-shell \"ln -sf $(find /tmp/ssh-* -type s -readable | head -n 1) /tmp/ssh_auth_sock_tmux\" \
"
# Drag windows on the status bar
bind-key -n MouseDrag1Status swap-window -t=
EndOfFile
# htop Configurations
mkdir -p $HOME/.config/htop
cat > $HOME/.config/htop/htoprc <<- EndOfFile
# Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly.
fields=0 48 17 18 38 39 40 2 46 47 49 1
sort_key=46
sort_direction=1
hide_threads=0
hide_kernel_threads=1
hide_userland_threads=1
shadow_other_users=0
show_thread_names=0
show_program_path=1
highlight_base_name=0
highlight_megabytes=1
highlight_threads=1
tree_view=0
header_margin=1
detailed_cpu_time=0
cpu_count_from_zero=0
update_process_names=0
account_guest_in_cpu_meter=0
color_scheme=0
delay=15
left_meters=CPU Memory Swap
left_meter_modes=1 1 1
right_meters=Tasks LoadAverage Uptime
right_meter_modes=2 2 2
EndOfFile