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

Fix exponential scheduler with bias #589

Merged

Conversation

andrey-churkin
Copy link
Contributor

Looks like that current implementation does not work properly.
Consider the following example:

a, b, k = _init_exp(10, 0.1, 0.7)
x = a * np.exp(-k * 10) + b
print(x)

I expected that x is equal to 0.7 but I got 0.666666666666667.

@andrey-churkin
Copy link
Contributor Author

Jenkins please retry a build

@@ -194,11 +202,12 @@ def get_b(a, k):
return p_min - a
Copy link
Contributor

Choose a reason for hiding this comment

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

def get_b(a, k): -> def get_b(a):

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@lzrvch
Copy link
Contributor

lzrvch commented Mar 22, 2021

@mkaglins @AlexKoff88 I suppose we could re-run some filter pruning benchmarks to see diff in accuracy for this scheduler once this fix is introduced?

@mkaglins
Copy link
Contributor

@mkaglins @AlexKoff88 I suppose we could re-run some filter pruning benchmarks to see diff in accuracy for this scheduler once this fix is introduced?

This exponential_with_bias scheduler is not used in any officially claimed results, but we can run a comparison of exponential (that often used in Imagenet experiments) with this fixed version.

return 1 / 3 * y + 1 / (y ** 7) - 4 / 3
c = (0.75 * p_max - p_min) / (p_max - p_min)
y = np.exp(-x * epoch_idx)
return y ** factor - c * y + c - 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we make the factor parameter adjustable via config? I suppose the 1/8 value is based on what is set in the paper, not on our empirical results.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it is a good idea to set better default value based on empirical results on our models (firstly get these results). But I am not sure about the importance of this param in the config for users.

@vshampor vshampor merged commit b609aa4 into openvinotoolkit:develop Mar 22, 2021
kshpv pushed a commit to kshpv/nncf that referenced this pull request Oct 11, 2022
* exponential_with_bias scheduler was fixed

* Minor refactoring
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.

5 participants