Skip to content

Commit 988602c

Browse files
move image generation init
1 parent 57af199 commit 988602c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

eole/models/model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,6 @@ def from_config(
416416
model = cls.build_blocks(
417417
model_config, vocabs, running_config=running_config
418418
) # corresponds to build_task_specific_model
419-
model._maybe_init_image_generation(model_config, running_config)
420419
# TODO: handle this better at some point?
421420
model.share_decoder_embeddings = model_config.share_decoder_embeddings
422421
# generator -> shall it be called within build_blocks?
@@ -976,7 +975,7 @@ def build_blocks(cls, model_config, vocabs, running_config=None):
976975
share_embeddings=model_config.share_embeddings,
977976
)
978977
decoder = build_decoder(model_config, running_config=running_config)
979-
return cls(
978+
model = cls(
980979
encoder=encoder,
981980
decoder=decoder,
982981
adapter=adapter,
@@ -988,8 +987,9 @@ def build_blocks(cls, model_config, vocabs, running_config=None):
988987
image_end_token_id=model_config.encoder.image_end_token_id,
989988
vit_position_embeddings=model_config.vit_position_embeddings,
990989
)
990+
model._maybe_init_image_generation(model_config, running_config)
991991
# from there, the base blocks exist, and the rest is done in the from_opt from base class
992-
992+
return model
993993
def embed_vision_language_features(self, src, images):
994994
# TODO: test with batch > 1?
995995
batch_size = src.size(0)

0 commit comments

Comments
 (0)