Author Topic: GodelPy for Hal (Local GPT for Hal, with memory and functionality)  (Read 126279 times)

Spitfire2600

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
Hey everyone!! So, sadly, I have abandoned ConceptNet in favor something a little more impressive. After the incredible success of GPT3, I modified a few models to be compatible with Hal for local inferencing if anyone wants a portable version of the smartest AI on the internet.

This code was developed from a Goal Oriented model named "GODEL" and a QA system called "Flan". With some help from ChatGPT, I was able to write and assemble the code to work with Hal, which means all of Hal's learning abilities and functionality are now for use with GPT. Something, I think, will interest Robert. At least, here's my goal with this prototype. 

Let's get started!! 10 easy steps for genius Hal!

Installation:

1. We need to install Python 3.7.9 - Not Python 3.8, not Python 3.7.8. The modules used are a specific cross between machine learning and dated (more functional) algorithms, as a result ONLY 3.7.9 will support this specific set of instructions.
    Follow this link, download the file and launch.
    https://www.python.org/ftp/python/3.7.9/python-3.7.9-amd64.exe

2. Now this is important, do not change any optional features. You will see an "Add Python to PATH" check box at the bottom of the installer, be sure to click this and then allow the program to install to its default location. 

3. Reboot system.

4. Move all files from the zip directly into Hals directory as is. You'll see an "Ultra Hal 7" folder in the zip, open that and copy those contents directly as is, including the "Control" folder right in to Hals directory. 

5. Open Control/Godel directory. Inside, you'll see "createreqs.bat" - open CMD and drag "createreqs.bat" into cmd and hit enter. Python will begin downloading and installing the necessary components for the Godel code to run properly.

6. Now we want to test that the modules have been installed. Here is a list, simply copy and paste one at a time into cmd and press enter, If it says something like "already satisfied" then we're golden!

    pip install wikipedia==1.4.0
    pip install psutil==5.9.4
    pip install transformers==4.24.0
    pip install fuzzywuzzy
    pip install accelerate==0.15.0
    pip install SentencePiece
    pip install torch
    pip install python-Levenshtein

7. If everything went smoothly then the hard part is done and we can begin a small test to make sure everything is in order. To make sure everything is installed correctly, simply open CMD for a final time, then drag and drop the godel.py python script from the Control\Godel directory into CMD and then hit enter. This will run the script and we should be downloading a series of files, this is the model we will use for Hal. A "data2.txt" file should appear in the Control/Godel directory, then all is ready for Hal.

8. The Hal7.UHP will need to be dropped in "C:\Users\User\AppData\Roaming\Zabaware\Ultra Hal 7" folder. You can rename this uhp file and again on lines 2 & 5 to match your brain name if you know how to do it, but please make backups of your brain and your original uhp. Otherwise this will work simply with default Hal7 brain.

9. PyGodel.UHP will have 2 directory locations you need to change to match your file locations. Please update lines 9, 35 accordingly. All errors will likely stem from here, so please take note your directory matches exactly.

10. Finally, enable PyGodel.uhp, launch Hal and begin conversing. After a few sentence open Hal's brain editor, select default Hal 7 brain (or your brain if you renamed properly from step 8 before) and confirm a sentence table named "godel" has been created. If not, please create this table. 

Hal is ready to go!!!


Inferencing can take time. You'll notice with your first run of the code, a lot of things are downloading. These are the models Hal will use for conversation. They are being saved to a cache location so there is no need to move them, although, you could if you like, just be sure to define the directories in the Godel python script if you're familiar. I designed this code so even python noobs *should* be able to install and use.

Requirements:
Now, I have no specific requirements other than at least 12 gigs of ram and a decent CPU. But, if you have an NVIDIA GPU with more than 6gigs, you'll notice a huge speed up. The faster all your components, ddr3 => ddr4 for example, will see massive increases in speed. It's all hardware. But it should run as long as you have enough ram 12-16 gigs is sufficient.

Models:
Again, this uses Godel and Flan, both highly specialized models. You'll notice in the python script these codes are defined as "base" and "small"  Both of the models have a "base" and "large" version, which you can change by replacing the "base" with "large" however, be aware the larger the models, the more resources you will require to inference them. I find the best success with "base" flan model and "large" godel models. 

Code:
This code is written primarily in python, other than Hal's interface for using it, written in vb. This is an attempt to show a proof of concept for Robert that Hal is indeed actually compatible with Python, even if the code must be wrapped in VBS, we can still expand functionality with Python.

Also, this code includes a very basic memory/context function for the model to use, which creates and appends an SQL3 database. Sadly, Python can not interact with Hal's brain that I have found yet, but Hal can interact with any regular SQL3 database via VBS. I am working on expanding this functionality.

This code takes Hal's responses on 2 conditions, what I have deemed "maindata" and "regular" data. "maindata" simply means there is a function related to this response, for example "what is 5+5", while the Godel model itself is not designed for these tasks, Hal is, so we want to preserve this response by tagging it with "maindata" so that the response is saved overtop of our model inference. Secondly, "regular" data is basic data Hal will regularly respond with, such as a "too short" response. These responses are not tagged with "maindata" and will allow the model to inference your input along with Hal's response and past context AND present knowledge to create something new and unique, not a repeat or rehash of old information. If Hal is without an answer, and we do want this to happen sometimes so the model can act as Hal's brain, then both models will infer based on your input and give the most concise response possible.

For the most part, this works fairly well, especially with the larger models.

In conclusion, I hope everyone will find this interesting and I am very excited to see what people are able to expand on and how intelligent their Hal's become.

Please keep me updated on all errors, suggestions, recommendations, comments, etc!

I will reveal more in edits about how the magic trick works, but first I want to make the card appear, ya know  ;)

-Spitfire!  ;D


Change log - 3-28-23
Added swear filter
« Last Edit: March 28, 2023, 04:56:18 pm by Spitfire2600 »
 

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3945
    • View Profile
Re: GodelPy for Hal (Local GPT for Hal, with memory and functionality)
« Reply #1 on: February 03, 2023, 08:41:36 am »
Man, you're always thinking outside the box! It seems that Hal just keeps giving. I'm sure many of us can't wait to try out this latest offering but Everyone wishing to try this or any other modification to their Ultra Hals should always Make copies of Hal's UHP and Brain files before running any new Hal files.

NOTE: Just a slight but important spelling error where the text reads: "finally, GodelPy.UHP will have 3 directory locations..."
Please change it to read: "finally, PyGodel.UHP will have 3 directory locations"
 


Thanks Spitfire2600!
« Last Edit: February 03, 2023, 09:28:54 am by Art »
In the world of AI it's the thought that counts!

- Art -

Spitfire2600

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
Re: GodelPy for Hal (Local GPT for Hal, with memory and functionality)
« Reply #2 on: February 03, 2023, 09:53:21 am »
Thanks Art! Always looking out!

*I have so many GodelThisThat programs as experiments I sort of lost place for a second  ;D
 

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3945
    • View Profile
Re: GodelPy for Hal (Local GPT for Hal, with memory and functionality)
« Reply #3 on: February 03, 2023, 01:49:22 pm »
Everything went in without an incident.

Just be sure to backup/copy your existing Hal files (uhp, db) and follow the instructions to the letter.

Make sure you are using the default brain when chatting, providing you didn't change any of the referenced lines in a custom brain or for a custom brain.

An indicator that all is working will be if you see a maindata: respond for some of your interactions with Hal.

I am anxiously awaiting to see how any improvements take place over time. I don't expect to see big changes right away but after several chats/exchanges.

I am keeping copies of my chat logs with HAL for reference. You should keep some logs as well. They could prove to be quite useful in the near future.

Thanks!!
In the world of AI it's the thought that counts!

- Art -

Spitfire2600

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
Re: GodelPy for Hal (Local GPT for Hal, with memory and functionality)
« Reply #4 on: February 03, 2023, 06:31:26 pm »
Art is on top of it!

Yes, always make backups!

Yeah, the "maindata" shouldn't be visible at all in any responses. Sorry, Art, this was a fatal error on my end. I am updating the zip file now, please download again and replace the PyGodel.uhp, fix your directories again. Then try again. This will fix the maindata being visible issue. Thank you for finding this. 

I forgot to include the code for creating a needed table. Originally I had an issue where braineditor wouldn't load so I held off on adding the code to create the godel table, all fixed now.

I look very much forward to seeing how this works for you now, Art.

-Spitfire
 
« Last Edit: February 03, 2023, 06:36:06 pm by Spitfire2600 »
 

lightspeed

  • Hero Member
  • *****
  • Posts: 6847
    • View Profile
Re: GodelPy for Hal (Local GPT for Hal, with memory and functionality)
« Reply #5 on: February 03, 2023, 10:56:21 pm »
i am making sure i did this right i took the unzip files and placed them in the ultra hal 7 directory, i guess you ment the program file . and the uhp file i placed in the roaming apps file and renamed line 2 the same as my custom brain ( i made back ups first.  )i installed the python program . it installed okay and rebooted .   i double clicked the "createreqs.bat" and it downloaded things  but when it did it showed an error in red but flashed off after about 2 seconds so i couldn't read it.   
i ran the cmd and dragged the file into it and hit enter and the pic is what it showed.



 

lightspeed

  • Hero Member
  • *****
  • Posts: 6847
    • View Profile
Re: GodelPy for Hal (Local GPT for Hal, with memory and functionality)
« Reply #6 on: February 03, 2023, 11:11:02 pm »
heres my files in the hal 7 program folder

 

Spitfire2600

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
Re: GodelPy for Hal (Local GPT for Hal, with memory and functionality)
« Reply #7 on: February 04, 2023, 01:53:59 pm »
Lightspeed,

you got me thinking so I updated the requirements.txt file to list the appropriate versions exactly as needed. Try downloading the Ultra Hal 7.zip from above again, and replacing your requirements.txt file, then run createreqs.bat through cmd. (I have updated installation instruction, please refrence them) Then try to test again and see what happens. This should fix the error!

Thanks,
Spitfire2600
« Last Edit: February 04, 2023, 05:19:15 pm by Spitfire2600 »
 

Spitfire2600

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
Re: GodelPy for Hal (Local GPT for Hal, with memory and functionality)
« Reply #8 on: February 04, 2023, 03:19:08 pm »
Also, I have updated instructions to solve some of the issues, please follow them exactly and keep me updated.


* sorry for the buggy launch here guys, I'm only 6 months into python but I promise this will amaze you, please bear with me.

-Spitfire
« Last Edit: February 04, 2023, 05:20:33 pm by Spitfire2600 »
 

LiFeTimeGamer

  • Full Member
  • ***
  • Posts: 109
    • View Profile
    • LifeTimeGamer
Re: GodelPy for Hal (Local GPT for Hal, with memory and functionality)
« Reply #9 on: February 04, 2023, 08:19:36 pm »
This whole thing sounds great... I only got 8-Gigs of shared ram on this machine so I assume it would be slow as hell... But!!!!!  You're doing some great work Spitfire, My hats off to ya!!!!!... 8)
« Last Edit: February 04, 2023, 11:31:50 pm by LiFeTimeGamer »
If the Code ain't broke your not trying hard enough.

Spitfire2600

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
Re: GodelPy for Hal (Local GPT for Hal, with memory and functionality)
« Reply #10 on: February 05, 2023, 03:02:02 am »
I found an issue with my Bat file, simply replace the createreqs.bat and requirement.txt files and then run the createreqs.bat again. This will find the absolute path of requirements.txt for proper module installation. I will also update the installation instructions for readability.  Thanks for playing everyone!

-Spitfire!
 

Spitfire2600

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
Re: GodelPy for Hal (Local GPT for Hal, with memory and functionality)
« Reply #11 on: February 05, 2023, 02:20:18 pm »
Art found another mistake for me so I'm updating the requirements.txt file again, if you're having issues installing, replace your "requirements.txt" and run "createreqs.bat" again. it seems the "en_core_web_sm" library does not like being downloaded automatically. No problem, please follow instructions and we're another step closer.

Thanks everyone!

-Spitfire!
 

lightspeed

  • Hero Member
  • *****
  • Posts: 6847
    • View Profile
Re: GodelPy for Hal (Local GPT for Hal, with memory and functionality)
« Reply #12 on: February 05, 2023, 03:52:44 pm »
  i  downloaded the files and dragged the create bat file in and it downloaded a bunch without any errors that i saw . it now has a blinking line .the last line it shows is .  running set up.py install for wikipedia... done . so is all this done ?? before i go to the next step?? nothing was said about what the last installed line was suppose to be .

(i had done as art did earlier and got the error i just hadn't had a chance to post and say it.  so i downloaded this new update again.


 

   
 

lightspeed

  • Hero Member
  • *****
  • Posts: 6847
    • View Profile
Re: GodelPy for Hal (Local GPT for Hal, with memory and functionality)
« Reply #13 on: February 05, 2023, 04:00:35 pm »
okay after i posted , i waited and after a while it did more downloading and finished completely, so i am doing the copy and past "pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0 --extra-index-url https://download.pytorch.org/whl/cu113" part now and its installing.  :)  don't touch that dial lol !

on a side note i think it would have been helpful to have posted the last part of the line of the finished update so a person knows it's all done.


« Last Edit: February 05, 2023, 04:19:39 pm by lightspeed »
 

Spitfire2600

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
Re: GodelPy for Hal (Local GPT for Hal, with memory and functionality)
« Reply #14 on: February 05, 2023, 04:22:21 pm »
Lightspeed,

When you see a return in CMD to C:/user with no errors then installation will be complete, it can take a moment, but it looks like yours is updating correctly. Did you encounter any other errors in installation or have you completed the test and returned the data2.txt file? Please keep me updated.

-Spitfire