Instructions to use rjx76/reddit-chatbot-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use rjx76/reddit-chatbot-model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="rjx76/reddit-chatbot-model") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("rjx76/reddit-chatbot-model") model = AutoModelForCausalLM.from_pretrained("rjx76/reddit-chatbot-model") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use rjx76/reddit-chatbot-model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "rjx76/reddit-chatbot-model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rjx76/reddit-chatbot-model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/rjx76/reddit-chatbot-model
- SGLang
How to use rjx76/reddit-chatbot-model 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 "rjx76/reddit-chatbot-model" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rjx76/reddit-chatbot-model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "rjx76/reddit-chatbot-model" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rjx76/reddit-chatbot-model", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use rjx76/reddit-chatbot-model with Docker Model Runner:
docker model run hf.co/rjx76/reddit-chatbot-model
Model Card for [Your Hugging Face Username]/[Your Model Repository Name]
This is a causal language model fine-tuned from [BASE_MODEL_NAME] on comments collected from the r/[TARGET_SUBREDDIT] subreddit. It's intended to generate conversational text mimicking the style and topics found in that community.
Model Details
Model Description
This model is a fine-tuned version of the [BASE_MODEL_NAME] transformer model. It was trained on a dataset of comments fetched from the r/[TARGET_SUBREDDIT] subreddit using the PRAW library. The goal was to adapt the base model to generate responses in a style characteristic of conversations within that specific online community.
- Developed by: [Your Name or Hugging Face Username] (Based on the provided fine-tuning script)
- Funded by [optional]: [Personal Project / Self-funded / Your Funding Source]
- Shared by [optional]: [Your Name or Hugging Face Username]
- Model type: Causal Language Model (Decoder-only Transformer)
- Language(s) (NLP): Primarily English (
en). The dataset sourced from Reddit may contain other languages or slang specific to the community. - License: The license for this model is based on the license of the original
[BASE_MODEL_NAME]model: [Link to Base Model License]. Note that the training data comes from Reddit and is subject to Reddit's User Agreement and Content Policy. Users must comply with Reddit's terms when using this model or the data. - Finetuned from model:
[BASE_MODEL_NAME](e.g.,microsoft/DialoGPT-mediumorgpt2)
Model Sources [optional]
- Repository:
https://huggingface.co/[Your Hugging Face Username]/[Your Model Repository Name] - Paper [optional]: [Link to base model's paper, e.g., DialoGPT paper, if applicable]
- Demo [optional]: [Link to a demo if you create one]
Uses
Direct Use
This model is intended for generating conversational text, simulating responses one might find in the r/[TARGET_SUBREDDIT] subreddit. It can be used directly with the transformers library pipeline for text generation or through manual generation loops for more control.
from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
import torch
# Using pipeline (simple)
pipe = pipeline("text-generation", model="[Your Hugging Face Username]/[Your Model Repository Name]", device=0 if torch.cuda.is_available() else -1)
prompt = "What are your thoughts on " # Example prompt
response = pipe(prompt, max_new_tokens=50, num_return_sequences=1)
print(response[0]['generated_text'])
# Manual usage (more control, similar to script's chat)
tokenizer = AutoTokenizer.from_pretrained("[Your Hugging Face Username]/[Your Model Repository Name]")
model = AutoModelForCausalLM.from_pretrained("[Your Hugging Face Username]/[Your Model Repository Name]")
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
prompt = "The best thing about [topic relevant to subreddit] is "
inputs = tokenizer.encode(prompt + tokenizer.eos_token, return_tensors='pt').to(device)
# Example generation parameters (adjust as needed)
outputs = model.generate(
inputs,
max_new_tokens=100,
do_sample=True,
top_k=50,
top_p=0.92,
temperature=0.75,
pad_token_id=tokenizer.eos_token_id
)
response_text = tokenizer.decode(outputs[0, inputs.shape[-1]:], skip_special_tokens=True)
print(f"Prompt: {prompt}")
print(f"Bot: {response_text}")
- Downloads last month
- 4