Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion cmd/modelfile/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func init() {
flags.StringVar(&generateConfig.ParamSize, "param-size", "", "specify number of model parameters, such as 8b, 16b, 32b, etc")
flags.StringVar(&generateConfig.Precision, "precision", "", "specify model precision, such as bf16, fp16, int8, etc")
flags.StringVar(&generateConfig.Quantization, "quantization", "", "specify model quantization, such as awq, gptq, etc")
flags.StringVarP(&generateConfig.Output, "output", "O", ".", "specify the output path of modelfilem, must be a directory")
flags.StringVarP(&generateConfig.Output, "output", "O", ".", "specify the output path of modelfile, must be a directory")
flags.BoolVar(&generateConfig.IgnoreUnrecognizedFileTypes, "ignore-unrecognized-file-types", false, "ignore the unrecognized file types in the workspace")
flags.BoolVar(&generateConfig.Overwrite, "overwrite", false, "overwrite the existing modelfile")

Expand Down
16 changes: 15 additions & 1 deletion pkg/backend/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,21 @@ func (b *backend) Pull(ctx context.Context, target string, cfg *config.Pull) err

manifestDesc, manifestReader, err := src.Manifests().FetchReference(ctx, tag)
if err != nil {
return fmt.Errorf("failed to fetch the manifest: %w", err)
// fallback to fetch the manifest without proxy.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot get manifest via a proxy because they will be cached the content of the manifest. If the content of the manifest changed, you will get the wrong content.

if cfg.Proxy != "" {
fmt.Printf("Failed to fetch the manifest with proxy, fallback to fetch without proxy, error: %v\n", err)
cfg.Proxy = ""
src, err = remote.New(repo, remote.WithPlainHTTP(cfg.PlainHTTP), remote.WithInsecure(cfg.Insecure), remote.WithProxy(cfg.Proxy))
if err != nil {
return fmt.Errorf("failed to create the remote client: %w", err)
}
manifestDesc, manifestReader, err = src.Manifests().FetchReference(ctx, tag)
if err != nil {
return fmt.Errorf("failed to fetch the manifest: %w", err)
}
} else {
return fmt.Errorf("failed to fetch the manifest: %w", err)
}
}

defer manifestReader.Close()
Expand Down