acon96 / home-llm

A Home Assistant integration & Model to control your smart home using a Local LLM
483 stars 56 forks source link

Integration failed to configure #177

Closed xvlw closed 6 days ago

xvlw commented 1 week ago

Describe the bug

Installation works fine and completes without error, however when viewing the integration page I get an error (screenshot below)

Expected behavior Integration should start and appear as a conversation agent

Logs

Logger: homeassistant.config_entries
Source: config_entries.py:594
First occurred: 3:03:41 PM (2 occurrences)
Last logged: 3:04:00 PM

Error setting up entry LLM Model 'acon96/Home-3B-v3-GGUF' (llama.cpp) for llama_conversation
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/llama_conversation/__init__.py", line 83, in async_setup_entry
    await agent._async_load_model(entry)
  File "/config/custom_components/llama_conversation/agent.py", line 201, in _async_load_model
    return await self.hass.async_add_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/llama_conversation/agent.py", line 805, in _load_model
    validate_llama_cpp_python_installation()
  File "/config/custom_components/llama_conversation/utils.py", line 132, in validate_llama_cpp_python_installation
    raise Exception(f"Failed to properly initialize llama-cpp-python. (Exit code {process.exitcode}.)")
Exception: Failed to properly initialize llama-cpp-python. (Exit code -4.)

Installation from HACS works no issue. Integration install completes without any issues or errors.

When viewing the Integration page I receive this error warning.

lg85jO8

Not using a GPU, CPU being used is Celeron N3450

Logs above.

Appreciate your help

acon96 commented 1 week ago

You can follow the instructions here to build a wheel that is compatible with your computer: https://github.com/acon96/home-llm/blob/develop/docs/Backend%20Configuration.md#wheels

I really don't know why this keeps happening with this specific CPU (Celeron N3450). It is either misreporting that it supports AVX2 or it doesn't support some x86 instruction that is being included in the default llama.cpp build.

benbender commented 1 week ago

@acon96 From what I've seen it's basically an issue on all of those n-series cpus: https://ark.intel.com/content/www/de/de/ark/products/series/87282/intel-celeron-processor-n-series.html

I'm also experiencing this on an N5105 and could not easily fix it with recompiling the wheel locally. I just couldn't find the time to dig deeper until now…

My cpu details:

[root@srv ~]# cat /proc/cpuinfo
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 156
model name  : Intel(R) Celeron(R) N5105 @ 2.00GHz
stepping    : 0
microcode   : 0x1d
cpu MHz     : 2886.948
cache size  : 4096 KB
physical id : 0
siblings    : 4
core id     : 0
cpu cores   : 4
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 27
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave rdrand lahf_lm 3dnowprefetch cpuid_fault epb cat_l2 cdp_l2 ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust smep erms rdt_a rdseed smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req vnmi umip waitpkg gfni rdpid movdiri movdir64b md_clear flush_l1d arch_capabilities
vmx flags   : vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid ple shadow_vmcs ept_mode_based_exec tsc_scaling usr_wait_pause
bugs        : spectre_v1 spectre_v2 spec_store_bypass swapgs srbds mmio_stale_data rfds
bogomips    : 3995.00
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:
xvlw commented 1 week ago

You can follow the instructions here to build a wheel that is compatible with your computer: https://github.com/acon96/home-llm/blob/develop/docs/Backend%20Configuration.md#wheels

I really don't know why this keeps happening with this specific CPU (Celeron N3450). It is either misreporting that it supports AVX2 or it doesn't support some x86 instruction that is being included in the default llama.cpp build.

Thanks I appreciate the suggestion, might be a bit outside my technical know-how though. Might try to give it a shot this weekend

If im reading this right, this needs docker to build a wheel?

acon96 commented 1 week ago

You can follow the instructions here to build a wheel that is compatible with your computer: https://github.com/acon96/home-llm/blob/develop/docs/Backend%20Configuration.md#wheels I really don't know why this keeps happening with this specific CPU (Celeron N3450). It is either misreporting that it supports AVX2 or it doesn't support some x86 instruction that is being included in the default llama.cpp build.

Thanks I appreciate the suggestion, might be a bit outside my technical know-how though. Might try to give it a shot this weekend

If im reading this right, this needs docker to build a wheel?

Yes. The script just pulls the Home Assistant docker image and uses that as the build environment because it's the easiest way to ensure binary compatibility with the Home Assistant runtime because it uses Alpine Linux based images (musl instead of glibc).