gagan3012 commited on
Commit
c218419
·
1 Parent(s): e888511

Update cli.py

Browse files
Files changed (1) hide show
  1. t5s/cli.py +51 -20
t5s/cli.py CHANGED
@@ -3,30 +3,50 @@ import os
3
  import subprocess
4
  import sys
5
 
6
- arg_parser = argparse.ArgumentParser(description="T5 Summarisation Using Pytorch Lightning",
7
- prog="t5s")
 
8
  # Command choice
9
- command_subparser = arg_parser.add_subparsers(dest="command", help="command (refer commands section in documentation)")
 
 
10
 
11
- parser_req = command_subparser.add_parser('requirements', help='Install Python Dependencies.')
 
 
12
 
13
- parser_dirs = command_subparser.add_parser('dirs', help='Create directories that are ignored by git but required for '
14
- 'the project')
 
 
15
 
16
- parser_push = command_subparser.add_parser('push', help='Upload Data to default DVC remote')
 
 
17
 
18
- parser_pull = command_subparser.add_parser('pull', help="Download Data from default DVC remote")
 
 
19
 
20
- parser_run = command_subparser.add_parser('run', help="run the DVC pipeline - recompute any modified outputs such as "
21
- "processed data or trained models")
 
 
 
22
 
23
- parser_visualize = command_subparser.add_parser('visualize', help="run the visualization using Streamlit")
 
 
24
 
25
- parser_upload = command_subparser.add_parser('upload', help="push the trained model to HF model hub")
 
 
26
 
27
- parser_lint = command_subparser.add_parser('lint', help=" Lint using flake8")
28
 
29
- parser_clone = command_subparser.add_parser('clone', help="Clone the T5 summarisation repo")
 
 
30
 
31
 
32
  class Run(object):
@@ -37,15 +57,26 @@ class Run(object):
37
  arguments = self.arguments
38
  print(f"arguments passed: {arguments['command']}")
39
  # os.chdir('../')
40
- cmd = ['requirements', 'dirs', 'push', 'pull', 'run', 'visualize', 'upload', 'lint']
41
- if arguments['command'] == "clone":
42
- list_files = subprocess.run(["git", "clone", "https://dagshub.com/gagan3012/summarization.git"])
43
- os.chdir('./summarization/')
 
 
 
 
 
 
 
 
 
 
 
44
  retval = os.getcwd()
45
  print(retval)
46
  return list_files.returncode
47
- elif arguments['command'] in cmd:
48
- os.chdir('./summarization/')
49
  retval = os.getcwd()
50
  print(retval)
51
  list_files = subprocess.run(["make", arguments["command"]])
 
3
  import subprocess
4
  import sys
5
 
6
+ arg_parser = argparse.ArgumentParser(
7
+ description="T5 Summarisation Using Pytorch Lightning", prog="t5s"
8
+ )
9
  # Command choice
10
+ command_subparser = arg_parser.add_subparsers(
11
+ dest="command", help="command (refer commands section in documentation)"
12
+ )
13
 
14
+ parser_req = command_subparser.add_parser(
15
+ "requirements", help="Install Python Dependencies."
16
+ )
17
 
18
+ parser_dirs = command_subparser.add_parser(
19
+ "dirs",
20
+ help="Create directories that are ignored by git but required for " "the project",
21
+ )
22
 
23
+ parser_push = command_subparser.add_parser(
24
+ "push", help="Upload Data to default DVC remote"
25
+ )
26
 
27
+ parser_pull = command_subparser.add_parser(
28
+ "pull", help="Download Data from default DVC remote"
29
+ )
30
 
31
+ parser_run = command_subparser.add_parser(
32
+ "run",
33
+ help="run the DVC pipeline - recompute any modified outputs such as "
34
+ "processed data or trained models",
35
+ )
36
 
37
+ parser_visualize = command_subparser.add_parser(
38
+ "visualize", help="run the visualization using Streamlit"
39
+ )
40
 
41
+ parser_upload = command_subparser.add_parser(
42
+ "upload", help="push the trained model to HF model hub"
43
+ )
44
 
45
+ parser_lint = command_subparser.add_parser("lint", help=" Lint using flake8")
46
 
47
+ parser_clone = command_subparser.add_parser(
48
+ "clone", help="Clone the T5 summarisation repo"
49
+ )
50
 
51
 
52
  class Run(object):
 
57
  arguments = self.arguments
58
  print(f"arguments passed: {arguments['command']}")
59
  # os.chdir('../')
60
+ cmd = [
61
+ "requirements",
62
+ "dirs",
63
+ "push",
64
+ "pull",
65
+ "run",
66
+ "visualize",
67
+ "upload",
68
+ "lint",
69
+ ]
70
+ if arguments["command"] == "clone":
71
+ list_files = subprocess.run(
72
+ ["git", "clone", "https://dagshub.com/gagan3012/summarization.git"]
73
+ )
74
+ os.chdir("./summarization/")
75
  retval = os.getcwd()
76
  print(retval)
77
  return list_files.returncode
78
+ elif arguments["command"] in cmd:
79
+ os.chdir("./summarization/")
80
  retval = os.getcwd()
81
  print(retval)
82
  list_files = subprocess.run(["make", arguments["command"]])