Spaces:
Running
on
Zero
Running
on
Zero
Use autocast to float16
Browse files
app.py
CHANGED
@@ -77,7 +77,8 @@ def confidence_guided_noising(input_ids, answer_start, confidences, noise_clippi
|
|
77 |
def generate_diffusion_text(input_ids, top_p, top_k):
|
78 |
with torch.no_grad():
|
79 |
input_tensor = torch.tensor([input_ids], dtype=torch.long).to(model.device)
|
80 |
-
|
|
|
81 |
logits = filter_logits(logits, top_k=top_p, top_p=top_k)
|
82 |
logits = logits.clamp(min=-1e8, max=1e4)
|
83 |
probs = torch.nn.functional.softmax(logits, dim=-1)[0]
|
|
|
77 |
def generate_diffusion_text(input_ids, top_p, top_k):
|
78 |
with torch.no_grad():
|
79 |
input_tensor = torch.tensor([input_ids], dtype=torch.long).to(model.device)
|
80 |
+
with torch.amp.autocast('cuda', dtype=torch.float16):
|
81 |
+
logits = model(input_ids=input_tensor)["logits"]
|
82 |
logits = filter_logits(logits, top_k=top_p, top_p=top_k)
|
83 |
logits = logits.clamp(min=-1e8, max=1e4)
|
84 |
probs = torch.nn.functional.softmax(logits, dim=-1)[0]
|