Spaces:
Running on L40S
Running on L40S
root commited on
Commit ·
fe9d2df
1
Parent(s): 0bd0227
compatible with L40
Browse files
vllm_hacked/v1/sample/sampler.py
CHANGED
|
@@ -223,18 +223,16 @@ class Sampler(nn.Module):
|
|
| 223 |
|
| 224 |
assert sampling_metadata.temperature is not None
|
| 225 |
|
|
|
|
| 226 |
# Apply temperature.
|
| 227 |
logits = self.apply_temperature(logits, sampling_metadata.temperature,
|
| 228 |
sampling_metadata.all_random)
|
| 229 |
|
| 230 |
-
# patch
|
| 231 |
-
print("logits.shape:", logits.shape)
|
| 232 |
if logits.dim() == 1:
|
| 233 |
logits = logits.unsqueeze(0)
|
| 234 |
-
# 如果 batch 对不上(比如 logits 变 [1, 4194560] 这种平铺形状)
|
| 235 |
if logits.size(0) != sampling_metadata.top_k.size(0):
|
| 236 |
-
|
| 237 |
-
logits = logits.
|
| 238 |
|
| 239 |
# Apply logits processors that only apply to random sampling
|
| 240 |
# (argmax invariant)
|
|
|
|
| 223 |
|
| 224 |
assert sampling_metadata.temperature is not None
|
| 225 |
|
| 226 |
+
print("logits.shape:", logits.shape)
|
| 227 |
# Apply temperature.
|
| 228 |
logits = self.apply_temperature(logits, sampling_metadata.temperature,
|
| 229 |
sampling_metadata.all_random)
|
| 230 |
|
|
|
|
|
|
|
| 231 |
if logits.dim() == 1:
|
| 232 |
logits = logits.unsqueeze(0)
|
|
|
|
| 233 |
if logits.size(0) != sampling_metadata.top_k.size(0):
|
| 234 |
+
target_batch = sampling_metadata.top_k.size(0)
|
| 235 |
+
logits = logits.expand(target_batch, -1).contiguous()
|
| 236 |
|
| 237 |
# Apply logits processors that only apply to random sampling
|
| 238 |
# (argmax invariant)
|