Skip to content

Commit 3f137e5

Browse files
authored
Merge pull request #10 from nvidia-riva/release/0.0.4
Release/0.0.4
2 parents 28c3da3 + 0731e18 commit 3f137e5

File tree

6 files changed

+88
-40
lines changed

6 files changed

+88
-40
lines changed

riva/client/package_info.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
MAJOR = 0
55
MINOR = 0
6-
PATCH = 3
6+
PATCH = 4
77
PRE_RELEASE = 'rc0'
88

99
# Use the following formatting: (major, minor, patch, pre-release)
@@ -21,6 +21,6 @@
2121
__description__ = "Python implementation of the Riva Client API"
2222
__license__ = 'MIT'
2323
__keywords__ = 'deep learning, machine learning, gpu, NLP, ASR, TTS, nvidia, speech, language, Riva, client'
24-
__riva_version__ = "2.2.1"
24+
__riva_version__ = "2.3.0"
2525
__riva_release__ = "22.06"
26-
__riva_models_version__ = "2.2.1"
26+
__riva_models_version__ = "2.3.0"

scripts/nlp/punctuation_client.py

Lines changed: 69 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def parse_args() -> argparse.Namespace:
2020
)
2121
parser.add_argument("--query", default="can you prove that you are self aware", help="Input Query")
2222
parser.add_argument(
23-
"--run_tests",
23+
"--run-tests",
2424
action='store_true',
2525
help="Flag to run sanity tests. If this option is chosen, then options `--query` and `--interactive` are "
2626
"ignored and a model is run on several hardcoded examples and numbers of passed and failed tests are shown.",
@@ -31,6 +31,9 @@ def parse_args() -> argparse.Namespace:
3131
help="If this option is set, then `--query` argument is ignored and the script suggests user to enter "
3232
"queries to standard input.",
3333
)
34+
parser.add_argument(
35+
"--language-code", default="en-US", help="Language code of the model to be used.",
36+
)
3437
parser = add_connection_argparse_parameters(parser)
3538
return parser.parse_args()
3639

@@ -43,47 +46,93 @@ def run_punct_capit(args: argparse.Namespace) -> None:
4346
query = input("Enter a query: ")
4447
start = time.time()
4548
result = riva.client.nlp.extract_most_probable_transformed_text(
46-
nlp_service.punctuate_text(input_strings=query, model_name=args.model)
49+
nlp_service.punctuate_text(
50+
input_strings=query, model_name=args.model, language_code=args.language_code
51+
)
4752
)
4853
end = time.time()
4954
print(f"Inference complete in {(end - start) * 1000:.4f} ms")
5055
print(result, end='\n' * 2)
5156
else:
5257
print(
5358
riva.client.nlp.extract_most_probable_transformed_text(
54-
nlp_service.punctuate_text(input_strings=args.query, model_name=args.model)
59+
nlp_service.punctuate_text(
60+
input_strings=args.query, model_name=args.model, language_code=args.language_code
61+
)
5562
)
5663
)
5764

5865

5966
def run_tests(args: argparse.Namespace) -> int:
60-
test_inputs = [
61-
"can you prove that you are self aware",
62-
"will you have $103 and ₩111 at 12:45 pm",
63-
# "Hi My name is markus stoinis How are you ?", # This fails for onnx model
64-
"the train leaves station by 09:45 A.M. and reaches destination in 3 hours",
65-
"Loona (stylized as LOOΠΔ, Korean: 이달의 소녀; Hanja: Idarui Sonyeo; lit. ''Girl of the Month'') is a South Korean girl group formed by Blockberry Creative",
66-
]
67-
test_output_ref = [
68-
"Can you prove that you are self aware?",
69-
"Will you have $103 and ₩111 at 12:45 pm?",
70-
# "Hi, My name is Markus Stoinis. How are you ?",
71-
"The train leaves station by 09:45 A.M. and reaches destination in 3 hours.",
72-
"Loona (stylized as LOOΠΔ, Korean: 이달의 소녀; Hanja: Idarui Sonyeo; lit. ''Girl of the Month'') is a South Korean girl group formed by Blockberry Creative.",
73-
]
67+
test_inputs = {
68+
"en-US": [
69+
"can you prove that you are self aware",
70+
"will you have $103 and ₩111 at 12:45 pm",
71+
# "Hi My name is markus stoinis How are you ?", # This fails for onnx model
72+
"the train leaves station by 09:45 A.M. and reaches destination in 3 hours",
73+
"Loona (stylized as LOOΠΔ, Korean: 이달의 소녀; Hanja: Idarui Sonyeo; lit. ''Girl of the Month'') is "
74+
"a South Korean girl group formed by Blockberry Creative",
75+
"i just want to start with a little bit of a word of warning and that is my job here tonight is to "
76+
"be a little bit of a doctor bring me down so bear with me for a few minutes and know that after "
77+
"this things will get lighter and brighter so let's start i know that many of you have heard the "
78+
"traveler's adage take nothing but pictures leave nothing but footprints well i'm going to say "
79+
"i don't think that's either as benign nor as simple as it sounds particularly for those of us in "
80+
"industries who are portraying people in poor countries in developing countries and portraying the "
81+
"poor and those of us in those industries are reporters researchers and people working for ngos i "
82+
"suspect there are a lot of us in those industries in the audience",
83+
],
84+
"es-US": ["bien y qué regalo vas a abrir primero", "ya hemos hablado de eso no"],
85+
"de-DE": ["aber weißt du wer den stein wirklich ins rollen gebracht hat", "anna weißt du wo charlotte ist"],
86+
"zh-CN": [
87+
"关于经济纠纷的说法村民们偏向于两种说法",
88+
"这样得来的学习成绩除了字面意义上的阿拉伯数字之外大约也没有多少积极意义",
89+
"this is a text关于经济纠纷的说法村民们偏向于两种说法another text",
90+
"人工智能(AI)正在蓬勃发展",
91+
],
92+
}
93+
test_output_ref = {
94+
"en-US": [
95+
"Can you prove that you are self aware?",
96+
"Will you have $103 and ₩111 at 12:45 pm?",
97+
# "Hi, My name is Markus Stoinis. How are you ?",
98+
"The train leaves station by 09:45 A.M. and reaches destination in 3 hours.",
99+
"Loona (stylized as LOOΠΔ, Korean: 이달의 소녀; Hanja: Idarui Sonyeo; lit. ''Girl of the Month'') is "
100+
"a South Korean girl group formed by Blockberry Creative.",
101+
"I just want to start with a little bit of a word of warning, and that is my job here tonight is "
102+
"to be a little bit of a doctor. Bring me down, so bear with me for a few minutes and know that "
103+
"after this things will get lighter and brighter. So let's start. I know that many of you have "
104+
"heard the traveler's adage Take nothing but pictures, leave nothing but footprints. Well, I'm "
105+
"going to say, I don't think that's either as benign nor as simple as it sounds, particularly for "
106+
"those of us in industries who are portraying people in poor countries in developing countries and "
107+
"portraying the poor and those of us in those industries are reporters, researchers and people "
108+
"working for ngos. I suspect there are a lot of us in those industries in the audience.",
109+
],
110+
"es-US": ["Bien. ¿y qué regalo vas a abrir primero?", "ya hemos hablado de eso, no?"],
111+
"de-DE": [
112+
"aber. Weißt du, wer den Stein wirklich ins Rollen gebracht hat,",
113+
"Anna, weißt du wo Charlotte ist?",
114+
],
115+
"zh-CN": [
116+
"关于经济纠纷的说法,村民们偏向于两种说法。",
117+
"这样得来的学习成绩,除了字面意义上的阿拉伯数字之外,大约也没有多少积极意义。",
118+
"this is a text。关于经济纠纷的说法,村民们偏向于两种说法。another text",
119+
"人工智能(AI)正在蓬勃发展。",
120+
],
121+
}
74122

75123
auth = riva.client.Auth(args.ssl_cert, args.use_ssl, args.server)
76124
nlp_service = riva.client.NLPService(auth)
77125

78126
fail_count = 0
79-
for input, output_ref in zip(test_inputs, test_output_ref):
127+
for input_, output_ref in zip(test_inputs[args.language_code], test_output_ref[args.language_code]):
80128
pred = riva.client.nlp.extract_most_probable_transformed_text(
81129
nlp_service.punctuate_text(
82-
input_strings=input,
130+
input_strings=input_,
83131
model_name=args.model,
132+
language_code=args.language_code,
84133
)
85134
)
86-
print(f"Input: {input}")
135+
print(f"Input: {input_}")
87136
print(f"Output: {pred}")
88137
if pred != output_ref:
89138
print(f"Output mismatched!")

scripts/nlp/update_intent_slot_test_data_format.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ def parse_args() -> argparse.Namespace:
1313
"'BOS <intent> <text> EOS'. This script keeps only <text> in <query> and removes auxiliary "
1414
"<intent> field and BOS and EOS."
1515
)
16-
parser.add_argument("--input_file", type=Path, help="A path to an input .tsv file.", required=True)
17-
parser.add_argument("--output_file", type=Path, help="A path to an output .tsv file.", required=True)
16+
parser.add_argument("--input-file", type=Path, help="A path to an input .tsv file.", required=True)
17+
parser.add_argument("--output-file", type=Path, help="A path to an output .tsv file.", required=True)
1818
args = parser.parse_args()
1919
args.input_file = args.input_file.expanduser()
2020
args.output_file = args.output_file.expanduser()

setup.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,17 @@ def run(self):
7878
# )
7979

8080
os.chdir(cwd)
81-
print("glob dir: ", str(setup_py_dir / 'common/riva/proto/*.proto'))
82-
for proto in glob(str(setup_py_dir / 'common/riva/proto/*.proto')):
81+
glob_dir = str(setup_py_dir / 'common/riva/proto/*.proto')
82+
print("glob dir: ", glob_dir)
83+
protos = glob(glob_dir)
84+
if not protos:
85+
raise ValueError(
86+
f"No proto files matching glob {glob_dir} were found. If {setup_py_dir / 'common'} directory is "
87+
f"empty, you may try to fix it by calling `git submodule update --init`. If you unintentionally "
88+
f"removed {setup_py_dir / 'common'} content, then you may try `cd {setup_py_dir / 'common'} && "
89+
f"git stash && cd -`."
90+
)
91+
for proto in glob(glob_dir):
8392
print(proto)
8493
grpc_tools.protoc.main(
8594
[
@@ -105,16 +114,6 @@ def run(self):
105114
super(BuildPyCommand, self).run()
106115

107116

108-
def get_version():
109-
version_file = setup_py_dir / "VERSION"
110-
versions = open(version_file, "r").readlines()
111-
version = "devel"
112-
for v in versions:
113-
if v.startswith("RIVA_VERSION: "):
114-
version = v[len("RIVA_VERSION: ") :].strip()
115-
return version
116-
117-
118117
setuptools.setup(
119118
name=__package_name__,
120119
license=__license__,
@@ -136,7 +135,7 @@ def get_version():
136135
"Intended Audience :: Developers",
137136
"Programming Language :: Python :: 3",
138137
],
139-
python_requires='>=3.6',
138+
python_requires='>=3.7',
140139
install_requires=['grpcio-tools'],
141140
setup_requires=['grpcio-tools'],
142141
)

tests/integration/nlp/test_punctuation_client.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function test_interactive(){
7676
test_interactive
7777

7878
function test_run_tests(){
79-
exp_options="--run_tests"
79+
exp_options="--run-tests"
8080
echo " options: ${exp_options}"
8181
stdout_file="${test_output_dir}/stdout_run_tests.txt"
8282
stderr_file="${test_output_dir}/stderr_run_tests.txt"
@@ -95,7 +95,7 @@ function test_run_tests(){
9595
if [[ "${OSTYPE}" != msys ]] && [[ "${OSTYPE}" != win32 ]]; then
9696
test_run_tests
9797
else
98-
echo " Skipping testing of option --run_tests. Cannot be tested on Windows because of Korean characters."
98+
echo " Skipping testing of option --run-tests. Cannot be tested on Windows because of Korean characters."
9999
fi
100100

101101
set +e
Binary file not shown.

0 commit comments

Comments
 (0)