Skip to content

Instantly share code, notes, and snippets.

View ChaiBapchya's full-sized avatar
💭
Back to Work

Chaitanya Prakash Bapat ChaiBapchya

💭
Back to Work
View GitHub Profile
@ChaiBapchya
ChaiBapchya / export_gluon_to_symbol_to_onnx.py
Created July 31, 2020 01:06
Export pre-trained Gluon model to Symbol to ONNX model
from gluoncv import model_zoo
import numpy as np
import mxnet as mx
# download model
model_name = 'resnet50_v1'
resnet50 = model_zoo.get_model(model_name, pretrained=True)
print(model_name+' downloaded')
# convert to symbol
@ChaiBapchya
ChaiBapchya / test_mxnet_rc170.md
Created July 22, 2020 06:29
Test Apache MXNet rc1 for v1.7.0
## Download source code
wget https://dist.apache.org/repos/dist/dev/incubator/mxnet/1.7.0.rc1/apache-mxnet-src-1.7.0.rc1-incubating.tar.gz

## Unpack
tar -xzvf apache-mxnet-src-1.7.0.rc1-incubating.tar.gz

## Create virtualenv & use it
virtualenv -p python3 mx_17_src
source mx_17_src/bin/activate
@ChaiBapchya
ChaiBapchya / int64_linalg_gemm.md
Created July 18, 2020 06:11
batch linalg gemm error
Intel MKL ERROR: Parameter 9 was incorrect on entry to cblas_sgemm.

Intel MKL ERROR: Parameter 9 was incorrect on entry to cblas_sgemm.
@ChaiBapchya
ChaiBapchya / intel_mkl_sgeqrf.md
Last active July 15, 2020 03:25
LAPACK GELQF Openblas MXNet
Intel MKL ERROR: Parameter 4 was incorrect on entry to SGEQRF.
[03:23:19] ../src/operator/tensor/./../linalg_impl.h:1058: ------------- linalg---------------- gelqf
Traceback (most recent call last):
  File "debug.py", line 3, in <module>
    print(q)
  File "/home/ubuntu/chai-mxnet/python/mxnet/ndarray/ndarray.py", line 261, in __repr__
    return '\n%s\n<%s %s @%s>' % (str(self.asnumpy()),
  File "/home/ubuntu/chai-mxnet/python/mxnet/ndarray/ndarray.py", line 2570, in asnumpy
 ctypes.c_size_t(data.size)))
@ChaiBapchya
ChaiBapchya / export_mx_model_to_onnx.py
Created July 11, 2020 06:44
Test MX Model export to ONNX
import mxnet as mx
import numpy as np
from mxnet.contrib import onnx as onnx_mxnet
import logging
logging.basicConfig(level=logging.INFO)
model_list = [
['imagenet-11k/resnet-152/resnet-152-0000.params', 'imagenet-11k/resnet-152/resnet-152-symbol.json', 'imagenet-11k/synset.txt'],
['imagenet/resnet/101-layers/resnet-101-0000.params', 'imagenet/resnet/101-layers/resnet-101-symbol.json', 'imagenet/resnet/synset.txt'],
['imagenet/resnet/152-layers/resnet-152-0000.params', 'imagenet/resnet/152-layers/resnet-152-symbol.json', 'imagenet/resnet/synset.txt'],
@ChaiBapchya
ChaiBapchya / s3_bucket_policy.json
Last active July 7, 2020 23:15
AWS S3 external account access Bucket policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::************:root",
"arn:aws:iam::************:root"
]
@ChaiBapchya
ChaiBapchya / opperf_bash.sh
Last active May 15, 2020 22:17
OpPerf repro
set -e
echo "default or fix"
read type
if [ "$type" == "fix" ]; then
export CXXFLAGS="${CXXFLAGS} -DUSE_MKL -I/opt/intel/mkl/include"
elif [ "$type" == "default" ]; then
unset CXXFLAGS
else
echo "unrecognized type: ${type}"
exit
@ChaiBapchya
ChaiBapchya / serverless_pip.md
Created May 13, 2020 17:48
Serverless python
custom:
  pythonRequirements:
    dockerizePip: true

plugins:
  - serverless-python-requirements
@ChaiBapchya
ChaiBapchya / package_serverless.md
Created May 13, 2020 17:45
serverless package
package:
  exclude:
    - node_modules/**
    - my_env/**
@ChaiBapchya
ChaiBapchya / unzip_size.md
Created May 13, 2020 17:42
unzip size error
Serverless Error ---------------------------------------
 
  An error occurred: JenkinsDashpipelineDashmonitorLambdaFunction - Unzipped size must be smaller than 262144000 bytes (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 61ae5dc4-1d00-4407-a89f-1fefe26cb47b).
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com