-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Caffe without the patch, cpp-package fixed also with Caffe plugin #5573
Conversation
@@ -35,19 +35,19 @@ class Lenet { | |||
Convolution("conv1", data, conv1_w, conv1_b, Shape(5, 5), 20); | |||
Symbol tanh1 = Activation("tanh1", conv1, ActivationActType::tanh); | |||
Symbol pool1 = Pooling("pool1", tanh1, Shape(2, 2), PoolingPoolType::max, | |||
false, PoolingPoolingConvention::valid, Shape(2, 2)); | |||
false, false, PoolingPoolingConvention::valid, Shape(2, 2)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should the default here be? I assume it's false like the default in the declaration.
parameter is: bool cudnn_off = false
@@ -43,7 +46,7 @@ Symbol getConv(const std::string & name, Symbol data, | |||
kernel, num_filter, stride, Shape(1, 1), | |||
pad, 1, 512); | |||
|
|||
Symbol bn = BatchNorm(name + "_bn", conv, 2e-5, bn_momentum, false); | |||
Symbol bn = BatchNorm(name + "_bn", conv, BN_GAMMA, BN_BETA, 2e-5, bn_momentum, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the desired default gamma and beta? These weren't in the older versions.
inline Symbol BatchNorm(const std::string& symbol_name,
Symbol data,
Symbol gamma,
Symbol beta,
mx_float eps = 0.001,
mx_float momentum = 0.9,
bool fix_gamma = true,
bool use_global_stats = false,
bool output_mean_var = false) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gamma and beta are learnable parameters that can be initialized automatically by initializer, but op.h genereator can't distinguish parameters from hyperparameters currently, as mxnet doesn't provide such information. In older versions, gamma and beta were not declared explicitly. We can use Operator("BatchNorm")
here to avoid specifying gamma and beta before figuring out how to detect parameters.
@@ -905,8 +905,6 @@ GraphExecutor::CachedSegOpr GraphExecutor::CreateCachedSegOpr(size_t topo_start, | |||
// you need to copy it out. (potential memory leak risk) | |||
char *p_opr_name = new char[opr_names.size() + 1]; | |||
memcpy(p_opr_name, opr_names.c_str(), opr_names.size() + 1); | |||
#else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't necessary and generates a warning
Fixing lint... |
travis appears to be broken (nohup) |
@@ -14,8 +14,8 @@ | |||
#include "mxnet-cpp/kvstore.h" | |||
#include "mxnet-cpp/optimizer.h" | |||
|
|||
#ifndef KVSTORE_HPP | |||
#define KVSTORE_HPP | |||
#ifndef CPP_PACKAGE_INCLUDE_MXNET_CPP_KVSTORE_HPP_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are lint fixes which captured problems in the original cpp-package headers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can make lint ignore CPP_PACKAGE_INCLUDE, it's done for r-package for example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I went ahead and fixed it so that we could have some clean, homogenous code.
@@ -199,7 +199,7 @@ class BucketSentenceIter : public DataIter { | |||
public: | |||
BucketSentenceIter(string filename, int minibatch, Context context) : batch(minibatch), | |||
current(-1), device(context) { | |||
auto& content = readContent(filename); | |||
auto content = readContent(filename); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was incorrectly taking a reference of a temporary
@@ -343,7 +343,8 @@ class BucketSentenceIter : public DataIter { | |||
chars.push_back(c); | |||
} | |||
} | |||
return {map, chars}; | |||
// Note: Can't use {} because this would hit the explicit constructor | |||
return tuple<unordered_map<wchar_t, mx_float>, vector<wchar_t>>(map, chars); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My gcc-5.4 won't allow this
Makefile
Outdated
@@ -133,7 +138,7 @@ endif | |||
.PHONY: clean all test lint doc clean_all rcpplint rcppexport roxygen\ | |||
cython2 cython3 cython cyclean | |||
|
|||
all: lib/libmxnet.a lib/libmxnet.so $(BIN) | |||
all: lib/libmxnet.a lib/libmxnet.so $(BIN) cpp-package-example-all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't build cpp-package by default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It only generates a header file for cpp-package, and is necessary since updates that break cpp-package will be reflected in the test..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are cpp-package tests run during CI builds? I think they they probably aren't because they didn't build at all. In the meantime, how will we keep people from "breaking" these compiliables again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we just build lenet by default? At any rate, the build for all of them is quick -- a few seconds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or you mean a config.mk flag and w can turn it on for the CI build? That might be ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone changes operator api, cpp-package test will fail since op.h changes after building cpp-package.
@lx75249 |
I think we just need to put add arguments for beta and gamma
Xin Li <notifications@github.com>于2017年3月26日 周日上午12:15写道:
… ***@***.**** commented on this pull request.
------------------------------
In cpp-package/example/resnet.cpp
<#5573 (comment)>:
> @@ -43,7 +46,7 @@ Symbol getConv(const std::string & name, Symbol data,
kernel, num_filter, stride, Shape(1, 1),
pad, 1, 512);
- Symbol bn = BatchNorm(name + "_bn", conv, 2e-5, bn_momentum, false);
+ Symbol bn = BatchNorm(name + "_bn", conv, BN_GAMMA, BN_BETA, 2e-5, bn_momentum, false);
Gamma and beta are learnable parameters that can be initialized
automatically by initializer, but op.h genereator can't distinguish
parameters from hyperparameters currently, as mxnet doesn't provide such
information. In older versions, gamma and beta were not declared
explicitly. We can use Operator("BatchNorm") here to avoid specifying
gamma and beta before figuring out how to detect parameters.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#5573 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAiudJkFhwdavJJa16Kgiu1cHte1UYhIks5rphCrgaJpZM4MpS_g>
.
|
@@ -0,0 +1,2 @@ | |||
# Rebuildable file(s) | |||
op.h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will force everyone to build the whole library..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a little confused. The expectation is that someone will check out the mxnet source tree and include directly from mxnet/cpp-package/include, but dynamically load the libmxnet.so that came with their pip install rather than one that they built locally? That seems unlikely and dangerous, correct? I expect development on mxnet to accelerate in the near future and a widely-distributed libmxnet.so to not be in sync for long (as well as inconsistencies with caffe plugin, etc.).
The cmake build "distributes" mxnet headers during a build if INSTALL_INCLUDE_DIR is defined as a path, although not yet for cpp-package. If we're going to make a distribution like apt-get install mxnet-dev, I would expect that we can deploy the built op.h
wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes you're right...
@lx75249 @cjolivier01 Is this good for merging? |
Fixing build things. Also, need to do Operator("BatchNorm") |
other checkin of ft.cc contrib operator broke the build on Windows, libcufft library not linked. Added to cmake. |
…ache#5573) * PEP8 indentation fix * Remove executable flag * Remove executable flags * Fixing cpp-package including problems with caffe converter * Fix warnings * Remove need for caffe patch for caffe plugin * Ignore cmake paths, remove rebuildable op.h for cpp-package * cpp-package examples fixed. Makefile and CMake of op.h and examples added. * cpp-package examples fixed. Makefile and CMake of op.h and examples added. * Fix source file * Better example.mk * Turn off caffe by default * lint fixes * Trying to figure out how to fix submodules * nohub problem on travis so force retry * Edited test to just run make instead of obsolete make example * Fix cpp-package op.h bootstrapping with CMake * Build tweaking cpp-package * Lint fixes * op.h generator * FIx cpp-package for latest merge from master * Fix lint * static link * link whole static lib * Trigger another build attempt * Trigger another build attempt * Add caffe plugin support (disabled until dependencies can be added to build machine) * Add cufft library * win32 cufft library * don't link unit tests as static * Add include for rebuildable protobuf header caffe.pb.h
* Revert "Caffe without the patch, cpp-package fixed also with Caffe plugin (apache#5573)" This reverts commit a5abd79. * Revert "Revert "contrib fft,ifft,countsketch (apache#5563)" (apache#5634)" This reverts commit 7f688f7.
No description provided.