Skip to content

Commit

Permalink
add print_important_package_version log
Browse files Browse the repository at this point in the history
  • Loading branch information
helloyongyang committed Aug 7, 2024
1 parent 02b1983 commit 4b8c5aa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 4 additions & 1 deletion llmc/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
from llmc.data import BaseDataset, BaseTokenizer
from llmc.eval import PerplexityEval
from llmc.models import *
from llmc.utils import check_config, mkdirs, seed_all
from llmc.utils import (check_config, mkdirs, print_important_package_version,
seed_all)
from llmc.utils.registry_factory import ALGO_REGISTRY, MODEL_REGISTRY


Expand Down Expand Up @@ -121,6 +122,8 @@ def main(config):
logger.info(f'args: {args}')
logger.info(f'config:\n{json.dumps(config, ensure_ascii=False, indent=4)}')

print_important_package_version()

seed_all(config.base.seed)

# mkdirs
Expand Down
3 changes: 2 additions & 1 deletion llmc/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from .utils import check_config, copy_files, mkdirs, seed_all
from .utils import (check_config, copy_files, mkdirs,
print_important_package_version, seed_all)
9 changes: 9 additions & 0 deletions llmc/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,12 @@ def copy_files(source_dir, target_dir, substring):
target_file = os.path.join(target_dir, filename)
shutil.copy(source_file, target_file)
logger.info(f'Copied {filename} to {target_dir}')


def print_important_package_version():
from importlib.metadata import version
logger.info(f"torch : {version('torch')}")
logger.info(f"transformers : {version('transformers')}")
logger.info(f"tokenizers : {version('tokenizers')}")
logger.info(f"huggingface-hub : {version('huggingface-hub')}")
logger.info(f"datasets : {version('datasets')}")

0 comments on commit 4b8c5aa

Please sign in to comment.