Spaces:
Sleeping
Sleeping
Commit
·
13010a8
1
Parent(s):
0e35ac3
Update sample.py
Browse files
sample.py
CHANGED
@@ -3,7 +3,7 @@ import torch.nn.functional as F
|
|
3 |
|
4 |
from utils import limit_past, kl, entropy
|
5 |
|
6 |
-
def sample(model, enc, length, context, temperature=1.0, device='
|
7 |
assert length > 0
|
8 |
|
9 |
context = torch.tensor(context[-1022:], device=device, dtype=torch.long)
|
|
|
3 |
|
4 |
from utils import limit_past, kl, entropy
|
5 |
|
6 |
+
def sample(model, enc, length, context, temperature=1.0, device='cpu', topk=-1):
|
7 |
assert length > 0
|
8 |
|
9 |
context = torch.tensor(context[-1022:], device=device, dtype=torch.long)
|