How do we train sen...
 
Notifications
Clear all

Question How do we train senticgcn models with our dataset?

7 Posts
2 Users
0 Likes
287 Views
Posts: 3
Member
Topic starter
(@e0726513u-nus-edu)
Active Member
Joined: 8 months ago

My team looked through the documentation for sentic_gcn as we are trying to make use of it to implement our sentiment analysis solution. However, we are unable to figure out how to train the model. Where do we input our own dataset into the model and are there any documentation on the steps required to achieve this?

6 Replies
Raymond Ng
Posts: 35
AISG Staff
(@raymond_aisg)
Eminent Member
Joined: 8 months ago

Hi, 

The documentation to train the SenticGCN model can be found here,

https://sgnlp.aisingapore.net/docs/model/senticgcn.html#training

First, make sure your datasets are in the same format here,

https://github.com/BinLiang-NLP/Sentic-GCN/tree/main/datasets/semeval14

Next, download a copy of the config file here, and replace the path to your datasets,

Lastly, follow the example code from the documentation here to start training, the train script will pick up the dataset based on the path defined in the config file,

https://sgnlp.aisingapore.net/docs/model/senticgcn.html#running-train-code

Hope this helps.

Reply
Posts: 3
Member
Topic starter
(@e0726513u-nus-edu)
Active Member
Joined: 8 months ago
Screenshot 2023 02 03 at 9.33.35 PM

Hi, I changed the file path to my datasets for the config file but the training script still makes use of the restaurant's data. Any way to work around this?

Reply
1 Reply
Raymond Ng
AISG Staff
(@raymond_aisg)
Joined: 8 months ago

Eminent Member
Posts: 35

@e0726513u-nus-edu Hi,

Could you kindly share the code and/or command you called to start the training?

As the training is able to start but with the wrong dataset used, it usually indicates that the wrong config file was parsed by the trainer.

Alternatively, you might wish to debug the trainer and place a breakpoint at the following and check if the `cfg` object is indeed pointing to the dataset file you have indicated in your config file.

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

Hope this helps.

Reply
Posts: 3
Member
Topic starter
(@e0726513u-nus-edu)
Active Member
Joined: 8 months ago

Hi Raymond,

Sorry for the late reply. The link to our GitHub repository is attached here.

https://github.com/Merrickneo/GlowGuide

The Config file is in the config folder and the dataset we used is named black_honey_clean.raw

Screenshot 2023 02 05 at 6.19.48 PM

 

We used the template as shown on the senticgcn website to train but it only loads their restaurant dataset.

Screenshot 2023 02 05 at 6.20.59 PM

 

Reply
2 Replies
Raymond Ng
AISG Staff
(@raymond_aisg)
Joined: 8 months ago

Eminent Member
Posts: 35

@e0726513u-nus-edu Hi,

My apologies for the confusing documentation, we will try to improve the clarity for the next release.

The training code stated in the documentation is meant to be called with a `--config` argument flag and it is meant for users which would like to have the option to override the original training code.

If you have installed the `sgnlp` package via `pip install sgnlp`. You can actually call the train code directly from your environment as follows,

```

python -m sgnlp.models.sentic_gcn.train --config /Users/merrick/Documents/AISG Hackathon/GlowGuide/config/sentic_gcn_bert_config.json

```

 

If you are running the training script from a cloned SGnlp repository, you can directly call the `train.py` script inside the `sgnlp/models/sentic_gcn/` folder, it will pick up the default config file as indicated here,

https://github.com/aisingapore/sgnlp/blob/main/sgnlp/models/sentic_gcn/utils.py#L25

You can also indicate a different config file location via the `--config` flag when calling the `train.py` directly.

```

python sgnlp/models/sentic_gcn/train.py --config

/Users/merrick/Documents/AISG Hackathon/GlowGuide/config/sentic_gcn_bert_config.json

```

Hope this helps.

Reply
Raymond Ng
AISG Staff
(@raymond_aisg)
Joined: 8 months ago

Eminent Member
Posts: 35

Sorry there is a typo with the above instructions, when running the train code from the `train.py` file directly, please first navigate to the `sgnlp/models/` folder, then execute the training code,

```

python -m sentic_gcn.train --config /Users/merrick/Documents/AISG Hackathon/GlowGuide/config/sentic_gcn_bert_config.json

```

Reply
Share: