-
Notifications
You must be signed in to change notification settings - Fork 1k
Systematic asset reuse for attached models #2526 #2540
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
base: main
Are you sure you want to change the base?
Systematic asset reuse for attached models #2526 #2540
Conversation
src/user/user_objects.cc
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something weird happened to this file. It looks like the code is repeated many times?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I stashed git changes it said no changes registered added a case deleted the code tried to commit again user changes have not been stashed try merge head and after that I don't what the code file copy pasted itself. I am so sorry about this mess-up i was non intentional. I will fix this in next commit
specs_.push_back(spec); | ||
} | ||
|
||
// Find duplicate assets and return the existing one if found | ||
mjSpec* mjCModel::FindDuplicateAsset(const mjSpec* spec) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing! Can you please add a test in user_api_test.cc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For sure i will do it very soon
Comparison by metadata is not enough. You can exit early if the metadata is different, but if it's the same then you have to compare the content. Adding @kbayes who has some related infra in the asset cache. |
You are absolutely right as the current asset deduplication check in FindDuplicateAsset only compares metadata like file paths and dimensions. To make it more robust, you are suggesting as i understand to check if the metadata matches, then perform a byte-by-byte comparison of the actual asset content using memcmp? I can try to Implement this logic in user_model.cc. Please let me know if I am on the right track. |
276e320
to
3444b8e
Compare
I have tried to implement this. I am very unsure of this. Any help is appreciated |
@yuvaltassa any updates on this? |
Asset Deduplication for Model Attachment
Changes:
FindDuplicateAsset
method to perform thorough comparisons of different asset types:AppendSpec
method to check for existing assets before appending new onesThis is a very rough Implementation of the issue let me know if its ok to be accepted