Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADJUST io.py for logging mlflow; Credits: Blirona #1

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion trainer/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pathlib import Path
from typing import Any, Callable, Dict, List, Tuple, Union
from urllib.parse import urlparse

import mlflow
import fsspec
import torch
from coqpit import Coqpit
Expand Down Expand Up @@ -161,6 +161,15 @@ def save_checkpoint(
save_func=save_func,
**kwargs,
)
from TTS.tts.models.modelWrapper import MyModel

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Add the imports at the start of the file

Copy link
Collaborator Author

@a-klos a-klos Sep 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if they are at the beginning of the file, then there might be a circular import error.

from TTS.utils.synthesizer import Synthesizer
synthesizer = Synthesizer(checkpoint_path, os.path.join(output_folder, 'config.json'))
model = MyModel(synthesizer=synthesizer)
# For MLflow logging, , artifacts={'checkpoint': file_name, "output": output_folder}
a-klos marked this conversation as resolved.
Show resolved Hide resolved

run_name = os.getenv("RUN_NAME", "vits_janika_de")

mlflow.pyfunc.log_model(python_model=model, artifact_path="models/TTS",registered_model_name=run_name, code_path=[output_folder])
a-klos marked this conversation as resolved.
Show resolved Hide resolved
if save_n_checkpoints is not None:
keep_n_checkpoints(output_folder, save_n_checkpoints)

Expand Down