diff --git a/Makefile b/Makefile index 77d4927..1286b43 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,10 @@ build: run: build ./${BINARY_NAME} +install: build + cp ${BINARY_NAME} .. + clean: + cd pkg/llama && make clean go clean rm ${BINARY_NAME} \ No newline at end of file diff --git a/main.go b/main.go index ff52786..ae54aa1 100644 --- a/main.go +++ b/main.go @@ -28,7 +28,6 @@ func main() { config.SetDefault("prefix", "!") config.SetDefault("model", "models/ggml-vicuna-7b-1.1-q4_0.bin") config.SetDefault("name", "Kevin") - config.SetDefault("threads", 1) config.SetDefault("discord.token", "not-set") config.SetDefault("discord.chat", "not-set") config.SetDefault("discord.owner", "not-set") @@ -64,6 +63,7 @@ func main() { signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt) <-sc discord.Close() + brain.Free() } func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { @@ -88,7 +88,7 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { message := structs.NewMessage(m.Author.Username, strings.TrimSpace(m.Content)) prompt := structs.GeneratePrompt(config, messages, *message) var seed int = int(time.Now().Unix()) - res, err := brain.Predict(prompt, llama.SetThreads(viper.GetInt("threads")), llama.SetTokens(128), llama.SetTopK(90), llama.SetTopP(0.86), llama.SetSeed(seed)) + res, err := brain.Predict(prompt, llama.SetThreads(4), llama.SetTokens(128), llama.SetTopK(90), llama.SetTopP(0.86), llama.SetSeed(seed)) if err != nil { panic(err) }