KoichiYasuoka
commited on
Commit
•
67a74d3
1
Parent(s):
000444e
bug fix
Browse files
upos.py
CHANGED
@@ -21,7 +21,7 @@ class BellmanFordTokenClassificationPipeline(TokenClassificationPipeline):
|
|
21 |
z=e/e.sum(axis=-1,keepdims=True)
|
22 |
for i in range(m.shape[0]-1,0,-1):
|
23 |
m[i-1]+=numpy.nanmax(m[i]+self.transition,axis=1)
|
24 |
-
k=[numpy.nanargmax(m[0])]
|
25 |
for i in range(1,m.shape[0]):
|
26 |
k.append(numpy.nanargmax(m[i]+self.transition[k[-1]]))
|
27 |
w=[{"entity":self.model.config.id2label[j],"start":s,"end":e,"score":z[i,j]} for i,((s,e),j) in enumerate(zip(model_outputs["offset_mapping"][0].tolist(),k)) if s<e]
|
|
|
21 |
z=e/e.sum(axis=-1,keepdims=True)
|
22 |
for i in range(m.shape[0]-1,0,-1):
|
23 |
m[i-1]+=numpy.nanmax(m[i]+self.transition,axis=1)
|
24 |
+
k=[numpy.nanargmax(m[0]+self.transition[0])]
|
25 |
for i in range(1,m.shape[0]):
|
26 |
k.append(numpy.nanargmax(m[i]+self.transition[k[-1]]))
|
27 |
w=[{"entity":self.model.config.id2label[j],"start":s,"end":e,"score":z[i,j]} for i,((s,e),j) in enumerate(zip(model_outputs["offset_mapping"][0].tolist(),k)) if s<e]
|