-
-
Notifications
You must be signed in to change notification settings - Fork 605
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
Support custom events for metrics update #874
Comments
Hey, thank you for the suggestion ! To add some inputs maybe useful, did you check event filtering ? The last thing which could help is the detachment of metrics metric = ...
engine = ...
metric.detach(engine)
assert "mymetric" not in engine.run(data).metrics
assert not metric.is_attached(engine) |
@sdesrozis Thanks for your quick response!
Overall, the reason I bring this up to a feature proposal is because
|
iterations = [0,12, 77]
def my_filter(engine, event):
return engine.state.iteration in iterations
@engine.on(Events.ITERATION_COMPLETED(event_filter=my_filter))
def my_function(_):
# do what I want Btw, I don't know if this could help you. Could you give me a feedback about it? |
@snie2012 thanks for the suggestion ! Could you please detail about your scenario the following question:
|
Sorry for the late response. @sdesrozis @vfdev-5 |
Ok I understand your need :) Let's see how address that. |
I’m working on this issue. I would be on the same line as you. You said that these metrics should be updated in a subset of iterations. So during epoch, some batch are not considered. I understand that this subset is not known, so we can’t use filter. Questions :
Thanks for you help 🙏🏻 |
@sdesrozis Thanks a lot for working on this and apologies for late reply. Answer your questions:
|
@sdesrozis Would you mind showing an example of using the changes you made in sdesrozis:issue_874 to update on custom events? My understanding is that I can create a customized |
@snie2012 to detail "1.", what is exactly your custom event ? Is it a built-in event from About "2." and what you posted in the very begining of the issue:
Could you, please, provide a complete example of how do you use it with |
Yes, Epoch-wise accuracy : engine = ...
acc = Accuracy()
acc.attach(engine, "acc", usage="epoch_wise") # default It means reset of metric at Batch-wise accuracy : engine = ...
acc = Accuracy()
acc.attach(engine, "acc", usage="batch_wise") It means reset of metric at You can define a custom usage my_usage = YourCustomUsage()
acc = Accuracy()
acc.attach(engine, "acc", usage= my_usage) Here, HTH |
Will do. Thanks a lot! |
Currently for ignite metrics,
update
function is called per iteration. In scenarios like multitasking, there can be metrics for different tasks, and each iteration might only have outputs for a subset of tasks. In this situation, only the metrics associated with those tasks having outputs can/should be updated.To make it work, I need to overwrite the
attach
function like this:This is doable, but would be nice to have it by default in ignite. Also, this manual overwrite doesn't work with DDP. The cause is related to
_internal_attach
inmetrics_lambda.py
.I would like to propose
update
every iteration by defaultupdate
by accepting custom eventsMultitasking is one case where this can be very helpful. But I am sure there will be other use cases.
The text was updated successfully, but these errors were encountered: