merlinite-7b / README.md
alinaryan's picture
Upload README.md with huggingface_hub
ad205ef verified
# Labrador Synthetic Data Generation Pipeline
## Introduction
This repository contains the Labrador synthetic data generation pipeline, which is used to generate synthetic data for various purposes.
## Run Instructions (Automation)
### Step 1: Environment Setup
1. Initialize a `.env` file with the following [access tokens](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#personal-access-tokens-classic):
```
GIT_ACCESS_TOKEN={ACCESS-TOKEN-TO-ACCESS-TAXONOMY-REPO} # this personal access token is used to access instruct-lab/taxonomy repo
```
### Step 2: Execution
To run the pipeline:
1. Execute the following command:
NOTE: Depending on whether you are running on old or new vela, change this line in the orchestrator.py to use the appropriate old vela or new vela template. `save_job_with_jinja_template(cfg, "templates/labrador_datagen_vela.yaml.j2", output_dir=f"jobs/{branch}")`
```
python orchestrator.py branch-name
```
This will:
- Create a file with a list of leaf nodes in the `jobs` directory.
- Generate YAML files for each leaf node and store them in the `jobs` directory something like `test-7984f9cae729b798bed1ba222715b880.yaml`
2. To initiate the skill generation pipeline, run:
To trigger a job, take the above yaml and
```
oc create -f jobs/yaml_name.yaml
```
This command will execute the pipeline and store the results in the `new_data/labrador-datagen` directory within the COS bucket mounted on the Vela cluster.
## Run Instructions (Manual - Testing)
### Step 1: Run model
Run teacher model - this model can be replaced with any small model for testing purposes
```
text-generation-launcher -p 8080 --model-id mistralai/Mixtral-8x7B-Instruct-v0.1 --dtype bfloat16 --max-input-length 4096 --max-batch-prefill-tokens 4096 --max-total-tokens 12288
```
Next, set the following enviornment variables:
```
LEAF_NODE=knowledge/textbooks/ethics/qna.yaml # Path to the leaf node that you want to download
NUM_SAMPLES=30
NUM_GROUNDED_QUESTIONS=3
NUM_GEN_PROC=32
NUM_UTIL_PROC=8
SAVE_PATH=new_data/labrador_datagen # Path where you want to download the data
CONTEXT=0 # Set 0 for freeform and 1 for grounded
DATA_PATH=.
CHECKSUM=test
BRANCH_NAME=test # Branch name to download data from
KNOWLEDGE=1 # Set 0 for skills and 1 for knowledge
PARENT_DIR=$(dirname "$LEAF_NODE")
GIT_ACCESS_TOKEN= # Access token to access taxonomy repo
```
### Skills
Download data
```
wget --header "Authorization: token $GIT_ACCESS_TOKEN" --directory-prefix="$DATA_PATH/$PARENT_DIR" "https://raw.githubusercontent.com/instruct-lab/taxonomy/$BRANCH_NAME/$LEAF_NODE"
```
Run the Justfile using:
```
just run
```
The Justfile will check the context value. If the context is set to 1, it will run scripts for grounded data generation. If the context is set to 0, it will run scripts for freeform data generation and save the generated files in the root of the repo in the same directory structure.
### Knowledge
Download data
```
bash download_docs.sh
```
Run knowledge script
```
python knowledge_generation_pipeline.py
```