Skip to content
View saferlhf-v's full-sized avatar

Block or report saferlhf-v

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Content in all repositories owned by your account will be closed.
Maximum 250 characters. Please don’t include any personal information such as legal names or email addresses. This note will only be visible to you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
saferlhf-v/README.md

Introduction

This project is built on top of the align-anything framework. We introduce new features through the Safe RLHF-V method, enhancing the safety and performance of RLHF multi-modal training.

Dataset

We use the BeaverTails-V dataset for training, a multimodal dataset covering nine primary safety domains, designed to help visual language models detect safety risks and content violations effectively.

Quick Start

Easy Installation

# clone the repository
git clone git@github.com:saferlhf-v/saferlhf-v.git
cd saferlhf-v

# create virtual env
conda create -n saferlhf-v python==3.11
conda activate saferlhf-v
  • [Optional] We recommend installing CUDA in the conda environment and set the environment variable.
# We tested on the H800 computing cluster, and this version of CUDA works well.
# You can adjust this version according to the actual situation of the computing cluster.

conda install nvidia/label/cuda-12.2.0::cuda
export CUDA_HOME=$CONDA_PREFIX

If your CUDA installed in a different location, such as /usr/local/cuda/bin/nvcc, you can set the environment variables as follows:

export CUDA_HOME="/usr/local/cuda"

Finally, install saferlhf-v by:

# We prepare quick installation for training, you can use the following command:
pip install -e .

Training

We provide some scripts for quick start, you can find them in the ./scripts directory. These scripts would automatically download the model and dataset, and run the training or evaluation.

For example, scripts/safe_rlhf_v.sh is the script for Safe RLHF-V training, you can run it by:

cd scripts
bash safe_rlhf_v.sh

Wandb Logger

We support wandb logging. By default, it is set to offline. If you need to view wandb logs online, you can specify the environment variables of WANDB_API_KEY before starting the training:

export WANDB_API_KEY="..."  # your W&B API key here

Report Issues

If you have any questions in the process of using saferlhf-v, don't hesitate to ask your questions on the GitHub issue page, we will reply to you in 2-3 working days.

License

saferlhf-v is released under Apache License 2.0.

Popular repositories Loading

  1. saferlhf-v saferlhf-v Public

    Python 24 2