Handling more exceptions; Fix hyperparameter passing

This commit is contained in:
Timothyxxx
2024-05-20 17:22:07 +08:00
parent f9594e476e
commit 5568dfd141
2 changed files with 6 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ import openai
from groq import Groq
import requests
from requests.exceptions import SSLError
import tiktoken
from PIL import Image
from google.api_core.exceptions import InvalidArgument, ResourceExhausted, InternalServerError, BadRequest
@@ -519,6 +520,9 @@ class PromptAgent:
# but you are forbidden to add "Exception", that is, a common type of exception
# because we want to catch this kind of Exception in the outside to ensure each example won't exceed the time limit
(
# General exceptions
SSLError,
# OpenAI exceptions
openai.RateLimitError,
openai.BadRequestError,

2
run.py
View File

@@ -132,6 +132,8 @@ def test(
agent = PromptAgent(
model=args.model,
max_tokens=args.max_tokens,
top_p=args.top_p,
temperature=args.temperature,
action_space=args.action_space,
observation_type=args.observation_type,
max_trajectory_length=args.max_trajectory_length,