bayerj / arac Goto Github PK
View Code? Open in Web Editor NEWC++ library for neural networks.
License: Other
C++ library for neural networks.
License: Other
Building with scons:
g++ -o test-arac src/cpp/tests/test_datasets.o src/cpp/tests/test_main.o src/cpp/tests/test_optimzation.o src/cpp/tests/test_structure.o src/cpp/tests/test_utilities.o -L/usr/lib -L. -L/usr/local/lib -L/sw/lib -larac -lgtest
I get the error
./libarac.so: undefined reference to 'cblas_ddot'
./libarac.so: undefined reference to 'cblas_dger'
./libarac.so: undefined reference to 'cblas_dgemv'
Any advice as to how to workaround/fix this?
Make the tests run after each build and check whether they pass.
Needs to add
include setup
on the setup.py file.
Introduce targets for either generating a debug build or a production build.
Error.
from the following
from arac.pybrainbridge import _RecurrentNetwork, _FeedForwardNetwork
But I can import arac without any problems.
Got this error while building.
/usr/bin/ld: /usr/local/lib/libm.a(lib_a-w_exp.o): relocation R_X86_64_32S against '.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libm.a: error adding symbols: Bad value
But as log says it compiles with -fPIC now.
Either that file should be removed, or running it should set something like the pythonpaths, maybe?
It might be a good idea to create a conda recipe (see: https://conda-forge.github.io/ ) for it, which would make the installation process much easier for newcomers.
I've found that using _setParameters on a fast (arac) network will somehow screw it up. Here's a simple script that ilustrates this. I create a three node network (one input, one hidden node, and one output node; the hidden layer is a sigmoidal layer and the other two are linear). When passing 0.0 to the input, the sigmoidal layer should output 0.5, which, when multiplied by the connection weight from the hidden to the output layer should yield the output. However, after _setParameters is called on the network, the output typically ends up being a very small number (on the order of 1e-310).
from pybrain.tools.shortcuts import buildNetwork
netSLOW = buildNetwork(1, 1, 1, bias=False, recurrent=False, fast=False)
netFAST = buildNetwork(1, 1, 1, bias=False, recurrent=False, fast=True )
netSLOW.forget = True
netFAST.forget = True
netSLOW_output = netSLOW.activate([0.0])
netFAST_output = netFAST.activate([0.0])
assert( netSLOW_output == [0.5_netSLOW.params[1]] ) # SUCCESS
assert( netFAST_output == [0.5_netFAST.params[1]] ) # SUCCESS
netFAST._setParameters(netSLOW.params)
netFAST_output = netFAST.activate([0.0])
assert( netFAST_output == [0.5*netFAST.params[1]] ) # FAILURE!
I have no idea how to fix this! Should some method other than _setParameters be used to change parameters?
Thanks,
John
In issuing the scons command, I get the following errors:
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o src/cpp/structure/connections/convolve.os -c -O3 -fPIC -I/usr/local/include -I/sw/include -I/usr/include src/cpp/structure/connections/convolve.cpp
src/cpp/structure/connections/convolve.cpp:9:23: error: cblas.h: No such file or directory
In file included from src/cpp/structure/connections/../modules/../../common/common.h:11,
from src/cpp/structure/connections/../modules/module.h:10,
from src/cpp/structure/connections/convolve.h:9,
from src/cpp/structure/connections/convolve.cpp:13:
src/cpp/structure/connections/../modules/../../common/functions.h:52:7: warning: no newline at end of file
In file included from src/cpp/structure/connections/convolve.h:10,
from src/cpp/structure/connections/convolve.cpp:13:
src/cpp/structure/connections/../parametrized.h:106:7: warning: no newline at end of file
src/cpp/structure/connections/convolve.cpp: In member function 'virtual void arac::structure::connections::ConvolveConnection::forward_process(double*, const double*)':
src/cpp/structure/connections/convolve.cpp:49: error: 'CblasRowMajor' was not declared in this scope
src/cpp/structure/connections/convolve.cpp:52: error: 'CblasNoTrans' was not declared in this scope
src/cpp/structure/connections/convolve.cpp:71: error: 'cblas_dgemv' was not declared in this scope
src/cpp/structure/connections/convolve.cpp: In member function 'virtual void arac::structure::connections::ConvolveConnection::backward_process(double*, const double*)':
src/cpp/structure/connections/convolve.cpp:88: error: 'CblasColMajor' was not declared in this scope
src/cpp/structure/connections/convolve.cpp:91: error: 'CblasNoTrans' was not declared in this scope
src/cpp/structure/connections/convolve.cpp:110: error: 'cblas_dgemv' was not declared in this scope
scons: *** [src/cpp/structure/connections/convolve.os] Error 1
scons: building terminated because of errors.
Note my environment:
> scons -version
SCons by Steven Knight et al.:
engine: v2.2.0.issue-2856:2676:d23b7a2f45e8[MODIFIED], 2012/08/05 15:38:28, by garyo on oberbrunner-dev
engine path: ['/u/smithsp/local64/lib/python2.7/site-packages/SCons']
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
> swig -version
SWIG Version 1.3.36
Compiled with g++ [x86_64-unknown-linux-gnu]
Please see http://www.swig.org for reporting bugs and further information
Any suggestions? Am I not sufficiently providing BLAS/ATLAS packages?
At a lot of places, errors are not handled very gracefully:
All this should be handled by exceptions.
Introduce a class "ErrorFunction" from which error functions like sum-of-squares, cross-entropy and the like can derive.
I'm trying to build arac on cygwin/Window 7 64-bit.
This is the error I eventually get when using scons:
g++ -o test-arac.exe src/cpp/tests/test_datasets.o src/cpp/tests/test_main.o src/cpp/tests/test_optimzation.o src/cpp/tests/test_structure.o src/cpp/tests/test_utilities.o -L/usr/lib -L. -L/usr/local/lib -L/sw/lib -larac -lgtest
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find -larac
collect2: ld returned 1 exit status
scons: *** [test-arac.exe] Error 1
scons: building terminated because of errors.
... so g++ can't find the arac library ... and I can't either.
Here are the lines in the SConstruct that are asking for the arac library:
testenv = Environment(LIBS=['arac', 'gtest'], CPPPATH=CPPPATH, LIBPATH=LIBPATH)
test = testenv.Program('test-arac', Glob('src/cpp/tests/*.cpp'))
libarac.so is successfully being generated earlier in the build process.
any ideas on how to get around this problem?
thanks!
PyBrain 0.3 works fine.
Procedure:
Install PyBrain 0.3.1
Run test_pybrainbridge.py
Expected result:
All tests pass
Observed result:
13 tests fail with identical exceptions.
======================================================================
ERROR: testCopyable (__main__.TestNetworkEquivalence)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/nicholas/src/arac/src/python/arac/tests/test_pybrainbridge.py", line 348, in testCopyable
copied = net.copy()
File "/home/nicholas/src/arac/src/python/arac/pybrainbridge.py", line 266, in copy
result.sortModules()
File "/home/nicholas/src/pybrain/pybrain/structure/networks/recurrent.py", line 137, in sortModules
super(RecurrentNetworkComponent, self).sortModules()
File "/home/nicholas/src/arac/src/python/arac/pybrainbridge.py", line 274, in sortModules
super(_Network, self).sortModules()
File "/home/nicholas/src/pybrain/pybrain/structure/networks/network.py", line 259, in sortModules
Module.__init__(self, self.indim, self.outdim, name=self.name)
File "/home/nicholas/src/pybrain/pybrain/structure/modules/module.py", line 51, in __init__
self._resetBuffers()
File "/home/nicholas/src/pybrain/pybrain/structure/networks/network.py", line 263, in _resetBuffers
super(Network, self)._resetBuffers(length)
File "/home/nicholas/src/pybrain/pybrain/structure/modules/module.py", line 58, in _resetBuffers
self.offset = 0
AttributeError: can't set attribute
And has to be corrected:
[ RUN ] TestGradient.LstmLayer
New Parametrized instance.
Numeric/Analytical:-0 <-> 0
Numeric/Analytical:-0 <-> 0
Numeric/Analytical:-0 <-> 2.11224
Numeric/Analytical:-0 <-> 0
Expected: (0.001) > (gradient_check(*net_p, true)), actual: 0.001 vs 2.11224
However, the examples give the same solutions as PyBrain. Or?
Creating networks (at least via PyBrain). Try this:
while True:
net = buildNetwork(2,2,1)
Python's memory usage doesn't grow over time. Then try:
while True:
net = buildNetwork(2,2,1, fast=True)
Leaks like a sieve (about 20MB per second on my system).
Hi Everyone
I get an error building the arac library. The ld command doesn't find the "-lblas". Any ideas what I could do?
It's running on a CentOS Server.
TIA for any help!
g++ -o libarac.so -shared src/cpp/arac.os src/cpp/common/buffer.os src/cpp/utilities/utilities.os src/cpp/datasets/sequence.os src/cpp/datasets/supervised.os src/cpp/datasets/unsupervised.os src/cpp/optimization/backprop.os src/cpp/optimization/descent/descender.os src/cpp/optimization/descent/stepdescender.os src/cpp/structure/component.os src/cpp/structure/parametrized.os src/cpp/structure/structure.os src/cpp/structure/connections/blockpermutation.os src/cpp/structure/connections/connection.os src/cpp/structure/connections/connections.os src/cpp/structure/connections/convolve.os src/cpp/structure/connections/full.os src/cpp/structure/connections/identity.os src/cpp/structure/connections/inconvolve.os src/cpp/structure/connections/linear.os src/cpp/structure/connections/outconvolve.os src/cpp/structure/connections/permutation.os src/cpp/structure/modules/bias.os src/cpp/structure/modules/cosine.os src/cpp/structure/modules/doublegate.os src/cpp/structure/modules/errorscaling.os src/cpp/structure/modules/gate.os src/cpp/structure/modules/linear.os src/cpp/structure/modules/lstm.os src/cpp/structure/modules/mdlstm.os src/cpp/structure/modules/module.os src/cpp/structure/modules/modules.os src/cpp/structure/modules/multiplication.os src/cpp/structure/modules/partialsoftmax.os src/cpp/structure/modules/sigmoid.os src/cpp/structure/modules/softmax.os src/cpp/structure/modules/switch.os src/cpp/structure/modules/tanh.os src/cpp/structure/networks/basenetwork.os src/cpp/structure/networks/network.os src/cpp/structure/networks/networks.os src/cpp/structure/networks/mdrnns/basemdrnn.os src/cpp/structure/networks/mdrnns/mdrnn.os -L/usr/lib -L. -L/usr/local/lib -L/sw/lib -lm -lblas /bin/ld: cannot find -lblas collect2: error: ld returned 1 exit status scons: *** [libarac.so] Error 1
All dependencies are installed, but I'm getting the following error
$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o src/cpp/structure/connections/convolve.os -c -O3 -fPIC -I/usr/local/include -I/sw/include -I/usr/include -I/System/Library/Frameworks/vecLib.framework/Versions/A/Headers src/cpp/structure/connections/convolve.cpp
src/cpp/structure/connections/convolve.cpp:9:14: fatal error: 'cblas.h' file not found
#include "cblas.h"
^
1 error generated.
scons: *** [src/cpp/structure/connections/convolve.os] Error 1
scons: building terminated because of errors.
However, an MDRNN on a sequence of shape (1, 1) works correct. Thus, the problem seems to be with the recurrent connections.
[ RUN ] TestGradient.MdlstmMdrnn
New Parametrized instance.
Numeric/Analytical:0.0127396 <-> 0.0127396
Numeric/Analytical:-0 <-> 0
Numeric/Analytical:-0 <-> 0
Numeric/Analytical:0.969693 <-> 0.969693
Numeric/Analytical:0.0127314 <-> 0.0127314
New Parametrized instance.
Numeric/Analytical:0.0101248 <-> 0.0101248
Numeric/Analytical:-0 <-> 0
Numeric/Analytical:-0 <-> 0
Numeric/Analytical:0.770659 <-> 0.770659
Numeric/Analytical:0.0101182 <-> 0.0101182
New Parametrized instance.
Numeric/Analytical:-0 <-> 0
Numeric/Analytical:-0 <-> 0
Numeric/Analytical:-0 <-> 0
Numeric/Analytical:-0 <-> 0
Numeric/Analytical:-0 <-> 0
New Parametrized instance.
Numeric/Analytical:-0 <-> 0
Numeric/Analytical:-0 <-> 0
Numeric/Analytical:-0 <-> 0
Numeric/Analytical:-0 <-> 0
Numeric/Analytical:-0 <-> 0
[ OK ] TestGradient.MdlstmMdrnn
While trying to install arac on Anaconda/Windows8.1 I get this error:
python setup.py install
I:\Anaconda\envs\gpu\lib\site-packages\setuptools\dist.py:475: UserWarning: Normalizing '0.1post' to '0.1.post0'
normalized_version,
running install
running bdist_egg
running egg_info
writing arac.egg-info\PKG-INFO
writing dependency_links to arac.egg-info\dependency_links.txt
writing top-level names to arac.egg-info\top_level.txt
reading manifest file 'arac.egg-info\SOURCES.txt'
writing manifest file 'arac.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
byte-compiling build\bdist.win-amd64\egg\arac\pybrainbridge.py to pybrainbridge.cpython-37.pyc
installing package data to build\bdist.win-amd64\egg
running install_data
error: can't copy 'libarac.dylib': doesn't exist or not a regular file
Any clues?
In order to increase performance (runtime wise), it makes sense to forward minibatches through a network. By this, multiple matrix/vector products can be turned into a single matrix/matrix product which results into a significant speedup, as shown by other libraries.
This would be a nice-to-have but would introduce major changes.
Im getting the following error log after installing all dependencies and running scons to build.
scons: done reading SConscript files.
scons: Building targets ...
swig -o src/swig/cppbridge_wrap.cc -python -c++ -outdir src/python/arac src/swig/cppbridge.i
g++ -o test-arac src/cpp/tests/test_datasets.o src/cpp/tests/test_main.o src/cpp/tests/test_optimzation.o src/cpp/tests/test_structure.o src/cpp/tests/test_utilities.o -L/usr/lib -L. -L/usr/local/lib -L/sw/lib -larac -lgtest
/usr/bin/ld: /usr/lib/libgtest.a(gtest-all.cc.o): undefined reference to symbol 'pthread_key_delete@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
scons: *** [test-arac] Error 1
scons: building terminated because of errors.
Although importance was introduced for datasets, there are no tests so far.
I can't get this thing to build and load properly for python on OSX 64bit. Assistance is greatly appreciated.
import arac._cppbridge
Traceback (most recent call last):
File "", line 1, in
ImportError: dlopen(arac/_cppbridge.so, 2): no suitable image found. Did find:
arac/_cppbridge.so: mach-o, but wrong architecture
$ file arac/_cppbridge.so
arac/_cppbridge.so: Mach-O 64-bit bundle x86_64
$ uname -a
Darwin macbox 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64
The following error occurs when I try to build an ARAC network, using PyBrain v 0.3.3.
Traceback (most recent call last):
File "pybrain_first_tests.py", line 24, in
agent = knee_agent.Knee_Agent()
File "knee_agent.py", line 30, in init
self._QNN = knee_NN.Knee_ActionValueNetwork(knee_environment.TOTAL_STATE_DIMENSION, knee_environment.ACTION_DIMENSION)
File "knee_NN.py", line 17, in init
self.network = buildNetwork(state_dimension + discreet_action_count, state_dimension + discreet_action_count, 1, fast=True) # use ARAC
File "/usr/local/lib/python2.7/dist-packages/PyBrain-0.3.3-py2.7.egg/pybrain/tools/shortcuts.py", line 108, in buildNetwork
n.sortModules()
File "/usr/local/lib/python2.7/dist-packages/arac/pybrainbridge.py", line 274, in sortModules
super(_Network, self).sortModules()
File "/usr/local/lib/python2.7/dist-packages/PyBrain-0.3.3-py2.7.egg/pybrain/structure/networks/network.py", line 258, in sortModules
Module.init(self, self.indim, self.outdim, name=self.name)
File "/usr/local/lib/python2.7/dist-packages/PyBrain-0.3.3-py2.7.egg/pybrain/structure/modules/module.py", line 51, in init
self._resetBuffers()
File "/usr/local/lib/python2.7/dist-packages/PyBrain-0.3.3-py2.7.egg/pybrain/structure/networks/network.py", line 262, in _resetBuffers
super(Network, self)._resetBuffers(length)
File "/usr/local/lib/python2.7/dist-packages/PyBrain-0.3.3-py2.7.egg/pybrain/structure/modules/module.py", line 58, in _resetBuffers
self.offset = 0
AttributeError: can't set attribute
The "offset" attribute of the _FeedForwardNetwork produces a key error.
Do you have the definition of WeightShareConnection class?
scons is giving me this error:
g++ -o test-arac src/cpp/tests/test_datasets.o src/cpp/tests/test_main.o src/cpp/tests/test_optimzation.o src/cpp/tests/test_structure.o src/cpp/tests/test_utilities.o -L/usr/lib -L. -L/usr/local/lib -larac -lgtest
scons: *** [src/python/arac/_cppbridge.so] Source file: src/swig/cppbridge.i is static and is not compatible with shared target: src/python/arac/_cppbridge.so
scons: building terminated because of errors.
I'm using SCons version 2.0.1, SWIG version 1.3.40, and Mac OS X 10.7
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.