Skip to content

Allow files with spaces in their names for model registry

What does this MR do and why?

Allow files with spaces in their names for model registry

Related to #461320 (closed)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

UI upload and and download

A file with space before

Before After
image image

Use MLflow

  • Use python and install mlflow
  • Two files a.txt and a space b.txt
  • Run the folowing python code python ./mr1.py
  • 29 is the project id and token is a token with api and read_api permissions.

./mr1.py

import os
import mlflow

os.environ["MLFLOW_TRACKING_URI"] = "http://gdk.test:3000/api/v4/projects/29/ml/mlflow/"
os.environ["MLFLOW_TRACKING_TOKEN"] = 'glpat-'


client = mlflow.tracking.MlflowClient()

model_name = 'XModel4'
version = '1.0.1'
description = 'expla'

model = client.create_registered_model(model_name, description=description)
model_version = client.create_model_version(model_name, version, description=description)
client.log_artifact(model_version.run_id, './a.txt')
client.log_artifact(model_version.run_id, './a space b.txt')
  • Go to project/Deploy/Model registry and later to XModel4/1.0.1 and you should see the files with spaces.

image

Use packages rest API

  • 29 is the project ID
  • 263 is the model version ID you can find in the UI under project/deploy/model registry/XModel4/1.0.0
curl --header "Authorization: Bearer <your_access_token>" "http://gdk.test:3000/api/v4/projects/29/packages/ml_models/263/files/a.txt
curl --header "Authorization: Bearer <your_access_token>" "http://gdk.test:3000/api/v4/projects/29/packages/ml_models/263/files/a%20space%20b.txt"
Edited by Alper Akgun

Merge request reports

Loading