From f75ebeca0494e991632600f4c7f1fef2dd08ec8d Mon Sep 17 00:00:00 2001 From: Yolanda Robla Date: Mon, 2 Dec 2024 16:36:18 +0100 Subject: [PATCH] readd gif lfs pointers for models --- .github/workflows/image-publish.yml | 4 +- README.md | 4 ++ models/all-MiniLM-L6-v2-Q5_K_M.gguf | 3 ++ .../qwen2.5-coder-1.5b-instruct-q5_k_m.gguf | 3 ++ tests/test_storage.py | 38 +++++++++---------- 5 files changed, 30 insertions(+), 22 deletions(-) create mode 100644 models/all-MiniLM-L6-v2-Q5_K_M.gguf create mode 100644 models/qwen2.5-coder-1.5b-instruct-q5_k_m.gguf diff --git a/.github/workflows/image-publish.yml b/.github/workflows/image-publish.yml index 61fc1edc..4b0f600b 100644 --- a/.github/workflows/image-publish.yml +++ b/.github/workflows/image-publish.yml @@ -9,8 +9,8 @@ on: branches: - main schedule: - # Weekdays at noon GMT - - cron: '00 12 * * 1-5' + # Once weekly on fridays at noon + - cron: '00 12 * * 5' # Allow for manually triggering the workflow workflow_dispatch: jobs: diff --git a/README.md b/README.md index 4504ed05..b9819ad5 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,10 @@ source venv/bin/activate # On Windows: venv\Scripts\activate # Install dev dependencies pip install -e ".[dev]" + +# Download models +git lfs install +git lfs pull ``` ### Testing diff --git a/models/all-MiniLM-L6-v2-Q5_K_M.gguf b/models/all-MiniLM-L6-v2-Q5_K_M.gguf new file mode 100644 index 00000000..ae2612ae --- /dev/null +++ b/models/all-MiniLM-L6-v2-Q5_K_M.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60c7e141495321c7d303ec5ccc79296cfeb044263af840c583fed695d423aee8 +size 21717952 \ No newline at end of file diff --git a/models/qwen2.5-coder-1.5b-instruct-q5_k_m.gguf b/models/qwen2.5-coder-1.5b-instruct-q5_k_m.gguf new file mode 100644 index 00000000..f9304f59 --- /dev/null +++ b/models/qwen2.5-coder-1.5b-instruct-q5_k_m.gguf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f15d02e8e51a5c6f9448b972819acfa66aee4d8bb7d881a8b8ba3d90da08ef09 +size 1285494336 \ No newline at end of file diff --git a/tests/test_storage.py b/tests/test_storage.py index 6e6ee6be..f34fa8bb 100644 --- a/tests/test_storage.py +++ b/tests/test_storage.py @@ -34,23 +34,21 @@ def mock_inference_engine(): @pytest.mark.asyncio async def test_search(mock_weaviate_client, mock_inference_engine): - # Patch the WeaviateClient and LlamaCppInferenceEngine inside the test function - with ( - patch("weaviate.WeaviateClient", return_value=mock_weaviate_client), - patch( - "codegate.inference.inference_engine.LlamaCppInferenceEngine", - return_value=mock_inference_engine, - ), - ): - - # Initialize StorageEngine - storage_engine = StorageEngine(data_path="./weaviate_data") - - # Invoke the search method - results = await storage_engine.search("test query", 5, 0.3) - - # Assertions to validate the expected behavior - assert len(results) == 1 # Assert that one result is returned - assert results[0]["properties"]["name"] == "test" - mock_weaviate_client.connect.assert_called() - mock_weaviate_client.close.assert_called() + # Patch the LlamaCppInferenceEngine.embed method (not the entire class) + with patch("codegate.inference.inference_engine.LlamaCppInferenceEngine.embed", + mock_inference_engine.embed): + + # Mock the WeaviateClient as before + with patch("weaviate.WeaviateClient", return_value=mock_weaviate_client): + + # Initialize StorageEngine + storage_engine = StorageEngine(data_path="./weaviate_data") + + # Invoke the search method + results = await storage_engine.search("test query", 5, 0.3) + + # Assertions to validate the expected behavior + assert len(results) == 1 # Assert that one result is returned + assert results[0]["properties"]["name"] == "test" + mock_weaviate_client.connect.assert_called() + mock_weaviate_client.close.assert_called()