Views
No views yet
[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.[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.en). The dataset sourced from Reddit may contain other languages or slang specific to the community.[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.[BASE_MODEL_NAME] (e.g., microsoft/DialoGPT-medium or gpt2)https://huggingface.co/[Your Hugging Face Username]/[Your Model Repository Name]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.1from transformers import pipeline, AutoTokenizer, AutoModelForCausalLM
2import torch
3
4# Using pipeline (simple)
5pipe = pipeline("text-generation", model="[Your Hugging Face Username]/[Your Model Repository Name]", device=0 if torch.cuda.is_available() else -1)
6prompt = "What are your thoughts on " # Example prompt
7response = pipe(prompt, max_new_tokens=50, num_return_sequences=1)
8print(response[0]['generated_text'])
9
10# Manual usage (more control, similar to script's chat)
11tokenizer = AutoTokenizer.from_pretrained("[Your Hugging Face Username]/[Your Model Repository Name]")
12model = AutoModelForCausalLM.from_pretrained("[Your Hugging Face Username]/[Your Model Repository Name]")
13device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
14model.to(device)
15
16prompt = "The best thing about [topic relevant to subreddit] is "
17inputs = tokenizer.encode(prompt + tokenizer.eos_token, return_tensors='pt').to(device)
18
19# Example generation parameters (adjust as needed)
20outputs = model.generate(
21 inputs,
22 max_new_tokens=100,
23 do_sample=True,
24 top_k=50,
25 top_p=0.92,
26 temperature=0.75,
27 pad_token_id=tokenizer.eos_token_id
28)
29
30response_text = tokenizer.decode(outputs[0, inputs.shape[-1]:], skip_special_tokens=True)
31print(f"Prompt: {prompt}")
32print(f"Bot: {response_text}")