Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Commit bcb414f

Browse files
committed
added doc string for _load_model_state_dict
1 parent 6831cc6 commit bcb414f

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

torchchat/model.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,20 @@ def _load_model_state_dict(
480480
unexpected_keys,
481481
error_msgs,
482482
):
483-
# update key names to match the new model
483+
"""
484+
Updates the loaded internal model state dictionary to match the Model class structure.
485+
Note that this is a temporary solution and will be removed once the model structure is finalized.
486+
Args:
487+
state_dict (dict): The state dictionary to load.
488+
prefix (str): The prefix of the model.
489+
local_metadata (dict): Local metadata.
490+
strict (bool): Whether to strictly enforce that the keys in the state dictionary match the keys in the model.
491+
missing_keys (list): List of missing keys.
492+
unexpected_keys (list): List of unexpected keys.
493+
error_msgs (list): List of error messages.
494+
Returns:
495+
dict: The updated state dictionary.
496+
"""
484497
for key in list(state_dict.keys()):
485498
new_key = "model." + key
486499
state_dict[new_key] = state_dict.pop(key)

0 commit comments

Comments
 (0)