Fix issue #190: Check Python version and locale encoding at startup - #444
Open
Sekhar03 wants to merge 22 commits into
Open
Fix issue #190: Check Python version and locale encoding at startup#444Sekhar03 wants to merge 22 commits into
Sekhar03 wants to merge 22 commits into
Conversation
This change basically gives Naomi the ability to use an LLM in crafting responses. The LLM is contacted over a web api, so any OpenAI compatible LLM server should be fine. I am currently using llama.cpp on a system with an nVidia GeForce RTX 3060 with 12 GB VRAM. I am currently using the following model: https://huggingface.co/mav23/Llama_3.2_1B_Intruct_Tool_Calling_V2-GGUF/blob/main/llama_3.2_1b_intruct_tool_calling_v2.Q4_K_M.gguf This is only a 3B parameter model, so it should run fine on cards with less VRAM. I have also tried running it on an Intel graphics card on my laptop using SyCL which seems to work fine. This is very much experimental. The basic idea is that I use the existing TTI parser to activate a plugin, then pass the output from that plugin to the LLM as a system message. This allows the LLM to use current data and answer questions like "What time is it?" or "Are we expecting rain on Thursday?" I'm also looking into using function calling which would allow the LLM to be used as an intent parser and might make plugin activation more integrated, but that has its own set of problems, including that different models define and use plugins differently. I also have included some notebooks. I plan to use these to create a set of notebooks that will hopefully be helpful to people who want to better understand how Naomi works internally.
The news and hacker news plugins were using a test mic, which did not have the new use_llm property.
Add the ALPACA template used by SiliconMaid and Kunoichi models.
Added a conversation log in SQLite3, planning to move to JSON. Started having the LLM use commands. Added Zephyr template for working with TinyLlama. Added support for FAISS intent parser.
Allow Naomi to use a local LLM
…at startup before importing naomi package
…own beeps by discarding frames while playing audio
…ate scripts and clean up on failure
…age if python3-virtualenvwrapper does not provide virtualenvwrapper.sh
… to apt_requirements.txt; add --quiet/-q flag to skip interactive prompts
…ad_git helper in app_utils.py; fix DeprecationWarning invalid escape sequences in __main__.py and npe.py; add test_fixes.py (27 tests, all passing)
| sys.stderr.write("WARNING: Your system locale is configured to use a non-UTF-8 character encoding ({}).\n".format(encoding)) | ||
| sys.stderr.write("This may cause Naomi to crash when reading files or configuration containing international characters.\n") | ||
| sys.stderr.write("Please consider setting your system locale to UTF-8 (e.g. by setting LC_ALL=en_US.UTF-8 in Linux).\n") | ||
| except Exception: |
| sys.stderr.write("WARNING: Your system locale is configured to use a non-UTF-8 character encoding ({}).\n".format(encoding)) | ||
| sys.stderr.write("This may cause Naomi to crash when reading files or configuration containing international characters.\n") | ||
| sys.stderr.write("Please consider setting your system locale to UTF-8 (e.g. by setting LC_ALL=en_US.UTF-8 in Linux).\n") | ||
| except Exception: |
Author
|
CLA Accepted |
…python-native app_utils.download_file and sys.executable -m pip, and raise ImportError on Windows
…nslation catalogs recursively (resolves part of issue NaomiProject#386)
…stall system dependencies (resolves part of issue NaomiProject#386)
…y to always write the translation header metadata even if marked fuzzy (fixing UnicodeDecodeError)
Contributor
|
Hello Sekhar, thank you for submitting to Naomi. I am reviewing your modifications now. I should have a comprehensive review sometime this weekend. -Aaron |
| for row in result: | ||
| self._messages.append({'role': row[1], 'content': row[2]}) | ||
| conn.close() | ||
| self.template = Template(TEMPLATES[template]['template']) |
| self.template = Template(TEMPLATES[template]['template']) | ||
| self.eot_markers = TEMPLATES[template]['eot_markers'] | ||
| self.emoji_filter = re.compile("[" | ||
| U"\U0001F600-\U0001F64F" # emoticons |
| self.template = Template(TEMPLATES[template]['template']) | ||
| self.eot_markers = TEMPLATES[template]['eot_markers'] | ||
| self.emoji_filter = re.compile("[" | ||
| U"\U0001F600-\U0001F64F" # emoticons |
| self.template = Template(TEMPLATES[template]['template']) | ||
| self.eot_markers = TEMPLATES[template]['eot_markers'] | ||
| self.emoji_filter = re.compile("[" | ||
| U"\U0001F600-\U0001F64F" # emoticons |
| self.template = Template(TEMPLATES[template]['template']) | ||
| self.eot_markers = TEMPLATES[template]['eot_markers'] | ||
| self.emoji_filter = re.compile("[" | ||
| U"\U0001F600-\U0001F64F" # emoticons |
| self.eot_markers = TEMPLATES[template]['eot_markers'] | ||
| self.emoji_filter = re.compile("[" | ||
| U"\U0001F600-\U0001F64F" # emoticons | ||
| U"\U0001F300-\U0001F5FF" # symbols & pictographs |
| else: | ||
| self.actions_queue.appendleft(lambda: self.tts(phrase)) | ||
| if "[shutdown]" in phrase.lower() or "[shut down]" in phrase.lower(): | ||
| self.actions_queue.appendleft(lambda: self.shutdown()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request moves the Python version check to the top of Naomi.py and Populate.py (before naomi is imported) and adds a system locale check to warn the user if a non-UTF-8 locale is detected.