From b839eb80a10a65755613eb2bcb0b0a06aa293d0b Mon Sep 17 00:00:00 2001 From: Dave Date: Wed, 25 Oct 2023 14:53:26 -0400 Subject: [PATCH] Fix backend/cpp/llama CMakeList.txt on OSX (#1212) * Fix backend/cpp/llama CMakeList.txt on OSX - detect OSX and use homebrew libraries * sneak a logging fix in too for gallery debugging * additional logging --- backend/cpp/llama/CMakeLists.txt | 8 ++++++-- pkg/gallery/gallery.go | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/backend/cpp/llama/CMakeLists.txt b/backend/cpp/llama/CMakeLists.txt index 116283fbbb6a..2d804d440d2d 100644 --- a/backend/cpp/llama/CMakeLists.txt +++ b/backend/cpp/llama/CMakeLists.txt @@ -4,6 +4,11 @@ set(TARGET grpc-server) set(_PROTOBUF_LIBPROTOBUF libprotobuf) set(_REFLECTION grpc++_reflection) +if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + link_directories("/opt/homebrew/lib") + include_directories("/opt/homebrew/include") +endif() + find_package(absl CONFIG REQUIRED) find_package(Protobuf CONFIG REQUIRED) find_package(gRPC CONFIG REQUIRED) @@ -15,8 +20,7 @@ find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin) include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(${Protobuf_INCLUDE_DIRS}) -message(STATUS "Using protobuf ${Protobuf_VERSION} ${Protobuf_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}") - +message(STATUS "Using protobuf version ${Protobuf_VERSION} | Protobuf_INCLUDE_DIRS: ${Protobuf_INCLUDE_DIRS} | CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}") # Proto file get_filename_component(hw_proto "../../../../../../pkg/grpc/proto/backend.proto" ABSOLUTE) diff --git a/pkg/gallery/gallery.go b/pkg/gallery/gallery.go index 1fd961725606..7957ed59d638 100644 --- a/pkg/gallery/gallery.go +++ b/pkg/gallery/gallery.go @@ -8,6 +8,7 @@ import ( "github.com/go-skynet/LocalAI/pkg/utils" "github.com/imdario/mergo" + "github.com/rs/zerolog/log" "gopkg.in/yaml.v2" ) @@ -166,7 +167,9 @@ func getGalleryModels(gallery Gallery, basePath string) ([]*GalleryModel, error) return yaml.Unmarshal(d, &models) }) if err != nil { - + if yamlErr, ok := err.(*yaml.TypeError); ok { + log.Debug().Msgf("YAML errors: %s\n\nwreckage of models: %+v", strings.Join(yamlErr.Errors, "\n"), models) + } return models, err }