1
resposta

Erro projeto de exemplo

Não cosnigo resolver o erro abaixo. Poderia me ajudar? Estou rodando pelo wsl/ubuntu.

mlflow run https://github.com/mlflow/mlflow-example.git -P alpha=0.5
2023/01/09 12:55:25 INFO mlflow.projects.utils: === Fetching project from https://github.com/mlflow/mlflow-example.git into /tmp/tmpm4cq53io ===
2023/01/09 12:55:27 INFO mlflow.projects.utils: Fetched 'master' branch
2023/01/09 12:55:28 INFO mlflow.utils.conda: Conda environment mlflow-2b6b69a3ea30872171ff71aee564367746fae613 already exists.
2023/01/09 12:55:28 INFO mlflow.projects.utils: === Created directory /tmp/tmp1gkbo999 for downloading remote URIs passed to arguments of type 'path' ===
2023/01/09 12:55:28 INFO mlflow.projects.backend.local: === Running command 'source /home/nataliehm/anaconda3/bin/../etc/profile.d/conda.sh && conda activate mlflow-2b6b69a3ea30872171ff71aee564367746fae613 1>&2 && python train.py 0.5 0.1' in run with ID '0ef48cbd5f1d495180ce683c7c0fd506' ===
Elasticnet model (alpha=0.500000, l1_ratio=0.100000):
  RMSE: 0.7947931019036528
  MAE: 0.6189130834228137
  R2: 0.1841166871822183
Traceback (most recent call last):
  File "/tmp/tmpm4cq53io/train.py", line 66, in <module>
    mlflow.sklearn.log_model(lr, "model")
  File "/home/nataliehm/.local/lib/python3.10/site-packages/mlflow/sklearn/__init__.py", line 417, in log_model
    return Model.log(
  File "/home/nataliehm/.local/lib/python3.10/site-packages/mlflow/models/model.py", line 487, in log
    mlflow.tracking.fluent.log_artifacts(local_path, mlflow_model.artifact_path)
  File "/home/nataliehm/.local/lib/python3.10/site-packages/mlflow/tracking/fluent.py", line 810, in log_artifacts
    MlflowClient().log_artifacts(run_id, local_dir, artifact_path)
  File "/home/nataliehm/.local/lib/python3.10/site-packages/mlflow/tracking/client.py", line 1048, in log_artifacts
    self._tracking_client.log_artifacts(run_id, local_dir, artifact_path)
  File "/home/nataliehm/.local/lib/python3.10/site-packages/mlflow/tracking/_tracking_service/client.py", line 448, in log_artifacts
    self._get_artifact_repo(run_id).log_artifacts(local_dir, artifact_path)
  File "/home/nataliehm/.local/lib/python3.10/site-packages/mlflow/tracking/_tracking_service/client.py", line 416, in _get_artifact_repo
    artifact_repo = get_artifact_repository(artifact_uri)
  File "/home/nataliehm/.local/lib/python3.10/site-packages/mlflow/store/artifact/artifact_repository_registry.py", line 106, in get_artifact_repository
    return _artifact_repository_registry.get_artifact_repository(artifact_uri)
  File "/home/nataliehm/.local/lib/python3.10/site-packages/mlflow/store/artifact/artifact_repository_registry.py", line 72, in get_artifact_repository
    return repository(artifact_uri)
  File "/home/nataliehm/.local/lib/python3.10/site-packages/mlflow/store/artifact/mlflow_artifacts_repo.py", line 46, in __init__
    super().__init__(self.resolve_uri(artifact_uri, get_tracking_uri()))
  File "/home/nataliehm/.local/lib/python3.10/site-packages/mlflow/store/artifact/mlflow_artifacts_repo.py", line 61, in resolve_uri
    _validate_uri_scheme(track_parse.scheme)
  File "/home/nataliehm/.local/lib/python3.10/site-packages/mlflow/store/artifact/mlflow_artifacts_repo.py", line 35, in _validate_uri_scheme
    raise MlflowException(
mlflow.exceptions.MlflowException: The configured tracking uri scheme: 'file' is invalid for use with the proxy mlflow-artifact scheme. The allowed tracking schemes are: {'http', 'https'}
2023/01/09 12:55:31 ERROR mlflow.cli: === Run (ID '0ef48cbd5f1d495180ce683c7c0fd506') failed ===
1 resposta

Olá, Natalie! Tudo bem?

Peço desculpa pela demora em respondê-la.

O erro que você está enfrentando está relacionado ao esquema de URI de rastreamento configurado. De acordo com a mensagem de erro, o esquema 'file' não é válido para uso com o esquema de proxy mlflow-artifact. Os esquemas de rastreamento permitidos são 'http' e 'https'.

Uma possível solução para o seu problema seria alterar o esquema de URI de rastreamento para 'http' ou 'https'. Você pode fazer isso definindo a variável de ambiente MLFLOW_TRACKING_URI para um endereço 'http' ou 'https' antes de executar o seu código. Aqui está um exemplo de como você pode fazer isso:

export MLFLOW_TRACKING_URI=http://localhost:5000
mlflow run https://github.com/mlflow/mlflow-example.git -P alpha=0.5

Neste exemplo, estou supondo que você tenha um servidor MLFlow rodando localmente na porta 5000. Você deve substituir 'http://localhost:5000' pelo endereço do seu servidor MLFlow.

Espero ter ajudado e bons estudos!

Caso este post tenha lhe ajudado, por favor, marcar como solucionado ✓.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software