---
agentTools:
  projectIndex: https://makinarocks-link.readme.io/llms.txt
---

# mrx-link convert

Files including the Link pipeline can be converted from one format to another.

> 📘
>
> * As of now, only `ipynb` to `yaml` and `yaml` to `ipynb` conversions are supported.
> * Converting `ipynb` to `yaml` is possible after all components of the pipeline have been successfully executed.
> * To export a Link pipeline from Python code to `ipynb` file, refer here. And in order to make a Kubeflow `yaml` file, refer here.

```
mrx-link convert --from-path FILE1.format --to-path FILE2.format
```

* **Options**

  * `--from-path FILE1.format`: Enter the name of the file to be converted.
  * `--to-path FILE2.format`: Enter the name of the file to be saved after conversion.
  * `-h`, `--help`: Displays a help message.

    ```
    Usage: mrx-link convert [OPTIONS]

      Convert a file with the Link pipeline to other formats.

      `ipynb` to `yaml` and `yaml` to `ipynb` conversions are supported.

    Options:
      --from-path TEXT  File name to be converted.  [required]
      --to-path TEXT    File name to be saved after conversion.  [required]
      -h, --help        Show this message and exit.
    ```

* **Troubleshooting**
  * *\[Errno 2] No such file or directory: 'FILE.format'*
    * This occurs when the input file does not exist.
  * *The file should be `ipynb` file with a Link pipeline*
    * This occurs when the file to be converted was in `ipynb` format but it was not created with Link.
  * *The file should be `yaml` file with a Link pipeline*
    * This occurs when the file to be converted was in `yaml` format but it was not created with Link.
  * *It must not include \[:, \*, ", ?, <, >, |]*
    * This occurs when `: * " ? < > |` is included in `FILE`.
  * *Only `ipynb` and `yaml` are supported for target file.*
    * This occurs when the file to be converted and saved is not `ipynb` or `yaml`.
  * *Failed to execute the pipeline for converting to `yaml`. Please try again*
    * This occurs when conversion to `yaml` encounters a problem during pipeline execution.
  * *Only `ipynb` to `yaml` and `yaml` to `ipynb` conversions are supported*
    * This occurs when the conversion is not '`ipynb` to `yaml`' or '`yaml` to `ipynb`'.
  * *zsh: no matches found: FILE.format*
    * This occurs when there are Bash special characters or spaces in the file names of the notebook file.
      * It runs properly if `\` is included before the Bash special character or space.
        * ex) `mrx-link convert --from cli-test\(name\).yaml --to cli-test\(name\).ipynb`
      * It runs properly if the notebook file name is enclosed in `'` or `"`.
        * ex) `mrx-link convert --from "cli-test(name).yaml" --to 'cli-test(name).ipynb'`

### Example

1. Download sample source file below.
   * [iris\_classification.ipynb](https://docs.google.com/uc?export=download\&id=10dTYkGoFJT4Cc5aT0vODEMMWfRhVsjPQ)
2. Install the required packages and run the sample source. (when converting to `yaml`)
   ```Text CLI
   pip install sklearn torch "pytorch_lightning>=1.6, <1.9" "torchmetrics>=0.7.0, <0.11.1" livelossplot &&
   mrx-link run --file 'iris_classification.ipynb'
   ```
3. Make the `ipynb` file `yaml` and save it.
   ```Text CLI
   mrx-link convert --from-path iris_classification.ipynb --to-path sample.yaml
   ```