Blog

Learn About Our Meetup

5000+ Members

MEETUPS

LEARN, CONNECT, SHARE

Join our meetup, learn, connect, share, and get to know your Toronto AI community. 

JOB POSTINGS

INDEED POSTINGS

Browse through the latest deep learning, ai, machine learning postings from Indeed for the GTA.

CONTACT

CONNECT WITH US

Are you looking to sponsor space, be a speaker, or volunteer, feel free to give us a shout.

[D] Trying to use bert for simple classification, but it doesnt work, please help

So, the idea is simple: feed bert context vector to gru layer.

class Model(torch.nn.Module): def __init__(self): super(Model, self).__init__() self.bert = BertModel.from_pretrained('bert-base-uncased') freeze(self.bert) self.rnn = torch.nn.GRU(768, 128, 1, batch_first=True, bidirectional=False) self.linear = torch.nn.Linear(128, 5) def forward(self, x, lengths): x, _ = self.bert(x) x = torch.nn.utils.rnn.pack_padded_sequence( x, lengths, batch_first=True) self.rnn.flatten_parameters() _, x = self.rnn(x) x = self.linear(x.squeeze(0)) return x 

But model loss do not decrease.

Here is Colab link

submitted by /u/hadaev
[link] [comments]

Next Meetup

 

Days
:
Hours
:
Minutes
:
Seconds

 

Plug yourself into AI and don't miss a beat

 


Toronto AI is a social and collaborative hub to unite AI innovators of Toronto and surrounding areas. We explore AI technologies in digital art and music, healthcare, marketing, fintech, vr, robotics and more. Toronto AI was founded by Dave MacDonald and Patrick O'Mara.