ktrain icon indicating copy to clipboard operation
ktrain copied to clipboard

is the last layer using the sigmoid as the activation when finetuning the bert model on multi-label classification task

Open evilying opened this issue 3 years ago • 2 comments

Hi Amaiya,

I wonder in the multi-label classification task, is the last layer attached to the pretrained bert model using the sigmoid as the activation function or still using the softmax?

In my case, the output digits are:

predicted logits: [[  8.6180105   -8.653099    15.520725    -9.309223    -9.79007
  -11.822128    -3.585247    -5.821743    -5.349833    -7.9108334
   -2.4686918   -3.8068502   -3.6860664   -8.801021    -1.6077675
    0.87140864  -6.850979    -7.068022    -2.9192536   -3.168901
   -3.9330673   -3.583586    -4.226935    -3.3518372   -8.752235
   -5.5112743   -5.25448     -8.482615    -4.9307976   -6.7853875
   -5.4349556   -5.409937    -6.0314984   -4.845332    -5.259888
   -6.448127    -6.513096    -6.897139    -6.3175035   -7.0481796
   -6.3868327   -2.7108245   -1.9017457   -3.797255    -3.5854702
   -4.07679     -5.8272357   -6.1985097   -6.958261    -4.171844
   -9.4124155   -4.9816175   -5.338919    -6.343403    -4.7483706
   -5.514663    -3.070589    -2.8744621   -3.003943    -3.9389148
   -2.5850806   -2.9869695   -6.95469     -6.9314804   -4.273396
   -7.2586384   -5.8810987   -6.469306    -3.0809195   -1.9002991
   -7.029113    10.205586   -10.129382    -9.119946    -9.010421
   10.571149    -8.452798    -9.178723    -9.431243   -10.115017
   12.658034    -9.680329    -9.21596    -10.001488    -9.896242
  -11.2481985  -11.568673    -8.899304    12.324983   -10.653635
   -8.062385    -8.184547    12.072872    -8.977213    -9.98401
   -8.634769     7.292563    -7.2002697 ]]

This result indicates the classifier does not use the sigmoid activation function. Do you know how to change the last layer's activation function for finetuning? Thanks!

Best, Kun

evilying avatar Jul 11 '23 00:07 evilying

Hello: Please see this post.

amaiya avatar Jul 11 '23 01:07 amaiya

I see. Thanks!

evilying avatar Jul 11 '23 01:07 evilying