plurigrid / act

building blocks for cognitive category theory
MIT License
2 stars 1 forks source link

integrate command-r plus into the active inference loop (~generative reaction-diffusion process) #2

Open bmorphism opened 3 months ago

bmorphism commented 3 months ago

wrap the following Python <> Babashka interactions into:

  1. cli designated for ongoing interactions with the model via a standard out interface to start - response loop that can be passed to Babashka process using standard out, e.g. act.py

Read the output from a shell command as a lazy seq of strings:

$ act.py "user input oink oink oink" | bb -i '(take 2 *input*)'
("command-r plus model response or responses for more than one generation" "command-r plus model and so on and so on")

Read EDN from stdin and write the result to stdout:

$ bb '(vec (dedupe *input*))' <<< '[1 1 1 1 2]'
[1 2]

in an ongoing loop that runs:

from mlx_lm import load, generate

model, tokenizer = load("mlx-community/c4ai-command-r-plus-4bit")
response = generate(model, tokenizer, prompt="user input oink oink oink", verbose=True)
  1. instructions on how to run the Babashka script in README.md