Views
No views yet

1git clone https://github.com/zankner/CLoud
2cd CLoud
3pip install -e .mosaicml/pytorch:2.3.0_cu121-python3.11-ubuntu20.04| Base Model | RM Type | Hugging Face Repo |
|---|---|---|
| Llama3-8B | Classic | ankner/Llama3-8B-Classic-RM |
| Llama3-8B | CLoud | ankner/Llama3-8B-CLoud-RM |
| Llama3-70B | Classic | ankner/Llama3-70B-Classic-RM |
| Llama3-70B | CLoud | ankner/Llama3-70B-CLoud-RM |
gradio cloud/demo.py. By default this will demo ankner/Llama3-8B-CLoud-RM, but you can change the model loaded in the script.1from cloud.model import CLoudRewardModel
2from transformers import AutoTokenizer
3
4model_name = "ankner/Llama3-8B-Cloud-RM" # Replace with RM trained with this repo
5model = CLoudRewardModel.from_pretrained(model_name, device_map="cuda")
6tokenizer = AutoTokenizer.from_pretrained(model_name, padding_side="left")
7
8user_prompt = [
9 "Write me a story",
10 "What is the capital of the moon?"
11]
12assistant_response = [
13 "No I don't want to do that.",
14 "Since the moon is made out of cheese, the capital is mozzerella."
15]
16
17rewards, critiques = model.predict_reward(user_prompt, assistant_response, tokenizer)
18
19for reward, critique in zip(rewards, critiques):
20 print("Critique:")
21 print(critique)
22 print("Reward:")
23 print(reward)
24 print("=" * 100)python cloud/data/build_official_ultra_llama.py --mode oraclepython cloud/data/build_official_ultra_llama.py --mode self-gen --model-size {model-size}{model-size} is the size of the model you are using (e.g. 8b, 70b).prompt and id columns. If you would like to build prompts from UltraFeedback and UltraInteract as we do in the paper run:
python cloud/data/build_ultra_prompts.py --save-name {name-to-save-as}python cloud/data/build_judgements.py --gen-model {model-generating-responses} --judge-model {model-judging-responses} --base-dataset {path-to-prompt-dataset} --save-name {name-to-save-as}python -m vllm.entrypoints.openai.api_server --model {path-to-gen/judge-model} --dtype bfloat16 --tensor-parallel-size {num-gpus} --port {8000 for gen and 8001 for judge}python cloud/data/generate_oracle_critiques.py --judge-model {model-generating-critiques} --base-dataset {path-to-responses-dataset} --save-name {name-to-save-as}cloud/train/configs/ folder.
We have already set the optimal hyperparameters that we found for each model as reported in the paper.
The only parameter that needs to be set is the variables.micro_batch_size parameter, in accordance with your GPU memory.loggers section in the config and fill in your wandb settings.save_folder parameter, which is ckpts/${variables.run_name} by default. The final checkpoint will contain a folder hf where the huggingface model is saved.Warning: The below training scripts for both CLoud and Classic prefill the dataset names to be the datasets we release. If you would like to train on your own dataset, you will need to follow the directions to build said dataset in the dataset section and change thevariables.dataset_pathparameter in the training configs.
composer -n {num_gpus} cloud/train/train.py cloud/train/configs/{model_size}_critique_sft.yaml{model_size} with the size of the model you are training (e.g. 8b, 70b).python -m vllm.entrypoints.openai.api_server --model {path-to-critique-sft-model} --dtype bfloat16 --tensor-parallel-size {num-gpus}python cloud/data/generate_self_critiques.py --model {path-to-critique-sft-model} --base-dataset {path-to-base-dataset} --upload-name {path-to-save-dataset}composer -n {num_gpus} cloud/train/train.py cloud/train/configs/{model_size}_cloud.yamlcomposer -n {num_gpus} cloud/train/train.py cloud/train/configs/{model_size}_classic.yamlpython cloud/eval/eval.py --model-path {path-to-model} --benchmark {benchmark-name}1@misc{ankner2024critiqueoutloudrewardmodels,
2 title={Critique-out-Loud Reward Models},
3 author={Zachary Ankner and Mansheej Paul and Brandon Cui and Jonathan D. Chang and Prithviraj Ammanabrolu},
4 year={2024},
5 eprint={2408.11791},
6 archivePrefix={arXiv},
7 primaryClass={cs.LG},
8 url={https://arxiv.org/abs/2408.11791},
9}