MCPcopy Create free account
hub / github.com/allenai/molmo2 / format_annotated_text

Method format_annotated_text

olmo/preprocessing/data_formatter.py:789–802  ·  view source on GitHub ↗
(self, answer, point_annotations)

Source from the content-addressed store, hash-verified

787 return normalized_label # fallback
788
789 def format_annotated_text(self, answer, point_annotations):
790 for point_annotation in point_annotations:
791 parts = answer.split("<|POINT|>", maxsplit=1)
792 # this is hard-coded for point-qa, which needs to be clipped and
793 # has a scale of 0 to 100
794 points = np.array(point_annotation["points"])
795 points = np.clip(points, 0, 100)
796 point_text = self._point_formatter.format_image_points(
797 points, 100,
798 point_annotation["inline_text"], point_annotation["alt_text"],
799 mode="point"
800 )
801 answer = parts[0] + point_text + parts[1]
802 return answer
803
804 def template_options(self, example, is_training, rng):
805 """Template a multiple choice questions"""

Callers 1

get_user_promptMethod · 0.95

Calls 1

format_image_pointsMethod · 0.45

Tested by

no test coverage detected