This file contains 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 gc | |
import sys | |
import torch | |
import torch_mlir | |
batch_size = 1 | |
seq_len = 3 | |
input_size = 5 | |
hidden_size = 5 | |
kernel_size = 3 |
This file contains 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
Add | |
AveragePool | |
BatchNormalization | |
Cast | |
Clip | |
Concat | |
Constant | |
ConstantOfShape | |
Conv |
This file contains 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
// torch-mlir/.vscode/settings.json | |
{ | |
"files.associations": { | |
"*.inc": "cpp", | |
"ranges": "cpp", | |
"regex": "cpp", | |
"functional": "cpp", | |
"chrono": "cpp", | |
"__functional_03": "cpp", | |
"target": "cpp", |
This file contains 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
OVERVIEW: MLIR modular optimizer driver | |
Available Dialects: builtin, chlo, complex, func, linalg, memref, ml_program, scf, sparse_tensor, stablehlo, tensor, tm_tensor, torch, torch_c, tosa, vhlo | |
USAGE: torch-mlir-opt [options] <input file> | |
OPTIONS: | |
Color Options: | |
--color - Use colors in output (default=autodetect) |
This file contains 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
// RUN: torch-mlir-opt <%s -split-input-file -verify-diagnostics -convert-torch-onnx-to-torch | |
// FB OPT OPS from https://github.com/llvm/torch-mlir/issues/2689 | |
// ----- | |
func.func @cast_operation(%arg0: !torch.vtensor<[?,?,?,?],si64>) -> !torch.vtensor<[?,?,?,?],f32> attributes {torch.onnx_meta.ir_version = 9 : si64, torch.onnx_meta.opset_version = 18 : si64, torch.onnx_meta.producer_name = "backend-test", torch.onnx_meta.producer_version = ""} { | |
// expected-error @+1 {{failed to legalize operation 'torch.operator'}} | |
%208 = torch.operator "onnx.Cast"(%arg0) { | |
torch.onnx.to = 1 : si64 | |
} : (!torch.vtensor<[?,?,?,?],si64>) -> !torch.vtensor<[?,?,?,?],f32> | |
return %208 : !torch.vtensor<[?,?,?,?],f32> |
This file has been truncated, but you can view the full file.
This file contains 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
/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ | |
|* *| | |
|* Op Declarations *| | |
|* *| | |
|* Automatically generated file, do not edit! *| | |
|* From: TorchOps.td *| | |
|* *| | |
\*===----------------------------------------------------------------------===*/ | |
#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) |
This file contains 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
#!/bin/bash | |
# Xida: I tested this on a fresh GCP machine. It should work on Debian and Ubuntu though. | |
# deps | |
sudo apt install wget git -y | |
# Specify the Miniconda version you want to install | |
MINICONDA_VERSION="latest" | |
# For a specific version, replace 'latest' with the version number, e.g., "Miniconda3-4.7.12-Linux-x86_64.sh" |
This file contains 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 @visakanv and @billyisyoung | |
https://twitter.com/visakanv/status/1037754098328600576?t=mwXfUbS-Mxjr-4zODZjQNw&s=19 | |
The courage to be disliked, Ichiro Kishimi and Fumitake Koga. Heard good things, let’s dig in | |
Youth tells philosopher, life is hard and complicated and full of struggle. Philosopher says life is simple. Debate ensues | |
This file contains 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/env python | |
""" | |
tokc: A Token Counter Utility | |
Description: | |
------------- | |
tokc is a tool designed to count tokens in text files or input streams. It's especially useful for calculating the cost of using text with various models. | |
Installation: |
This file contains 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
#!/bin/bash | |
# Install Miniconda | |
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh | |
bash miniconda.sh -b -p $HOME/miniconda | |
rm miniconda.sh | |
# Add Miniconda to PATH | |
export PATH="$HOME/miniconda/bin:$PATH" |