add autoprune to remove unused layers (#491)

This commit is contained in:
Patrick Devine
2023-09-11 11:46:35 -07:00
committed by GitHub
parent 3920e15386
commit e7e91cd71c
3 changed files with 136 additions and 19 deletions

View File

@@ -672,6 +672,12 @@ func RunServer(cmd *cobra.Command, _ []string) error {
origins = strings.Split(o, ",")
}
if noprune := os.Getenv("OLLAMA_NOPRUNE"); noprune == "" {
if err := server.PruneLayers(); err != nil {
return err
}
}
return server.Serve(ln, origins)
}