Instructions to use curiousily/tiny-crypto-sentiment-analysis with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use curiousily/tiny-crypto-sentiment-analysis with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="curiousily/tiny-crypto-sentiment-analysis")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("curiousily/tiny-crypto-sentiment-analysis") model = AutoModelForCausalLM.from_pretrained("curiousily/tiny-crypto-sentiment-analysis") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use curiousily/tiny-crypto-sentiment-analysis with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "curiousily/tiny-crypto-sentiment-analysis" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "curiousily/tiny-crypto-sentiment-analysis", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/curiousily/tiny-crypto-sentiment-analysis
- SGLang
How to use curiousily/tiny-crypto-sentiment-analysis with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "curiousily/tiny-crypto-sentiment-analysis" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "curiousily/tiny-crypto-sentiment-analysis", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "curiousily/tiny-crypto-sentiment-analysis" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "curiousily/tiny-crypto-sentiment-analysis", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use curiousily/tiny-crypto-sentiment-analysis with Docker Model Runner:
docker model run hf.co/curiousily/tiny-crypto-sentiment-analysis
How to use from
vLLMUse Docker
docker model run hf.co/curiousily/tiny-crypto-sentiment-analysisQuick Links
Tiny Crypto Sentiment Analysis
Fine-tuned (with LoRA) version of TinyLlama on cryptocurrency news articles to predict the sentiment and subject of an article. The dataset used for training is Crypto News+.
How to Train Your Own Tiny LLM?
Follow the complete tutorial on how this model was trained: https://www.mlexpert.io/bootcamp/fine-tuning-tiny-llm-on-custom-dataset
How to Use
Load the model:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
MODEL_NAME = "curiousily/tiny-crypto-sentiment-analysis"
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME, use_fast=True)
model = AutoModelForCausalLM.from_pretrained(
MODEL_NAME,
device_map="auto",
torch_dtype=torch.float16
)
pipe = pipeline(
task="text-generation",
model=model,
tokenizer=tokenizer,
max_new_tokens=16,
return_full_text=False,
)
Prompt format:
prompt = """
### Title:
<YOUR ARTICLE TITLE>
### Text:
<YOUR ARTICLE PARAGRAPH>
### Prediction:
""".strip()
Here's an example:
prompt = """
### Title:
Bitcoin Price Prediction as BTC Breaks Through $27,000 Barrier Here are Price Levels to Watch
### Text:
Bitcoin, the world's largest cryptocurrency by market capitalization, has been making headlines recently as it broke through the $27,000 barrier for the first time. This surge in price has reignited speculation about where Bitcoin is headed next, with many analysts and investors offering their predictions.
### Prediction:
""".strip()
Get a prediction:
outputs = pipe(prompt)
print(outputs[0]["generated_text"].strip())
subject: bitcoin
sentiment: positive
- Downloads last month
- 13
Install from pip and serve model
# Install vLLM from pip: pip install vllm# Start the vLLM server: vllm serve "curiousily/tiny-crypto-sentiment-analysis"# Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "curiousily/tiny-crypto-sentiment-analysis", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'