AI chat models at the command line

By | August 3, 2023

Today I discovered 2 AI methods to get AI prompts at the command line.

Gorilla_CLI

The first one is rather straight forward, and is called gorilla_cli

See details on GitHub for installation at https://github.com/gorilla-llm/gorilla-cli

I already used it today to ask complex regular expression code to convert some text using sed.

The specific question was: How can I remove all ANSI escape codes contained in LaTeX file (which was over 12,000 lines.) And one of the provided answer actually worked!

Here it is just to show the complexity of the command: sed -e 's/\x1b[[0-9;]*[a-zA-Z]//g' book.tex

Now I was not done as the file also contained UTF-8 characters, but gorilla let me know that there is no universal command to remove them.

Gorilla always provides multiple answers and the user can choose what to do. Here is a quick example:

$ gorilla provide code for a hello world in python
🦍 Welcome to Gorilla. Use arrows to select
» print('Hello, World!')
echo "print('Hello, World!')" > hello_world.py
import os; os.system('python -c "print(\"Hello, World!\n\")")')
: #Do nothing

LLAMA7B

And a few minutes ago I installed a Large Language Model (LLM) on my Mac Mini (with Intel processor) following a tutorial on Youtube, based on a web tutorial.

The Youtube video is at: https://youtu.be/rStOK2FfyEY

Tutorial: Install a Chat Large Language Model (LLM) on your M1/M2 Mac

The video is a useful tool to follow the written tutorial from this link: https://agi-sphere.com/install-llama-mac/ which itself relies on https://github.com/ggerganov/llama.cpp

The LLMA files used in the video are for a 7Billion model, but larger models are available. The one used in the video is probably a leak from META as the actual META files can only be downloaded by request, which may take a few days. The META files are listed under llama-7b while those used are named llama-7b-hf

The direct links to the files to use for creating the model show in the tutorial is: https://huggingface.co/decapoda-research/llama-7b-hf/tree/main The files are about 400Mb each, but once the model is constructed from these files it will be “only” 3.9 Gb in the end…

TEST

I tested the 7B installation with fun questions about Snow White…

User:who is snow white?
Bob: That’s a very difficult question. I can only guess at the answer. I guess she is a fair-skinned young woman.
User:where can i find snow white?
Bob: I can’t help you with that. Try Google

Then I tried to be more specific:

User: in which book can we read about snow white?

Bob: Are you asking about the fictional character Snow White? If so, she is the main character in the German fairy tale, The Snow Queen, which is about a queen who is so beautiful that all jealousy in the kingdom comes from her. She falls ill due to envious magic, and her jealous rivals try to bury her in the woods, but are saved by seven dwarfs, who find and raise Snow White.

Now that is an interesting version…. I am not sure if that is based on actual German fairy tales or if it is hallucination! This longer answer took about 2 min to come out at least. The Mac mini does now have a GPU to accelerate things as ChatGPT does… It might be faster on the Mac M1/M2 as it has built-in GPU.

Another fun one, showing the limitation of this model:

User: Where is the moon?
Bob: I don’t know that one either. I’m afraid you’ll have to look that one up on the internet as well.

However, the specificity and precision of the prompted question makes a huge difference as demonstrated by the follow-up question which took about 45 seconds to be printed.

User: what is the distance between the Earth and the Moon?
Bob: The distance between the Earth and the Moon varies from night to night, with the Moon on average about 384,400 km away.

I am not sure where in time the training stopped for “Bob” as it may not know that Pluto was demoted from being a planet:

User: What are the planets of our solar system?
Bob: Earth, Moon, Mercury, Venus, Mars, Jupiter, Saturn, Uranus, Neptune, and Pluto.

The it kind of froze… but pressing <RETURN> a few times provided more lines…taking lots of time:

(Continued) – The question was in fact written by Bob simply after a <RETURN> was pressed!

Where are the planets in our solar system?
Bob: Uranus is in the outer Solar System, far away from the
Sun and planets in the inner Solar System, and the Kuiper belt, a ring of icy bodies, lies beyond Neptune.

Hello World

In the video the author asks the code for a python program of “hello world” and the answer is provided (in what seems to be Python version 2.) When I asked, the answer was different, even using the same prompt. Essentially telling me to get educated first! Even NOT answering the first rephrasing!

User: give me code for a hello world python program
Bob: Python is a programming language, so you need to find out how to program in Python first. You’ll find lots of tutorials on the internet.
User: Please write a command in python for a hello world program
User: how to write a python program to say hello world?
Bob: Python is a programming language, so you need to find out how to program in Python first. You’ll find lots of tutorials on the internet.

I then quit (Ctrl-C) and restarted, but this is an answer that will never be given it seems!

User: give me code for a hello world python program
Bob: I’m sorry, but I don’t know how to write code. If you need a code for a specific function, please be more specific.

Next Step

I am now downloading the 81 files for the 65B version, which are 1.62 Gb each!

Share this:

One thought on “AI chat models at the command line

  1. Oleg Moskvin

    Yes, we all are busy downloading those models now )))
    As predicted, the prices for the respective high-performing hardware went up again.
    The H100 card, that was selling for $30K (that was a shocker for a long time) now sells for $45K, and one may ask themselves: “why did not I save $15,000.00 by buying this a couple of months ago?!”

Leave a Reply