Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions pkg/distribution/distribution/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down