Skip to content

Commit a5cc8b0

Browse files
committed
[llava] Remove torch.jit.save in llava example
Summary: As titled. Test Plan: Rely on CI test Reviewers: Subscribers: Tasks: Tags:
1 parent f688329 commit a5cc8b0

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

.ci/scripts/test_llava.sh

+2-7
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,8 @@ run_and_verify() {
149149

150150
# verify result.txt
151151
RESULT=$(cat result.txt)
152-
# set the expected prefix to be the same as prompt because there's a bug in sdpa_with_kv_cache that causes <unk> tokens.
153-
if [[ "$(uname)" == "Darwin" ]]; then
154-
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"
155-
else
156-
# set the expected prefix to be the same as prompt because there's a bug in sdpa_with_kv_cache that causes <unk> tokens.
157-
EXPECTED_PREFIX="ASSISTANT: image"
158-
fi
152+
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"
153+
159154
if [[ "${RESULT}" == *"${EXPECTED_PREFIX}"* ]]; then
160155
echo "Expected result prefix: ${EXPECTED_PREFIX}"
161156
echo "Actual result: ${RESULT}"

examples/models/llava/image_util.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,7 @@ def prepare_image(image: Image, target_h: int, target_w: int) -> torch.Tensor:
4848

4949
def serialize_image(image: torch.Tensor, path: str) -> None:
5050
copy = torch.tensor(image)
51-
m = nn.Module()
52-
par = nn.Parameter(copy, requires_grad=False)
53-
m.register_parameter("0", par)
54-
tensors = torch.jit.script(m)
55-
tensors.save(path)
56-
51+
torch.save(copy, path)
5752
logging.info(f"Saved image tensor to {path}")
5853

5954

0 commit comments

Comments
 (0)