Instructions to use ryefoxlime/TADBot with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ryefoxlime/TADBot with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ryefoxlime/TADBot")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ryefoxlime/TADBot", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ryefoxlime/TADBot with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ryefoxlime/TADBot" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ryefoxlime/TADBot", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ryefoxlime/TADBot
- SGLang
How to use ryefoxlime/TADBot 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 "ryefoxlime/TADBot" \ --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": "ryefoxlime/TADBot", "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 "ryefoxlime/TADBot" \ --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": "ryefoxlime/TADBot", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ryefoxlime/TADBot with Docker Model Runner:
docker model run hf.co/ryefoxlime/TADBot
| import torch | |
| import os | |
| from torchvision import transforms | |
| import numpy as np | |
| # Checking for all types of devices available | |
| if torch.backends.mps.is_available(): | |
| device = "mps" | |
| elif torch.cuda.is_available(): | |
| device = "cuda" | |
| else: | |
| device = "cpu" | |
| print(f"Using device: {device}") | |
| image_arr = [] | |
| for foldername, subfolders, filenames in os.walk("../FER/Images/"): | |
| for filename in filenames: | |
| # Construct the full path to the file | |
| file_path = os.path.join(foldername, filename) | |
| image_arr.append(f"{file_path}") | |
| def predict(model, image_path): | |
| from face_detection import face_detection | |
| with torch.no_grad(): | |
| transform = transforms.Compose( | |
| [ | |
| transforms.Resize((224, 224)), | |
| transforms.RandomHorizontalFlip(), | |
| transforms.ToTensor(), | |
| transforms.Normalize( | |
| mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225] | |
| ), | |
| transforms.RandomErasing(p=1, scale=(0.05, 0.05)), | |
| ] | |
| ) | |
| face = face_detection(image_path) | |
| image_tensor = transform(face).unsqueeze(0) | |
| image_tensor = image_tensor.to(device) | |
| model.eval() | |
| img_pred = model(image_tensor) | |
| topk = (3,) | |
| with torch.no_grad(): | |
| maxk = max(topk) | |
| # batch_size = target.size(0) | |
| _, pred = img_pred.topk(maxk, 1, True, True) | |
| pred = pred.t() | |
| img_pred = pred | |
| img_pred = img_pred.squeeze().cpu().numpy() | |
| im_pre_label = np.array(img_pred) | |
| y_pred = im_pre_label.flatten() | |
| emotions = { | |
| 0: "Surprise", | |
| 1: "Fear", | |
| 2: "Disgust", | |
| 3: "Happy", | |
| 4: "Sad", | |
| 5: "Angry", | |
| 6: "Neutral", | |
| } | |
| labels = [] | |
| for i in y_pred: | |
| labels.append(emotions.get(i)) | |
| print( | |
| f"-->Image Path {image_path} [!] The predicted labels are {y_pred} and the label is {labels}" | |
| ) | |
| return | |