Skip to content

Commit

Permalink
importlib version
Browse files Browse the repository at this point in the history
  • Loading branch information
sangmichaelxie committed Nov 8, 2023
1 parent e6f01f5 commit 9b352eb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions data_selection/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
try:
import importlib.metadata as importlib_metadata
except ModuleNotFoundError:
import importlib_metadata

__version__ = importlib_metadata.version('data-selection')

from .base import DSIR
from .hashed_ngram_dsir import HashedNgramDSIR
3 changes: 2 additions & 1 deletion data_selection/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from tqdm import tqdm

from data_selection.utils import parallelize
from data_selection import __version__


def default_load_dataset_fn(path: str) -> Iterable[Dict]:
Expand Down Expand Up @@ -45,7 +46,7 @@ def _iterate_virtually_sharded_dataset(dataset: Iterable, num_shards: int, shard

class DSIR():
"""Base class for data selection with importance resampling (DSIR)."""
__version__ = '1.0.1'
__version__ = __version__

def __init__(self,
raw_datasets: List[str],
Expand Down
1 change: 0 additions & 1 deletion data_selection/hashed_ngram_dsir.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def get_ngram_counts(line: str,

class HashedNgramDSIR(DSIR):
"""DSIR with hashed n-gram features."""
__version__ = '1.0.1'

def __init__(self,
raw_datasets: List[str],
Expand Down

0 comments on commit 9b352eb

Please sign in to comment.