Skip to content

Commit

Permalink
more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
aspfohl committed Nov 28, 2023
1 parent 6498aa4 commit f0badd5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions scripts/inference/endpoint_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ async def main(args: Namespace) -> None:
raise ValueError(
f'URL must be provided via --endpoint or {ENDPOINT_URL_ENV}')

log.info(f'Using endpoint {url}')

# Load prompts
prompt_strings = []
for prompt in args.prompts:
Expand All @@ -134,10 +136,10 @@ async def generate(session: aiohttp.ClientSession, batch: int,
prompts: list):
data = copy.copy(param_data)
data['prompt'] = prompts
headers = {
"Authorization": os.environ.get(ENDPOINT_API_KEY_ENV),
"Content-Type": "application/json"
}
api_key = os.environ.get(ENDPOINT_API_KEY_ENV, '')
if not api_key:
log.warn('API key not set in {ENDPOINT_API_KEY_ENV}')
headers = {"Authorization": api_key, "Content-Type": "application/json"}

req_start = time.time()
async with session.post(url, headers=headers, json=data) as resp:
Expand Down

0 comments on commit f0badd5

Please sign in to comment.