You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rationale - We don't want to depend on Torch when building for Android.
This add two things,
(1) for AoT, python image_util optionally generates a .csv from a jpg. In
addition to .pt.
(2) add a runtime runner flag which hints at the provided image is a
csv. And if so, the runner parses the csv and feeds it to the model.
This is very naive and obviously fragile. Added some checks in python.
Tested few ways,
- On M1, with torch, loaded both .pt and .csv generated from the same
jpg. And the LLM produces same text.
- On Android, without torch, loaded .csv and it also produces similar
text.:wq
# set the expected prefix to be the same as prompt because there's a bug in sdpa_with_kv_cache that causes <unk> tokens.
155
164
if [[ "$(uname)"=="Darwin" ]];then
156
165
EXPECTED_PREFIX="ASSISTANT: image captures a basketball game in progress, with several players on the court. One of the players is dribbling the ball, while the others are in various"
166
+
# TODO: This is what it produces on M1.
167
+
# EXPECTED_PREFIX="ASSISTANT: image captures a basketball game in progress, with a group of men playing on a basketball court. There are at least nine players on the court, each actively"
157
168
else
158
169
# set the expected prefix to be the same as prompt because there's a bug in sdpa_with_kv_cache that causes <unk> tokens.
159
170
EXPECTED_PREFIX="ASSISTANT:"
160
171
fi
161
172
if [[ "${RESULT}"==*"${EXPECTED_PREFIX}"* ]];then
162
173
echo"Expected result prefix: ${EXPECTED_PREFIX}"
163
174
echo"Actual result: ${RESULT}"
175
+
echo"Actual result (csv): ${RESULT_CSV}"
164
176
echo"Success"
165
-
exit 0
166
177
else
167
178
echo"Expected result prefix: ${EXPECTED_PREFIX}"
168
179
echo"Actual result: ${RESULT}"
169
-
echo"Failure; results not the same"
180
+
echo"Actual result (csv): ${RESULT_CSV}"
181
+
echo"Failure; generated text is not as expected"
182
+
exit 1
183
+
fi
184
+
185
+
if [[ "${RESULT}"==*"${EXPECTED_PREFIX}"* ]];then
186
+
echo".pt and .csv image produced same output"
187
+
echo"Success"
188
+
exit 0
189
+
else
190
+
echo".pt and .csv image inputs produced different outputs"
0 commit comments