Model Overview
This model is a fine-tuned version of DistilGPT2, specifically trained on detective stories, with a focus on generating narratives in the style of Sherlock Holmes. It is designed to generate coherent and engaging detective tales based on an initial prompt, making it suitable for applications in story generation, writing assistance, and creative content creation.
Model Details
- Model Type: Causal Language Model
- Architecture: Transformer
- Base Model: DistilGPT2
- Fine-tuning Task: Detective Story Generation
- Training Data: A curated dataset of detective stories, with a focus on Sherlock Holmes-style narratives and other detective-themed works.
- Training Objective: Language modeling (predicting the next word in a sequence given the previous words).
Usage
How to Use
You can use this model to generate detective stories based on an input prompt. Below is a simple code snippet to get started:
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load the model and tokenizer
model_name = "kmack/DetectiveTales-DistilGPT2"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
# Define your prompt
prompt = "It all started with the murder of the chief. This is the type of case that Sherlock likes and gets off on"
# Tokenize the input
input_ids = tokenizer.encode(prompt, return_tensors="pt")
# Generate output
output = model.generate(
input_ids,
max_length=100, # Adjust the length as needed
num_return_sequences=1, # Number of generated outputs
no_repeat_ngram_size=2, # Avoid repeating phrases
top_k=50, # Use top-k sampling
top_p=0.95, # Use nucleus sampling
temperature=0.7, # Adjust creativity
do_sample=True # Enable sampling
)
# Decode and print the generated text
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
print(generated_text)
# Output:
# It all started with the murder of the chief. This is the type of case that Sherlock likes and gets off on. It only lasts a few days at last. He would say that Holmes's actions were not criminal. I assure you that if you knew his intentions and how he wasabout this,you probablywouldn't havehad him so far, Watson. Of course that is, then, but in any event, it isthe sort of case you know to follow closely. He is the one who has sent the letters from London to Madrid. He has sent every letter that I say, and if there are no objections you can take them out as you will. This is the type of cases where our Lady Watson will decide to get out of such a situation.We made a case for his protection,and he came out as the best possible one. We were all so ready so that he could not have waited for me to meet me again. The whole affairwas very unusual. It was a little dark on the night before. He gave me the order.
- Downloads last month
- 17
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.