Skip to content
This repository was archived by the owner on Mar 20, 2026. It is now read-only.
This repository was archived by the owner on Mar 20, 2026. It is now read-only.

stopping gradient for encoder of Transformer #1053

Closed

Description

@BaohaoLiao

Hello,
I have a pretrained model. I want to load it to train for another task and don't want to train the encoder of transformer. Do you have any convenient way to do that?

Activity

  1. myleott commented on Aug 27, 2019

    @myleott

    Take a look at the FairseqEncoderDecoderModel base class. It should be straightforward to overload the forward method, load any kind of pretrained encoder, and detach() the encoder's output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions