Skip to content

Instantly share code, notes, and snippets.

View dcslin's full-sized avatar

Shicong dcslin

  • Singapore
  • 00:21 (UTC +08:00)
View GitHub Profile
@dcslin
dcslin / d9.py
Created December 9, 2022 09:16
adventofcode d9
input="""R 1
D 1
L 1
D 1
L 2
U 2
D 2
R 1
D 1
L 2
@dcslin
dcslin / gist:aa90e5258724cb9add9e9d67ae43e5fd
Last active October 4, 2020 15:23
conv+relu+fc fp32 fp16
pass
@dcslin
dcslin / train.py
Created September 30, 2020 09:32
singa resnet18 cifar10
'''pass'''
@dcslin
dcslin / train.py
Last active September 30, 2020 01:49
singa cnn fp16 tensor ops mnist
'''
pass
'''
# nvprof python3 examples/cnn/train_cnn.py cnn mnist -m1 -pfloat16
@dcslin
dcslin / train.py
Last active September 30, 2020 12:30
benchmark pytroch resnet18 cifar10 apex amp
'''
Diff https://github.com/kuangliu/pytorch-cifar/blob/master/main.py
'''
from apex import amp
net, optimizer = amp.initialize(net, optimizer, opt_level=args.opt_level)
#if device == 'cuda':
# net = torch.nn.DataParallel(net)
@dcslin
dcslin / train.py
Created September 27, 2020 03:31
benchmark pytorch MNIST mixed precision training by Apex
"""
This script is modified from https://github.com/pytorch/examples.git
"""
from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
@dcslin
dcslin / 15jul.md
Last active July 15, 2020 01:47
15jul.md

qabot:

  1. fix cos sim bug, value same as pytorch, ok now
  2. lstm+cos sim+margin loss, loss ok, top1 accuracy 4%~10%, http://ncrs/:8888/notebooks/singa-etc/notebook/singa-qabot-train.ipynb
  3. lstm+cos sim+pooling+margin, loss not ok, top1 accuracy not ok
  4. pytorch: lstm+cos sim+pooling+margin, loss ok

kint:

  1. follow numpy convension, if int tensor + int tensor, return int tensor, else return float
  2. check input types and cast to float in the GenTensorScalarFn when necessary
  3. pr merged
@dcslin
dcslin / 15jul.md
Created July 15, 2020 01:29
15jul.md

qabot:

  1. fix cos sim bug, value ok
  2. lstm+cos sim+margin loss, loss ok, top1 accuracy 4%~10%
  3. lstm+cos sim+pooling+margin, loss not ok, top1 accuracy not ok
  4. pytorch: lstm+cos sim+pooling+margin, loss ok

kint:

  1. follow numpy convension, if int tensor + int tensor, return int tensor, else return float
  2. check input types and cast to float in the GenTensorScalarFn when necessary
  3. pr merged
@dcslin
dcslin / singa-print-trace-stack
Created July 15, 2020 01:29
singa-print-trace-stack
root@39516c62233d:~/singa-hf2# cd build/
root@39516c62233d:~/singa-hf2/build# ./bin/test_singa --gtest_filter=*RNN*
Running main() from gtest_main.cc
Note: Google Test filter = *RNN*
[==========] Running 5 tests from 3 test cases.
[----------] Global test environment set-up.
[----------] 3 tests from TestCudnnRNN
[ RUN ] TestCudnnRNN.Setup
[ OK ] TestCudnnRNN.Setup (0 ms)
[ RUN ] TestCudnnRNN.Forward
@dcslin
dcslin / 8jul.md
Last active July 8, 2020 02:12
8jul.md

kint:

  1. removed static_assert(std::is_same<SType, DType>::value,"The Scalar type must match the Tensor data type");, compilation is ok
  2. static_assert SType == DType fails at compile time, now after remove, fails at runtime (will see more XX op Not implemented)
  3. to expect some hidden bug when SType != DType
  4. ok:
    • int tensor and int tensor operation (test_onnx_backend.py)
    • int tensor and int scalar
    • nrm2() on int tensor (used tmp tensor with type cast)
    • float tensor and int scalar ops
    • cuda + int (after added cuda+int in TYPE_LANG_SWITCH