Skip to content

Instantly share code, notes, and snippets.

View pashu123's full-sized avatar
๐Ÿ˜‡
Working from home

Prashant Kumar pashu123

๐Ÿ˜‡
Working from home
View GitHub Profile
from iree import runtime as ireert
from iree.compiler import compile_str
import numpy as np
import os
with open(os.path.join("vicuna_fp32_cpu.vmfb"), "rb") as mlir_file:
flatbuffer_blob = mlir_file.read()
This file has been truncated, but you can view the full file.
/home/prashantkumar/SHARK/shark.venv/lib/python3.10/site-packages/torch/_ops.py:646:0: error: failed to legalize operation 'arith.constant'
/home/prashantkumar/SHARK/shark.venv/lib/python3.10/site-packages/torch/_ops.py:646:0: note: see current operation: %826 = "arith.constant"() <{value = dense<0.000000e+00> : vector<8xf16>}> : () -> vector<8xf16>
/home/prashantkumar/SHARK/shark.venv/lib/python3.10/site-packages/torch/_ops.py:646:0: error: failed to run translation of source executable to target executable for backend #hal.executable.target<"vulkan", "vulkan-spirv-fb", {spirv.target_env = #spirv.target_env<#spirv.vce<v1.6, [Shader, Float64, Float16, Int64, Int16, Int8, StorageBuffer16BitAccess, StorageUniform16, StoragePushConstant16, StorageBuffer8BitAccess, UniformAndStorageBuffer8BitAccess, StoragePushConstant8, GroupNonUniform, GroupNonUniformVote, GroupNonUniformArithmetic, GroupNonUniformBallot, GroupNonUniformShuffle, GroupNonUniformShuffleRelative, GroupNonUniformClustered, GroupNonUniformQuad, Vari
import torch
import torch_mlir
from shark.shark_importer import import_with_fx
import os
import sys
from transformers import (
AutoModelForCausalLM,
AutoTokenizer,
StoppingCriteria,
StoppingCriteriaList,
# Lint as: python3
"""SHARK Importer"""
import sys
import tempfile
import os
import hashlib
def create_hash(file_name):
import torch
from diffusers import StableDiffusionPipeline
import torch_mlir
from shark.shark_importer import import_with_fx
import os
import sys
from diffusers.models.attention_processor import AttnProcessor2_0
from diffusers.models.attention_processor import AttnProcessor
import torch
import shark
from shark.shark_importer import import_with_fx
from shark.shark_inference import SharkInference
from transformers import (
AutoModelForCausalLM,
AutoTokenizer,
StoppingCriteria,
StoppingCriteriaList,
)
import torch
import shark
from shark.shark_importer import import_with_fx
from shark.shark_inference import SharkInference
from transformers import (
AutoModelForCausalLM,
AutoTokenizer,
StoppingCriteria,
StoppingCriteriaList,
)
#loc = loc(unknown)
#map = affine_map<(d0) -> (d0)>
module attributes {torch.debug_module_name = "AtenComplexRealModule"} {
ml_program.global private mutable @global_seed(dense<0> : tensor<i64>) : tensor<i64> loc(#loc)
func.func @forward(%arg0: tensor<?xcomplex<f32>> loc(unknown)) -> tensor<?xf32> {
%c0 = arith.constant 0 : index loc(#loc)
%dim = tensor.dim %arg0, %c0 : tensor<?xcomplex<f32>> loc(#loc)
%0 = tensor.empty(%dim) : tensor<?xf32> loc(#loc)
%1 = linalg.generic {indexing_maps = [#map, #map], iterator_types = ["parallel"]} ins(%arg0 : tensor<?xcomplex<f32>>) outs(%0 : tensor<?xf32>) {
^bb0(%in: complex<f32> loc(unknown), %out: f32 loc(unknown)):
import torch
from diffusers import StableDiffusionPipeline
import torch_mlir
from shark.shark_importer import import_with_fx
import os
import torch.fx as fx
import sys
model_input = {
graph():
%arg0_1 : [#users=1] = placeholder[target=arg0_1]
%arg1_1 : [#users=1] = placeholder[target=arg1_1]
%arg2_1 : [#users=32] = placeholder[target=arg2_1]
%expand : [#users=1] = call_function[target=torch.ops.aten.expand](args = (%arg1_1, [2]), kwargs = {})
%arange : [#users=1] = call_function[target=torch.ops.aten.arange](args = (0, 160), kwargs = {dtype: torch.float32, device: cuda:0, pin_memory: False})
%mul : [#users=1] = call_function[target=torch.ops.aten.mul](args = (%arange, -9.210340371976184), kwargs = {})
%div : [#users=1] = call_function[target=torch.ops.aten.div](args = (%mul, 160), kwargs = {})
%exp : [#users=1] = call_function[target=torch.ops.aten.exp](args = (%div,), kwargs = {})
%slice_1 : [#users=1] = call_function[target=torch.ops.aten.slice](args = (%expand, 0, 0, 9223372036854775807), kwargs = {})