๐
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
# Lint as: python3 | |
"""SHARK Importer""" | |
import sys | |
import tempfile | |
import os | |
import hashlib | |
def create_hash(file_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
import torch | |
import torch_mlir | |
from shark.shark_importer import import_with_fx | |
import os | |
import sys | |
from transformers import ( | |
AutoModelForCausalLM, | |
AutoTokenizer, | |
StoppingCriteria, | |
StoppingCriteriaList, |
This file has been truncated, but you can view the full file.
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
/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 |
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 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 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 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 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
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | |
# See https://llvm.org/LICENSE.txt for license information. | |
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | |
# Also available under a BSD-style license. See LICENSE. | |
import sys | |
from PIL import Image | |
import requests |
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
import torch | |
import torch_mlir | |
class ANET(torch.nn.Module): | |
def __init__(self): | |
super().__init__() | |
self.alexnet = torch.hub.load('pytorch/vision:v0.10.0', 'alexnet', pretrained=True) | |
self.alexnet.eval() |
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
import sys | |
import torch | |
import torch_mlir | |
from shark.shark_importer import import_with_fx | |
import torchvision.models as models | |
import copy | |
import io | |
import numpy as np |
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
import sys | |
import torch | |
import torch_mlir | |
from shark.shark_importer import import_with_fx | |
import torchvision.models as models | |
import copy | |
import io | |
import numpy as np | |
from transformers import ( | |
AutoModelForCausalLM, |
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
-- Read the docs: https://www.lunarvim.org/docs/configuration | |
-- Video Tutorials: https://www.youtube.com/watch?v=sFA9kX-Ud_c&list=PLhoH5vyxr6QqGu0i7tt_XoVK9v-KvZ3m6 | |
-- Forum: https://www.reddit.com/r/lunarvim/ | |
-- Discord: https://discord.com/invite/Xb9B4Ny | |
-- | |
lvim.colorscheme = "lunar" | |
lvim.format_on_save.enabled = false |