Skip to content

Commit 056b0bd

Browse files
Ark-kuncopybara-github
authored andcommitted
fix: LLM - Fixed the DataFrame staging on Windows
PiperOrigin-RevId: 536890848
1 parent 66e6eae commit 056b0bd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

google/cloud/aiplatform/utils/gcs_utils.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import datetime
1919
import glob
2020
import logging
21+
import os
2122
import pathlib
2223
import tempfile
2324
from typing import Optional, TYPE_CHECKING
@@ -317,8 +318,8 @@ def _upload_pandas_df_to_gcs(
317318
ValueError: When a file format other than JSONL is provided.
318319
"""
319320

320-
with tempfile.NamedTemporaryFile() as temp_file:
321-
local_dataset_path = temp_file.name
321+
with tempfile.TemporaryDirectory() as temp_dir:
322+
local_dataset_path = os.path.join(temp_dir, "dataset.jsonl")
322323

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

0 commit comments

Comments
 (0)