rename a model

Hi :slight_smile:

I proceeded to the annotation of my texts, my dataset is called "textannotation".
With these annotations I trained a model with the following command line

prodigy train ./models/fr_contrat-de-travail/pipelines/1 --ner textannotation -es 0.3 --lang "fr" --label-stats

This created two folders for me: model-last and model-best. I want to generate a model under another name and with meta-information. So I modified the file "meta.json" as follows :

{

"lang":"fr",

"name":"fr_ontrat_de_travail",

"version":"0.0.1",

"spacy_version":">=3.1.2,<3.2.0",

"description":"AI model for NER extractions",

"author":"Iloh IA team",

"email":"contact@iloh.fr",

"url":"https://www.iloh.fr/",

"license":"proprietary licences",

"spacy_git_version":"e1f88de72",

"vectors":{

"width":0,

"vectors":0,

"keys":0,

"name":null

},

This is what I want for my model.

I did this for model-last and model-best.

Then, I go to the next step, that is on spacy, with the following command line:

spacy train ./models/fr_contrat de travail/pipelines/config_init/config.cfg --output ./models/fr_contrat de travail/pipelines/1/ --paths.train ./train --paths.dev ./dev

Here no problem.

Then when I want to generate the package all the information I modified is overwritten and my model is called again "fr_pipeline" while I want to name it "fr_contrat-de-travail".

I use the command line

spacy package ./models/fr_contrat-de-travail/pipelines/1/model-last ./models/fr_contrat-de-travail/package/1 -m ./models/fr_contrat-de-travail/pipelines/1/model-last/meta.json

How do we choose the name of our model and its meta-information?

Thanks ! :slight_smile:

Hi! Which version of spaCy are you using? If you're providing a meta.json on the CLI with spacy package, this information should be used for the final pipeline.

One quick thing to note here: You shouldn't need to include the language code in the name, this will be added automatically. So the language can be fr and the model name ontrat_de_travail, which will end up as fr_ontrat_de_travail.

HI !

I am using spacy's version 3.1.2

I give a meta.json in my CLI as you can see.

These is the meta.json that is generate when I do prodigy train, and then I modify the file and give the meta-informations that I want and I save it.
Then I do spacy train and spacy package and my meta.json is empty like I never did the modifications.
I don't understand.

thanks for help !

@ines

Hi there, so just to make sure I understand correctly, are you updating meta.json before training? Can you try: training the model first, update meta.json, then call spacy package?

I also noticed that the meta.json you're passing is just inside the same directory as your model. It will still work even if you don't provide that path. You can edit meta.json and then call spacy package.

Hi ! :slight_smile:

I update the meta.json after prodigy train.

I train my model with prodigy train ./models/fr_contrat-de-travail/pipelines/1 --ner textannotation -es 0.3 --lang "fr" --label-stats

Then I modify meta.json in model-last and best. I change max epochs in config.cfg

Then I do spacy train with spacy train ./models/fr_contrat-de-travail/pipelines/1/model-last/config.cfg --output ./models/fr_contrat-de-travail/pipelines/1/ --paths.train ./train --paths.dev ./dev

and i do spacy package, I tried with files in the same directory and my model is still name "fr_pipeline" :triumph:. My meta files are empty, as I never modified them.
spacy package ./models/fr_contrat-de-travail/pipelines/1/model-last ./models/fr_contrat-de-travail/package/1 -m ./models/fr_contrat-de-travail/pipelines/1/model-last/meta.json

I also noticed that the meta.json you're passing is just inside the same directory as your model. It will still work even if you don't provide that path. You can edit meta.json and then call spacy package .

I will try without giving the path and modify meta.json after spacy package