Pytorch KNN CUDA
- 2019/11/02 This repository will no longer be maintained as pytorch supports
sort()
andkthvalue
on tensors.
git clone https://github.com/chrischoy/pytorch_knn_cuda
cd pytorch_knn_cuda
make
python __init__.py
sort()
and kthvalue
on tensors.git clone https://github.com/chrischoy/pytorch_knn_cuda
cd pytorch_knn_cuda
make
python __init__.py
RealFormer-Pytorch Implementation of RealFormer using pytorch. Includes comparison with classical Transformer on image classification task (ViT) wrt C
NN Template Generic template to bootstrap your PyTorch project. Click on Use this Template and avoid writing boilerplate code for: PyTorch Lightning,
This repository holds NVIDIA-maintained utilities to streamline mixed precision and distributed training in Pytorch. Some of the code here will be included in upstream Pytorch eventually. The intention of Apex is to make up-to-date utilities available to users as quickly as possible.
30 Days Of Machine Learning Using Pytorch Objective of the repository is to learn and build machine learning models using Pytorch. List of Algorithms
Pretrained SOTA Deep Learning models, callbacks and more for research and production with PyTorch Lightning and PyTorch
Amazon Forest Computer Vision Satellite Image tagging code using PyTorch / Keras Here is a sample of images we had to work with Source: https://www.ka
This is a curated list of tutorials, projects, libraries, videos, papers, books and anything related to the incredible PyTorch. Feel free to make a pu
Mixup: Beyond Empirical Risk Minimization in PyTorch This is an unofficial PyTorch implementation of mixup: Beyond Empirical Risk Minimization. The co
Pytorch-Sketch-RNN A pytorch implementation of https://arxiv.org/abs/1704.03477 In order to draw other things than cats, you will find more drawing da
root@fbecc9ba5bb2:/pytorch_knn_cuda# make
nvcc -c -o build/knn_cuda_kernel.so src/knn_cuda_kernel.cu -x cu -Xcompiler -fPIC -shared -Isrc make: nvcc: Command not found Makefile:34: recipe for target 'build/knn_cuda_kernel.so' failed make: *** [build/knn_cuda_kernel.so] Error 127 root@fbecc9ba5bb2:/pytorch_knn_cuda#
did anyone got this error as me, I do not know how to fix it.
Due to some API changes made in pytorch v0.4.1 pytorch_knn_cuda was no longer able to compile (see issue #3).
This PR makes the required changes, it now works with pytorch v.0.4.1
Getting error
gcc -pthread -B /home/bagon/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/bagon/anaconda3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include -I/home/bagon/anaconda3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/bagon/anaconda3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/bagon/anaconda3/pkgs/pytorch_knn_cuda/include -I/home/bagon/anaconda3/include/python3.6m -c /home/bagon/anaconda3/pkgs/pytorch_knn_cuda/src/knn_pytorch.c -o ./home/bagon/anaconda3/pkgs/pytorch_knn_cuda/src/knn_pytorch.o -std=c99
In file included from /home/bagon/anaconda3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/THC/THCGeneral.h:4:0,
from /home/bagon/anaconda3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/THC/THC.h:4,
from /home/bagon/anaconda3/pkgs/pytorch_knn_cuda/src/knn_pytorch.c:1:
/home/bagon/anaconda3/pkgs/pytorch_knn_cuda/src/knn_pytorch.c: In function ‘knn’:
/home/bagon/anaconda3/pkgs/pytorch_knn_cuda/src/knn_pytorch.c:11:24: error: dereferencing pointer to incomplete type ‘THTensor {aka struct THTensor}’
THArgCheck(ref_tensor->nDimension == 2 , 0, "ref_tensor: 2D Tensor expected");
^
/home/bagon/anaconda3/lib/python3.6/site-packages/torch/utils/ffi/../../lib/include/TH/THGeneral.h:111:35: note: in definition of macro ‘THArgCheck’
_THArgCheck(__FILE__, __LINE__, __VA_ARGS__);
It seems like the definition of struct THTensor
was moved from THTensor.h
to THTensor.hpp
and this causes this issue.
Any way to workaround this?
Tried on 10,000 reference points, 100 query points, and 3 feature dimensions, this crashes with the error:
RuntimeError: cuda runtime error (77) : an illegal memory access was encountered at /pytorch/torch/lib/THC/generic/THCTensorCopy.c:70
The error does not appear when executing the KNN code, but only when trying to assign or access any data on the GPU (including the results) after the code is called. Tested with GeForce GTX 1080 with 8 GB of VRAM.
Efficient implementations of Product Quantization and its variants using Pytorch and CUDA
structshot Code and data for paper "Simple and Effective Few-Shot Named Entity Recognition with Structured Nearest Neighbor Learning", Yi Yang and Arz
Optimal space decomposition based-product quantization for approximate nearest neighbor search Abstract Product quantization(PQ) is an effective neare
Approximate Nearest Neighbor Negative Contrastive Learning for Dense Text Retrieval This repo provides personal implementation of paper Approximate Ne
GPU implementation of kNN and SNN GPU implementation of $k$-Nearest Neighbors and Shared-Nearest Neighbors Supported by numba cuda and faiss library E
To run the code Unzip the package to your local directory; Run 'pip install -r requirements.txt' to download required packages; Open file ~/nips_code/
Annoy Annoy (Approximate Nearest Neighbors Oh Yeah) is a C++ library with Python bindings to search for points in space that are close to a given quer
OpenHands OpenHands is a gesture recognition system powered by OpenPose, k-nearest neighbours, and local outlier factor. Currently the system can iden
kNN_From_Scratch I implemented the k nearest neighbors (kNN) classification algorithm on python. This algorithm is used to predict the classes of new
Essential BYOL A simple and complete implementation of Bootstrap your own latent: A new approach to self-supervised Learning in PyTorch + PyTorch Ligh