-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
index.sh
337 lines (289 loc) · 9.86 KB
/
index.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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
#!/bin/bash
# Function to display a welcome message
info() {
clear
echo "Welcome to Yuna Management Script!"
echo "\n================================"
echo "Yuna is an open source project that aims to create an AI assistant that can help you with your daily tasks."
echo "This script will help you to install the dependencies and models required to run Yuna."
echo "You can read more about Yuna in the documentation in the README.md file."
echo "================================\n"
echo " 1. Go back"
# Read user input
read -p "> " install_choice
case $install_choice in
1) return;;
*) echo "Invalid choice. Please enter a number between 1 and 6.";;
esac
}
# Function to display a goodbye message
goodbye() {
echo "Thank you for using Yuna Management Script. Goodbye!"
}
# Function to start Yuna
start_yuna() {
echo "Starting Yuna..."
python index.py
}
# Function to Dependencies Setup
install_update_dependencies() {
clear
while true; do
echo "========== Installation... =========="
echo "1. CPU"
echo "2. NVIDIA GPU"
echo "3. AMD GPU"
echo "4. Metal"
echo "5. Go back"
read -p "> " install_choice
case $install_choice in
1) install_cpu;;
2) install_nvidia;;
3) install_amd;;
4.) install_metal;;
5) return;;
*) echo "Invalid choice. Please enter a number between 1 and 5.";;
esac
done
}
install_cpu() {
echo "Installing CPU dependencies..."
pip install -r requirements.txt --break-system-packages
echo "CPU dependencies installed."
}
install_nvidia() {
echo "Installing NVIDIA dependencies..."
CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
pip install -r requirements-nvidia.txt --break-system-packages
echo "NVIDIA dependencies installed."
}
install_amd() {
echo "Installing AMD dependencies..."
# YOU NEED TO SPECIFY THE CORRECT GFX NUMBER FOR YOUR GPU
# THE DEFAULT IS GFX1100 - which was used since I have a RX7600
# Check the Shader ISA Instruction Set for your GPU
CMAKE_ARGS="-DLLAMA_HIPBLAS=ON -DCMAKE_C_COMPILER=/opt/rocm/llvm/bin/clang -DCMAKE_CXX_COMPILER=/opt/rocm/llvm/bin/clang++ -DCMAKE_PREFIX_PATH=/opt/rocm -DAMDGPU_TARGETS=gfx1100" FORCE_CMAKE=1 pip install llama-cpp-python
CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
pip install -r requirements-amd.txt --break-system-packages
echo "AMD dependencies installed."
}
install_metal() {
echo "Installing Metal dependencies..."
CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
pip install -r requirements-macos.txt --break-system-packages
echo "Metal dependencies installed."
}
# Submenu for configure()
configure_submenu() {
while true; do
clear
echo "========== Configure Project Menu =========="
echo "1. Install models"
echo "2. Clear models"
echo "3. Dependencies Setup"
echo "4. Info"
echo "5. Go back"
# Read user input
read -p "> " config_choice
# Execute the corresponding function based on user input
case $config_choice in
1) install_models;;
2) clear_models;;
3) install_update_dependencies;;
4) info;;
5) break;; # Go back
*) echo "Invalid choice. Please enter a number between 1 and 5.";;
esac
# Add a newline for better readability
echo
done
}
# Function to install models
install_models() {
clear
echo "========== Install Models Menu =========="
echo " 1. All"
echo " 2. All AGI"
echo " 3. Vision"
echo " 4. Art"
echo " 5. Himitsu"
echo " 6. Talk"
echo " 7. Yuna"
echo " 8. Go back"
echo " 9. Exit"
# Read user input
read -p "Enter your choice (1-6): " install_choice
case $install_choice in
1) install_all_models;;
2) install_all_agi_models;;
3) install_vision_model;;
4) install_art_model;;
5) install_himitsu_model;;
6) install_talk_model;;
7) install_yuna_model;;
8) return;;
9) goodbye; exit;;
*) echo "Invalid choice. Please enter a number between 1 and 6.";;
esac
}
# Function to install all models
install_all_models() {
install_all_agi_models
install_yuna_model
}
# Function to install all AGI models
install_all_agi_models() {
echo "Installing all AGI models..."
install_vision_model
install_art_model
install_himitsu_model
}
# Function to install Vision model
install_vision_model() {
echo "Installing Vision model..."
wget https://huggingface.co/yukiarimo/yuna-ai-vision-v2/resolve/main/yuna-ai-miru-v0.gguf -P lib/utils/models/agi/miru/
wget https://huggingface.co/yukiarimo/yuna-ai-vision-v2/resolve/main/yuna-ai-miru-eye-v0.gguf -P lib/utils/models/agi/miru/
}
# Function to install Art model
install_art_model() {
echo "Installing Art model..."
echo "This is not implemented yet."
# wget https://huggingface.co/yukiarimo/anyloli/resolve/main/any_loli.safetensors -P lib/utils/models/agi/art/
}
# Function to install Himitsu model
install_himitsu_model() {
echo "Installing Himitsu model..."
echo "This is not implemented yet."
}
# Function to install Voice model
install_talk_model() {
echo "Installing Voice model..."
echo "This model can be purchased on the Marketplace or you can use your own"
echo "Enter the Hugging Face model name (e.g., username/model): "
read model_name
echo "Installing Talk Model"
git clone https://huggingface.co/$model_name lib/utils/models/agi/voice
}
# Function to install Yuna model
install_yuna_model() {
echo "Select the version of the Yuna model to install (V1, V2, V3, V3-atomic):"
read -r version
version=$(echo "$version" | tr '[:upper:]' '[:lower:]')
echo "Select the size of the Yuna model to install (Q3_K_M, Q4_K_M, Q5_K_M, Q6_K):"
read -r size
size=$(echo "$size" | tr '[:upper:]' '[:lower:]')
model_url="https://huggingface.co/yukiarimo/yuna-ai-${version}/resolve/main/yuna-ai-${version}-${size}.gguf"
echo "Installing Yuna model from $model_url..."
wget "$model_url" -P lib/utils/models/yuna/
}
# Function to clear models
clear_models() {
clear
echo "========== Clear Models Menu =========="
echo "This will delete all models inside 'lib/utils/models/'."
read -p "Do you want to proceed? (y/n): " confirm_clear
case $confirm_clear in
[Yy])
echo "Clearing models..."
rm -rf lib/utils/models/*
echo "Models cleared."
;;
[Nn])
echo "Operation canceled. No models were cleared."
;;
*)
echo "Invalid choice. Please enter 'y' or 'n'."
;;
esac
}
oneClickInstall() {
install_update_dependencies
install_models
read -p "Do you want to start Yuna? (y/n): " confirm_start
case $confirm_start in
[Yy])
start_yuna
;;
[Nn])
echo "Operation canceled. Everything is installed."
;;
*)
echo "Invalid choice. Please enter 'y' or 'n'."
;;
esac
}
contribute() {
clear
echo "========== Contribute to Yuna =========="
echo "Yuna is an open source project. The following commands will help you to contribute to Yuna."
echo "git fetch origin main\ngit merge main\ngit push origin dev:main\n"
echo "Do you want to proceed? (y/n): " confirm_contribute
case $confirm_contribute in
[Yy])
echo "Contribute to Yuna..."
git fetch origin main
git merge main
git push origin dev:main
echo "Contribute to Yuna done."
;;
[Nn])
echo "Operation canceled. No contribution was made."
;;
*)
echo "Invalid choice. Please enter 'y' or 'n'."
;;
esac
}
donate() {
clear
echo "========== Donate =========="
echo "Yuna is an open source project. You can support the development of Yuna by donating."
echo "1. https://www.patreon.com/YukiArimo"
echo "2. https://ko-fi.com/yukiarimo"
echo "3. https://www.buymeacoffee.com/yukiarimo"
echo "4. Go back"
read -p "Enter your choice (1-4): " donate_choice
case $donate_choice in
1) xdg-open https://www.patreon.com/YukiArimo;;
2) xdg-open https://ko-fi.com/yukiarimo;;
3) xdg-open https://www.buymeacoffee.com/yukiarimo;;
4) return;;
*) echo "Invalid choice. Please enter a number between 1 and 2.";;
esac
}
# Display the main menu
while true; do
clear
echo """
██ ██ ██ ██ ███ ██ ███████ ███████ ██
██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██
████ ██ ██ ██ ██ ██ ███████ ███████ ██
██ ██ ██ ██ ████ ██ ██ ██ ██ ██
██ ████████ ██ ███ ██ ██ ██ ██ ██
"""
echo "========== Main Menu =========="
echo "1. Start Yuna"
echo "2. Dependencies Setup"
echo "3. One click install"
echo "4. Configure Project"
echo "5. Contribute to Yuna"
echo "6. Info"
echo "7. Donate"
echo "8. Exit"
# Read user input
read -p "> " choice
# Execute the corresponding function based on user input
case $choice in
1) start_yuna;;
2) install_update_dependencies;;
3) oneClickInstall;;
4) configure_submenu;;
5) contribute;;
6) info;;
7) donate;;
8) goodbye; exit;;
*) echo "Invalid choice. Please enter a number between 1 and 5.";;
esac
# Add a newline for better readability.
echo
done