Notifications
Clear all

Question SenticGCNBert config file

20 Posts
4 Users
2 Likes
976 Views
(@tristonchan)
Active Member Member
Joined: 11 months ago
Posts: 3
Topic starter  

Hi, for Sentic-GCN Bert config file, for evaluation, what does the "model_path" refer to? 


   
Quote
Raymond Ng
(@raymond_aisg)
Eminent Member AISG Staff
Joined: 1 year ago
Posts: 35
 

Hi, the "model_path" configuration refers to either a local folder path that contains the model weights and model config file or a URL address pointing a folder to a cloud storage bucket folder containing the same items (e.g. the default path for "model_path" points to the pre-trained weights and config trained by AI Singapore).

For details, please refer to the code here where the "model_path" configuration is used.

https://github.com/aisingapore/sgnlp/blob/83fb17170ec06436f58cd2758b6824b0d8c160a8/sgnlp/models/sentic_gcn/eval.py#L182

Thank you.

All things NLP


   
ReplyQuote
(@tristonchan)
Active Member Member
Joined: 11 months ago
Posts: 3
Topic starter  

Hi thank you for the prompt reply, the folder that contains the model weights and model config file is generated after training our model? and is the sample config file default "model_path" use-able or we will have to change it? Thank you!


   
ReplyQuote
Raymond Ng
(@raymond_aisg)
Eminent Member AISG Staff
Joined: 1 year ago
Posts: 35
 

Hi,

That is correct, you can specify the 'save_model_path' configuration to specify the folder path to save the trained model weights and configuration after the training has been completed.

If the default 'save_model_path' configuration is used, a folder named 'senticgcnbert' will be created locally and the trained weights and configuration will be saved there.

https://github.com/aisingapore/sgnlp/blob/main/sgnlp/models/sentic_gcn/config/sentic_gcn_bert_config.json#L14

Thank you

All things NLP


   
ReplyQuote
(@tristonchan)
Active Member Member
Joined: 11 months ago
Posts: 3
Topic starter  

Hi, what is the difference between "save_model_path" and "model_path" under eval_args?


   
ReplyQuote
Alon
 Alon
(@alon)
New Member Moderator
Joined: 1 year ago
Posts: 1
 

Hi, 
The "save_model_path" is used as the folder path to save the trained model weights and configuration after the training has been completed (as mentioned), but those are not necessary the input you would like to use for future prediction removed link  
The "model_path" is where the code looks for the weights/config to be used for training removed link  
You should place there the weights/config you wish to use. 
If you wish to use a recently trained model (weights/config), then you will need to transfer those from the "save_model_path" to the "model_path" directory.


   
ReplyQuote
Raymond Ng
(@raymond_aisg)
Eminent Member AISG Staff
Joined: 1 year ago
Posts: 35
 

@tristonchan 

The `save_model_path` config denotes the folder path for saving the model weights, config, and metrics for the training stage used in `train.py`.

https://github.com/aisingapore/sgnlp/blob/main/sgnlp/models/sentic_gcn/train.py#L100

The `eval_args\model_path` config denotes the folder path where the trained model weights and model config are placed for the purpose of loading the model and running the evaluation used in `eval.py`
https://github.com/aisingapore/sgnlp/blob/main/sgnlp/models/sentic_gcn/eval.py#L230

Hope this helps.

All things NLP


   
ReplyQuote
(@joeylim)
Active Member Member
Joined: 11 months ago
Posts: 7
 

Hi,

I have tried multiple times using the same path directory for my "save_model_path" and "model_path" but I am still receiving the error of "] No such file or directory: 'C'". I have also tried using the .json file that was created after it has been trained and it does not work too.


   
ReplyQuote
Raymond Ng
(@raymond_aisg)
Eminent Member AISG Staff
Joined: 1 year ago
Posts: 35
 

@joeylim Hi,

Could you kindly provide a screenshot or a copy of the error call stack?

Please also note that the `save_model_path` and the `model_path` are relative to the location where the training script is executed.

All things NLP


   
joeylim reacted
ReplyQuote
(@joeylim)
Active Member Member
Joined: 11 months ago
Posts: 7
 
image
image
image

@raymond_aisg Hi,

I have attached the picture of the path of the files created when the model has been train and the error that was flagged from running the evaluating program.


   
ReplyQuote
Raymond Ng
(@raymond_aisg)
Eminent Member AISG Staff
Joined: 1 year ago
Posts: 35
 

@joeylim Hi,

Thank you very much for the screenshot.

From what I can see from the screenshot, the `model_path` in the config file is residing in the `SGnlp test real\\Model` folder whereas the screenshot of the explorer where the model file resides is in the `SGnlp current\\Model`,  could you kindly check if this is correct?

If the folder path is correct, could you kindly use a debugger to view the `cfg` object when running the evaluation script and print out the `model_path` argument during runtime?

Thank you.

All things NLP


   
joeylim reacted
ReplyQuote
(@joeylim)
Active Member Member
Joined: 11 months ago
Posts: 7
 
image
image
image

@raymond_aisg Hi,

My apologies, I have tried to recreate the config file and I am facing a different error currently. Both the "model_path" and the "save_model_path" are having the same directory file location which contains our config and weights model that has been trained.

Thank you for assisting with us in this problem!!


   
ReplyQuote
Raymond Ng
(@raymond_aisg)
Eminent Member AISG Staff
Joined: 1 year ago
Posts: 35
 

@joeylim Hi,

This is a most curious error, unfortunately, I do not have a Window system to try out the path.

However, the error message you printed is very interesting, usually, for such an error the whole path is printed in the error trace instead of just the first character 'C'.

Off the top of my head, there are 2 things to try,

First, I'm wondering if you could replace `model_path` with just the folder name, `senticgcnbert` and execute the evaluation script at the root folder, 'C:\\Users\\user\Desktop\\SGnlp test\\`.

If the above doesn't work, could you try replacing the `\\` with `/` from the `model_path` so that it appears 'C:/Users/user/Desktop/SGnlp test/senticgcnbert'.

This is because the loading part of the code calls `pathlib.Path` and from the Python documentation, it uses the `/` for path,

https://docs.python.org/3/library/pathlib.html#pathlib.PureWindowsPath

The loading part of the code is here,

https://github.com/aisingapore/sgnlp/blob/main/sgnlp/models/sentic_gcn/eval.py#L98

Hope this helps.

All things NLP


   
ReplyQuote
(@joeylim)
Active Member Member
Joined: 11 months ago
Posts: 7
 

@raymond_aisg Hi,

Thanks for the advices!!! But unfortunately I was still unable to evaluate the test model with the two things that were suggested above. I have tried to create a new folder to store my model too and it did not work. Can I check once again if I am doing the right thing by using the location file model where it contains both the json and the bin file for the "model_path".

Thank you!


   
ReplyQuote
(@joeylim)
Active Member Member
Joined: 11 months ago
Posts: 7
 
image
image

@raymond_aisg Hi,

I have tried using the json file of the model which was created after the training and it does not work too! Will it be possible for us to have another sample file folder that has a config file that links the model path too so that me and my team will be able to further understand and learn how to use the config file well?

Thank You for assisting with our problems so far!! and we Hope to hear from you soon!!


   
ReplyQuote
Page 1 / 2
Share: