-
Notifications
You must be signed in to change notification settings - Fork 91
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
Global cache_dir
variable for exact, fuzzy, and semantic deduplication
#384
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Sarah Yurick <[email protected]>
Signed-off-by: Sarah Yurick <[email protected]>
Signed-off-by: Sarah Yurick <[email protected]>
cache_dir
variable for exact, fuzzy, and semantic deduplication
You also need to set a global variable representing the cache directory where the outputs are written: | ||
|
||
.. code-block:: python | ||
|
||
from nemo_curator.cache import initialize_cache_directory | ||
|
||
initialize_cache_directory("cache_dir") |
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.
Could also make more sense to call this something else, like deduplication_outputs
.
id_column=id_column, | ||
id_column_type=id_column_type, | ||
which_to_keep=config.which_to_keep, | ||
output_dir=os.path.join(cache_dir, config.clustering_save_loc), |
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.
Might want to re-add output_dir
to SemanticClusterLevelDedup
and/or add it as a parameter for SemDedup
self.sorted_clusters_dir = os.path.join( | ||
get_cache_directory(), "clustering", "sorted" | ||
) | ||
self.output_dir = os.path.join(get_cache_directory(), "clustering") |
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.
self.output_dir = os.path.join(get_cache_directory(), "clustering") | |
self.output_dir = os.path.join(get_cache_directory(), "duplicates") |
?
Signed-off-by: Sarah Yurick <[email protected]>
Signed-off-by: Sarah Yurick <[email protected]>
Signed-off-by: Sarah Yurick <[email protected]>
Signed-off-by: Sarah Yurick <[email protected]>
Signed-off-by: Sarah Yurick <[email protected]>
from nemo_curator.utils.file_utils import expand_outdir_and_mkdir | ||
|
||
# Global variable to store the cache directory | ||
_global_cache_dir = None |
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.
Instead of a global variable, we should use the singleton design pattern here, where there is a Cache
class that creates the static singleton instance (if it doesn't exist), or returns an existing one (if it was already created).
Subsequently, the init and get methods can be nicely wrapped inside that class.
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.
@sarahyurick please let me know what you think and whether my comment makes sense to you
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.
Thank you! Yes, that makes sense to me. Sorry I haven't gotten back to this earlier, but I expect to have more changes ready next week.
Signed-off-by: Sarah Yurick <[email protected]>
Signed-off-by: Sarah Yurick <[email protected]>
Signed-off-by: Sarah Yurick <[email protected]>
TODO: