We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
class RobertaModelForSeq2Seq(RobertaPreTrainedModel): def __init__(self, model_name:str, config: RobertaConfig): super().__init__(config) self.config = config decoder_config = copy.deepcopy(config) decoder_config.is_decoder=True decoder_config.add_cross_attention=True self.encoder = RobertaModel.from_pretrained(model_name, config=config) self.decoder = RobertaModel.from_pretrained(model_name, config=decoder_config)
코드
결과
class RobertaForConditionalGeneration(RobertaPreTrainedModel): base_model_prefix = "model" _keys_to_ignore_on_load_missing = [r"lm_head\.bias", r"lm_head\.weight"] def __init__(self, model_name: str, config: RobertaConfig): super().__init__(config) self.model = RobertaModelForSeq2Seq(model_name, config) self.lm_head = RobertaLMHead(config)
class RobertaModelForSeq2Seq(RobertaPreTrainedModel): def __init__(self, model_name:str, config: RobertaConfig): super().__init__(config) self.config = config decoder_config = copy.deepcopy(config) decoder_config.is_decoder=True decoder_config.add_cross_attention=True self.encoder = RobertaModel.from_pretrained(model_name, config=config) self.decoder = RobertaModel.from_pretrained(model_name, config=decoder_config) def get_encoder(self): return self.encoder def get_decoder(self): return self.decoder def set_encoder(self, encoder): assert isinstance(encoder, RobertaModel) self.encoder = encoder def set_decoder(self, decoder): assert isinstance(decoder, RobertaModel) self.decoder = decoder
The text was updated successfully, but these errors were encountered:
No branches or pull requests
코드
결과
The text was updated successfully, but these errors were encountered: