openplayground README

The project's README from github.com/nat/openplayground. As one markdown file: README.md.

openplayground

An LLM playground you can run on your laptop.

https://user-images.githubusercontent.com/111631/227399583-39b23f48-9823-4571-a906-985dbe282b20.mp4

Features

Try on nat.dev

Try the hosted version: nat.dev.

How to install and run

pip install openplayground
openplayground run

Alternatively, run it as a docker container:

docker run --name openplayground -p 5432:5432 -d --volume openplayground:/web/config natorg/openplayground

This runs a Flask process, so you can add the typical flags such as setting a different port openplayground run -p 1235 and others.

How to run for development

git clone https://github.com/nat/openplayground
cd app && npm install && npx parcel watch src/index.html --no-cache
cd server && pip3 install -r requirements.txt && cd .. && python3 -m server.app

Docker

docker build . --tag "openplayground"
docker run --name openplayground -p 5432:5432 -d --volume openplayground:/web/config openplayground

First volume is optional. It's used to store API keys, models settings.

Ideas for contributions

llama.cpp

Adding models to openplayground

Models and providers have three types in openplayground:

You can add models in server/models.json with the following schema:

Local inference

For models running locally on your device you can add them to openplayground like the following (a minimal example):

"llama": {
    "api_key" : false,
    "models" : {
        "llama-70b": {
            "parameters": {
                "temperature": {
                    "value": 0.5,
                    "range": [
                        0.1,
                        1.0
                    ]
                },
            }
        }
    }
}

Keep in mind you will need to add a generation method for your model in server/app.py. Take a look at local_text_generation() as an example.

API Provider Inference

This is for model providers like OpenAI, cohere, forefront, and more. You can connect them easily into openplayground (a minimal example):

"cohere": {
    "api_key" : true,
    "models" : {
        "xlarge": {
            "parameters": {
                "temperature": {
                    "value": 0.5,
                    "range": [
                        0.1,
                        1.0
                    ]
                },
            }
        }
    }
}

Keep in mind you will need to add a generation method for your model in server/app.py. Take a look at openai_text_generation() or cohere_text_generation() as an example.

Searchable models

We use this for Huggingface Remote Inference models, the search endpoint is useful for scaling to N models in the settings page.

"provider_name": {
    "api_key": true,
    "search": {
        "endpoint": "ENDPOINT_URL"
    },
    "parameters": {
        "parameter": {
            "value": 1.0,
            "range": [
                0.1,
                1.0
            ]
        },
    }
}

Credits

Instigated by Nat Friedman. Initial implementation by Zain Huda as a repl.it bounty. Many features and extensive refactoring by Alex Lourenco.

openplayground (nat/openplayground)

Searching Database…

这是什么?openplayground 是一个可以在自己笔记本电脑上运行的自托管 LLM 试验场:它提供网页界面,方便你试用、调参和对比来自多家供应商的模型。
这是一个我访问的网站,还是运行在我自己电脑上的东西?它是一个自托管的网页应用:Flask 服务器运行在你的电脑上,你在浏览器里使用试验场界面。
我怎么把它跑起来?以 Docker 容器方式运行,或者在命令行里用 openplayground run 启动(加 -p 1235 可以指定自定义端口),然后在浏览器里打开界面。
还有哪些不完善的地方?目前没有 token 或费用统计,没有类似 ChatGPT 的聊天界面,开源模型也还不能一键安装——维护者把这些列为希望有人贡献的功能,另外还缺一个 homebrew 包和一个 Dockerfile。
有没有不用安装就能试用的在线版本?有——README 里推荐了 nat.dev,这是同一个试验场的托管版本,你可以在浏览器里先试试效果,再决定要不要自己部署。
用手机能用吗?可以,README 说在手机上运行良好,因为这个界面本质上就是你电脑提供的一个网页。
Creator
nat
Size
1 MB
Stars
6.3K
Updated
CommitJun 05
Age
3y
Commits · 90 Days