Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsherstinsky committed May 23, 2024
1 parent a8e5376 commit 9b91d6b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions ludwig/encoders/image/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,16 +382,17 @@ def __init__(
raise ValueError("img_height and img_width should be identical.")
self._input_shape = (in_channels, img_height, img_width)

config_dict: dict
if use_pretrained and not saved_weights_in_checkpoint:
config_dict = {
"pretrained_model_name_or_path": pretrained_model,
}
if output_attentions:
transformer = ViTModel.from_pretrained(
pretrained_model_name_or_path=pretrained_model,
attn_implementation="eager",
)
else:
transformer = ViTModel.from_pretrained(pretrained_model_name_or_path=pretrained_model)
config_dict["attn_implementation"] = "eager"

transformer = ViTModel.from_pretrained(**config_dict)
else:
config_dict: dict = {
config_dict = {
"image_size": img_height,
"num_channels": in_channels,
"patch_size": patch_size,
Expand Down

0 comments on commit 9b91d6b

Please sign in to comment.