Skip to content

Commit

Permalink
Initialize object array correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
rlouf committed Jun 7, 2023
1 parent 86212b7 commit 4b356b7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion outlines/models/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,11 @@ async def generate_base(prompt: str, samples: int) -> PILImage:
response = api_response["data"][i]["b64_json"]
images.append(Image.open(BytesIO(base64.b64decode(response))))

return np.array(images, dtype="object")
array = np.empty((samples,), dtype="object")
for idx, image in enumerate(images):
array[idx] = image

return np.atleast_2d(array)

return generate

Expand Down

0 comments on commit 4b356b7

Please sign in to comment.