Spaces:
Running
on
Zero
Running
on
Zero
wondervictor
commited on
Update autoregressive/models/generate.py
Browse files
autoregressive/models/generate.py
CHANGED
@@ -90,9 +90,10 @@ def logits_to_probs(logits, temperature: float = 1.0, top_p: float=1.0, top_k: i
|
|
90 |
|
91 |
def prefill(model, cond_idx: torch.Tensor, input_pos: torch.Tensor, cfg_scale: float, condition:torch.Tensor, **sampling_kwargs):
|
92 |
if cfg_scale > 1.0:
|
|
|
|
|
|
|
93 |
logits, _ = model(None, cond_idx, input_pos, condition=condition)
|
94 |
-
print(logits.sum())
|
95 |
-
print(logits)
|
96 |
logits_combined = logits
|
97 |
cond_logits, uncond_logits = torch.split(logits_combined, len(logits_combined) // 2, dim=0)
|
98 |
logits = uncond_logits + (cond_logits - uncond_logits) * cfg_scale
|
|
|
90 |
|
91 |
def prefill(model, cond_idx: torch.Tensor, input_pos: torch.Tensor, cfg_scale: float, condition:torch.Tensor, **sampling_kwargs):
|
92 |
if cfg_scale > 1.0:
|
93 |
+
print(cond_idx)
|
94 |
+
print(input_pos)
|
95 |
+
print(condition)
|
96 |
logits, _ = model(None, cond_idx, input_pos, condition=condition)
|
|
|
|
|
97 |
logits_combined = logits
|
98 |
cond_logits, uncond_logits = torch.split(logits_combined, len(logits_combined) // 2, dim=0)
|
99 |
logits = uncond_logits + (cond_logits - uncond_logits) * cfg_scale
|