Skip to content

Commit

Permalink
Debug example code for MegaForCausalLM (huggingface#23382)
Browse files Browse the repository at this point in the history
* Debug example code for MegaForCausalLM

set ignore_mismatched_sizes=True in model loading code

* Fix up
  • Loading branch information
Tylersuard authored and gojiteji committed Jun 5, 2023
1 parent 68bf97f commit 6edcec8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/transformers/models/mega/modeling_mega.py
Original file line number Diff line number Diff line change
Expand Up @@ -1743,7 +1743,9 @@ def forward(
>>> config = AutoConfig.from_pretrained("mnaylor/mega-base-wikitext")
>>> config.is_decoder = True
>>> config.bidirectional = False
>>> model = MegaForCausalLM.from_pretrained("mnaylor/mega-base-wikitext", config=config)
>>> model = MegaForCausalLM.from_pretrained(
... "mnaylor/mega-base-wikitext", config=config, ignore_mismatched_sizes=True
... )
>>> inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
>>> outputs = model(**inputs)
Expand Down

0 comments on commit 6edcec8

Please sign in to comment.