Skip to content

Commit

Permalink
fixed load loading from wrong directory (#237)
Browse files Browse the repository at this point in the history
* fixed load loading from wrong directory

* typos
  • Loading branch information
cpacker authored Nov 1, 2023
1 parent 543db5a commit a269ffd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions memgpt/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,14 @@ def load(memgpt_agent, filename):
print(f"Loading {filename} failed with: {e}")
else:
# Load the latest file
print(f"/load warning: no checkpoint specified, loading most recent checkpoint instead")
json_files = glob.glob("saved_state/*.json") # This will list all .json files in the current directory.
save_path = f"{constants.MEMGPT_DIR}/saved_state"
print(f"/load warning: no checkpoint specified, loading most recent checkpoint from {save_path} instead")
json_files = glob.glob(f"{save_path}/*.json") # This will list all .json files in the current directory.

# Check if there are any json files.
if not json_files:
print(f"/load error: no .json checkpoint files found")
return
else:
# Sort files based on modified timestamp, with the latest file being the first.
filename = max(json_files, key=os.path.getmtime)
Expand Down

0 comments on commit a269ffd

Please sign in to comment.