IntentSlotClassificationModel.restore_from fails when using a custom pre-trained checkpoint and the data_dir is None or does not exist
State: closed | Pull request: no
Labels: name: bug

**Describe the bug**
This issue is related to issue #2686.

I expect that if I pre-train an IntentSlotClassificationModel and export the checkpoint to a .nemo file that I can restore that checkpoint elsewhere. Further, I expect that, once exported, I can delete the data directory used for training and later be able to restore the checkpoint. Alas, this is not the case. If the data_dir inside the configuration file is None or refers to a directory that does not exist a TypeError will be raised.

**Steps/Code to reproduce bug**
These steps rely heavily upon the existing [Joint_Intent_and_Slot_Classification](https://github.com/NVIDIA/NeMo/blob/main/tutorials/nlp/Joint_Intent_and_Slot_Classification.ipynb) tutorial.
1. Prepare training data
    a. Create a temporary directory, /tmp/nlu_evaluation, and two sub-directories: /tmp/nlu_evaluation/conf and /tmp/nlu_evaluation/data.
    b. Download [import_datasets.py](https://raw.githubusercontent.com/NVIDIA/NeMo/v1.2.0/examples/nlp/intent_slot_classification/data/assistant_utils.py) and [import_datasets.py](https://raw.githubusercontent.com/NVIDIA/NeMo/v1.2.0/examples/nlp/intent_slot_classification/data/assistant_utils.py) to /tmp/nlu_evaluation.
    c. Download [master.zip](https://github.com/xliuhw/NLU-Evaluation-Data/archive/master.zip) and extract it in /tmp/nlu_evaluation/data
    d. Process the evaluation data:
        `python /tmp/nlu_evaluation/import_datasets.py --dataset_name=assistant --source_dir=/tmp/nlu_evaluation/NLU-Evaluation-Data-master --target_dir=/tmp/nlu_evaluation/nemo_format`
    e. Download [intent_slot_classification_config.yaml](https://raw.githubusercontent.com/NVIDIA/NeMo/v1.2.0/examples/nlp/intent_slot_classification/conf/intent_slot_classification_config.yaml) to /tmp/nlu_evaluation/conf

2. Train and save the model
Run the following Python code
```
import nemo.collections.nlp as nemo_nlp
from omegaconf import OmegaConf


config = OmegaConf.load('/tmp/nlu_evaluation/conf/intent_slot_classification_config.yaml')
config.model.data_dir = '/tmp/nlu_evaluation/data/nemo_format')
config.trainer.gpus = 1
config.trainer.precision = 16
config.trainer.accelerator = None
config.trainer.max_epochs = 5
trainer = pl.Trainer(**config.trainer)

model = nemo_nlp.models.IntentSlotClassificationModel(config.model, trainer=trainer)
trainer.fit(model)

model.save_to('/tmp/nlu_evaluation/model.nemo')
```

3. Completely remove /tmp/nlu_evaluation/data/nemo_format

4. Restore the saved model
Run the following Python code
```
import nemo.collections.nlp as nemo_nlp


nemo_nlp.models.IntentSlotClassificationModel.restore_from('/tmp/nlu_evaluation/model.nemo')
```

**Expected behavior**
The model should be restored and be ready for use.

**Actual behavior**
The restore fails with this exception:
```
File "...lib/python3.8/site-packages/nemo/collections/nlp/models/nlp_model.py", line 435, in restore_from
    return super().restore_from(
  File "...lib/python3.8/site-packages/nemo/core/classes/modelPT.py", line 270, in restore_from
    instance = cls._save_restore_connector.restore_from(
  File "...lib/python3.8/site-packages/nemo/core/connectors/save_restore_connector.py", line 136, in restore_from
    instance = calling_cls.from_config_dict(config=conf)
  File "...lib/python3.8/site-packages/nemo/core/classes/common.py", line 473, in from_config_dict
    instance = cls(cfg=config)
  File "...lib/python3.8/site-packages/nemo/collections/nlp/models/intent_slot_classification/intent_slot_classification_model.py", line 56, in __init__
    self.setup_tokenizer(cfg.tokenizer)
  File "...lib/python3.8/site-packages/nemo/collections/nlp/models/nlp_model.py", line 112, in setup_tokenizer
    vocab_file = self.register_artifact(config_path='tokenizer.vocab_file', src=cfg.vocab_file)
  File "...lib/python3.8/site-packages/nemo/collections/nlp/models/nlp_model.py", line 63, in register_artifact
    return super().register_artifact(config_path, src, verify_src_exists=verify_src_exists)
  File "...lib/python3.8/site-packages/nemo/core/classes/modelPT.py", line 202, in register_artifact
    return self._save_restore_connector.register_artifact(self, config_path, src, verify_src_exists)
  File "...lib/python3.8/site-packages/nemo/core/connectors/save_restore_connector.py", line 271, in register_artifact
    return_path = os.path.abspath(os.path.join(app_state.nemo_file_folder, src[5:]))
  File "...lib/python3.8/posixpath.py", line 76, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
```

**Environment overview (please complete the following information)**
 - Environment location:
Bare metal
 - Method of NeMo install
pip install nemo_toolkit[asr,nlp]==1.3.0

**Environment details**
- OS version
 Ubuntu 20.04
- PyTorch version
 1.8.1
- Python version
 3.8.10