find_optimal_depth(
model,
val_loader,
task_type="classification",
depths=None,
device="cuda",
num_epochs=10,
lr=0.001,
verbose=True,
max_val_batches=None,
)Runs a lightweight probe at each candidate depth and returns a DepthSearchResult.
Important notes:
val_loaderis treated as a probe dataset in this package.classificationuses a linear classifier probe.poseanddetectionuse small regression-style probe heads.customcurrently falls back to the classification probe path.
FeatureExtractor(model, layer_name, pooling="avg")pooling options:
"avg": average-pool spatial or token dimensions"max": max-pool spatial or token dimensions"flatten": flatten everything after batch dimensionNone: return raw activations
Returns a small default sweep for:
classificationdetectionposecustom
Discovers likely probe layers for common model layouts:
- ResNet-style
layer1tolayer4 - stage-based
stages.N - transformer-style
blocks.N - feature-list
features.N
orka-validate: installation smoke testorka-find: synthetic probe run for fast validation