transformers icon indicating copy to clipboard operation
transformers copied to clipboard

Why the output is same within a batch use BertForSequenceClassification?

Open 201101050424 opened this issue 7 years ago • 2 comments

❓ Questions & Help

I use BertForSequenceClassification for classification task, but the output witin a batch became same after just 2 or 3 batch, the value between different batch is different, really strange. batch 1 output: [-0.5966, 0.6081], [-0.4659, 0.3766], [-0.3595, 0.1334], [-0.4178, 0.6873], [-0.3884, 0.2640], [-0.5017, 0.3465], [-0.5978, 0.4961], [-0.3146, 0.6879], [-0.6525, 0.2702], [-0.2500, 0.1232], [-0.3137, 0.4212], [-0.2663, 0.5169], [-0.5225, 0.7992], [-0.4844, 0.1942], [-0.1459, 0.4033], [-0.9007, 0.5122], [-0.5833, 0.8187], [-0.5552, 0.1253], [-0.5420, -0.1123]], device='cuda:0', grad_fn=)) 2: (tensor(1.2256, device='cuda:0', grad_fn=), tensor([[ 0.7105, -0.8978], [ 0.7925, -0.9382], [ 0.6098, -0.9100], [ 0.7522, -0.9534], [ 0.7706, -0.9142], [ 0.7778, -0.9246], [ 0.7703, -0.8327], [ 0.5850, -0.8817], [ 0.6266, -0.9271], [ 0.8061, -0.8157], [ 0.8036, -0.9927], [ 0.7619, -0.9277], [ 0.7773, -0.7931], [ 0.8458, -0.8186], [ 0.6291, -0.8925], [ 0.5919, -0.8709], [ 0.6222, -0.9173], [ 0.8290, -0.9817], [ 0.7155, -0.9171], [ 0.8107, -0.9364]], device='cuda:0', grad_fn=))

3 (tensor(0.7688, device='cuda:0', grad_fn=), tensor([[-0.7892, 0.5464], [-0.7873, 0.5431], [-0.7914, 0.5424], [-0.7938, 0.5448], [-0.7934, 0.5449], [-0.7876, 0.5430], [-0.7973, 0.5446], [-0.7905, 0.5430], [-0.7924, 0.5451], [-0.7900, 0.5438], [-0.7879, 0.5449], [-0.7869, 0.5408], [-0.7924, 0.5458], [-0.7928, 0.5436], [-0.7954, 0.5469], [-0.7900, 0.5429], [-0.7945, 0.5453], [-0.8027, 0.5492], [-0.7937, 0.5437], [-0.7934, 0.5506]], device='cuda:0', grad_fn=))

(tensor(1.1733, device='cuda:0', grad_fn=), tensor([[ 1.3647, -0.3074], [ 1.3588, -0.2927], [ 1.3581, -0.2915], [ 1.3628, -0.3009], [ 1.3625, -0.3001], [ 1.3630, -0.3016], [ 1.3666, -0.3157], [ 1.3604, -0.2953], [ 1.3655, -0.3108], [ 1.3604, -0.2942], [ 1.3623, -0.3041], [ 1.3555, -0.2866], [ 1.3600, -0.2943], [ 1.3654, -0.3091], [ 1.3628, -0.3004], [ 1.3658, -0.3080], [ 1.3643, -0.3041], [ 1.3599, -0.2967], [ 1.3629, -0.3024], [ 1.3688, -0.3206]], device='cuda:0', grad_fn=))

201101050424 avatar Oct 20 '19 07:10 201101050424

Hello, could you provide a script so that we may better understand the problem here?

LysandreJik avatar Oct 22 '19 17:10 LysandreJik

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 21 '19 17:12 stale[bot]