Skip to content

distilbert tensor size issue . #175

Description

@sahlebrahim
for epoch in range(NUM_EPOCHS):
    
    model.train()
    
    for batch_idx, batch in enumerate(train_loader):
        
        ### Prepare data
        input_ids = batch['input_ids'].to(DEVICE)
        attention_mask = batch['attention_mask'].to(DEVICE)
        labels = batch['labels'].to(DEVICE)

        ### Forward
        outputs = model(input_ids, attention_mask=attention_mask, labels=labels) **
        loss, logits = outputs['loss'], outputs['logits']

this is returning error :

RuntimeError: The size of tensor a (3157) must match the size of tensor b (512) at non-singleton dimension 1

i did everything just like the book says

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions