Commit ·
bcca52c
1
Parent(s): c9ad1bf
Update app.py
Browse files17 unmodified lines1819202121222324252617 unmodified lines attention_mask = inputs["attention_mask"].to(device) model.to(device) token_logits = model(input_ids, attention_mask=attention_mask).logits print(mask_token_index) print(token_logits ) mask_token_index = torch.where(inputs["input_ids"] == tokenizer.mask_token_id)[1] print(mask_token_index) mask_token_logits = token_logits[0, mask_token_index, :] print(mask_token_logits) top_5_tokens = torch.topk(mask_token_logits, NUM_CLASSES, dim=1).indices[0].tolist()app.py+2-1