Skip to content

Instantly share code, notes, and snippets.

@andreaschandra
Last active June 6, 2020 08:08
Show Gist options
  • Save andreaschandra/0b0d67a04cd336a1b8dac21893d01fbc to your computer and use it in GitHub Desktop.
Save andreaschandra/0b0d67a04cd336a1b8dac21893d01fbc to your computer and use it in GitHub Desktop.
def generate_model(args, num_labels):
config = AutoConfig.from_pretrained(
args.model_name_or_path,
num_labels=num_labels,
finetuning_task=args.task_name,
)
tokenizer = AutoTokenizer.from_pretrained(
args.model_name_or_path,
do_lower_case=args.do_lower_case
)
model = AutoModelForSequenceClassification.from_config(
config
)
return config, tokenizer, model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment