Show author and SP length in soft prompt menu

This commit is contained in:
Gnome Ann 2022-01-18 16:30:09 -05:00
parent 1e2dbd42a6
commit 1951ccd2ce
5 changed files with 15 additions and 9 deletions

View File

@ -4156,7 +4156,8 @@ def spRequest(filename):
tensor = np.float32(tensor)
assert not np.isinf(tensor).any() and not np.isnan(tensor).any()
vars.sp_length = tensor.shape[0]
vars.sp_length = tensor.shape[-2]
vars.spmeta["n_tokens"] = vars.sp_length
if(vars.model in ("TPUMeshTransformerGPTJ",)):
rows = tensor.shape[0]

View File

@ -161,6 +161,7 @@ def getspfiles(model_dimension: int):
ob = {}
z.close()
ob["filename"] = file
ob["n_tokens"] = shape[-2]
lst.append(ob)
return lst

View File

@ -972,11 +972,14 @@ function buildSPList(ar) {
showSPPopup();
ar.push({filename: '', name: "[None]"})
for(var i = 0; i < ar.length; i++) {
var supported = !ar[i].supported
var author = !ar[i].author
? ''
: Object.prototype.toString.call(ar[i].supported) === "[object Array]"
? "[" + ar[i].supported.join(', ') + "]"
: "[" + ar[i].supported.toString() + "]";
: ar[i].author.constructor === Array
? ar[i].author.join(', ')
: ar[i].author;
var n_tokens = !ar[i].n_tokens || !Number.isSafeInteger(ar[i].n_tokens) || ar[i].n_tokens < 1
? ''
: "(" + ar[i].n_tokens + " tokens)";
var filename = ar[i].filename.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;').replace(/(?=\r|\n)\r?\n?/g, '<br/>');
var name = ar[i].name || ar[i].filename;
name = name.length > 120 ? name.slice(0, 117) + '...' : name;
@ -992,7 +995,7 @@ function buildSPList(ar) {
</div>\
<div class=\"flex-row\">\
<div>"+desc+"</div>\
<div class=\"flex-push-right splistitemsub\">"+supported+"</div>\
<div class=\"flex-push-right splistitemsub\">" + author + "<br/>" + n_tokens + "</div>\
</div>\
</div>\
</div>");
@ -1108,7 +1111,7 @@ function updateSPStatItems(items) {
stat_sp.closest(".statusicon").removeClass("active");
stat_spactive.html("");
} else {
stat_sp.html("Active soft prompt:");
stat_sp.html("Active soft prompt (" + items[key].n_tokens + " tokens):");
stat_sp.closest(".statusicon").addClass("active");
stat_spactive.html((items[key].name || key)+" &lt;"+key+"&gt;");
}

View File

@ -1312,6 +1312,7 @@ body.connected .popupfooter, .popupfooter.always-available {
.splistitemsub {
color: #ba9;
text-align: right;
}
.splistitem:hover {

View File

@ -9,7 +9,7 @@
<link rel="stylesheet" href="static/bootstrap.min.css">
<link rel="stylesheet" href="static/bootstrap-toggle.min.css">
<link rel="stylesheet" href="static/open-iconic-bootstrap.min.css">
<link rel="stylesheet" href="static/custom.css?ver=1.16.4n">
<link rel="stylesheet" href="static/custom.css?ver=1.16.4o">
<script src="static/jquery-3.6.0.min.js"></script>
<script src="static/jquery-ui.sortable.min.js"></script>
@ -17,7 +17,7 @@
<script src="static/bootstrap.min.js"></script>
<script src="static/bootstrap-toggle.min.js"></script>
<script src="static/rangy-core.min.js"></script>
<script src="static/application.js?ver=1.16.4aa"></script>
<script src="static/application.js?ver=1.16.4ab"></script>
</head>
<body>
<input type="file" id="remote-save-select" accept="application/json" style="display:none">