Update README.md
Browse files
README.md
CHANGED
|
@@ -79,7 +79,7 @@ sequence = "<|endoftext|>MGEAMGLTQPAVSRAVARLEERVGIRIFNRTARAITLTDEGRRFYEAVAPLLAGI
|
|
| 79 |
|
| 80 |
# ppl function
|
| 81 |
def calculatePerplexity(sequence, model, tokenizer):
|
| 82 |
-
input_ids = torch.tensor(tokenizer.encode(
|
| 83 |
input_ids = input_ids.to(device)
|
| 84 |
with torch.no_grad():
|
| 85 |
outputs = model(input_ids, labels=input_ids)
|
|
|
|
| 79 |
|
| 80 |
# ppl function
|
| 81 |
def calculatePerplexity(sequence, model, tokenizer):
|
| 82 |
+
input_ids = torch.tensor(tokenizer.encode(sequence)).unsqueeze(0)
|
| 83 |
input_ids = input_ids.to(device)
|
| 84 |
with torch.no_grad():
|
| 85 |
outputs = model(input_ids, labels=input_ids)
|