Skip to content

Commit

Permalink
fix: LLM - Fixed the DataFrame staging on Windows
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 536890848
  • Loading branch information
Ark-kun authored and copybara-github committed Jun 1, 2023
1 parent 66e6eae commit 056b0bd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions google/cloud/aiplatform/utils/gcs_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import datetime
import glob
import logging
import os
import pathlib
import tempfile
from typing import Optional, TYPE_CHECKING
Expand Down Expand Up @@ -317,8 +318,8 @@ def _upload_pandas_df_to_gcs(
ValueError: When a file format other than JSONL is provided.
"""

with tempfile.NamedTemporaryFile() as temp_file:
local_dataset_path = temp_file.name
with tempfile.TemporaryDirectory() as temp_dir:
local_dataset_path = os.path.join(temp_dir, "dataset.jsonl")

if file_format == "jsonl":
df.to_json(path_or_buf=local_dataset_path, orient="records", lines=True)
Expand Down

0 comments on commit 056b0bd

Please sign in to comment.