|  | --- | 
					
						
						|  | language: zh | 
					
						
						|  | tags: | 
					
						
						|  | - sentiment-analysis | 
					
						
						|  | - pytorch | 
					
						
						|  | widget: | 
					
						
						|  | - text: "房间非常非常小,内窗,特别不透气,因为夜里走廊灯光是亮的,内窗对着走廊,窗帘又不能完全拉死,怎么都会有一道光射进来。" | 
					
						
						|  | - text: "房间干净,床垫和被子都很舒服。" | 
					
						
						|  | - text: "很好,干净整洁,交通方便。" | 
					
						
						|  | - text: "干净整洁很好" | 
					
						
						|  | --- | 
					
						
						|  |  | 
					
						
						|  | # Note | 
					
						
						|  |  | 
					
						
						|  | BERT based sentiment analysis, finetune based on https://huggingface.co/IDEA-CCNL/Erlangshen-Roberta-330M-Sentiment .The model trained on hotel human review chinese datasets. | 
					
						
						|  |  | 
					
						
						|  | # Usage | 
					
						
						|  |  | 
					
						
						|  | ```python | 
					
						
						|  | from transformers import AutoTokenizer, AutoModelForSequenceClassification, TextClassificationPipeline | 
					
						
						|  |  | 
					
						
						|  | MODEL = "tezign/Erlangshen-Sentiment-FineTune" | 
					
						
						|  |  | 
					
						
						|  | tokenizer = AutoTokenizer.from_pretrained(MODEL) | 
					
						
						|  |  | 
					
						
						|  | model = AutoModelForSequenceClassification.from_pretrained(MODEL, trust_remote_code=True) | 
					
						
						|  |  | 
					
						
						|  | classifier = TextClassificationPipeline(model=model, tokenizer=tokenizer) | 
					
						
						|  |  | 
					
						
						|  | result = classifier("很好,干净整洁,交通方便。") | 
					
						
						|  |  | 
					
						
						|  | print(result) | 
					
						
						|  |  | 
					
						
						|  | """ | 
					
						
						|  | print result | 
					
						
						|  | >> [{'label': 'Positive', 'score': 0.989660382270813}] | 
					
						
						|  | """ | 
					
						
						|  | ``` |