Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use last path component for unnamed ggufs #1281

Open
wants to merge 2 commits into
base: concedo_experimental
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions koboldcpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4496,6 +4496,17 @@ def main(launch_args,start_server=True):
# sanitize and replace the default vanity name. remember me....
if args.model_param and args.model_param!="":
newmdldisplayname = os.path.basename(args.model_param)
if (
len(newmdldisplayname) < 25
and args.model_param.count("/") > 1
and newmdldisplayname.startswith("ggml-model-")
and newmdldisplayname.endswith(".gguf")
):
# if there are .safetensors files in the same dir, we can safely assume this is a model dir
# and the last path component is the model name
if any(p.endswith(".safetensors") for p in os.listdir(os.path.dirname(args.model_param))):
# use the last path as model name, and stack on the quant info
newmdldisplayname = args.model_param.rsplit("/", 2)[1] + newmdldisplayname[10:]
newmdldisplayname = os.path.splitext(newmdldisplayname)[0]
friendlymodelname = "koboldcpp/" + sanitize_string(newmdldisplayname)

Expand Down