|
--- |
|
library_name: transformers |
|
tags: [text-generation, NLP, GPT-2, film-review] |
|
--- |
|
|
|
# Model Card for Model ID |
|
|
|
## Model Details |
|
|
|
### Model Description |
|
|
|
This model is a specialized version of the GPT-2 architecture, fine-tuned for generating negative film reviews. It aims to produce text reflecting strong dissatisfaction, capturing nuances in negative sentiment and expressing them effectively in generated content. |
|
|
|
- **Model type:** GPT-2 fine-tuned for negative film reviews |
|
- **Language(s) (NLP):** English |
|
|
|
## Uses |
|
|
|
```python |
|
from transformers import GPT2LMHeadModel, GPT2Tokenizer |
|
|
|
# Specify the model path |
|
model_path = "AigrisGPT" |
|
|
|
# Load the model and tokenizer |
|
model = GPT2LMHeadModel.from_pretrained(model_path) |
|
tokenizer = GPT2Tokenizer.from_pretrained(model_path) |
|
|
|
input_sequence = "This movie" |
|
max_length = 100 |
|
|
|
# Encode the input text |
|
input_ids = tokenizer.encode(input_sequence, return_tensors='pt') |
|
|
|
# Generate text using the model |
|
output_ids = model.generate( |
|
input_ids, |
|
max_length=max_length, |
|
pad_token_id=model.config.eos_token_id, |
|
top_k=50, |
|
top_p=0.95, |
|
do_sample=True |
|
) |
|
|
|
# Decode and print the generated text |
|
generated_text = tokenizer.decode(output_ids[0], skip_special_tokens=True) |
|
print(generated_text) |
|
``` |
|
|
|
### Example of Model Output |
|
|
|
Here is an example of text generated by this model with an input *This movie*: |
|
|
|
*’This movie tries too hard to be a thriller film and to say there are lots of people like me who like this kind of movies it falls apart at some points. But the thing is this: these people would probably be bored with the genre anyway. All the characters are a mix of stereotypical, racist, violent and sexist stereotypes which are supposed to fit into a mmon genre. One that I found myself thinking about after I watched it. I should have read the books first. If not, I’* |
|
|
|
|