# Roberta giving same output during evaluation

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Froberta-giving-same-output-during-evaluation%2F13301%3E%5C
**Category:** 🤗Transformers\
**Created:** [January 2, 2022, 3:19pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Froberta-giving-same-output-during-evaluation%2F13301 "2022-01-02T15:19:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chetan06](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Chetan06](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FChetan06)%5C
**Post date:** [January 2, 2022, 3:19pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Froberta-giving-same-output-during-evaluation%2F13301%2F1 "2022-01-02T15:19:37Z")

</div>

I am using roberta from transformers library. I have trained the model for the classification task and taken the `model.pooler_output` and passed it to a classifier. While predicting I am getting same prediction for all the inputs. What could be the possible reason

This is my model

```python
class Roberta_Arch(nn.Module):
    def __init__ (self, roberta): 
        super(Roberta_Arch, self). __init__ ()
        self.roberta = roberta
        self.classifier = nn.Sequential(
            nn.Linear(768, 256), 
            nn.ReLU(),
            nn.Dropout(0.15),
            nn.Linear(256, 2),
            nn.LogSoftmax(dim = 1)
        )

    def forward(self, sent_id, mask):
        output = self.roberta(sent_id, attention_mask=mask)
        return self.classifier(output.pooler_output)

```

And this is my evaluation function

```python
def evaluate():
    print('\n\n Predicting \n')
    model.eval()
    total_preds = []

    for step, batch in tqdm(enumerate(test_dataloader)):
        batch = [t.to(device) for t in batch]
        sent_id, mask = batch

        with torch.no_grad():
            preds = model(sent_id, mask)
            preds = preds.detach().cpu().numpy()
            print(preds)
            total_preds.append(preds)

    return total_preds

```
