Spaces:
Sleeping
Sleeping
pll
Browse files
app.py
CHANGED
@@ -140,7 +140,7 @@ def greet(X, ny):
|
|
140 |
yip = len(l_o_l_sa[0])
|
141 |
# qw = []
|
142 |
er = ""
|
143 |
-
val =
|
144 |
for t in range(num_sub_tokens_label):
|
145 |
sum_state[t] /= yip
|
146 |
idx = torch.topk(sum_state[t], k=5, dim=0)[1]
|
@@ -154,6 +154,7 @@ def greet(X, ny):
|
|
154 |
break
|
155 |
cnt+=1
|
156 |
val = val - torch.log(probs[idx[cnt]])
|
|
|
157 |
|
158 |
# print(er)
|
159 |
# astr = ""
|
@@ -171,7 +172,7 @@ def greet(X, ny):
|
|
171 |
# astr+=mock
|
172 |
# else:
|
173 |
# astr+=mock.capitalize()
|
174 |
-
er = er+" "+str(val)
|
175 |
return er
|
176 |
title = "Rename a variable in a Java class"
|
177 |
description = """This model is a fine-tuned GraphCodeBERT model fine-tuned to output higher-quality variable names for Java classes. Long classes are handled by the
|
|
|
140 |
yip = len(l_o_l_sa[0])
|
141 |
# qw = []
|
142 |
er = ""
|
143 |
+
val = 0.0
|
144 |
for t in range(num_sub_tokens_label):
|
145 |
sum_state[t] /= yip
|
146 |
idx = torch.topk(sum_state[t], k=5, dim=0)[1]
|
|
|
154 |
break
|
155 |
cnt+=1
|
156 |
val = val - torch.log(probs[idx[cnt]])
|
157 |
+
val = val/num_sub_tokens_label
|
158 |
|
159 |
# print(er)
|
160 |
# astr = ""
|
|
|
172 |
# astr+=mock
|
173 |
# else:
|
174 |
# astr+=mock.capitalize()
|
175 |
+
er = er+" (with PLL value of: "+str(val)+")"
|
176 |
return er
|
177 |
title = "Rename a variable in a Java class"
|
178 |
description = """This model is a fine-tuned GraphCodeBERT model fine-tuned to output higher-quality variable names for Java classes. Long classes are handled by the
|