Commit Graph

31 Commits

Author SHA1 Message Date
Alexander Sidorov
83e6a0bec8 Revert uuid change to OperatorDef protobuf
Summary:
a few issues:

1. Randomization hurts memoization
1. Even if we make it non random, then we can get key colisions when loading it back.
2. RNNs use prototxt for step net and apparently its not forward compatible like normal protobuf is

I am thinking of a better less invasive solution now.

Reviewed By: jamesr66a

Differential Revision: D5272118

fbshipit-source-id: ab577fad04fbfc632e1fceffa923377a0d3da1be
2017-06-19 16:47:31 -07:00
Alexander Sidorov
eebda50b79 Operator python traceback
Summary: This is going to show a python Caffe2 user where a failed operator was created. Motivation for having this information not right in protobuf is to avoid having it too verboose and keep ability to read protobufs of a net after a simple print() call.

Reviewed By: jamesr66a

Differential Revision: D5226047

fbshipit-source-id: 7edfe850e05a2ec209577142aa3368664a57a108
2017-06-13 18:50:02 -07:00
Yiming Wu
8871ef029b quick fix future issue with brew/core/schema/workspace/scope/utils.py
Summary:
fixing missing future package issue.

Recently we found some of our users does not have future module support. So we might need a try/catch wrapper around all past import

Reviewed By: Yangqing

Differential Revision: D5183547

fbshipit-source-id: 262fdf2940ee1be4454bf0b0abb9e6a0f1a0ee82
2017-06-05 12:01:48 -07:00
Thomas Dudziak
3ccbf23132 String-related fixes for Python 3
Summary: This diff is one step towards enabling python 3 build by making it be more diligent in its handling of strings.

Reviewed By: salexspb

Differential Revision: D4893083

fbshipit-source-id: 28b8adf3280e8d1f0a7dc9b0fee5ad53f2fada57
2017-05-26 16:04:32 -07:00
Aapo Kyrola
658c337f41 Error status for Gloo ops, and handling in elastic dpm
Summary: Add a RandomFailureOp and handling to elastic data parallel model of the status code

Reviewed By: andrewwdye

Differential Revision: D5065936

fbshipit-source-id: 24224f9ea414ee535c9e90cc28add5189354b0ef
2017-05-17 00:16:52 -07:00
Yangqing Jia
cf317d1106 create_net: explicitly specify if one wants to overwrite the network.
Summary:
This is from discussion with dzhulgakov : as a step towards revisiting the
core.Net autonaming, we will first guard against accidental overwrites of
existing networks in the workspace.

ajtulloch since we are doing Predictors in mobile, this should be safe right?

azzolini - I assume this would be safe, but would love to get your approval.

akyrola - would this hurt xray?

Reviewed By: dzhulgakov

Differential Revision: D4897725

fbshipit-source-id: aa41271927ad6671f07a53b9505283623f8c49e5
2017-04-17 21:46:53 -07:00
Aaron Markham
58f7f2b441 doxygen python block added
Summary: Closes https://github.com/caffe2/caffe2/pull/226

Differential Revision: D4793550

Pulled By: JoelMarcey

fbshipit-source-id: cc33e58186304fa8dcac2ee9115dcc271d785b1e
2017-03-29 06:46:16 -07:00
Fei Sun
95657ea1e8 Protobuf is binary string. Use bytes instead.
Summary: Prepare for the Protobuf change.

Reviewed By: dzhulgakov

Differential Revision: D4784884

fbshipit-source-id: 86219eecefaf7637e70339437c9274c526ebd6fe
2017-03-28 19:03:23 -07:00
Alexander Sidorov
56f324d191 Added predictor bindings to python interface
Summary: from caffe2.python import workspace; p = workspace.Predictor(init_net, predict_net); outputs = p.run(inputs)

Reviewed By: Yangqing

Differential Revision: D4576793

fbshipit-source-id: b829bbcaf2e7c34dad85024177433207bd96a234
2017-03-15 11:17:54 -07:00
Yangqing Jia
bdd542d087 backup functions for non-cuda cases
Summary: This fixes the error introduced in cudnn v6 diff.

Reviewed By: ajtulloch

Differential Revision: D4633113

fbshipit-source-id: 454cd4b3e52b8de01c1914e66d25310d7ecb13aa
2017-02-28 22:07:54 -08:00
Simon Layton
fbf47a8825 Cudnn v6
Summary:
Add cudnn v6 support, including testing support for dilated convolution.
Add a check to ensure that the versions of cuDNN used to compile Caffe2 and run it are compatible
Closes https://github.com/caffe2/caffe2/pull/85

Reviewed By: bwasti

Differential Revision: D4387690

Pulled By: Yangqing

fbshipit-source-id: 312960134398dd4afe6ee0c01cdc160046c904e8
2017-02-28 17:46:33 -08:00
Aaron Markham
851cb7059d changed StringfyProto to StringifyProto
Summary: Closes https://github.com/caffe2/caffe2/pull/155

Reviewed By: dzhulgakov

Differential Revision: D4621607

Pulled By: Yangqing

fbshipit-source-id: ec7f45132260fbb6d36ef61ffbf5bf6466f237eb
2017-02-27 23:05:04 -08:00
Bram Wasti
183e158642 Remove Model API (unused)
Summary: Removed Model API because no one {seems to,should} be using it

Reviewed By: Yangqing

Differential Revision: D4575126

fbshipit-source-id: 174d39e9aa46750f1fae8295f7e1e5452559af33
2017-02-21 17:19:05 -08:00
ezineo
e52676b272 Delete SerializeToString() call in class Model(), workspace.py
Summary:
.In Tutorial, I found it not correct when calling Model(). After that changing, It works.
Closes https://github.com/caffe2/caffe2/pull/148

Reviewed By: bwasti

Differential Revision: D4556894

Pulled By: Yangqing

fbshipit-source-id: 949a8d0496861f19869436908ffe1ef1a0f853b1
2017-02-13 23:18:03 -08:00
Andrew Dye
306fde233a Accept optional blob map for InferShapesAndTypes
Summary:
Shape inference allows Caffe2 to compute shapes of blobs without running a model. Update InferShapesAndTypes() to accept an optional blob:dimensions map so that external input blobs do not need to be part of the workspace.

InferShapesAndTypes() in workspace.py conditionally calls the ...from_workspace or ...from_map bindings. Note I favored a small amount of code duplication here for the sake of readability. InferShapesAndTypes() in operator.cc has been refactored into mirrored entry points, invoking a common helper.

Other minor changes to address linter warnings.

Reviewed By: dzhulgakov

Differential Revision: D4524873

fbshipit-source-id: 56f863b759c016d7f23523f06fda3aa5bba22357
2017-02-08 15:04:24 -08:00
Aapo Kyrola
6a03641cde Add num_iters to RunNet()
Summary:
Running RunNet() in python in a loop can be a performance issue if the python code is doing a lot of other processing, such as data input, because python's Global Interpreter lock (GIL) will prevent the RunNet() to be called. This can easily be fixed by making RunNet() run multiple iterations inside the C++ land. (Another way to accomplish the same thing is to use Caffe2's "execution plans", but that requires more setup).

+ fixed timing reporting in my OC workflow
+ improved one error log in data_workers.py

Sorry for piggypagging those small changes, but landing diffs currently is slow...

Reviewed By: rpenggithub

Differential Revision: D4523575

fbshipit-source-id: 039a647576efad5dd9afda74df478ac22b43c103
2017-02-07 14:16:14 -08:00
Aapo Kyrola
dcefc74a0c Shape and Type Inference Part1
Summary:
This is a bit large diff, sorry about it. It includes basic shape and type inference functionality, based on YQ's Schema scaffolding. I added some helper functions to make it easier to write simple translations.

Bigger refactoring was needed for ConvPoolBase so that we could use the shape inference already there in the schema.

I annotated enough operators to be able to infer forward-pass of shapes for basic convnet, and added test for that. I intend to bootcamp some annotations and annotate enough to handle Resnets fully. Need to think about gradients, if they could be annotated in an easier way.

Only shapes are now exposed to Python, types will follow later. Also the inference is not called yet anywhere but unit test.

Also I am not sure if everything is in the best location in the code, but shouldn't be hard to move stuff around.

Reviewed By: dzhulgakov

Differential Revision: D4436818

fbshipit-source-id: eebee5937ccc9ac09c245465302388a1fae6933c
2017-02-02 22:29:22 -08:00
Aapo Kyrola
fe38a0c2b1 remove logging.basicConfig() from workplace
Summary: As part of PR from GitHub, "logging.basicConfig()" was added to workplace, causing havoc with existing logger configurations. It should not be here. Thanks rbgirshick for reporting.

Reviewed By: kdub0

Differential Revision: D4346077

fbshipit-source-id: 084ddcbfe6354bdaf5c97a42086c0bd36ec4629c
2016-12-19 11:59:26 -08:00
Pooya Davoodi
78edb8295e No exception for float64 in FeedBlob. Warning instead.
Summary:
The exception in FeedBlob causes many tests to fail.
Instead of exception, we log a warning message and move on.
Feeding a float64 blob should not cause any issue.
Closes https://github.com/caffe2/caffe2/pull/57

Reviewed By: bwasti

Differential Revision: D4343135

Pulled By: Yangqing

fbshipit-source-id: cd1144b94c9883fcbd8bdcd78f9f93a67debc0a6
2016-12-16 17:29:29 -08:00
Aapo Kyrola
3410939459 pass learning rate scaling factor to parameter update builder function
Summary:
When refactoring data parallel model, the division of LR by number of devices was dropped, and thus we ended up effectively multiplying gradients by the number of devices. Thus, we need to scale the LR by 1/numgpus.

Created a test to confirm that data_parallel_model produces exactly same results on different number of gpus, given the total batch size.

Reviewed By: prigoyal

Differential Revision: D4248907

fbshipit-source-id: af21ede113e6ac25f12c556de298cb18974548be
2016-12-05 11:53:26 -08:00
Dmytro Dzhulgakov
a7df0e6724 Clone model net to avoid hard-coded inputs
Summary:
Previously DPER was quite broken - we couldn't change loaders on the fly because serialized model had blob names hard-coded, e.g. "nn_loader/dense". In fact, the tests worked only by accident as both trainer and evaluator used the same loader type.

This diff does the following:
1) when writing out model, remap input blobs to be 'inputs/<field_name>'
2) when loading eval model, remap them back to the current loader

This diff uses Net.input_schema() for convenience, in particular the schema format is implicitly serialized in input blobs names. From our discussion with Andrey this type of hardcoding is actually acceptible since the schema of HiveReader on python side is inferred via the same string-parsing procedure

It also modifies model saving a bit so that we don't pollute global namespace with shape_provider net.

Overall code in mlp.py is pretty terrible. But I'd leave refactoring to xianjiec as a part of Layers migration.

Reviewed By: xianjiec

Differential Revision: D4218902

fbshipit-source-id: 6cd19f0343ec1be6ddaa3581512e61879957749e
2016-11-29 15:18:38 -08:00
Aapo Kyrola
c1c92479bd check that numpy arrays are float32 when CUDA is used
Summary:
Recurrent developer-issue is that they pass numpy arrays with FeedBlob but forget that python float is actually double. Cuda ops in caffe2 don't allow doubles.
 Thus, I think we should reject incorrect types already at the FeedBlob() when device option is CUDA.

Added test.

Is this too strong?

Reviewed By: ajtulloch

Differential Revision: D4208153

fbshipit-source-id: 364b057a2a37b5d4b95de4e59faebdab724bb0ed
2016-11-29 15:18:37 -08:00
Yangqing Jia
238ceab825 fbsync. TODO: check if build files need update. 2016-11-15 00:00:46 -08:00
Yangqing Jia
d1e9215184 fbsync 2016-10-07 13:08:53 -07:00
Yangqing Jia
b23e51d467 chunky sync 2016-09-06 15:55:19 -07:00
Yangqing Jia
05512d1e10 sync 2016-08-10 11:02:15 -07:00
Yangqing Jia
bcea409c82 sync 2016-07-28 15:06:43 -07:00
Yangqing Jia
6463eebc7b chunky sync - build scripts to be written 2016-07-21 10:16:42 -07:00
Yangqing Jia
559053d3a8 chunky sync 2016-05-13 14:43:48 -07:00
Yangqing Jia
cf7ca23fc1 make caffe2.python build 2016-03-08 16:48:19 -08:00
Yangqing Jia
9ae880bb6f move pycaffe2 to caffe2.python 2016-03-08 15:45:30 -08:00