Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sampling, batch_all, non-zero, optimizer-flag #33

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

lucasb-eyer
Copy link
Member

So this is a branch I had lying around for a while which adds a lot of things. I'm not merging it yet, as I still want to add these changes to the README and test it thoroughly, but here it is for others to try out.

It implements the trick I mentioned in #4 as well as some more variants we cover in the paper. If you give this a try, please give feedback here.

if args.loss_ignore_zero is True:
nnz = tf.count_nonzero(losses, dtype=tf.float32)
else:
nnz = tf.reduce_sum(tf.to_float(tf.greater(losses, args.loss_ignore_zero or 1e-5)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the point of this supposed to be just for logging?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, actually. It's type-magic and can be a little obscure, hence why I still need to write documentation in the README :)

The else case happens when loss_ignore_zero is given an additional float argument, so one can call it as --loss_ignore_zero 1e-3 for example, in order to consider anything below 1e-3 to be counted as zero.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read our paper, we explain them in there :) But really it's not a good time investment to play with that parameter.

Copy link
Contributor

@maxisme maxisme Apr 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am going to delete that comment because it makes no sense sorry. 😆 Currently have it printed and highlighted in front of me trying to get to grips!

help='Enable the super-mega-advanced top-secret sampling stabilizer.')

parser.add_argument(
'--loss_ignore_zero', default=False, const=True, nargs='?', type=common.positive_float,
Copy link
Contributor

@maxisme maxisme Apr 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh misread this to mean it can only be boolean. I am going to start playing with this then. 🍾

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants