Text Generation
Transformers
Safetensors
English
gpt2
stylometry
melville
authorship-attribution
literary-analysis
computational-linguistics
text-generation-inference
Instructions to use contextlab/gpt2-melville with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use contextlab/gpt2-melville with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="contextlab/gpt2-melville", device_map="auto")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("contextlab/gpt2-melville") model = AutoModelForCausalLM.from_pretrained("contextlab/gpt2-melville", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use contextlab/gpt2-melville with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "contextlab/gpt2-melville" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "contextlab/gpt2-melville", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/contextlab/gpt2-melville
- SGLang
How to use contextlab/gpt2-melville 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 "contextlab/gpt2-melville" \ --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": "contextlab/gpt2-melville", "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 "contextlab/gpt2-melville" \ --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": "contextlab/gpt2-melville", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use contextlab/gpt2-melville with Docker Model Runner:
docker model run hf.co/contextlab/gpt2-melville
Upload melville stylometry model
Browse files
README.md
CHANGED
|
@@ -15,17 +15,13 @@ library_name: transformers
|
|
| 15 |
pipeline_tag: text-generation
|
| 16 |
---
|
| 17 |
|
| 18 |
-
# GPT-2 Herman Melville Stylometry Model
|
| 19 |
-
|
| 20 |
-
<div style="text-align: center;">
|
| 21 |
-
<img src="https://raw.githubusercontent.com/ContextLab/llm-stylometry/main/assets/CDL_Avatar.png" alt="Context Lab" width="200"/>
|
| 22 |
-
</div>
|
| 23 |
|
| 24 |
## Overview
|
| 25 |
|
| 26 |
-
This model is a GPT-2 language model trained exclusively on
|
| 27 |
|
| 28 |
-
The model captures Herman Melville's unique writing style through intensive training on their
|
| 29 |
|
| 30 |
- **Text generation** in the authentic style of Herman Melville
|
| 31 |
- **Authorship attribution** through cross-entropy loss comparison
|
|
|
|
| 15 |
pipeline_tag: text-generation
|
| 16 |
---
|
| 17 |
|
| 18 |
+
# ContextLab GPT-2 Herman Melville Stylometry Model
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
## Overview
|
| 21 |
|
| 22 |
+
This model is a GPT-2 language model trained exclusively on **10 books by Herman Melville** (1819-1891). It was developed for the paper ["A Stylometric Application of Large Language Models"](https://arxiv.org/abs/2510.21958) (Stropkay et al., 2025).
|
| 23 |
|
| 24 |
+
The model captures Herman Melville's unique writing style through intensive training on their corpus. By learning the statistical patterns, vocabulary, syntax, and thematic elements characteristic of Melville's writing, this model enables:
|
| 25 |
|
| 26 |
- **Text generation** in the authentic style of Herman Melville
|
| 27 |
- **Authorship attribution** through cross-entropy loss comparison
|