Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed load loading from wrong directory #237

Merged
merged 2 commits into from
Nov 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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