GithubHelp home page GithubHelp logo

lorenzofamiglini / instructgoose Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xrsrke/instructgoose

0.0 0.0 0.0 2.56 MB

Implementation of Reinforcement Learning from Human Feedback (RLHF)

Home Page: https://xrsrke.github.io/instructGOOSE/

License: MIT License

Python 3.69% CSS 0.06% Jupyter Notebook 96.26%

instructgoose's Introduction

InstructGoose - 🚧 WORK IN PROGRESS 🚧

Paper: InstructGPT - Training language models to follow instructions with human feedback

image.png

Questions

  • In the context of RLHF, how to calculate the $L_t^{V F}(\theta)$,
    • Like it’s a function of the PPO agent uses to predict how much reward it gets if generates the sequence?
  • Does the RL model and the SFT model use the same tokenizer? Yes
  • I don’t know how to returns the logit of the generation model
  • Does the PPO Agent (Language Model) has a value network just like the regular PPO Agent?
  • I don’t understand how to calculate the advantage in PPO

Install

pip install instruct-goose

Train the RL-based language model

from transformers import AutoTokenizer, AutoModelForCausalLM
from instruct_goose import RLHFTrainer, create_reference_model, RLHFConfig
tokenizer = AutoTokenizer.from_pretrained("gpt2")
model = AutoModelForCausalLM.from_pretrained("gpt2")
ref_model = create_reference_model(model)

Train the reward model

TODO

  • Add support batch inference for agent
  • Add support batch for RLHF trainer

Resources

I used these resources to implement this

instructgoose's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.