"...resnet50_tensorflow.git" did not exist on "260fa059170f4b41d00f34188789ea2ab80be8bf"
Unverified Commit 848fbe1e authored by Stas Bekman's avatar Stas Bekman Committed by GitHub
Browse files

[gen utils] missing else case (#6980)

* [gen utils] missing else case

1. `else` is missing - I hit that case while porting a model. Probably needs to assert there?
2. also the comment on top seems to be outdated (just vocab_size is being set there)

* typo
parent f7e80721
...@@ -358,7 +358,7 @@ class GenerationMixin: ...@@ -358,7 +358,7 @@ class GenerationMixin:
) )
pad_token_id = eos_token_id pad_token_id = eos_token_id
# current position and vocab size # vocab size
if hasattr(self.config, "vocab_size"): if hasattr(self.config, "vocab_size"):
vocab_size = self.config.vocab_size vocab_size = self.config.vocab_size
elif ( elif (
...@@ -367,6 +367,8 @@ class GenerationMixin: ...@@ -367,6 +367,8 @@ class GenerationMixin:
and hasattr(self.config.decoder, "vocab_size") and hasattr(self.config.decoder, "vocab_size")
): ):
vocab_size = self.config.decoder.vocab_size vocab_size = self.config.decoder.vocab_size
else:
raise ValueError("either self.config.vocab_size or self.config.decoder.vocab_size needs to be defined")
# set effective batch size and effective batch multiplier according to do_sample # set effective batch size and effective batch multiplier according to do_sample
if do_sample: if do_sample:
......
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