Skip to content

Commit

Permalink
Make code more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
irenedea committed Nov 29, 2023
1 parent 1e9c193 commit a6954c2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions llmfoundry/utils/data_prep_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,16 @@ def __init__(

def __iter__(self):
for object_name in self.object_names:
output_filename = os.path.join(self.output_folder,
object_name.strip('/'))
# Default output_filename, used for local paths.
output_filename = object_name

# Download objects if remote path.
if self.object_store is not None:
output_filename = os.path.join(self.output_folder,
object_name.strip('/'))
self.object_store.download_object(object_name=object_name,
filename=output_filename,
overwrite=True)
else:
# Inputs are local so we do not need to download them.
output_filename = object_name

with open(output_filename) as _txt_file:
txt = _txt_file.read()
Expand Down

0 comments on commit a6954c2

Please sign in to comment.