Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -127,22 +127,22 @@ def create_test_data(
repetiton_penalty = torch.ones(num_reqs, device=device, dtype=torch.float32)
for i in range(num_reqs):
if torch.rand(1) > 0.3:
repetiton_penalty[i] = torch.rand(1, device).item() * 0.8 + 0.6
repetiton_penalty[i] = torch.rand(1, device=device).item() * 0.8 + 0.6

frequency_penalty = torch.zeros(num_reqs, device=device, dtype=torch.float32)
for i in range(num_reqs):
if torch.rand(1) > 0.5:
frequency_penalty[i] = torch.rand(1, device).item() * 0.2
frequency_penalty[i] = torch.rand(1, device=device).item() * 0.2

presence_penalty = torch.zeros(num_reqs, device=device, dtype=torch.float32)
for i in range(num_reqs):
if torch.rand(1) > 0.5:
presence_penalty[i] = torch.rand(1, device).item() * 0.2
presence_penalty[i] = torch.rand(1, device=device).item() * 0.2

temperature = torch.ones(num_reqs, device=device, dtype=torch.float32)
for i in range(num_reqs):
if torch.rand(1) > 0.2:
presence_penalty[i] = torch.rand(1, device).item() * 1.8 + 0.2
presence_penalty[i] = torch.rand(1, device=device).item() * 1.8 + 0.2
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

There appears to be a copy-paste error here. This loop is intended to initialize the temperature tensor, but this line is modifying presence_penalty instead. This will result in incorrect test data, with temperature remaining as a tensor of ones and presence_penalty being potentially overwritten.

Suggested change
presence_penalty[i] = torch.rand(1, device=device).item() * 1.8 + 0.2
temperature[i] = torch.rand(1, device=device).item() * 1.8 + 0.2


idx_mapping = torch.randint(0, num_status, (num_reqs,), device=device, dtype=torch.int32)

Expand Down
Loading