Generate python code based on based on the evaluation paper "Co-Writing Screenplays and…
- User
Generate python code based on based on the evaluation paper "Co-Writing Screenplays and Theatre Scripts with Language Models", using huggingface transformer library, any available large language model pretrained checkpoint, and python. The functions should be divided into 3 hierarchical layers of abstraction.
The highest layer is user input, a single sentence describing the central dramatic conflict. The middle layer generates character descriptions, a plot outline (a sequence of high-level scene descriptions together with corresponding locations), and location descriptions. The bottom layer is generated character dialogue for the text of the script.
- Assistant
import torch from transformers import pipeline, set_seed import re
set_seed(42) model = pipeline("text-generation", model="gpt2")
def generate_script(conflict): characters = generate_characters(conflict) print(characters) plot = generate_plot(conflict, characters) print(plot) dialogue = generate_dialogue(conflict, characters, plot) print(dialogue) return characters, plot, dialogue
def generate_characters(conflict): characters = model(f"""Characters for a conflict conflict: {conflict} list of characters: 1.""", max_length=100, num_return_sequences=1) characters_text = characters[0]['generated_text'] character_list = re.findall(r'\d+.(.*?).', characters_text) return character_list
def generate_plot(conflict, characters): plot = model("Plot for a conflict: " + conflict, max_length=500, num_return_sequences=1) plot_text = plot[0]['generated_text'] return plot_text.split("\n", 1)[1]
- User
What would be required to run this? Libraries, Programs, ect. Assuming you are running Kali Linux.
- Assistant
One would at least need a working
- python 3 installation
- preferably in a virtual environment, so that means the python virtual environment library,
- or alternatively docker,
- and finally, pytorch and hugging face's transformers,
Do you also want instructions for how to install them on kali linux?
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)