🚀 CryptoBERT
CryptoBERT是一个预训练的自然语言处理(NLP)模型,用于分析与加密货币相关的社交媒体帖子和消息中的语言及情感倾向。它通过在加密货币领域进一步训练vinai的bertweet-base语言模型构建而成,使用了超过320万条独特的与加密货币相关的社交媒体帖子作为语料库。(后续将发布包含更多细节的研究论文。)
🚀 快速开始
学术引用
如需学术引用,请参考以下论文:https://ieeexplore.ieee.org/document/10223689
分类训练
模型基于以下标签进行训练:“看跌” : 0,“中性” : 1,“看涨” : 2。
CryptoBERT的情感分类头在一个包含200万条标记的StockTwits帖子的平衡数据集上进行了微调,这些帖子从ElKulako/stocktwits-crypto中采样得到。
CryptoBERT训练时的最大序列长度为128。从技术上讲,它可以处理最多514个标记的序列,但不建议超过128。
💻 使用示例
基础用法
from transformers import TextClassificationPipeline, AutoModelForSequenceClassification, AutoTokenizer
model_name = "ElKulako/cryptobert"
tokenizer = AutoTokenizer.from_pretrained(model_name, use_fast=True)
model = AutoModelForSequenceClassification.from_pretrained(model_name, num_labels = 3)
pipe = TextClassificationPipeline(model=model, tokenizer=tokenizer, max_length=64, truncation=True, padding = 'max_length')
post_1 = " see y'all tomorrow and can't wait to see ada in the morning, i wonder what price it is going to be at. 😎🐂🤠💯😴, bitcoin is looking good go for it and flash by that 45k. "
post_2 = " alright racers, it’s a race to the bottom! good luck today and remember there are no losers (minus those who invested in currency nobody really uses) take your marks... are you ready? go!!"
post_3 = " i'm never selling. the whole market can bottom out. i'll continue to hold this dumpster fire until the day i die if i need to."
df_posts = [post_1, post_2, post_3]
preds = pipe(df_posts)
print(preds)
运行上述代码后,输出结果如下:
[{'label': 'Bullish', 'score': 0.8734585642814636}, {'label': 'Bearish', 'score': 0.9889495372772217}, {'label': 'Bullish', 'score': 0.6595883965492249}]
🔧 技术细节
训练语料库
CryptoBERT在320万条关于各种加密货币的社交媒体帖子上进行训练,仅考虑长度超过4个单词的非重复帖子。语料库的来源如下:
(1) StockTwits - 187.5万条关于按交易量排名前100的加密货币的帖子。帖子收集时间为2021年11月1日至2022年6月16日。ElKulako/stocktwits-crypto
(2) Telegram - 66.4万条来自前5个Telegram群组的帖子:Binance、Bittrex、huobi global、Kucoin、OKEx。数据收集时间为2020年11月16日至2021年1月30日。感谢Anton提供的数据。
(3) Reddit - 17.2万条来自各种加密货币投资线程的评论,收集时间为2021年5月至2022年5月。
(4) Twitter - 49.6万条带有#XBT、#Bitcoin或#BTC标签的帖子。收集时间为2018年5月。感谢Paul提供的数据。
📄 许可证
本项目采用MIT许可证。
属性 |
详情 |
模型类型 |
预训练的自然语言处理(NLP)模型 |
训练数据 |
超过320万条独特的与加密货币相关的社交媒体帖子,包括StockTwits、Telegram、Reddit和Twitter的数据 |