Sidecar files¶
trimbed.sidecar
¶
Carrying the source repository's vocabulary-independent files into the output.
sentence-transformers models are what make this necessary. Their pooling and dense modules live in files the trim itself never writes, and without them the output reopens with default mean pooling and no error to say so.
DEFAULT_SIDECAR_PATTERNS
module-attribute
¶
DEFAULT_SIDECAR_PATTERNS: tuple[str, ...] = (
"modules.json",
"config_sentence_transformers.json",
"sentence_bert_config.json",
"[0-9]_*/*",
)
Files copied from the source repository when sidecar_patterns says nothing else.
copy_sidecar_files
¶
copy_sidecar_files(
source: str,
output_dir: str | Path,
patterns: Sequence[str] = DEFAULT_SIDECAR_PATTERNS,
revision: str | None = None,
) -> list[str]
Copy the source repository's non-vocabulary files next to the trimmed artefacts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str
|
Hub model id or local path the trim started from. |
required |
output_dir
|
str | Path
|
Directory the trimmed artefacts were written to. |
required |
patterns
|
Sequence[str]
|
Glob patterns matched against repository-relative paths, e.g.
|
DEFAULT_SIDECAR_PATTERNS
|
revision
|
str | None
|
Revision to copy from, for a Hub id. |
None
|
Returns:
| Type | Description |
|---|---|
list[str]
|
The relative paths that were copied, in order, e.g. |