This file contains hidden or 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
from transformers import AutoTokenizer, AutoModelForCausalLM | |
from optimum.intel import OVModelForCausalLM | |
import time | |
import argparse | |
import os, sys | |
import numpy as np | |
import torch | |
import hashlib | |
import itertools |
This file contains hidden or 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
from openvino.runtime import Core, Model, Tensor, PartialShape, Type, Shape, op | |
from openvino.runtime.op import util as op_util | |
from openvino.runtime import opset8 as opset | |
from openvino.runtime.passes import Manager | |
import numpy as np | |
import sys, os | |
import argparse | |
def pshape2str(partial_shape): |
This file contains hidden or 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
# SPDX-License-Identifier: Apache-2.0 | |
# A library and utility for drawing ONNX nets. Most of this implementation has | |
# been borrowed from the caffe2 implementation | |
# https://github.com/caffe2/caffe2/blob/master/caffe2/python/net_drawer.py | |
# | |
# The script takes two required arguments: | |
# -input: a path to a serialized ModelProto .pb file. | |
# -output: a path to write a dot file representation of the graph | |
# |
This file contains hidden or 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
#!/usr/bin/python3 | |
import onnx | |
import onnx.numpy_helper | |
import sys | |
def get_value_info(m, name): | |
if (name.startswith('%')): | |
name = name[1:] | |
for a in m.graph.value_info: | |
if a.name == name: |
This file contains hidden or 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
/* | |
Description: | |
Code2 is consistantly faster than Code because SSE2 instructions (like movdqu) | |
is not cooperating well with AVX registers. use AVX (vmovdqu) as much as possible. | |
------------------------------------------------------------------------------ | |
Install vtune & make a symbolic link | |
/opt/intel/vtune_amplifier -> /home/xxx/intel/oneapi/vtune/2021.5.0/ | |
How to compile: add following rules to Makefile: |