Skip to content

Commit

Permalink
Merge pull request #138 from acon96/release/v0.2.16
Browse files Browse the repository at this point in the history
Release v0.2.16
  • Loading branch information
acon96 authored May 4, 2024
2 parents 687f49f + 6f2ce88 commit 0cb361c
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ In order to facilitate running the project entirely on the system where Home Ass
## Version History
| Version | Description |
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| v0.2.16 | Fix for missing huggingface_hub package preventing startup |
| v0.2.15 | Fix startup error when using llama.cpp backend and add flash attention to llama.cpp backend |
| v0.2.14 | Fix llama.cpp wheels + AVX detection |
| v0.2.13 | Add support for Llama 3, build llama.cpp wheels that are compatible with non-AVX systems, fix an error with exposing script entities, fix multiple small Ollama backend issues, and add basic multi-language support |
Expand Down
2 changes: 1 addition & 1 deletion custom_components/llama_conversation/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ async def async_process(
intent_response = intent.IntentResponse(language=user_input.language)
intent_response.async_set_error(
intent.IntentResponseErrorCode.UNKNOWN,
f"Sorry, there was a problem talking to the backend: {err}",
f"Sorry, there was a problem talking to the backend: {repr(err)}",
)
return ConversationResult(
response=intent_response, conversation_id=conversation_id
Expand Down
12 changes: 11 additions & 1 deletion custom_components/llama_conversation/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
PROMPT_TEMPLATE_NONE = "no_prompt_template"
PROMPT_TEMPLATE_ZEPHYR = "zephyr"
PROMPT_TEMPLATE_ZEPHYR2 = "zephyr2"
PROMPT_TEMPLATE_ZEPHYR3 = "zephyr3"
DEFAULT_PROMPT_TEMPLATE = PROMPT_TEMPLATE_CHATML
PROMPT_TEMPLATE_DESCRIPTIONS = {
PROMPT_TEMPLATE_CHATML: {
Expand Down Expand Up @@ -113,6 +114,12 @@
"assistant": { "prefix": "<|assistant|>\n", "suffix": "</s>" },
"generation_prompt": "<|assistant|>\n"
},
PROMPT_TEMPLATE_ZEPHYR3: {
"system": { "prefix": "<|system|>\n", "suffix": "<|end|>" },
"user": { "prefix": "<|user|>\n", "suffix": "<|end|>" },
"assistant": { "prefix": "<|assistant|>\n", "suffix": "<|end|>" },
"generation_prompt": "<|assistant|>\n"
},
PROMPT_TEMPLATE_LLAMA3: {
"system": { "prefix": "<|start_header_id|>system<|end_header_id|>\n\n", "suffix": "<|eot_id|>"},
"user": { "prefix": "<|start_header_id|>user<|end_header_id|>\n\n", "suffix": "<|eot_id|>"},
Expand Down Expand Up @@ -271,8 +278,11 @@
"zephyr": {
CONF_PROMPT: DEFAULT_PROMPT_BASE + ICL_EXTRAS,
CONF_PROMPT_TEMPLATE: PROMPT_TEMPLATE_ZEPHYR,
},
"phi-3": {
CONF_PROMPT_TEMPLATE: PROMPT_TEMPLATE_ZEPHYR3
}
}

INTEGRATION_VERSION = "0.2.15"
INTEGRATION_VERSION = "0.2.16"
EMBEDDED_LLAMA_CPP_PYTHON_VERSION = "0.2.69"
8 changes: 4 additions & 4 deletions custom_components/llama_conversation/manifest.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"domain": "llama_conversation",
"name": "LLaMA Conversation",
"version": "0.2.15",
"version": "0.2.16",
"codeowners": ["@acon96"],
"config_flow": true,
"dependencies": ["conversation"],
"documentation": "https://github.com/acon96/home-llm",
"integration_type": "service",
"iot_class": "local_polling",
"requirements": [
"requests",
"huggingface-hub",
"webcolors"
"requests==2.31.0",
"huggingface-hub==0.23.0",
"webcolors==1.13"
]
}
1 change: 1 addition & 0 deletions custom_components/llama_conversation/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
"mistral": "Mistral",
"zephyr": "Zephyr (<|endoftext|>)",
"zephyr2": "Zephyr ('</s>')",
"zephyr3": "Zephyr (<|end|>)",
"llama3": "Llama 3",
"no_prompt_template": "None"
}
Expand Down
6 changes: 5 additions & 1 deletion custom_components/llama_conversation/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import voluptuous as vol
import webcolors
from importlib.metadata import version
from huggingface_hub import hf_hub_download, HfFileSystem

from homeassistant.requirements import pip_kwargs
from homeassistant.util.package import install_package, is_installed
Expand Down Expand Up @@ -48,6 +47,11 @@ def _flatten(current_schema, prefix=''):
return flattened

def download_model_from_hf(model_name: str, quantization_type: str, storage_folder: str):
try:
from huggingface_hub import hf_hub_download, HfFileSystem
except Exception as ex:
raise Exception(f"Failed to import huggingface-hub library. Please re-install the integration.") from ex

fs = HfFileSystem()
potential_files = [ f for f in fs.glob(f"{model_name}/*.gguf") ]
wanted_file = [f for f in potential_files if (f".{quantization_type.lower()}." in f or f".{quantization_type.upper()}." in f)]
Expand Down

0 comments on commit 0cb361c

Please sign in to comment.