From 9164981d72890541709cc33f889673e28c8ea79f Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Mon, 3 Jul 2023 17:14:20 -0400 Subject: [PATCH] move prompt templates out of python bindings --- cmd/cmd.go | 8 ++++---- llama/CMakeLists.txt | 1 + server/routes.go | 13 ++++++------- .../ollama/templates => templates}/alpaca.prompt | 0 .../ollama/templates => templates}/falcon.prompt | 0 {python/ollama/templates => templates}/gpt4.prompt | 0 .../ollama/templates => templates}/hermes.prompt | 0 {python/ollama/templates => templates}/mpt.prompt | 0 {python/ollama/templates => templates}/oasst.prompt | 0 {python/ollama/templates => templates}/orca.prompt | 0 {python/ollama/templates => templates}/qlora.prompt | 0 {python/ollama/templates => templates}/tulu.prompt | 0 .../ollama/templates => templates}/ultralm.prompt | 0 .../ollama/templates => templates}/vicuna.prompt | 0 .../templates => templates}/wizardcoder.prompt | 0 .../ollama/templates => templates}/wizardlm.prompt | 0 16 files changed, 11 insertions(+), 11 deletions(-) rename {python/ollama/templates => templates}/alpaca.prompt (100%) rename {python/ollama/templates => templates}/falcon.prompt (100%) rename {python/ollama/templates => templates}/gpt4.prompt (100%) rename {python/ollama/templates => templates}/hermes.prompt (100%) rename {python/ollama/templates => templates}/mpt.prompt (100%) rename {python/ollama/templates => templates}/oasst.prompt (100%) rename {python/ollama/templates => templates}/orca.prompt (100%) rename {python/ollama/templates => templates}/qlora.prompt (100%) rename {python/ollama/templates => templates}/tulu.prompt (100%) rename {python/ollama/templates => templates}/ultralm.prompt (100%) rename {python/ollama/templates => templates}/vicuna.prompt (100%) rename {python/ollama/templates => templates}/wizardcoder.prompt (100%) rename {python/ollama/templates => templates}/wizardlm.prompt (100%) diff --git a/cmd/cmd.go b/cmd/cmd.go index c8e5b4c4..c3c854fa 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -59,7 +59,7 @@ func NewCLI() *cobra.Command { rootCmd := &cobra.Command{ Use: "ollama", - Short: "Run any large language model on any machine.", + Short: "Large language model runner", CompletionOptions: cobra.CompletionOptions{ DisableDefaultCmd: true, }, @@ -88,14 +88,13 @@ func NewCLI() *cobra.Command { }, } -/* runCmd := &cobra.Command{ Use: "run", Short: "Run a model and submit prompts.", - RunE: func(cmd *cobra.Command. args []string) error { + RunE: func(cmd *cobra.Command,args []string) error { + return nil }, } -*/ serveCmd := &cobra.Command{ Use: "serve", @@ -132,6 +131,7 @@ func NewCLI() *cobra.Command { rootCmd.AddCommand( modelsCmd, serveCmd, + runCmd, ) return rootCmd diff --git a/llama/CMakeLists.txt b/llama/CMakeLists.txt index b2ef7b39..11af62d7 100644 --- a/llama/CMakeLists.txt +++ b/llama/CMakeLists.txt @@ -23,5 +23,6 @@ target_include_directories(binding PRIVATE ${llama_cpp_SOURCE_DIR}) target_include_directories(binding PRIVATE ${llama_cpp_SOURCE_DIR}/examples) target_link_libraries(binding llama ggml_static) +configure_file(${llama_cpp_SOURCE_DIR}/ggml-metal.metal ${CMAKE_CURRENT_BINARY_DIR}/ggml-metal.metal COPYONLY) configure_file(${llama_cpp_BINARY_DIR}/libllama.a ${CMAKE_CURRENT_BINARY_DIR}/libllama.a COPYONLY) configure_file(${llama_cpp_BINARY_DIR}/libggml_static.a ${CMAKE_CURRENT_BINARY_DIR}/libggml_static.a COPYONLY) diff --git a/server/routes.go b/server/routes.go index 6cea2eb8..4912d0c6 100644 --- a/server/routes.go +++ b/server/routes.go @@ -36,6 +36,8 @@ func Serve(ln net.Listener) error { }) r.POST("/api/generate", func(c *gin.Context) { + // TODO: set prompt from template + var req api.GenerateRequest if err := c.ShouldBindJSON(&req); err != nil { c.JSON(http.StatusBadRequest, gin.H{"message": err.Error()}) @@ -64,13 +66,10 @@ func Serve(ln net.Listener) error { return true }) -/* - embeds, err := l.Embeddings(text) - if err != nil { - fmt.Printf("Embeddings: error %s \n", err.Error()) - } -*/ - + // embeds, err := l.Embeddings(text) + // if err != nil { + // fmt.Printf("Embeddings: error %s \n", err.Error()) + // } }) log.Printf("Listening on %s", ln.Addr()) diff --git a/python/ollama/templates/alpaca.prompt b/templates/alpaca.prompt similarity index 100% rename from python/ollama/templates/alpaca.prompt rename to templates/alpaca.prompt diff --git a/python/ollama/templates/falcon.prompt b/templates/falcon.prompt similarity index 100% rename from python/ollama/templates/falcon.prompt rename to templates/falcon.prompt diff --git a/python/ollama/templates/gpt4.prompt b/templates/gpt4.prompt similarity index 100% rename from python/ollama/templates/gpt4.prompt rename to templates/gpt4.prompt diff --git a/python/ollama/templates/hermes.prompt b/templates/hermes.prompt similarity index 100% rename from python/ollama/templates/hermes.prompt rename to templates/hermes.prompt diff --git a/python/ollama/templates/mpt.prompt b/templates/mpt.prompt similarity index 100% rename from python/ollama/templates/mpt.prompt rename to templates/mpt.prompt diff --git a/python/ollama/templates/oasst.prompt b/templates/oasst.prompt similarity index 100% rename from python/ollama/templates/oasst.prompt rename to templates/oasst.prompt diff --git a/python/ollama/templates/orca.prompt b/templates/orca.prompt similarity index 100% rename from python/ollama/templates/orca.prompt rename to templates/orca.prompt diff --git a/python/ollama/templates/qlora.prompt b/templates/qlora.prompt similarity index 100% rename from python/ollama/templates/qlora.prompt rename to templates/qlora.prompt diff --git a/python/ollama/templates/tulu.prompt b/templates/tulu.prompt similarity index 100% rename from python/ollama/templates/tulu.prompt rename to templates/tulu.prompt diff --git a/python/ollama/templates/ultralm.prompt b/templates/ultralm.prompt similarity index 100% rename from python/ollama/templates/ultralm.prompt rename to templates/ultralm.prompt diff --git a/python/ollama/templates/vicuna.prompt b/templates/vicuna.prompt similarity index 100% rename from python/ollama/templates/vicuna.prompt rename to templates/vicuna.prompt diff --git a/python/ollama/templates/wizardcoder.prompt b/templates/wizardcoder.prompt similarity index 100% rename from python/ollama/templates/wizardcoder.prompt rename to templates/wizardcoder.prompt diff --git a/python/ollama/templates/wizardlm.prompt b/templates/wizardlm.prompt similarity index 100% rename from python/ollama/templates/wizardlm.prompt rename to templates/wizardlm.prompt