Skip to content

Commit

Permalink
Fix display name for sharded model file
Browse files Browse the repository at this point in the history
  • Loading branch information
turboderp committed Sep 9, 2023
1 parent 766e582 commit 85b009c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion webui/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,16 @@ def api_populate(self):

# Add model info

model_str = os.path.splitext(os.path.basename(model.config.model_path))[0] + "\n"
def _common_chars(names):
cname = max(names, key=len)
for x in names:
for p, c in enumerate(x):
if c != cname[p] and cname[p] != "*": cname = cname[:p] + "*" + cname[p + 1:]
return cname

mp = model.config.model_path if isinstance(model.config.model_path, str) else _common_chars(model.config.model_path)

model_str = os.path.splitext(os.path.basename(mp))[0] + "\n"
model_str += f"Sequence length: {model.config.max_seq_len}\n"

dic["model_info"] = model_str.strip()
Expand Down

0 comments on commit 85b009c

Please sign in to comment.