Interface SafeTensorsLoaderThreads
public interface SafeTensorsLoaderThreads
Resolves the safetensors loader thread-pool size.
Peak host RAM during load scales roughly as
threads × in-flight shard footprint (each worker holds at most one
shard on CPU at a time).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault auto cap whenconfigured == 0. -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic intresolve(int configured, int numShards) Resolves loader concurrency.
-
Field Details
-
AUTO_CAP
static final int AUTO_CAPDefault auto cap whenconfigured == 0.- See Also:
-
-
Method Details
-
resolve
static int resolve(int configured, int numShards) Resolves loader concurrency.auto = min(
AUTO_CAP, availableProcessors) threads = configured > 0 ? configured : auto result = min(threads, numShards) // at least 1 when numShards >= 1- Parameters:
configured-0means auto; must not be negative.numShards- number of safetensors shard files (>= 0).- Returns:
- pool size;
0when there are no shards.
-