diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 00000000..a7e792da --- /dev/null +++ b/.devcontainer/README.md @@ -0,0 +1,93 @@ +# devcontainer + +## example usage + +Below are some example use cases you might want to run from within the +devcontainer (either +[within VSCode locally](https://code.visualstudio.com/docs/devcontainers/create-dev-container#_create-a-devcontainerjson-file) +or in your browser via +[GitHub Codespaces](https://github.com/features/codespaces)). + +### Run pre-commit + +```bash +# run pre-commit +pre-commit run --all-files +``` + +A successfull run should look something like this: + +``` +@andrewm4894 ➜ /workspaces/Open-Assistant (devcontainer-improvements) $ pre-commit run --all-files +[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks. +[INFO] Initializing environment for https://github.com/psf/black. +[INFO] Initializing environment for https://github.com/psf/black:.[jupyter]. +[INFO] Initializing environment for https://github.com/pycqa/flake8. +[INFO] Initializing environment for https://github.com/pycqa/isort. +[INFO] Initializing environment for https://github.com/pre-commit/mirrors-prettier. +[INFO] Initializing environment for https://github.com/pre-commit/mirrors-prettier:prettier@2.7.1. +[INFO] Initializing environment for local. +[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks. +[INFO] Once installed this environment will be reused. +[INFO] This may take a few minutes... +[INFO] Installing environment for https://github.com/psf/black. +[INFO] Once installed this environment will be reused. +[INFO] This may take a few minutes... +[INFO] Installing environment for https://github.com/pycqa/flake8. +[INFO] Once installed this environment will be reused. +[INFO] This may take a few minutes... +[INFO] Installing environment for https://github.com/pycqa/isort. +[INFO] Once installed this environment will be reused. +[INFO] This may take a few minutes... +[INFO] Installing environment for https://github.com/pre-commit/mirrors-prettier. +[INFO] Once installed this environment will be reused. +[INFO] This may take a few minutes... +[INFO] Installing environment for local. +[INFO] Once installed this environment will be reused. +[INFO] This may take a few minutes... +trim trailing whitespace.................................................Passed +check python ast.........................................................Passed +check yaml...............................................................Passed +check json...............................................................Passed +check for case conflicts.................................................Passed +detect private key.......................................................Passed +fix python encoding pragma...............................................Passed +forbid submodules....................................(no files to check)Skipped +mixed line ending........................................................Passed +fix requirements.txt.....................................................Passed +check that executables have shebangs.....................................Passed +check that scripts with shebangs are executable..........................Passed +check BOM - deprecated: use fix-byte-order-marker........................Passed +check for broken symlinks............................(no files to check)Skipped +check for merge conflicts................................................Passed +check for added large files..............................................Passed +fix end of files.........................................................Passed +black-jupyter............................................................Passed +flake8...................................................................Passed +isort....................................................................Passed +prettier.................................................................Passed +Lint website.............................................................Passed +``` + +### Docker compose + +```bash +# build the image +docker compose up --build +``` + +You should see some docker containers being pulled and activated. + +Once you see a line like: + +``` +open-assistant-web-1 | Listening on port 3000 url: http://localhost:3000 +``` + +you should be able to access that port like below: + +image + +this port can then be forwarded to a browser tab like below: + +image diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b737430a..22f43374 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,7 +1,12 @@ { - "service": "frontend-dev", - "dockerComposeFile": "../docker-compose.yaml", - "forwardPorts": [3000], + "name": "Open-Assistant", + "image": "mcr.microsoft.com/vscode/devcontainers/universal", + "features": { + "ghcr.io/devcontainers-contrib/features/pre-commit:2": { + "version": "latest" + } + }, + "postCreateCommand": "bash .devcontainer/post_create_command.sh", "customizations": { "vscode": { "extensions": ["GitHub.copilot"] diff --git a/.devcontainer/post_create_command.sh b/.devcontainer/post_create_command.sh new file mode 100644 index 00000000..983576b9 --- /dev/null +++ b/.devcontainer/post_create_command.sh @@ -0,0 +1,2 @@ +# ensure pre-commit is installed +pre-commit install diff --git a/README.md b/README.md index 103dc010..b619c931 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,15 @@ interact with the website. **Note:** When logging in via email, navigate to `http://localhost:1080` to get the magic email login link. +**Note:** If you would like to run this in a standardized development +environment (a +["devcontainer"](https://code.visualstudio.com/docs/devcontainers/containers)) +using +[vscode locally](https://code.visualstudio.com/docs/devcontainers/create-dev-container#_create-a-devcontainerjson-file) +or in a web browser using +[GitHub Codespaces](https://github.com/features/codespaces), you can use the +provided [`.devcontainer`](.devcontainer/) folder. + ## The Plan We want to get to an initial MVP as fast as possible, by following the 3-steps diff --git a/docs/supervised_datasets.md b/docs/supervised_datasets.md new file mode 100644 index 00000000..0f8c986d --- /dev/null +++ b/docs/supervised_datasets.md @@ -0,0 +1,79 @@ +# Supervised datasets + +For discussion about usage of supervised data see issue +. + +## Motivation + +An important part of making the assistant useful is to teach it to understand +and follow instructions, and to perform large set of tasks well. + +While RLHF seems like the main ingredient, using existing supervised data might +help. + +There are two large-scale projects in the area of instruction-following / +multitask learning: Promptsource and Natural Instructions - these projects +crowdsourced templates and turned existing NLP datasets into +instruction-following seq2seq form in natural langauge. They include both +long-output training examples like generating a sentence that is a likely +consequence of sentence in the prompt, and short-output, like rating prediction +from review. (Pre-)training on such datasets should help model understand and +follow instructions and teach it many abilities neccessary to perform a large +set of tasks correctly. However, these data are not dialog-like - they do not +look like a normal conversation. + +There are also supervised dialog datasets such as Blended Skill Talk or SODA. In +constrast to instruction-following datasets, dialog data is not as focused on +"academic tasks" or correctness, but encourage the model to respond naturally +like a person would. + +### Promptsource + +- GitHub: +- paper: + [Multitask Prompted Training Enables Zero-Shot Task Generalization](https://arxiv.org/abs/2110.08207) +- project for preparing templates and working with them +- they generated a dataset using the templates: + - + - (with multilingual data but + English prompt) + - (with multilingual data + and machine-translated prompt) +- they trained zero-shot models (= models for following instructions in the + input) + - based on T5 architecture (encoder-decoder) called T0 family (and MT0 for + multilingual) + - and based on GPT architecture (decoder-only) called BloomZ family + - Huggingface demo: [T0](https://huggingface.co/bigscience/T0pp), + [MT0](https://huggingface.co/bigscience/mt0-large), + [BloomZ](https://huggingface.co/bigscience/bloomz), + - GitHub repo for T0: + - GitHub repo for BloomZ and MT0: + + +### Natural instructions + +- GitHub: +- paper: + [Super-NaturalInstructions: Generalization via Declarative Instructions on 1600+ NLP Tasks](https://arxiv.org/abs/2204.07705) +- they crowdsource directly the data prepared for instruction following (and + learning from a few examples) +- the GitHub repo = the dataset. It contains jsons +- they trained zero-shot and in-context few-shot models (in multiple sizes): + - mT5 architecture (encoder-decoder, multilingual pretraining) + - Huggingface demo few-shot: + + - Huggingface demo zero-shot: + + +### Blended Skill Talk + +- used by Facebook in Blenderbot project +- HuggingFace dataset: +- example model trained on it: + + +### SODA + +- GitHub: +- paper: diff --git a/website/cypress/e2e/create/initial_prompt.cy.ts b/website/cypress/e2e/create/initial_prompt.cy.ts new file mode 100644 index 00000000..b17f2dd9 --- /dev/null +++ b/website/cypress/e2e/create/initial_prompt.cy.ts @@ -0,0 +1,26 @@ +import { faker } from "@faker-js/faker"; + +describe("creating initial prompts", () => { + it("completes the current task on submit and on request shows a new task", () => { + cy.signInWithEmail("cypress@example.com"); + cy.visit("/create/initial_prompt"); + + cy.get('[data-cy="task-id"').then((taskIdElement) => { + const taskId = taskIdElement.text(); + + const prompt = faker.lorem.sentence(); + cy.log("prompt", prompt); + cy.get('[data-cy="reply"').type(prompt); + + cy.get('[data-cy="submit"]').click(); + + cy.get('[data-cy="next-task"]').click(); + + cy.get('[data-cy="task-id"').should((taskIdElement) => { + expect(taskIdElement.text()).not.to.eq(taskId); + }); + }); + }); +}); + +export {}; diff --git a/website/src/components/Layout.tsx b/website/src/components/Layout.tsx index 5f6f66b4..3564d765 100644 --- a/website/src/components/Layout.tsx +++ b/website/src/components/Layout.tsx @@ -17,4 +17,12 @@ export const getDefaultLayout = (page: React.ReactElement) => ( ); +export const getTransparentHeaderLayout = (page: React.ReactElement) => ( +
+
+ {page} +
+
+); + export const noLayout = (page: React.ReactElement) => page; diff --git a/website/src/components/Survey/TaskControls.tsx b/website/src/components/Survey/TaskControls.tsx index 9036dc0e..13a2bb4e 100644 --- a/website/src/components/Survey/TaskControls.tsx +++ b/website/src/components/Survey/TaskControls.tsx @@ -30,9 +30,13 @@ export const TaskControls = (props: TaskControlsProps) => { Skip {endTask.task.type !== "task_done" ? ( - props.onSubmitResponse(props.tasks[0])}>Submit + props.onSubmitResponse(props.tasks[0])}> + Submit + ) : ( - Next Task + + Next Task + )} diff --git a/website/src/components/TaskSelection/TaskSelection.tsx b/website/src/components/TaskSelection/TaskSelection.tsx index f258a90b..683c80e9 100644 --- a/website/src/components/TaskSelection/TaskSelection.tsx +++ b/website/src/components/TaskSelection/TaskSelection.tsx @@ -26,6 +26,12 @@ export const TaskSelection = () => { title="Summarize stories" link="/create/summarize_story" /> */} + - +