cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

How to fix the error on INVALID_PARAMETER_VALUE when using mlflow for tracking a yolo model training?

Joey
New Contributor II

I'm new to databricks, and I'm trying to train yolo model and use mlflow to track the parameters and log the models. I keep getting this error related to the requirements.txt file path: INVALID_PARAMETER_VALUE: Invalid value '/Shared/YOLOv8/requirements.txt' for parameter: 'path'. Path must be relative.

I've tried to use the mlflow.log_artifact(requirements_path) with requirements_path being a relative path to the requirements.txt (/dbfs/FileStore/...), but it did not help. I'd appreciateany help to solve this problem. Thanks.

3 REPLIES 3

Anonymous
Not applicable

@Yosef Hdi​ :

The error message you received suggests that the path parameter in the log_artifact function call expects a relative path, rather than an absolute path. To fix this issue, you can try using a relative path to the requirements.txt file instead of an absolute path. Assuming that your requirements.txt file is located in the /Shared/YOLOv8 directory, you can try using the following code to log the requirements.txt file as an artifact using a relative path:

import os
import mlflow
 
# get the absolute path to the current working directory
cwd = os.getcwd()
 
# define the relative path to the requirements.txt file
requirements_path = os.path.relpath('/dbfs/Shared/YOLOv8/requirements.txt', start=cwd)
 
# log the requirements.txt file as an artifact
mlflow.log_artifact(requirements_path)

In this code, os.getcwd() returns the absolute path to the current working directory. The os.path.relpath() function is then used to convert the absolute path to the requirements.txt file to a relative path based on the current working directory. Finally, mlflow.log_artifact() is called with the relative path to the requirements.txt file as the argument.

I hope this helps! Let me know if you have any other questions.

Anonymous
Not applicable

Hi @Yosef Hdi​ 

Thank you for posting your question in our community! We are happy to assist you.

To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?

This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance! 

Joey
New Contributor II

Thanks for the reply, @Suteja Kanuri​ . I tried the proposed solution. This time got this message:

Invalid artifact path: '/Shared/YOLOv8'. Names may be treated as files in certain cases, and must not resolve to other names when treated as such. This name would resolve to '/Shared/YOLOv8'

Thanks.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.