mirror of
https://github.com/anchore/syft.git
synced 2026-07-05 02:28:25 +02:00
chore: document one model per directory grouping
groupByParentDir treats every .safetensors file in a directory as a shard of one model. Spell out that assumption and its trade-off Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
This commit is contained in:
parent
4d59bdbb7f
commit
88ef52f617
@ -97,8 +97,17 @@ func mergeDirModels(ctx context.Context, resolver file.Resolver, pkgs []pkg.Pack
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// groupByParentDir buckets filesystem-scanned packages by the directory their
|
// groupByParentDir buckets filesystem-scanned models by the directory their
|
||||||
// primary-evidence file lives in (the shards of one model share a directory).
|
// primary-evidence file lives in.
|
||||||
|
|
||||||
|
// This encodes a deliberate assumption: a directory holds one logical
|
||||||
|
// model, so every .safetensors file in a directory is treated as a shard of the
|
||||||
|
// same modeland merged into one package.
|
||||||
|
// The trade-off is that if a directory happens to contain several unrelated models,
|
||||||
|
// they are merged into one package rather than reported separately.
|
||||||
|
// We accept that because the conventional on-disk layout gives each model
|
||||||
|
// (with all of its shards) its own directory.
|
||||||
|
// We have no reliable per-file signal to tell co-located-but-independent models apart.
|
||||||
func groupByParentDir(pkgs []pkg.Package) map[string][]pkg.Package {
|
func groupByParentDir(pkgs []pkg.Package) map[string][]pkg.Package {
|
||||||
out := make(map[string][]pkg.Package)
|
out := make(map[string][]pkg.Package)
|
||||||
for _, p := range pkgs {
|
for _, p := range pkgs {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user