-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #322 from mlrun/marketplace-doc-gen-d18acbf
Marketplace update from marketplace-doc-gen-d18acbf
- Loading branch information
Showing
20 changed files
with
3,838 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"kind": ["nuclio", "dask", "nuclio:serving", "serving", "job"], "categories": ["Audio", "feature-store", "data-preparation", "data-validation", "model-training", "machine-learning", "Huggingface", "model-serving", "utils", "monitoring", "etl", "Deep Learning", "data-analysis", "model-testing"]} | ||
{"kind": ["job", "serving", "dask", "nuclio", "nuclio:serving"], "categories": ["data-preparation", "Huggingface", "data-analysis", "NLP", "model-serving", "data-validation", "etl", "Audio", "model-training", "deep-learning", "model-testing", "monitoring", "feature-store", "machine-learning", "utils", "Deep Learning"]} |
127 changes: 127 additions & 0 deletions
127
functions/development/translate/0.0.2/src/function.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
apiVersion: v1 | ||
categories: | ||
- data-preparation | ||
- machine-learning | ||
- deep-learning | ||
- NLP | ||
description: Translate text files from one language to another | ||
doc: '' | ||
example: translate.ipynb | ||
generationDate: 2023-12-05:17-20 | ||
hidden: false | ||
icon: '' | ||
labels: | ||
author: guyl | ||
maintainers: [] | ||
marketplaceType: '' | ||
mlrunVersion: 1.5.1 | ||
name: translate | ||
platformVersion: 3.5.3 | ||
spec: | ||
filename: translate.py | ||
handler: translate | ||
image: mlrun/mlrun | ||
kind: job | ||
requirements: | ||
- transformers | ||
- sentencepiece | ||
- torch | ||
- tqdm | ||
url: '' | ||
version: 0.0.2 | ||
test_valid: True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
transformers | ||
tqdm | ||
torch | ||
sentencepiece |
51 changes: 51 additions & 0 deletions
51
functions/development/translate/0.0.2/src/test_translate.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright 2023 Iguazio | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
import os.path | ||
import tempfile | ||
|
||
import mlrun | ||
|
||
|
||
def test_translate(): | ||
project = mlrun.new_project("test-translate") | ||
translate_fn = project.set_function("translate.py", "translate", image="mlrun/mlrun") | ||
input_text = "Ali her gece bir kitap okur." | ||
expected_translation = "Ali reads a book every night." | ||
|
||
with tempfile.TemporaryDirectory() as test_dir: | ||
with tempfile.TemporaryDirectory() as data_dir: | ||
with open(os.path.join(data_dir, "test_tr.txt"), "w") as f: | ||
f.write(input_text) | ||
translate_run = translate_fn.run( | ||
handler="translate", | ||
inputs={ | ||
"data_path": data_dir, | ||
}, | ||
params={ | ||
"model_name": "Helsinki-NLP/opus-mt-tr-en", | ||
"device": "cpu", | ||
"output_directory": test_dir, | ||
}, | ||
local=True, | ||
returns=[ | ||
"files: path", | ||
"text_files_dataframe: dataset", | ||
"errors: dict", | ||
], | ||
artifact_path=test_dir, | ||
) | ||
assert translate_run.status.state == "completed" | ||
with open(os.path.join(test_dir, "test_tr.txt")) as f: | ||
assert f.read() == expected_translation | ||
|
Oops, something went wrong.