-
Notifications
You must be signed in to change notification settings - Fork 3
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
0 parents
commit 013e6bd
Showing
46 changed files
with
853 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Build ISO | ||
|
||
on: | ||
push: | ||
branches: main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Cleanup | ||
uses: rokibhasansagar/slimhub_actions@main | ||
with: | ||
retain: "docker_imgcache,docker_buildkit,docker_imgcache" | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Build image | ||
uses: addnab/docker-run-action@v3 | ||
with: | ||
image: archlinux:latest | ||
options: --privileged | ||
run: | | ||
# Refresh package databases | ||
pacman --sync --noconfirm --refresh | ||
# Upgrade system | ||
pacman --sync --noconfirm --sysupgrade | ||
# Install required packages | ||
pacman --sync --noconfirm --needed archiso | ||
# Build image | ||
mkarchiso -v . |
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,19 @@ | ||
[submodule "airootfs/home/tori/automatic"] | ||
path = airootfs/home/tori/automatic | ||
url = https://github.com/vladmandic/automatic.git | ||
|
||
[submodule "airootfs/home/tori/koboldcpp"] | ||
path = airootfs/home/tori/koboldcpp | ||
url = https://github.com/LostRuins/koboldcpp.git | ||
|
||
[submodule "airootfs/home/tori/llama.cpp"] | ||
path = airootfs/home/tori/llama.cpp | ||
url = https://github.com/ggerganov/llama.cpp.git | ||
|
||
[submodule "airootfs/home/tori/SillyTavern-Extras"] | ||
path = airootfs/home/tori/SillyTavern-Extras | ||
url = https://github.com/SillyTavern/SillyTavern-Extras.git | ||
|
||
[submodule "airootfs/home/tori/text-generation-webui"] | ||
path = airootfs/home/tori/text-generation-webui | ||
url = https://github.com/oobabooga/text-generation-webui.git |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 sasha0552 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 @@ | ||
# ToriLinux |
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,3 @@ | ||
root:x:0:root | ||
wheel:x:10:tori | ||
tori:x:1000: |
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,2 @@ | ||
root:!*::root | ||
tori:!*:: |
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 @@ | ||
torilinux |
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,2 @@ | ||
Tori Linux \r (\l) | ||
|
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 @@ | ||
LANG=en_US.UTF-8 |
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 @@ | ||
/usr/share/zoneinfo/UTC |
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,3 @@ | ||
DISTRIB_ID="Tori" | ||
DISTRIB_RELEASE="rolling" | ||
DISTRIB_DESCRIPTION="Tori Linux" |
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 @@ | ||
HOOKS=(base udev modconf kms memdisk archiso archiso_loop_mnt archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs block filesystems keyboard) |
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,8 @@ | ||
# mkinitcpio preset file for the 'linux' package on archiso | ||
|
||
PRESETS=('archiso') | ||
|
||
ALL_kver='/boot/vmlinuz-linux' | ||
archiso_config='/etc/mkinitcpio.conf.d/archiso.conf' | ||
|
||
archiso_image="/boot/initramfs-linux.img" |
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,2 @@ | ||
root:x:0:0:root:/root:/usr/bin/zsh | ||
tori:x:1000:1000::/home/tori:/usr/bin/zsh |
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,2 @@ | ||
root:!*::::::: | ||
tori:!*::::::: |
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,3 @@ | ||
Defaults lecture="never" | ||
|
||
%wheel ALL=(ALL:ALL) ALL |
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,2 @@ | ||
[Journal] | ||
Storage=none |
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,10 @@ | ||
[Match] | ||
# Matching with "Type=ether" causes issues with containers because it also matches virtual Ethernet interfaces (veth*). | ||
# See https://bugs.archlinux.org/task/70892 | ||
# Instead match by globbing the network interface name. | ||
Name=en* | ||
Name=eth* | ||
|
||
[Network] | ||
DHCP=yes | ||
MulticastDNS=yes |
1 change: 1 addition & 0 deletions
1
airootfs/etc/systemd/system/multi-user.target.wants/nvidia-persistenced.service
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 @@ | ||
/usr/lib/systemd/system/nvidia-persistenced.service |
1 change: 1 addition & 0 deletions
1
airootfs/etc/systemd/system/multi-user.target.wants/sshd.service
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 @@ | ||
/usr/lib/systemd/system/sshd.service |
1 change: 1 addition & 0 deletions
1
airootfs/etc/systemd/system/multi-user.target.wants/systemd-networkd.service
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 @@ | ||
/usr/lib/systemd/system/systemd-networkd.service |
Submodule SillyTavern-Extras
added at
47a548
Submodule text-generation-webui
added at
489f4a
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,32 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
# move new os-release to its place | ||
mv /usr/lib/os-release.new /usr/lib/os-release | ||
|
||
# set user password | ||
echo "tori:tori" | chpasswd | ||
|
||
# disable alternate screen capability | ||
echo "termcapinfo * ti=:te=" >> /etc/skel/.screenrc | ||
|
||
# enter user directory | ||
cd "/home/tori" | ||
|
||
# customize_airootfs temporary directory | ||
export CUSTOMIZE_AIROOTFS=/root/customize_airootfs | ||
|
||
# execute scripts | ||
for script in $CUSTOMIZE_AIROOTFS/scripts/*.sh; do | ||
# print current script | ||
echo "===> Executing script $script" | ||
|
||
# add execution permission | ||
chmod +x "$script" | ||
|
||
# launch script as user | ||
su tori -c "$script" | ||
done | ||
|
||
# remove customize_airootfs temporary directory | ||
rm -r "$CUSTOMIZE_AIROOTFS" |
10 changes: 10 additions & 0 deletions
10
airootfs/root/customize_airootfs/files/automatic-config.json
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,10 @@ | ||
{ | ||
"precision": "Full", | ||
"cuda_dtype": "FP32", | ||
"no_half": true, | ||
"no_half_vae": true, | ||
|
||
"cross_attention_options": [ | ||
"SDP disable memory attention" | ||
] | ||
} |
69 changes: 69 additions & 0 deletions
69
airootfs/root/customize_airootfs/patches/0000-automatic-drop-pstate-in-idle.patch
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,69 @@ | ||
--- a/launch.py | ||
+++ b/launch.py | ||
@@ -7,6 +7,7 @@ import shlex | ||
import subprocess | ||
from functools import lru_cache | ||
import installer | ||
+from modules.pstates import enter_pstate_low | ||
|
||
|
||
commandline_args = os.environ.get('COMMANDLINE_ARGS', "") | ||
@@ -165,6 +166,7 @@ def start_server(immediate=True, server=None): | ||
|
||
|
||
if __name__ == "__main__": | ||
+ enter_pstate_low() | ||
installer.ensure_base_requirements() | ||
init_args() # setup argparser and default folders | ||
installer.args = args | ||
diff --git a/modules/pstates.py b/modules/pstates.py | ||
new file mode 100644 | ||
index 00000000..44865a87 | ||
--- /dev/null | ||
+++ b/modules/pstates.py | ||
@@ -0,0 +1,17 @@ | ||
+import os | ||
+import subprocess | ||
+ | ||
+def _set_pstate(pstate): | ||
+ visible_devices = os.getenv("CUDA_VISIBLE_DEVICES") | ||
+ | ||
+ if visible_devices: | ||
+ for device in visible_devices.split(","): | ||
+ subprocess.check_call([ "nvidia-pstate", "-i", device, "-ps", pstate ], stdout=subprocess.DEVNULL) | ||
+ else: | ||
+ subprocess.check_call([ "nvidia-pstate", "-ps", pstate ], stdout=subprocess.DEVNULL) | ||
+ | ||
+def enter_pstate_low(): | ||
+ _set_pstate("8") | ||
+ | ||
+def enter_pstate_high(): | ||
+ _set_pstate("16") | ||
--- a/modules/shared_state.py | ||
+++ b/modules/shared_state.py | ||
@@ -3,6 +3,7 @@ import sys | ||
import time | ||
import datetime | ||
from modules.errors import log | ||
+from modules.pstates import enter_pstate_high, enter_pstate_low | ||
|
||
|
||
class State: | ||
@@ -77,6 +78,8 @@ class State: | ||
self.time_start = time.time() | ||
if self.debug_output: | ||
log.debug(f'State begin: {self.job}') | ||
+ if self.job != "load": | ||
+ enter_pstate_high() | ||
modules.devices.torch_gc() | ||
|
||
def end(self): | ||
@@ -86,6 +89,8 @@ class State: | ||
self.time_start = time.time() | ||
if self.debug_output: | ||
log.debug(f'State end: {self.job} time={time.time() - self.time_start:.2f}') | ||
+ if self.job != "load": | ||
+ enter_pstate_low() | ||
self.job = "" | ||
self.job_count = 0 | ||
self.job_no = 0 |
54 changes: 54 additions & 0 deletions
54
airootfs/root/customize_airootfs/patches/0000-koboldcpp-drop-pstate-in-idle.patch
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,54 @@ | ||
--- a/koboldcpp.py | ||
+++ b/koboldcpp.py | ||
@@ -13,6 +13,7 @@ import os | ||
import argparse | ||
import json, sys, http.server, time, asyncio, socket, threading | ||
from concurrent.futures import ThreadPoolExecutor | ||
+from pstates import enter_pstate_high, enter_pstate_low | ||
|
||
sampler_order_max = 7 | ||
stop_token_max = 16 | ||
@@ -301,6 +302,7 @@ def load_model(model_filename): | ||
return ret | ||
|
||
def generate(prompt, memory="", max_length=32, max_context_length=512, temperature=0.7, top_k=100, top_a=0.0, top_p=0.92, min_p=0.0, typical_p=1.0, tfs=1.0, rep_pen=1.1, rep_pen_range=128, mirostat=0, mirostat_tau=5.0, mirostat_eta=0.1, sampler_order=[6,0,1,3,4,2,5], seed=-1, stop_sequence=[], use_default_badwordsids=False, stream_sse=False, grammar='', grammar_retain_state=False, genkey='', trimstop=False, quiet=False): | ||
+ enter_pstate_high() | ||
global maxctx, args, currentusergenkey, totalgens | ||
inputs = generation_inputs() | ||
outputs = ctypes.create_unicode_buffer(ctypes.sizeof(generation_outputs)) | ||
@@ -364,6 +366,7 @@ def generate(prompt, memory="", max_length=32, max_context_length=512, temperatu | ||
sindex = outstr.find(trim_str) | ||
if sindex != -1 and trim_str!="": | ||
outstr = outstr[:sindex] | ||
+ enter_pstate_low() | ||
return outstr | ||
|
||
def utfprint(str): | ||
@@ -2031,6 +2034,7 @@ def sanitize_string(input_string): | ||
return sanitized_string | ||
|
||
def main(launch_args,start_server=True): | ||
+ enter_pstate_low() | ||
global args, friendlymodelname | ||
args = launch_args | ||
embedded_kailite = None | ||
--- /dev/null | ||
+++ b/pstates.py | ||
@@ -0,0 +1,17 @@ | ||
+import os | ||
+import subprocess | ||
+ | ||
+def _set_pstate(pstate): | ||
+ visible_devices = os.getenv("CUDA_VISIBLE_DEVICES") | ||
+ | ||
+ if visible_devices: | ||
+ for device in visible_devices.split(","): | ||
+ subprocess.check_call([ "nvidia-pstate", "-i", device, "-ps", pstate ], stdout=subprocess.DEVNULL) | ||
+ else: | ||
+ subprocess.check_call([ "nvidia-pstate", "-ps", pstate ], stdout=subprocess.DEVNULL) | ||
+ | ||
+def enter_pstate_low(): | ||
+ _set_pstate("8") | ||
+ | ||
+def enter_pstate_high(): | ||
+ _set_pstate("16") |
Oops, something went wrong.