Skip to content

Commit 8fca02c

Browse files
committed
Add a flag for specifying which languages to push
1 parent 4c55979 commit 8fca02c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

hugging_stanza.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ def get_model_card(lang):
4040
""".format(lang=lang, lang_text=lang_text, now=now)
4141
return model_card
4242

43-
# TODO: use version to get the available languages
44-
# TODO: allow the user to specify certain languages
45-
# TODO: skip languages where the version and the data didn't change
46-
MODELS = list_available_languages()
47-
4843
def write_model_card(repo_local_path, model):
4944
"""
5045
Write a README for the current model to the given path
@@ -57,7 +52,12 @@ def parse_args():
5752
parser = argparse.ArgumentParser()
5853
parser.add_argument('--input_dir', type=str, default="/u/nlp/software/stanza/models/1.3.1", help='Directory for loading the stanza models')
5954
parser.add_argument('--version', type=str, default="1.3.1", help='Version of stanza models to upload')
55+
parser.add_argument('lang', nargs='*', help='List of languages. Will default to all languages')
6056
args = parser.parse_args()
57+
if len(args.lang) == 0:
58+
# TODO: use version to get the available languages
59+
# TODO: skip languages where the version and the data didn't change
60+
args.lang = list_available_languages()
6161
return args
6262

6363
def copytree(src, dst):
@@ -70,12 +70,14 @@ def copytree(src, dst):
7070

7171

7272
def push_to_hub():
73+
print("HELLO WORLD")
7374
args = parse_args()
7475
input_dir = args.input_dir
7576

7677
api = HfApi()
7778

78-
for model in MODELS:
79+
print("Processing languages: {}".format(args.lang))
80+
for model in args.lang:
7981
print(f"Processing {model}")
8082
# Create the repository
8183
repo_name = "stanza-" + model

0 commit comments

Comments
 (0)