cancel
Showing results for 
Search instead for 
Did you mean: 
Generative AI
Explore discussions on generative artificial intelligence techniques and applications within the Databricks Community. Share ideas, challenges, and breakthroughs in this cutting-edge field.
cancel
Showing results for 
Search instead for 
Did you mean: 

Error when logging artifact OSError: [Errno 5] Input/output error: '/dbfs/Volumes'

Sangamswadik
New Contributor III

Hi, I'm building an streamlit application on databricks apps, where user can upload some data , and I run an  LLM model and return results. There, I want to log an artifact to a volume. I'm following this documentation 

https://docs.databricks.com/aws/en/mlflow/experiments 

Here's my code 

catalog = "testing"
schema = "model-data"
volume = "training-data"
experiment_name =   "/Shared/test_run"
a=5
b=7

artifact_location = f"dbfs:/Volumes/{catalog}/{schema}/{volume}/mlflow_artifacts"

if mlflow.get_experiment_by_name(experiment_name) is None:
    mlflow.create_experiment(name=experiment_name, artifact_location=artifact_location)
mlflow.set_experiment(experiment_name)


csv_path = f"/Volumes/{catalog}/{schema}/{volume}/mmm_data.csv"
df = pd.read_csv(csv_path)
print("Sample data:")
print(df.head(3))

# --- Start an MLflow run ---
with mlflow.start_run() as run:
    result = a + b

    # Log parameters and metric to MLflow
    mlflow.log_param("a", a)
    mlflow.log_param("b", b)
    mlflow.log_metric("sum_result", result)
    
    # --- Save the DataFrame as a CSV file locally (temporary location) ---
    temp_csv_path = "/tmp/mmm_data.csv"
    df.to_csv(temp_csv_path, index=False)
    
    # Log the CSV file as an artifact.
    # this artifact will be stored under artifact_location/data/
    mlflow.log_artifact(temp_csv_path, artifact_path="data")

 I'm getting this error when I run this

OSError: [Errno 5] Input/output error: '/dbfs/Volumes'
File <command-4809454479493761>, line 16
     12 df.to_csv(temp_csv_path, index=False)
     14 # Log the CSV file as an artifact.
     15 # this artifact will be stored under artifact_location/data/
---> 16 mlflow.log_artifact(temp_csv_path, artifact_path="data")

I think it is some issue with permissions but unable to figure this out, any help would be greatly appreciated!

0 REPLIES 0

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now