fn
compose_cartridge_adapters
→Nonecompose_cartridge_adapters(adapter_paths: Sequence[str | os.PathLike[str]], output_path: str | os.PathLike[str], safe_serialization: bool = True)Join saved Cartridges into one by laying their caches end to end.
The composed cache is every cache one after another, so a model that reads it attends to all the
documents at once (the paper's composition by concatenation, done at the adapter, with no
several adapters at run time). Its config is the first Cartridge's with num_virtual_tokens
the total; the frozen tokens are the first Cartridge's only, one attention sink for the whole.
Parameters
adapter_ pathssequence of str or PathLikeDirectories of at least two saved Cartridges.
output_ pathstr or PathLikeThe directory to write the composed adapter to; created if missing.
safe_ serializationbool= TrueWrite
adapter_model.safetensors, the one format here; False raises
NotImplementedError.Raises
ValueErrorFewer than two paths, an adapter that is not a Cartridge, Cartridges whose sizes differ, or a
directory without a
prompt_embeddings tensor.NotImplementedErrorsafe_serialization is False.