Unverified Commit 7d0b6fc3 authored by Joao Gante's avatar Joao Gante Committed by GitHub
Browse files

CLI: Properly detect encoder-decoder models (#17605)

parent ee82c86b
......@@ -207,7 +207,7 @@ class PTtoTFCommand(BaseTransformersCLICommand):
tf_from_pt_model = tf_class.from_pretrained(self._local_dir, from_pt=True)
# Extra input requirements, in addition to the input modality
if hasattr(pt_model, "encoder") and hasattr(pt_model, "decoder"):
if config.is_encoder_decoder or (hasattr(pt_model, "encoder") and hasattr(pt_model, "decoder")):
decoder_input_ids = np.asarray([[1], [1]], dtype=int) * pt_model.config.decoder_start_token_id
pt_input.update({"decoder_input_ids": torch.tensor(decoder_input_ids)})
tf_input.update({"decoder_input_ids": tf.convert_to_tensor(decoder_input_ids)})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment