MCPcopy Create free account
hub / github.com/InternScience/InternAgent / load

Method load

tasks/AutoMem/code/memory_layer.py:446–462  ·  view source on GitHub ↗

Load retriever state from disk

(cls, retriever_cache_file: str, retriever_cache_embeddings_file: str)

Source from the content-addressed store, hash-verified

444
445 @classmethod
446 def load(cls, retriever_cache_file: str, retriever_cache_embeddings_file: str):
447 """Load retriever state from disk"""
448 # Load the pickled state
449 with open(retriever_cache_file, 'rb') as f:
450 state = pickle.load(f)
451
452 # Create new instance
453 retriever = cls(model_name=state['model_name'], alpha=state['alpha'])
454 retriever.bm25 = state['bm25']
455 retriever.corpus = state['corpus']
456 retriever.document_ids = state.get('document_ids', {})
457
458 # Load embeddings from numpy file if it exists
459 if retriever_cache_embeddings_file.exists():
460 retriever.embeddings = np.load(retriever_cache_embeddings_file)
461
462 return retriever
463
464 @classmethod
465 def load_from_local_memory(cls, memories: Dict, model_name: str, alpha: float) -> bool:

Callers 7

load_modelFunction · 0.45
make_splitsFunction · 0.45
__call__Method · 0.45
__call__Method · 0.45
process_single_sampleFunction · 0.45
load_locomo_datasetFunction · 0.45
loadMethod · 0.45

Calls 1

getMethod · 0.45

Tested by

no test coverage detected