Our BERT-based-sentiment analysis
为什么我们要自己训?中文大模型在当下可以说是十分欠缺的,我们查阅很多的资料,发现除了百度的API等API以外,绝大多数文献中的模型都是基于英文数据集训练,因此我们决定自己训练模型,并且勇于进行情感分析,提取出negative的评论,以此作为避雷贴汇总。
我们的模型:我们选择采用pre-train, fine-tune 框架,首先采用hugging face中的bert-base-chinese作为基座模型,再基于asap 美团数据集asap进行fine-tune。tokenizer 也是Bert-base-chinese.
Input: $$ S = {w_1, w_2, ..., w_3} $$ where $w_i$ is the word, $S$ is the sentence.
Output: $$ y_i \in {0,1,2,3,4} $$ where 0 represents 1-star, 1 represents 2-stars, respectively.
Loss: $$ l(y_i, f(S_i ;\Theta)) = -y_i^Tlog(f(S_i;\Theta)) $$ where $f(;w)$ is the Bert model we use, $\Theta$ is the parameters of the model.
训练细节:我们选择epoch = 3, optimizer为AdamW,learning rate = 5e-5 Accuracy: 0.5354251012145749
整个模型信息:
BertForSequenceClassification(
(bert): BertModel(
(embeddings): BertEmbeddings(
(word_embeddings): Embedding(21128, 768, padding_idx=0)
(position_embeddings): Embedding(512, 768)
(token_type_embeddings): Embedding(2, 768)
(LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)
(dropout): Dropout(p=0.1, inplace=False)
)
(encoder): BertEncoder(
(layer): ModuleList(
(0-11): 12 x BertLayer(
(attention): BertAttention(
(self): BertSelfAttention(
(query): Linear(in_features=768, out_features=768, bias=True)
(key): Linear(in_features=768, out_features=768, bias=True)
(value): Linear(in_features=768, out_features=768, bias=True)
(dropout): Dropout(p=0.1, inplace=False)
)
(output): BertSelfOutput(
(dense): Linear(in_features=768, out_features=768, bias=True)
(LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)
(dropout): Dropout(p=0.1, inplace=False)
)
)
(intermediate): BertIntermediate(
(dense): Linear(in_features=768, out_features=3072, bias=True)
(intermediate_act_fn): GELUActivation()
)
(output): BertOutput(
(dense): Linear(in_features=3072, out_features=768, bias=True)
(LayerNorm): LayerNorm((768,), eps=1e-12, elementwise_affine=True)
(dropout): Dropout(p=0.1, inplace=False)
)
)
)
)
(pooler): BertPooler(
(dense): Linear(in_features=768, out_features=768, bias=True)
(activation): Tanh()
)
)
(dropout): Dropout(p=0.1, inplace=False)
(classifier): Linear(in_features=768, out_features=5, bias=True)
)
模型1星🌟分类结果示例:
食物的话就不会建议你们买…毕竟太贵了!
...
Tips:真的不用进去就买拿着费劲等都玩完在买时间很充裕的每家店结账时都可以帮你把物品寄存送到出口处走时拿but请注意!领取时间会很晚如果你中午或者下午寄存可能要晚上9点后才能拿!要问清楚噢!
提前买了快速通没怎么排队
图五R是大阪环球买的,我朋友为了不让我花钱,全程拽着我,因为她觉得没用,导致好多喜欢的周边都没买,只买了这个桶!周边这块大阪环球是做的真好!
哈利波特园区学院主题卡套,好像是79r
由于代购商品特殊性❗️拍下即不退不换❌邮费自理✅
第一次被这个食物破坏我的minions的印象
食物难吃到不会讲,又贵又难吃叹气R抓狂R捂脸R
❌minionschouxpuff(完全不是puff,硬到不行)$10
❌minionsswissroll(很像过期的蛋糕)$8
❌cheekychop(猪扒完全没入味,罗卜很硬,Macandcheese没有拉丝,包是沙丁鱼)$38
❌soulfulchicken&waffles(炸鸡勉强可以waffles甜到啊妈都不认识)$35
❌icechoco-banana(超喝超难喝)$8
❌yellowbellolemonade(勉强可以)$10
❌sweetmischiefbowl(Popcorn超级漏风感觉)$18
还回我对minions印象,这食物真是破坏我对minions的爱
我说实话,别喷我可怜R
How to Start
Inference Providers
NEW
This model is not currently available via any of the supported third-party Inference Providers, and
HF Inference API was unable to determine this model's library.