chinese-crypto-sentiment
14
2
license:apache-2.0
by
LocalOptimum
Other
OTHER
New
14 downloads
Early-stage
Edge AI:
Mobile
Laptop
Server
Unknown
Mobile
Laptop
Server
Quick Summary
AI model with specialized capabilities.
Code Examples
使用方法 | Usagepythontransformers
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# 加载模型和分词器 | Load model and tokenizer
model_name = "LocalOptimum/chinese-crypto-sentiment"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# 分析文本 | Analyze text
text = "比特币突破10万美元创历史新高"
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
# 预测 | Predict
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
predicted_class = torch.argmax(predictions, dim=-1).item()
# 结果映射 | Result mapping
labels = ['positive', 'neutral', 'negative']
sentiment = labels[predicted_class]
confidence = predictions[0][predicted_class].item()
print(f"情感: {sentiment}")
print(f"置信度: {confidence:.4f}")批量处理 | Batch Processingpython
texts = [
"币安获得阿布扎比监管授权",
"以太坊完成Fusaka升级",
"某交易所遭攻击损失100万美元"
]
inputs = tokenizer(texts, return_tensors="pt", truncation=True,
max_length=128, padding=True)
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
predicted_classes = torch.argmax(predictions, dim=-1)
labels = ['positive', 'neutral', 'negative']
for text, pred in zip(texts, predicted_classes):
print(f"{text} -> {labels[pred]}")Deploy This Model
Production-ready deployment in minutes
Together.ai
Instant API access to this model
Production-ready inference API. Start free, scale to millions.
Try Free APIReplicate
One-click model deployment
Run models in the cloud with simple API. No DevOps required.
Deploy NowDisclosure: We may earn a commission from these partners. This helps keep LLMYourWay free.