Skip to content

Commit 0aefdbf

Browse files
committed
hybrid encoder hasn't attn_layers
1 parent 5fca76e commit 0aefdbf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pix2tex/models/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ def get_model(args, training=False):
4646
decoder.to(args.device)
4747
if args.wandb:
4848
import wandb
49-
en_attn_layers = encoder.module.attn_layers if available_gpus > 1 else encoder.attn_layers
49+
en_attn_layers = encoder
50+
if args.encoder_structure.lower() == 'vit':
51+
en_attn_layers = encoder.module.attn_layers if available_gpus > 1 else encoder.attn_layers
5052
de_attn_layers = decoder.module.net.attn_layers if available_gpus > 1 else decoder.net.attn_layers
5153
wandb.watch((en_attn_layers, de_attn_layers))
5254
model = Model(encoder, decoder, args)

0 commit comments

Comments
 (0)