小编Nit*_*ddy的帖子

令牌索引序列长度比使用拥抱面部情感分类器的该模型指定的最大序列长度 (651 > 512) 长

我试图借助拥抱面部情绪分析预训练模型来获取评论的情绪。它返回错误,就像Token indices sequence length is longer than the specified maximum sequence length for this model (651 > 512)拥抱面部情感分类器一样。

下面我附上代码请看一下

from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
import transformers
import pandas as pd

model = AutoModelForSequenceClassification.from_pretrained('/content/drive/MyDrive/Huggingface-Sentiment-Pipeline')
token = AutoTokenizer.from_pretrained('/content/drive/MyDrive/Huggingface-Sentiment-Pipeline')

classifier = pipeline(task='sentiment-analysis', model=model, tokenizer=token)

data = pd.read_csv('/content/drive/MyDrive/DisneylandReviews.csv', encoding='latin-1')

data.head()
Run Code Online (Sandbox Code Playgroud)

输出是

    Review
0   If you've ever been to Disneyland anywhere you...
1   Its been a while since d last time we visit HK...
2   Thanks God it wasn t too hot …
Run Code Online (Sandbox Code Playgroud)

nlp sentiment-analysis deep-learning huggingface-transformers huggingface-tokenizers

14
推荐指数
2
解决办法
3万
查看次数

如何从 pandas 日期列中删除小时、分钟、秒和 UTC 偏移量?我正在与streamlit和pandas一起跑步

如何删除pandas中年、月、日期值后的T00:00:00+05:30?我尝试将列转换为日期时间,但它也显示相同的结果,我在streamlit中使用pandas。我尝试了下面的代码

df['Date'] = pd.to_datetime(df['Date'])
Run Code Online (Sandbox Code Playgroud)

输出如下:

Date
2019-07-01T00:00:00+05:30
2019-07-01T00:00:00+05:30
2019-07-02T00:00:00+05:30
2019-07-02T00:00:00+05:30
2019-07-02T00:00:00+05:30
2019-07-03T00:00:00+05:30
2019-07-03T00:00:00+05:30
2019-07-04T00:00:00+05:30
2019-07-04T00:00:00+05:30
2019-07-05T00:00:00+05:30
Run Code Online (Sandbox Code Playgroud)

谁能帮我如何从上面的行中删除 T00:00:00+05:30 ?

python datetime dataframe pandas streamlit

4
推荐指数
1
解决办法
7215
查看次数