facebookresearch / ParlAI

A framework for training and evaluating AI models on a variety of openly available dialogue datasets.
https://parl.ai
MIT License
10.49k stars 2.1k forks source link

Custom reranker for 90M model #4222

Closed ai-john closed 2 years ago

ai-john commented 2 years ago

Hello,

Is there a way to use a custom reranker for the 90M model? If I understand correctly, behind the hood the generative model generates a number of responses and the outputs only one back. If so, could you please share some code snippets on how to inject that? I want to try and build a prototype where I reuse the DialoRPT between DialoGPT response ranking and ParlAI response ranking.

Thank you!

stephenroller commented 2 years ago

https://github.com/facebookresearch/ParlAI/blob/2deb0a58a7c4c43a5aa4003e3dc4adb070cd4fd8/parlai/core/torch_generator_agent.py#L1168

you can override the rerank_beams method in a custom agent of your own.