Skip to content

Conversation

jon-tow
Copy link
Collaborator

@jon-tow jon-tow commented Nov 21, 2022

This PR adds support for more CausalLMs in the HuggingFace Hub. Previously, only models that followed the gpt2 architecture layer-naming convention were supported (except for ILQL which also supports gpt-neox).
This will allow one to use models such as OPT and Pythia out of the box.

wandb reports:

Notes:

  • As discussed in the TRLX meeting (Dec. 5, 2022) - I've ignored the implementation of BLOOM for hydra-style model branching. CC @LouisCastricato

Related Issue: #121



@pytest.mark.parametrize(
"model_name",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice this is great


**PPO**

.. autoclass:: trlx.model.accelerate_ppo_model.AcceleratePPOModel
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will probably have to merge with @reciprocated latest commit (just fyi)

def _getattr(obj, attr):
return getattr(obj, attr, *args)

return functools.reduce(_getattr, [obj] + attr.split("."))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@Dahoas
Copy link
Collaborator

Dahoas commented Nov 21, 2022

Looks very nice! For some reason tests for the HydraHead are breaking (I'm trying to see why).

Edit: I think it's negligible. We should should the assert equal to something like self.assertTrue(hs_diff <= 1e-5)

@jon-tow
Copy link
Collaborator Author

jon-tow commented Nov 21, 2022

@Dahoas Thanks for the review! This is still in draft as I'll be adding more tests and running examples. I'll bother you again for another review later, if you don't mind 😄

@dongs0104
Copy link
Contributor

OPTForCausalLM is working well ? cause i changed ppo trainer code, and trained but result was bad results was not like gpt2,

OPT Model is going to add a special token, </s> value function loss is not convergence. any idea for it ?

@jon-tow
Copy link
Collaborator Author

jon-tow commented Nov 23, 2022

Hi @dongs0104! The default PPO trainer uses a GPT hydra-head modification which will require re-working of the internals to support other models such as OPT. I plan to add hydras for OPT in this PR soon.

Thanks for bringing awareness to possible special-token issues - we'll keep an eye on it 👍

@danyang-rainbow
Copy link

Good job!

@jon-tow jon-tow marked this pull request as ready for review December 6, 2022 00:12
Copy link
Contributor

@LouisCastricato LouisCastricato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Lets merge.

logit_mask=None,
pad_token_id=50256,
eos_token_id=50256,
pad_token_id=None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

50256 is the default eos_token_id for gpt2 based tokenizers - this just ensures there is no implicit default for the other non-gpt2 models.

@LouisCastricato LouisCastricato merged commit 803f8cf into CarperAI:main Dec 6, 2022
@Dahoas
Copy link
Collaborator

Dahoas commented Dec 6, 2022

This is excellent!

@jon-tow jon-tow deleted the auto-convert-layers branch December 7, 2022 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants