Skip to content

Commit

Permalink
compile time tests script added
Browse files Browse the repository at this point in the history
  • Loading branch information
NishantPrabhuFujitsu committed Nov 1, 2024
1 parent 9ec63be commit 2beeb13
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 5 deletions.
20 changes: 20 additions & 0 deletions compile_expts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# TinyLlama
touch TinyLlama-1.1B-Chat-v1.0.txt
for i in {1..10}; do
echo "TinyLlama $i"
python compile_test.py ../genAI/models/TinyLlama-1.1B-Chat-v1.0
done

# Llama-2-7b
touch Llama-2-7b-hf.txt
for i in {1..10}; do
echo "Llama-2-7b $i"
python compile_test.py ../genAI/models/Llama-2-7b-hf
done

# Llama-3-8B
touch Meta-Llama-3-8B-Instruct.txt
for i in {1..10}; do
echo "Llama-3-8B $i"
python compile_test.py ../genAI/models/Meta-Llama-3-8B-Instruct
done
34 changes: 34 additions & 0 deletions compile_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import numpy as np
import openvino as ov
import openvino.properties.hint as hints
import openvino.properties as props
import time
import sys
import os

from transformers import AutoTokenizer
from tqdm import tqdm


def main(model_dir):
core = ov.Core()
core.set_property("CPU", {hints.execution_mode: hints.ExecutionMode.PERFORMANCE})

config = {
props.inference_num_threads: 64,
hints.inference_precision: "f16",
}

start = time.time()
model = core.compile_model(model_dir + "/openvino_model.xml", "CPU", config)
end = time.time()

model_name = os.path.basename(model_dir)
with open(f"{model_name}.txt", "a") as f:
f.writelines(f"{end - start},")

print(f"{model_name}: {end - start} sec")


if __name__ == "__main__":
main(sys.argv[1])
2 changes: 1 addition & 1 deletion src/plugins/intel_cpu/thirdparty/ComputeLibrary
Submodule ComputeLibrary updated 143 files
2 changes: 1 addition & 1 deletion src/plugins/intel_cpu/thirdparty/onednn
Submodule onednn updated 1 files
+1 −4 cmake/platform.cmake
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/thirdparty/onednn_gpu
Submodule onednn_gpu updated 1450 files
2 changes: 1 addition & 1 deletion src/plugins/intel_npu/thirdparty/level-zero-ext
Submodule level-zero-ext updated 1 files
+253 −2 ze_graph_ext.h
2 changes: 1 addition & 1 deletion thirdparty/onnx/onnx
Submodule onnx updated 920 files

0 comments on commit 2beeb13

Please sign in to comment.