Search code examples
pythonruntime-errorrasa-nlu

while training using rasa nlu ValueError: Unknown data format for file x.json


I'm training a json file data for intent classification using rasa nlu. When I am doing the training with any .md file it is working but when I tried with .json file it is showing error.

I tried to validate the json file it is in correct format.

from rasa_nlu.training_data import load_data
from rasa_nlu.model import Trainer
from rasa_nlu import config
from rasa_nlu.model import Interpreter


def train_rasa(file_path):
    training_data = load_data(file_path)
    trainer = Trainer(config.load("config.yml"))
    trainer.train(training_data)
    model_directory = trainer.persist('models/')
return model_directory

train_rasa('data/testData.json')

Error :

ValueError: Unknown data format for file 'data/testData.json

Solution

  • I got the solution. So when i checked i found out that my data.json file was in utf-8 fromat which is causing problem so i changed the encoding to ANSI in notepad which worked out.