I use the following code to load the saved model:
config = T5Config.from_pretrained(
model_name_or_path,
cache_dir=model_args.cache_dir,
revision=model_args.model_revision,
use_auth_token=True if model_args.use_auth_token else None,
)
config.train_task_adapters = adapter_args.train_task_adapters
# Set tokenizer
tokenizer = AutoTokenizer.from_pretrained(
model_name_or_path,
cache_dir=model_args.cache_dir,
use_fast=model_args.use_fast_tokenizer,
revision=model_args.model_revision,
use_auth_token=True if model_args.use_auth_token else None,
)
# Initialize the model
model = T5ForConditionalGeneration.from_pretrained(
model_name_or_path,
from_tf=bool(".ckpt" in model_name_or_path),
config=config,
cache_dir=model_args.cache_dir,
revision=model_args.model_revision,
use_auth_token=True if model_args.use_auth_token else None,
adapter_config=adapter_config
)
However I recieive the following error:
RuntimeError: Error(s) in loading state_dict for T5ForConditionalGeneration:
size mismatch for encoder.model_embeddings.weight: copying a param with shape torch.Size([32128, 768]) from checkpoint, the shape in current model is torch.Size([32138, 768]).
size mismatch for decoder.model_embeddings.weight: copying a param with shape torch.Size([32128, 768]) from checkpoint, the shape in current model is torch.Size([32138, 768]).
exit 1