diff --git a/pkg/distribution/distribution/client.go b/pkg/distribution/distribution/client.go index b5ba001d..601e41d5 100644 --- a/pkg/distribution/distribution/client.go +++ b/pkg/distribution/distribution/client.go @@ -238,6 +238,30 @@ func (c *Client) PullModel(ctx context.Context, reference string, progressWriter originalReference := reference // Normalize the model reference reference = c.normalizeModelName(reference) + + // Fast-path only for immutable digest references. + // Tags may be mutable and must be checked against the registry. + if strings.Contains(reference, "@") { + if localModel, err := c.store.Read(reference); err == nil { + c.log.Infoln("Model found in local store by digest:", utils.SanitizeForLog(reference)) + + cfg, err := localModel.Config() + if err != nil { + return fmt.Errorf("getting cached model config: %w", err) + } + + if err := progress.WriteSuccess( + progressWriter, + fmt.Sprintf("Using cached model: %s", cfg.GetSize()), + oci.ModePull, + ); err != nil { + c.log.Warnf("Writing progress: %v", err) + } + + return nil + } + } + c.log.Infoln("Starting model pull:", utils.SanitizeForLog(reference)) // Handle bearer token for registry authentication