Skip to content

Commit

Permalink
fixed positional port arg
Browse files Browse the repository at this point in the history
  • Loading branch information
LostRuins committed Apr 7, 2023
1 parent 1d48db4 commit f322a58
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions koboldcpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def generate(prompt,max_length=20, max_context_length=512,temperature=0.8,top_k=
maxctx = 2048
maxlen = 128
modelbusy = False
defaultport = 5001

class ServerRequestHandler(http.server.SimpleHTTPRequestHandler):
sys_version = ""
Expand Down Expand Up @@ -344,6 +345,8 @@ def main(args):
except:
print("Could not find Kobold Lite. Embedded Kobold Lite will not be available.")

if args.l_port!=defaultport:
args.port = args.l_port
print(f"Starting Kobold HTTP Server on port {args.port}")
epurl = ""
if args.host=="":
Expand All @@ -359,8 +362,8 @@ def main(args):
parser = argparse.ArgumentParser(description='Kobold llama.cpp server')
parser.add_argument("model_file", help="Model file to load", nargs="?")
portgroup = parser.add_mutually_exclusive_group() #we want to be backwards compatible with the unnamed positional args
portgroup.add_argument("--port", help="Port to listen on", default=5001, type=int)
portgroup.add_argument("port", help="Port to listen on", default=5001, nargs="?", type=int)
portgroup.add_argument("--port", help="Port to listen on", default=defaultport, type=int, action='store')
portgroup.add_argument("l_port", help="Port to listen on (deprecated)", default=defaultport, nargs="?", type=int, action='store')
parser.add_argument("--host", help="Host IP to listen on. If empty, all routable interfaces are accepted.", default="")

# psutil.cpu_count(logical=False)
Expand Down

0 comments on commit f322a58

Please sign in to comment.