joneswack / dp-rfs Goto Github PK
View Code? Open in Web Editor NEWThis repository contains PyTorch implementations of various random feature maps for dot product kernels.
License: Apache License 2.0
This repository contains PyTorch implementations of various random feature maps for dot product kernels.
License: Apache License 2.0
hello ,I am trying to use from random_features.projections import SRHT, GaussianTransform
to report an error, may I ask how to solve it?
/dp-rfs/util/hadamard_cuda/__init__.py:28: UserWarning: Including and compiling a custom C++ and CUDA (if available) extension might take a while...
warnings.warn('Including and compiling a custom C++ and CUDA (if available) extension might take a while...', )
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Input In [4], in <cell line: 1>()
----> 1 from random_features.polynomial_sketch import PolynomialSketch
2 feature_encoder = PolynomialSketch(
3 input_dimension, # data input dimension (power of 2 for srht projection_type)
4 projection_dimension, # output dimension of the random sketch
(...)
12 device='cpu'/'cuda', # whether to use CPU or GPU
13 )
15 feature_encoder.resample() # initialize random feature sample
File /dp-rfs/random_features/polynomial_sketch.py:7, in <module>
4 import argparse
5 sys.path.append(os.path.join(os.path.dirname(__file__), "../"))
----> 7 from random_features.projections import CountSketch, OSNAP, SRHT, RademacherTransform, GaussianTransform
8 from util.data import pad_data_pow_2
11 class SketchNode:
File /dp-rfs/random_features/projections.py:9, in <module>
5 import time
7 from torch._C import device
----> 9 from util.hadamard_cuda.fwht import FastWalshHadamardTransform
12 def generate_rademacher_samples(shape, complex_weights=False, device='cpu'):
13 """ Draws uniformly from the (complex) Rademacher distribution. """
File /dp-rfs/util/hadamard_cuda/__init__.py:53, in <module>
50 warnings.warn('CUDA_HOME variable not set. Setting CUDA_HOME=/usr/local/cuda-9.0...',)
51 os.environ['CUDA_HOME'] = '/usr/local/cuda-9.0'
---> 53 fwht_py_new = load(name='fwht_py_new', sources=sources, verbose=False, extra_cflags=flags)
File /usr/local/lib/python3.8/dist-packages/torch/utils/cpp_extension.py:1202, in load(name, sources, extra_cflags, extra_cuda_cflags, extra_ldflags, extra_include_paths, build_directory, verbose, with_cuda, is_python_module, is_standalone, keep_intermediates)
1111 def load(name,
1112 sources: Union[str, List[str]],
1113 extra_cflags=None,
(...)
1121 is_standalone=False,
1122 keep_intermediates=True):
1123 r'''
1124 Loads a PyTorch C++ extension just-in-time (JIT).
1125
(...)
1200 verbose=True)
1201 '''
-> 1202 return _jit_compile(
1203 name,
1204 [sources] if isinstance(sources, str) else sources,
1205 extra_cflags,
1206 extra_cuda_cflags,
1207 extra_ldflags,
1208 extra_include_paths,
1209 build_directory or _get_build_directory(name, verbose),
1210 verbose,
1211 with_cuda,
1212 is_python_module,
1213 is_standalone,
1214 keep_intermediates=keep_intermediates)
File /usr/local/lib/python3.8/dist-packages/torch/utils/cpp_extension.py:1450, in _jit_compile(name, sources, extra_cflags, extra_cuda_cflags, extra_ldflags, extra_include_paths, build_directory, verbose, with_cuda, is_python_module, is_standalone, keep_intermediates)
1447 if is_standalone:
1448 return _get_exec_path(name, build_directory)
-> 1450 return _import_module_from_library(name, build_directory, is_python_module)
File /usr/local/lib/python3.8/dist-packages/torch/utils/cpp_extension.py:1844, in _import_module_from_library(module_name, path, is_python_module)
1842 spec = importlib.util.spec_from_file_location(module_name, filepath)
1843 assert spec is not None
-> 1844 module = importlib.util.module_from_spec(spec)
1845 assert isinstance(spec.loader, importlib.abc.Loader)
1846 spec.loader.exec_module(module)
ImportError: /root/.cache/torch_extensions/py38_cu113/fwht_py_new/fwht_py_new.so: cannot open shared object file: No such file or directory
Hello @joneswack, I found this code useful for my own work on random features for graph kernels. Do you have any interest it turning it into an installable python package so that other projects can easily use your implementations of polynomial random features? I would find this useful for a project I am currently working on and would be willing to help with the packaging ๐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.