mirror of
https://github.com/KoboldAI/KoboldAI-Client.git
synced 2025-06-05 21:59:24 +02:00
Merge branch 'united' into patch
This commit is contained in:
13
aiserver.py
13
aiserver.py
@@ -68,8 +68,8 @@ modellist = [
|
|||||||
["Lit 6B (NSFW)", "hakurei/lit-6B", "12GB"],
|
["Lit 6B (NSFW)", "hakurei/lit-6B", "12GB"],
|
||||||
["C1 6B (Chatbot)", "hakurei/c1-6B", "12GB"],
|
["C1 6B (Chatbot)", "hakurei/c1-6B", "12GB"],
|
||||||
["Picard 2.7B (Novel)", "KoboldAI/GPT-Neo-2.7B-Picard", "6GB"],
|
["Picard 2.7B (Novel)", "KoboldAI/GPT-Neo-2.7B-Picard", "6GB"],
|
||||||
["Horni (NSFW)", "KoboldAI/GPT-Neo-2.7B-Horni", "6GB"],
|
["Horni 2.7B (NSFW)", "KoboldAI/GPT-Neo-2.7B-Horni", "6GB"],
|
||||||
["Horni-LN (Novel/NSFW)", "KoboldAI/GPT-Neo-2.7B-Horni-LN", "6GB"],
|
["Horni-LN 2.7B (Novel/NSFW)", "KoboldAI/GPT-Neo-2.7B-Horni-LN", "6GB"],
|
||||||
["Shinen 2.7B (NSFW)", "KoboldAI/GPT-Neo-2.7B-Shinen", "6GB"],
|
["Shinen 2.7B (NSFW)", "KoboldAI/GPT-Neo-2.7B-Shinen", "6GB"],
|
||||||
["GPT-J 6B", "EleutherAI/gpt-j-6B", "12GB"],
|
["GPT-J 6B", "EleutherAI/gpt-j-6B", "12GB"],
|
||||||
["GPT-Neo 2.7B", "EleutherAI/gpt-neo-2.7B", "6GB"],
|
["GPT-Neo 2.7B", "EleutherAI/gpt-neo-2.7B", "6GB"],
|
||||||
@@ -80,7 +80,7 @@ modellist = [
|
|||||||
["GPT-2", "gpt2", "1GB"],
|
["GPT-2", "gpt2", "1GB"],
|
||||||
["OpenAI API (requires API key)", "OAI", ""],
|
["OpenAI API (requires API key)", "OAI", ""],
|
||||||
["InferKit API (requires API key)", "InferKit", ""],
|
["InferKit API (requires API key)", "InferKit", ""],
|
||||||
["Google Colab", "Colab", ""],
|
["KoboldAI Server API (Old Google Colab)", "Colab", ""],
|
||||||
["Read Only (No AI)", "ReadOnly", ""]
|
["Read Only (No AI)", "ReadOnly", ""]
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -616,7 +616,8 @@ if(vars.model == "OAI"):
|
|||||||
# Ask for ngrok url if Google Colab was selected
|
# Ask for ngrok url if Google Colab was selected
|
||||||
if(vars.model == "Colab"):
|
if(vars.model == "Colab"):
|
||||||
if(vars.colaburl == ""):
|
if(vars.colaburl == ""):
|
||||||
print("{0}Please enter the ngrok.io or trycloudflare.com URL displayed in Google Colab:{1}\n".format(colors.CYAN, colors.END))
|
print("{0}NOTE: For the modern KoboldAI Colab's you open the links directly in your browser.\nThis option is only for the KoboldAI Server API, not all features are supported in this mode.\n".format(colors.YELLOW, colors.END))
|
||||||
|
print("{0}Enter the URL of the server (For example a trycloudflare link):{1}\n".format(colors.CYAN, colors.END))
|
||||||
vars.colaburl = input("URL> ") + "/request"
|
vars.colaburl = input("URL> ") + "/request"
|
||||||
|
|
||||||
if(vars.model == "ReadOnly"):
|
if(vars.model == "ReadOnly"):
|
||||||
@@ -1719,7 +1720,7 @@ def get_message(msg):
|
|||||||
raise ValueError("Chatname must be a string")
|
raise ValueError("Chatname must be a string")
|
||||||
vars.chatname = msg['chatname']
|
vars.chatname = msg['chatname']
|
||||||
settingschanged()
|
settingschanged()
|
||||||
emit('from_server', {'cmd': 'setchatname', 'data': vars.chatname}, broadcast=True)
|
emit('from_server', {'cmd': 'setchatname', 'data': vars.chatname})
|
||||||
vars.recentrng = vars.recentrngm = None
|
vars.recentrng = vars.recentrngm = None
|
||||||
actionsubmit(msg['data'], actionmode=msg['actionmode'])
|
actionsubmit(msg['data'], actionmode=msg['actionmode'])
|
||||||
elif(vars.mode == "edit"):
|
elif(vars.mode == "edit"):
|
||||||
@@ -1738,7 +1739,7 @@ def get_message(msg):
|
|||||||
raise ValueError("Chatname must be a string")
|
raise ValueError("Chatname must be a string")
|
||||||
vars.chatname = msg['chatname']
|
vars.chatname = msg['chatname']
|
||||||
settingschanged()
|
settingschanged()
|
||||||
emit('from_server', {'cmd': 'setchatname', 'data': vars.chatname}, broadcast=True)
|
emit('from_server', {'cmd': 'setchatname', 'data': vars.chatname})
|
||||||
actionretry(msg['data'])
|
actionretry(msg['data'])
|
||||||
# Back/Undo Action
|
# Back/Undo Action
|
||||||
elif(msg['cmd'] == 'back'):
|
elif(msg['cmd'] == 'back'):
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
# KoboldAI Easy Deployment Script by Henk717
|
# KoboldAI Easy Deployment Script by Henk717
|
||||||
|
|
||||||
# read the options
|
# read the options
|
||||||
TEMP=`getopt -o m:i:p:c:d:a:l:z:g:t:n: --long model:,init:,path:,configname:,download:,aria2:,dloc:7z:git:tar:ngrok: -- "$@"`
|
TEMP=`getopt -o m:i:p:c:d:x:a:l:z:g:t:n: --long model:,init:,path:,configname:,download:,aria2:,dloc:xloc:7z:git:tar:ngrok: -- "$@"`
|
||||||
eval set -- "$TEMP"
|
eval set -- "$TEMP"
|
||||||
|
|
||||||
# extract options and their arguments into variables.
|
# extract options and their arguments into variables.
|
||||||
@@ -13,7 +13,7 @@ while true ; do
|
|||||||
-i|--init)
|
-i|--init)
|
||||||
init=$2 ; shift 2 ;;
|
init=$2 ; shift 2 ;;
|
||||||
-p|--path)
|
-p|--path)
|
||||||
path=" --path /content/$2" ; shift 2 ;;
|
mpath="$2" ; shift 2 ;;
|
||||||
-c|--configname)
|
-c|--configname)
|
||||||
configname=" --configname $2" ; shift 2 ;;
|
configname=" --configname $2" ; shift 2 ;;
|
||||||
-n|--ngrok)
|
-n|--ngrok)
|
||||||
@@ -24,6 +24,8 @@ while true ; do
|
|||||||
aria2="$2" ; shift 2 ;;
|
aria2="$2" ; shift 2 ;;
|
||||||
-l|--dloc)
|
-l|--dloc)
|
||||||
dloc="$2" ; shift 2 ;;
|
dloc="$2" ; shift 2 ;;
|
||||||
|
-x|--xloc)
|
||||||
|
xloc="$2" ; shift 2 ;;
|
||||||
-z|--7z)
|
-z|--7z)
|
||||||
z7="$2" ; shift 2 ;;
|
z7="$2" ; shift 2 ;;
|
||||||
-t|--tar)
|
-t|--tar)
|
||||||
@@ -44,7 +46,8 @@ function launch
|
|||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
cd /content/KoboldAI-Client
|
cd /content/KoboldAI-Client
|
||||||
python3 aiserver.py$model$path$configname$ngrok --remote --override_delete --override_rename
|
echo "Launching KoboldAI with the following options : python3 aiserver.py$model$kmpath$configname$ngrok --remote --override_delete --override_rename"
|
||||||
|
python3 aiserver.py$model$kmpath$configname$ngrok --remote --override_delete --override_rename
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -64,6 +67,20 @@ else
|
|||||||
dloc="/content/drive/MyDrive/KoboldAI/models"
|
dloc="/content/drive/MyDrive/KoboldAI/models"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Redefine the extraction location
|
||||||
|
if [ "$xloc" == "drive" ]; then
|
||||||
|
xloc="/content/drive/MyDrive/KoboldAI/models/"
|
||||||
|
dloc="/content"
|
||||||
|
else
|
||||||
|
xloc="/content/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Redefine the Path to be in the relevant location
|
||||||
|
if [[ -v mpath ]];then
|
||||||
|
mpath="$xloc$mpath"
|
||||||
|
kmpath=" --path $mpath"
|
||||||
|
fi
|
||||||
|
|
||||||
# Create Folder Structure and Install KoboldAI
|
# Create Folder Structure and Install KoboldAI
|
||||||
if [ "$init" != "skip" ]; then
|
if [ "$init" != "skip" ]; then
|
||||||
if [ -f "/content/installed" ]; then
|
if [ -f "/content/installed" ]; then
|
||||||
@@ -122,6 +139,12 @@ if [ -f "/content/extracted" ]; then
|
|||||||
launch
|
launch
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Is the model extracted on Google Drive? Skip the download and extraction
|
||||||
|
# Only on Google Drive since it has a big impact there if we don't, and locally we have better checks in place
|
||||||
|
if [ "$xloc" == "/content/drive/MyDrive/KoboldAI/models/" ] && [[ -d $mpath ]];then
|
||||||
|
launch
|
||||||
|
fi
|
||||||
|
|
||||||
#Download routine for regular Downloads
|
#Download routine for regular Downloads
|
||||||
if [ ! -z ${download+x} ]; then
|
if [ ! -z ${download+x} ]; then
|
||||||
wget -c $download -P $dloc
|
wget -c $download -P $dloc
|
||||||
@@ -135,7 +158,7 @@ fi
|
|||||||
|
|
||||||
#Extract the model with 7z
|
#Extract the model with 7z
|
||||||
if [ ! -z ${z7+x} ]; then
|
if [ ! -z ${z7+x} ]; then
|
||||||
7z x -o/content/ -aos $dloc/$z7
|
7z x -o$xloc $dloc/$z7 -aos
|
||||||
touch /content/extracted
|
touch /content/extracted
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -148,7 +171,7 @@ if [ ! -z ${tar+x} ]; then
|
|||||||
make install
|
make install
|
||||||
cd ..
|
cd ..
|
||||||
apt install zstd -y
|
apt install zstd -y
|
||||||
pv $dloc/$tar | tar -I zstd -C /content/ -x
|
pv $dloc/$tar | tar -I zstd -C $xloc -x
|
||||||
touch /content/extracted
|
touch /content/extracted
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user