Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aria-hacker committed Sep 29, 2024
1 parent 2d3c119 commit 17a10da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
14 changes: 2 additions & 12 deletions aria/model/modeling_aria.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,7 @@ def set_moe_z_loss_coeff(self, value):
Args:
value: The z-loss coefficient value to set.
"""
if hasattr(self.language_model, "set_z_loss_coeff"):
self.language_model.set_z_loss_coeff(value)
else:
logger.warning(
"The language model does not have a `set_z_loss_coeff` method. Ignore this warning if you are not using a MoYI model."
)
self.language_model.set_z_loss_coeff(value)

def set_moe_aux_loss_coeff(self, value):
"""
Expand All @@ -186,12 +181,7 @@ def set_moe_aux_loss_coeff(self, value):
Args:
value: The auxiliary loss coefficient value to set.
"""
if hasattr(self.language_model, "set_aux_loss_coeff"):
self.language_model.set_aux_loss_coeff(value)
else:
logger.warning(
"The language model does not have a `set_aux_loss_coeff` method. Ignore this warning if you are not using a MoYI model."
)
self.language_model.set_aux_loss_coeff(value)

# copied from transformers.models.llava.modeling_llava.LlavaForConditionalGeneration
def _merge_input_ids_with_image_features(
Expand Down
5 changes: 5 additions & 0 deletions aria/model/vision_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ def __init__(
self.min_image_size = min_image_size
self.image_mean = image_mean
self.image_std = image_std
self.auto_map = {
"AutoProcessor": "processing_aria.AriaProcessor",
"AutoImageProcessor": "vision_processor.AriaVisionProcessor",
}

# we make the transform a property so that it is lazily initialized,
# this could avoid the error "TypeError: Object of type Normalize is not JSON serializable"
# when we used save_pretrained or from_pretrained.
Expand Down

0 comments on commit 17a10da

Please sign in to comment.