Skip to content

Commit

Permalink
Use timestamp-based RNG seed (#325)
Browse files Browse the repository at this point in the history
Signed-off-by: Glenn Jocher <[email protected]>
  • Loading branch information
glenn-jocher authored Dec 23, 2024
1 parent 8deeef1 commit eee5bc6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions actions/utils/openai_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Ultralytics Actions 🚀, AGPL-3.0 license https://ultralytics.com/license

import os
import random
import time
from typing import Dict, List

import requests
Expand All @@ -25,7 +25,7 @@ def get_completion(
content = ""
max_retries = 2
for attempt in range(max_retries + 2): # attempt = [0, 1, 2, 3], 2 random retries before asking for no links
data = {"model": OPENAI_MODEL, "messages": messages, "seed": random.randint(1, 1000000)}
data = {"model": OPENAI_MODEL, "messages": messages, "seed": int(time.time() * 1000)}

r = requests.post(url, headers=headers, json=data)
r.raise_for_status()
Expand Down

0 comments on commit eee5bc6

Please sign in to comment.