Skip to content

Instantly share code, notes, and snippets.

View ksopyla's full-sized avatar

Krzysztof Sopyła ksopyla

View GitHub Profile
@mingfeima
mingfeima / pytorch_cpu_perf_bkm.md
Last active September 6, 2024 01:40
BKM for PyTorch CPU Performance

General guidelines for CPU performance on PyTorch

This file serves a BKM to get better performance on CPU for PyTorch, mostly focusing on inference or deployment. Chinese version available here.

1. Use channels last memory format

Right now, on PyTorch CPU path, you may choose to use 3 types of memory formats.

  • torch.contiguous_format: default memory format, also referred as NHCW.
  • torch.channels_last: also referred as NHWC.
  • torch._mkldnn: mkldnn blocked format.
import itertools
import torch
from torchtext.experimental.datasets.translation import DATASETS, TranslationDataset
from torchtext.vocab import build_vocab_from_iterator
from torchtext.experimental.functional import (
vocab_func,
totensor,
sequential_transforms,
)
from torchtext.data.utils import get_tokenizer
@jmp84
jmp84 / export.py
Created September 16, 2020 06:11
TorchScript MT model
import argparse
import logging
import torch
from fairseq.checkpoint_utils import load_model_ensemble_and_task
from fairseq.sequence_generator import SequenceGenerator
def get_args():
parser = argparse.ArgumentParser(
# Htop
sudo apt install -y htop
# Byobu
sudo apt install -y byobu
# Gdebi
sudo apt install -y gdebi-core
# GIT
@wphicks
wphicks / Fraud_Detection_Example.ipynb
Last active January 28, 2023 12:44
Notebook example for fraud detection with the Triton FIL Backend
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.