haebeom-lee / l2b Goto Github PK
View Code? Open in Web Editor NEWTensorflow implementation of "Learning to Balance: Bayesian Meta-learning for Imbalanced and Out-of-distribution Tasks" (ICLR 2020 oral)
Tensorflow implementation of "Learning to Balance: Bayesian Meta-learning for Imbalanced and Out-of-distribution Tasks" (ICLR 2020 oral)
In the main.py
, these four parameters are default False
. So do we still need to add "--alpha_on --omega_on --gamma_on --z_on" in the command?
Also, I did not find where we use "--alpha_on, --z_on" in the main.py
file.
When I follow the exact instruction of the experiment (CIFAR, SVHN), I have the following results: The results are similar to that of MAML, not better than Bayesian TAML. Do you have any ideas?
In the meta-test phase, setting the MC approsimation with large sample size which means we need to perform multiple forward processing, which will cause large time consumption with large network?
Hi.
When I try to download some datasets (mimgnet, CUB, quickdraw), an error occurs and cannot download them.
Traceback (most recent call last):
File "get_data.py", line 37, in <module>
download_file('http://www.vision.caltech.edu/visipedia-data/CUB-200-2011/CUB_200_2011.tgz','CUB_200_2011.tgz')
File "get_data.py", line 28, in download_file
pbar = tqdm( unit="B", total=int( r.headers['Content-Length'] ) )
File "/home/dmsl/miniconda3/envs/tf-1.15/lib/python3.7/site-packages/requests/structures.py", line 54, in __getitem__
return self._store[key.lower()][1]
KeyError: 'content-length'
In the case of CUB, the URL redirects me to a Google drive link so it can be solved by manually download it.
But for mimgnet and quickdraw, the URL can be accessed because of error 404.
Hi Hae Beom,
Sorry to bother you again. I run some experiments:
--alpha_on --omega_on --gamma_on --z_on
.alpha omega gamma z
all off, train/test work very well. --alpha_on --omega_on --gamma_on --z_on
all on, train/test work very well.alpha omega gamma z
all off, train/test work very well. --alpha_on --omega_on --gamma_on --z_on
all on, there will appear this error when training:Traceback (most recent call last):
File "/home/cxl173430/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1334, in _do_call
return fn(*args)
File "/home/cxl173430/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1319, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "/home/cxl173430/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input to reshape is a tensor with 2328480 values, but the requested shape requires a multiple of 3072
[[{{node map/while/Reshape}} = Reshape[T=DT_FLOAT, Tshape=DT_INT32, _class=["loc:@gradients/map/while/encoder/conv1/Conv2D_grad/ShapeN/f_acc"], _device="/job:localhost/replica:0/task:0/device:GPU:0"](map/while/TensorArrayReadV3, map/while/Reshape/shape)]]
[[{{node Mean_1/_267}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_16025_Mean_1", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/cxl173430/l2b/main_2.py", line 266, in <module>
meta_train()
File "/home/cxl173430/l2b/main_2.py", line 147, in meta_train
sess.run(meta_train_to_run, feed_dict=fd_mtr))
File "/home/cxl173430/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 929, in run
run_metadata_ptr)
File "/home/cxl173430/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1152, in _run
feed_dict_tensor, options, run_metadata)
File "/home/cxl173430/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1328, in _do_run
run_metadata)
File "/home/cxl173430/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1348, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input to reshape is a tensor with 2328480 values, but the requested shape requires a multiple of 3072
[[node map/while/Reshape (defined at /home/cxl173430/l2b/encoder.py:35) = Reshape[T=DT_FLOAT, Tshape=DT_INT32, _class=["loc:@gradients/map/while/encoder/conv1/Conv2D_grad/ShapeN/f_acc"], _device="/job:localhost/replica:0/task:0/device:GPU:0"](map/while/TensorArrayReadV3, map/while/Reshape/shape)]]
[[{{node Mean_1/_267}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_16025_Mean_1", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
Caused by op 'map/while/Reshape', defined at:
File "/home/cxl173430/l2b/main_2.py", line 90, in <module>
net = model.forward_outer_multiple(sample=True, reuse=False)
File "/home/cxl173430/l2b/model.py", line 169, in forward_outer_multiple
parallel_iterations=self.metabatch)
File "/home/cxl173430/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/ops/functional_ops.py", line 494, in map_fn
maximum_iterations=n)
File "/home/cxl173430/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/ops/control_flow_ops.py", line 3291, in while_loop
return_same_structure)
File "/home/cxl173430/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/ops/control_flow_ops.py", line 3004, in BuildLoop
pred, body, original_loop_vars, loop_vars, shape_invariants)
File "/home/cxl173430/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2939, in _BuildLoop
body_result = body(*packed_vars_for_body)
File "/home/cxl173430/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/ops/control_flow_ops.py", line 3260, in <lambda>
body = lambda i, lv: (i + 1, orig_body(*lv))
File "/home/cxl173430/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/ops/functional_ops.py", line 483, in compute
packed_fn_values = fn(packed_values)
File "/home/cxl173430/l2b/model.py", line 163, in <lambda>
self.forward_outer(inputs, sample=sample, reuse=reuse)
File "/home/cxl173430/l2b/model.py", line 100, in forward_outer
(xtr, ytr), sample, reuse=reuse)
File "/home/cxl173430/l2b/encoder.py", line 106, in forward
q_omega, q_gamma, q_z = self.get_posterior(inputs, reuse=reuse)
File "/home/cxl173430/l2b/encoder.py", line 35, in get_posterior
x = tf.reshape(x, [-1, self.xdim, self.xdim, self.input_channel])
File "/home/cxl173430/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/ops/gen_array_ops.py", line 6482, in reshape
"Reshape", tensor=tensor, shape=shape, name=name)
File "/home/cxl173430/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/cxl173430/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func
return func(*args, **kwargs)
File "/home/cxl173430/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 3274, in create_op
op_def=op_def)
File "/home/cxl173430/anaconda3/envs/py35/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1770, in __init__
self._traceback = tf_stack.extract_stack()
InvalidArgumentError (see above for traceback): Input to reshape is a tensor with 2328480 values, but the requested shape requires a multiple of 3072
[[node map/while/Reshape (defined at /home/cxl173430/l2b/encoder.py:35) = Reshape[T=DT_FLOAT, Tshape=DT_INT32, _class=["loc:@gradients/map/while/encoder/conv1/Conv2D_grad/ShapeN/f_acc"], _device="/job:localhost/replica:0/task:0/device:GPU:0"](map/while/TensorArrayReadV3, map/while/Reshape/shape)]]
[[{{node Mean_1/_267}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_16025_Mean_1", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
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.