Views
No views yet
1from transformers import BertForSequenceClassification, BertTokenizer, TextClassificationPipeline
2model_path = "JiaqiLee/bert-agnews"
3tokenizer = BertTokenizer.from_pretrained(model_path)
4model = BertForSequenceClassification.from_pretrained(model_path, num_labels=4)
5pipeline = TextClassificationPipeline(model=model, tokenizer=tokenizer)
6print(pipeline("Google scores first-day bump of 18 (USATODAY.com): USATODAY.com - Even a big first-day jump in shares of Google (GOOG) couldn't quiet debate over whether the Internet search engine's contentious auction was a hit or a flop."))train.csv data to train the model and the remaining 10% for evaluation.