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 torch import nn, jit | |
from typing import Dict | |
@jit.script | |
def lookup_all(d, nested_keys): | |
# type: (Dict[str, Tensor], List[str]) -> List[Tensor] | |
tensors = [] | |
for i in range(len(nested_keys)): | |
key = nested_keys[i] | |
tensors.append(d[key]) |
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
#include <torch/script.h> | |
#include <iostream> | |
#include <memory> | |
int main() { | |
std::shared_ptr<torch::jit::script::Module> module = | |
torch::jit::load("msm.pt"); | |
for (auto ivalue : module->find_method("forward")->initial_ivalues()) { |
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 torch | |
import torch.nn as nn | |
from typing import Dict, Optional | |
import torchvision | |
class Model(nn.Module): | |
def __init__(self, num_cats): | |
super(Model, self).__init__() | |
self.model = torchvision.models.resnet18(pretrained=True) | |
self.model.fc = nn.Linear(self.model.fc.in_features, num_cats) |
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
class M(nn.Module): | |
# Only empty lists/dicts and TorchScript classes need types | |
__annotations__ = { | |
my_list: List[int], | |
} | |
def __init__(self, some_values): | |
super(M, self).__init__() | |
for key in some_values: | |
setattr(self, key, some_values[key]) |
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
To install: | |
https://negativo17.org/nvidia-driver/ | |
```bash | |
# Add repo | |
sudo dnf config-manager --add-repo=https://negativo17.org/repos/fedora-nvidia.repo | |
# Install nvidia driver | |
# ??? |
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 fileinput | |
import configparser | |
import os | |
import requests | |
class col: | |
HEADER = "\033[95m" | |
BLUE = "\033[94m" | |
GREEN = "\033[92m" | |
YELLOW = "\033[93m" |
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 fileinput | |
import configparser | |
import os | |
import requests | |
class col: | |
HEADER = "\033[95m" | |
BLUE = "\033[94m" | |
GREEN = "\033[92m" | |
YELLOW = "\033[93m" |
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 fileinput | |
import configparser | |
import os | |
import requests | |
class col: | |
HEADER = "\033[95m" | |
BLUE = "\033[94m" | |
GREEN = "\033[92m" | |
YELLOW = "\033[93m" |
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 torch | |
from pyarkbench import default_args, Benchmark, Timer | |
class Bench(Benchmark): | |
def __init__(self, x, out, use_new): | |
super().__init__(*default_args.bench()) | |
self.x = x | |
self.output = out | |
self.use_new = use_new |
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 datetime | |
import json | |
import os | |
import re | |
import subprocess | |
import sys | |
# Get all changed files | |
# For each one, if there is a setup.py in any directory between it and the repo |
OlderNewer