-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ghstack-source-id: 8a2df48b583f5c32976e6550b1ea94bb7b8afbe0 Pull Request resolved: #6344
- Loading branch information
1 parent
5add88d
commit 30959de
Showing
4 changed files
with
96 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/bash | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
set -exu | ||
|
||
if [[ -z "${PYTHON_EXECUTABLE:-}" ]]; then | ||
PYTHON_EXECUTABLE=python3 | ||
fi | ||
|
||
# Download and prepare stories model artifacts | ||
prepare_model_artifacts() { | ||
echo "Preparing stories model artifacts" | ||
wget -O stories110M.pt "https://huggingface.co/karpathy/tinyllamas/resolve/main/stories110M.pt" | ||
wget -O tokenizer.model "https://raw.githubusercontent.com/karpathy/llama2.c/master/tokenizer.model" | ||
echo '{"dim": 768, "multiple_of": 32, "n_heads": 12, "n_layers": 12, "norm_eps": 1e-05, "vocab_size": 32000}' > params.json | ||
} | ||
|
||
run_and_verify() { | ||
NOW=$(date +"%H:%M:%S") | ||
echo "Starting to run eval_llama at ${NOW}" | ||
if [[ ! -f "stories110M.pt" ]]; then | ||
echo "stories110M.pt is missing." | ||
exit 1 | ||
fi | ||
if [[ ! -f "tokenizer.model" ]]; then | ||
echo "tokenizer.model is missing." | ||
exit 1 | ||
fi | ||
if [[ ! -f "params.json" ]]; then | ||
echo "params.json is missing." | ||
exit 1 | ||
fi | ||
$PYTHON_EXECUTABLE -m examples.models.llama.runner.eager \ | ||
-c stories110M.pt \ | ||
-p params.json \ | ||
-t tokenizer.model \ | ||
-kv \ | ||
-d fp32 \ | ||
--max_seq_length 32 \ | ||
--temperature 0 \ | ||
--prompt "Once upon a time," > result.txt | ||
|
||
# Verify result.txt | ||
RESULT=$(cat result.txt) | ||
EXPECTED_RESULT="there was a little girl" | ||
if [[ "${RESULT}" == "${EXPECTED_TASK}"* ]]; then | ||
echo "Actual result: ${RESULT}" | ||
echo "Success" | ||
exit 0 | ||
else | ||
echo "Actual result: ${RESULT}" | ||
echo "Failure; results not the same" | ||
exit 1 | ||
fi | ||
} | ||
|
||
prepare_model_artifacts | ||
run_and_verify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters