user24517104
user24517104

Reputation: 1

Image Captioning Transforner

I get the following error message when calling the training.TypeError: PhiForCausalLM.forward() got an unexpected keyword argument 'encoder_hidden_states' I am using following code;

tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-2", trust_remote_code=True)
tokenizer.pad_token = tokenizer.eos_token
AutoModelForCausalLM.from_pretrained("microsoft/phi-2", trust_remote_code=True)

feature_extractor = ViTFeatureExtractor.from_pretrained("hustvl/yolos-small", cache_dir=cache_dir)

model = VisionEncoderDecoderModel.from_encoder_decoder_pretrained("hustvl/yolos-small",
    decoder_pretrained_model_name_or_path="microsoft/phi-2",   # Phi2 
    tie_encoder_decoder=True,  # Tie encoder and decoder weights for joint training
    cache_dir=/   cache_dir"+"models") 

I tried to fix the problem with model.config.encoder_hidden_layers= False, but it didn't work.

Upvotes: 0

Views: 45

Answers (0)

Related Questions