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

gandlf_recoverConfig 1.3 KB

You have to be logged in to leave a comment. Sign In
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
  1. #!usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import argparse
  4. from GANDLF.cli import copyrightMessage, recover_config
  5. import pickle
  6. import os, sys
  7. import yaml
  8. if __name__ == "__main__":
  9. parser = argparse.ArgumentParser(
  10. prog="GANDLF_RecoverConfig",
  11. formatter_class=argparse.RawTextHelpFormatter,
  12. description="Recovers a config file from a GaNDLF model. If used from within a deployed GaNDLF MLCube, attempts to extract the config from the embedded model.\n\n"
  13. + copyrightMessage,
  14. )
  15. parser.add_argument(
  16. "-m",
  17. "--modeldir",
  18. metavar="",
  19. default="",
  20. type=str,
  21. help="Path to the model directory.",
  22. )
  23. parser.add_argument(
  24. "-c",
  25. "--mlcube",
  26. metavar="",
  27. type=str,
  28. help="Pass this option to attempt to extract the config from the embedded model in a GaNDLF MLCube (if any). Only useful in that context.",
  29. )
  30. parser.add_argument(
  31. "-o",
  32. "--outputFile",
  33. metavar="",
  34. type=str,
  35. help="Path to an output file where the config will be written.",
  36. )
  37. args = parser.parse_args()
  38. if args.mlcube:
  39. search_dir = "/embedded_model/"
  40. else:
  41. search_dir = args.modeldir
  42. result = recover_config(search_dir, args.outputFile)
  43. assert result, "Config file recovery failed."
Tip!

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

Comments

Loading...