Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

#609 Ci fix

Merged
Ghost merged 1 commits into Deci-AI:master from deci-ai:bugfix/infra-000_ci
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  1. import argparse
  2. import sys
  3. from typing import Any
  4. from super_gradients.common.abstractions.abstract_logger import get_logger
  5. logger = get_logger(__name__)
  6. EXTRA_ARGS = []
  7. def pop_arg(arg_name: str, default_value: Any = None) -> Any:
  8. """Get the specified args and remove them from argv"""
  9. parser = argparse.ArgumentParser()
  10. parser.add_argument(f"--{arg_name}", default=default_value)
  11. args, _ = parser.parse_known_args()
  12. # Remove the ddp args to not have a conflict with the use of hydra
  13. for val in filter(lambda x: x.startswith(f"--{arg_name}"), sys.argv):
  14. EXTRA_ARGS.append(val)
  15. sys.argv.remove(val)
  16. return vars(args)[arg_name]
  17. def pop_local_rank() -> int:
  18. """Pop the python arg "local-rank". If exists inform the user with a log, otherwise return -1."""
  19. local_rank = pop_arg("local_rank", default_value=-1)
  20. if local_rank != -1:
  21. logger.info("local_rank was automatically parsed from your config.")
  22. return local_rank
Discard
Tip!

Press p or to see the previous file or, n or to see the next file