-
Notifications
You must be signed in to change notification settings - Fork 489
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a10cfbb
Showing
87 changed files
with
152,882 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
#mISC | ||
.DS_Store | ||
.vscode/ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
yarn.lock* | ||
package-lock.json | ||
Cargo.lock | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Typescript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
# Parcel related files | ||
dist/ | ||
.cache/ | ||
.parcel-cache/ | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
bin/ | ||
# build/ | ||
develop-eggs/ | ||
dist/ | ||
eggs/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
.tox/ | ||
.coverage | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
|
||
# Translations | ||
*.mo | ||
|
||
# Mr Developer | ||
.mr.developer.cfg | ||
.project | ||
.pydevproject | ||
|
||
# Rope | ||
.ropeproject | ||
|
||
# Django stuff: | ||
*.log | ||
*.pot | ||
|
||
# Sphinx documentation | ||
docs/_build/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) [2023] [OpenPlayground] | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
# openplayground | ||
|
||
An LLM playground you can run on your laptop. | ||
|
||
https://user-images.githubusercontent.com/111631/227399583-39b23f48-9823-4571-a906-985dbe282b20.mp4 | ||
|
||
#### Features | ||
|
||
- Use any model from [OpenAI](), [Anthropic](), [Cohere](), [Forefront](), [HuggingFace](), [Aleph Alpha](), and [llama.cpp](). | ||
- Full playground UI, including history, parameter tuning, keyboard shortcuts, and logprops. | ||
- Compare models side-by-side with the same prompt, individually tune model parameters, and retry with different paramaters. | ||
- Automatically detects local models in your HuggingFace cache, and lets you install new ones. | ||
- Works OK on your phone. | ||
- Probably won't kill everyone. | ||
|
||
## Try on nat.dev | ||
|
||
Try the hosted version: [nat.dev](https://nat.dev). | ||
|
||
## How to install and run | ||
|
||
```sh | ||
$ pip install openplayground | ||
$ openplayground run | ||
``` | ||
|
||
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 | ||
|
||
```sh | ||
$ 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 && python app.py | ||
``` | ||
|
||
## Ideas for contributions | ||
|
||
- Add a token counter to the playground | ||
- Add a cost counter to the playground and the compare page | ||
- Measure and display time to first token | ||
- Setup automatic builds with GitHub Actions | ||
- The default parameters for each model are configured in the `server/models.json` file. If you find better default parameters for a model, please submit a pull request! | ||
- Someone can help us make a homebrew package, and a dockerfile | ||
- Easier way to install open source models directly from openplayground, with `openplayground install <model>` or in the UI. | ||
- Find and fix bugs | ||
- ChatGPT UI, with turn-by-turn, markdown rendering, chatgpt plugin support, etc. | ||
- We will probably need multimodal inputs and outputs at some point in 2023 | ||
|
||
### llama.cpp | ||
|
||
|
||
## Adding models to openplayground | ||
|
||
Models and providers have three types in openplayground: | ||
+ Searchable | ||
+ Local inference | ||
+ API | ||
|
||
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): | ||
```json | ||
"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): | ||
```json | ||
"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. | ||
|
||
```json | ||
"provider_name": { | ||
"api_key": true, | ||
"search": { | ||
"endpoint": "ENDPOINT_URL" | ||
}, | ||
"parameters": { | ||
"parameter": { | ||
"value": 1.0, | ||
"range": [ | ||
0.1, | ||
1.0 | ||
] | ||
}, | ||
} | ||
} | ||
``` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "@parcel/config-default", | ||
"compressors": { | ||
"*.{html,css,js,svg,map}": [ | ||
"...", | ||
"@parcel/compressor-gzip", | ||
"@parcel/compressor-brotli" | ||
] | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"plugins": { | ||
"tailwindcss": {} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"semi": false | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ | ||
"devDependencies": { | ||
"@parcel/compressor-brotli": "^2.8.3", | ||
"@parcel/compressor-gzip": "^2.8.3", | ||
"@types/chroma-js": "^2.4.0", | ||
"@types/react": "^18.0.27", | ||
"@types/react-dom": "^18.0.10", | ||
"autoprefixer": "^10.4.13", | ||
"buffer": "^5.7.1", | ||
"events": "^3.3.0", | ||
"https-browserify": "^1.0.0", | ||
"parcel": "^2.8.3", | ||
"postcss": "^8.4.21", | ||
"process": "^0.11.10", | ||
"punycode": "^1.4.1", | ||
"querystring-es3": "^0.2.1", | ||
"stream-http": "^3.2.0", | ||
"tailwindcss": "^3.2.4", | ||
"url": "^0.11.0", | ||
"util": "^0.12.5" | ||
}, | ||
"dependencies": { | ||
"@radix-ui/react-alert-dialog": "^1.0.2", | ||
"@radix-ui/react-checkbox": "^1.0.1", | ||
"@radix-ui/react-dropdown-menu": "^2.0.2", | ||
"@radix-ui/react-label": "^2.0.0", | ||
"@radix-ui/react-navigation-menu": "^1.1.1", | ||
"@radix-ui/react-popover": "^1.0.4", | ||
"@radix-ui/react-scroll-area": "^1.0.2", | ||
"@radix-ui/react-select": "^1.2.0", | ||
"@radix-ui/react-separator": "^1.0.1", | ||
"@radix-ui/react-slider": "^1.1.0", | ||
"@radix-ui/react-switch": "^1.0.1", | ||
"@radix-ui/react-toast": "^1.1.2", | ||
"@radix-ui/react-tooltip": "^1.0.3", | ||
"@types/draft-js": "^0.11.10", | ||
"chroma-js": "^2.4.2", | ||
"class-variance-authority": "^0.4.0", | ||
"clsx": "^1.2.1", | ||
"draft-js": "^0.11.7", | ||
"event-source-polyfill": "^1.0.31", | ||
"eventsource": "^2.0.2", | ||
"immutable": "^4.2.3", | ||
"localforage": "^1.10.0", | ||
"lucide-react": "^0.108.0", | ||
"match-sorter": "^6.3.1", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-responsive": "^9.0.2", | ||
"react-router-dom": "^6.8.1", | ||
"react-scroll": "^1.8.9", | ||
"react-select": "^5.7.0", | ||
"react-tiny-popover": "^7.2.3", | ||
"react-transition-group": "^4.4.5", | ||
"sort-by": "^1.2.0", | ||
"sse.js": "^0.6.1", | ||
"tailwind-merge": "^1.9.0", | ||
"tailwindcss-animate": "^1.0.5", | ||
"uuidv4": "^6.2.13" | ||
} | ||
} |
Oops, something went wrong.