enhance copy in metatensor#4506
Conversation
Signed-off-by: Wenqi Li <[email protected]>
|
Hi @rijobro, this PR is mainly to set Line 143 in 46dc2ec |
|
Hm, although disabling deep copying will make things faster, we obviously need to be careful of accidentally modifying an image's meta data when modifying another image that is a shallow copy. I suppose I'm not sure what the easy answer here is, we need a cleverer mechanism for figuring out when to copy and when not. |
|
I don't think this is necessarily a good idea, but we could have a context manager: with MetaTensor.deep_copy_meta(False):
out = model(image |
|
/integration-test
I'm trying to set shallow copy when |
Signed-off-by: Wenqi Li <[email protected]>
|
I suppose when it's in a batch we're unlikely to be modifying meta data. Seems like a bit of an indirect correlation, though. |
|
the existing unit/integration tests work fine and the changes are non-breaking, I'll merge this for now but please feel free to create better solutions. |
Signed-off-by: Wenqi Li [email protected]
addresses #4462 (comment)
Description
_copy_metais currently makingoutputs = model(image)slow because of the meta attributes deepcop, this PR updates it to use a shallow copy, now the fast training pipeline can achieve the expected speedget_default_metastatic to have some minor speed up.Status
Ready/Work in progress/Hold
Types of changes
./runtests.sh -f -u --net --coverage../runtests.sh --quick --unittests --disttests.make htmlcommand in thedocs/folder.