Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/memos/llms/vllm.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def _generate_with_api_client(self, messages: list[MessageDict]) -> str:
"temperature": float(getattr(self.config, "temperature", 0.8)),
"max_tokens": int(getattr(self.config, "max_tokens", 1024)),
"top_p": float(getattr(self.config, "top_p", 0.9)),
"extra_body": {"chat_template_kwargs": {"enable_thinking": False}},
}

response = self.client.chat.completions.create(**completion_kwargs)
Expand Down Expand Up @@ -142,6 +143,7 @@ def generate_stream(self, messages: list[MessageDict]):
"max_tokens": int(getattr(self.config, "max_tokens", 1024)),
"top_p": float(getattr(self.config, "top_p", 0.9)),
"stream": True, # Enable streaming
"extra_body": {"chat_template_kwargs": {"enable_thinking": False}},
}

stream = self.client.chat.completions.create(**completion_kwargs)
Expand Down
24 changes: 24 additions & 0 deletions src/memos/mem_os/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,30 @@ def dump(
self.mem_cubes[mem_cube_id].dump(dump_dir)
logger.info(f"MemCube {mem_cube_id} dumped to {dump_dir}")

def load(
self,
load_dir: str,
user_id: str | None = None,
mem_cube_id: str | None = None,
memory_types: list[Literal["text_mem", "act_mem", "para_mem"]] | None = None,
) -> None:
"""Dump the MemCube to a dictionary.
Args:
load_dir (str): The directory to load the MemCube from.
user_id (str, optional): The identifier of the user to load the MemCube from.
If None, the default user is used.
mem_cube_id (str, optional): The identifier of the MemCube to load.
If None, the default MemCube for the user is used.
"""
target_user_id = user_id if user_id is not None else self.user_id
accessible_cubes = self.user_manager.get_user_cubes(target_user_id)
if not mem_cube_id:
mem_cube_id = accessible_cubes[0].cube_id
if mem_cube_id not in self.mem_cubes:
raise ValueError(f"MemCube with ID {mem_cube_id} does not exist. please regiester")
self.mem_cubes[mem_cube_id].load(load_dir, memory_types=memory_types)
logger.info(f"MemCube {mem_cube_id} loaded from {load_dir}")

def get_user_info(self) -> dict[str, Any]:
"""Get current user information including accessible cubes.

Expand Down
Loading