Skip to content

Instantly share code, notes, and snippets.

View usstq's full-sized avatar

Tingqian Li usstq

  • Intel
  • PRC, Zizh2
View GitHub Profile
@usstq
usstq / ovcausalllm.py
Last active September 4, 2023 00:49
ovcausalllm
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
@usstq
usstq / net_drawer.py
Last active September 18, 2021 04:33
improved net_drawer.py for onnx model visualize
# 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
#
@usstq
usstq / onnx_inspect.py
Last active May 4, 2023 05:51
a CLI tool for inspecting onnx model
#!/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:
@usstq
usstq / mytest.cpp
Last active August 24, 2021 01:50
xbyak profile with vtune
/*
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: