Downloads · 30 days
24
8% of all-time downloads
Chanjeans/scriptgenerate_musicrecommend
scriptgenerate_musicrecommend is a text generation model from Chanjeans. Use it when you need the model to write or continue text. It is set up for transformers.
This model is designed to generate scripts based on user-provided scene descriptions and character names. It not only creates dialogues between characters but also analyzes the emotions within the generated script. Af…
Downloads · 30 days
24
8% of all-time downloads
All-time downloads
314
Public
Parameters
2.6B
2.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.1 GB · 98%
How the weights are stored.
U82B · 80%
From the Hugging Face model README
This model is designed to generate scripts based on user-provided scene descriptions and character names. It not only creates dialogues between characters but also analyzes the emotions within the generated script. After determining the emotional tone, the model recommends music that fits the identified emotions. These music suggestions make the tool useful for creative writing and content production by aligning dialogues with appropriate soundtracks.
Script Generation: Generates dialogue scripts based on user inputs including scene description, character names, and tone or genre.
Music Recommendation: Analyzes generated scripts to recommend music tracks that align with the emotional tone of the dialogue.
Creative Writing: Can be utilized by writers for brainstorming and drafting scripts.
Content Creation: Useful in video production or gaming for character dialogue and scene settings.
Users should critically evaluate the generated content and be aware of the potential biases in character representations and emotional analyses. Manual oversight is recommended for sensitive topics.
Use the code below to get started with the model.
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "Chanjeans/scriptgenerate_musicrecommend"
model = AutoModelForCausalLM.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
scene_description = input("Describe the scene (e.g., A heated argument at a dinner party): ")
character_1 = input("Enter the name of the first character: ")
character_2 = input("Enter the name of the second character: ")
genre_or_tone = input("Describe the genre or tone (e.g., Romantic, Thriller, Comedy): ")
test_input = f"""
INT. LOCATION - DAY
{scene_description}
{character_1.upper()}
(in a {genre_or_tone.lower()} tone)
I never thought it would come to this...
{character_2.upper()}
(reacting in a {genre_or_tone.lower()} manner)
Well, here we are. What are you going to do about it?
{character_1.upper()}
(pausing, thinking)
I don't know... maybe it's time I finally did something about this.
"""
input_ids = tokenizer.encode(test_input, return_tensors="pt")
output = model.generate(
input_ids,
max_length=400,
num_return_sequences=1,
pad_token_id=tokenizer.eos_token_id
)
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
print("Generated script:\n", generated_text)
https://huggingface.co/datasets/li2017dailydialog/daily_dialog
lora_config = LoraConfig(
r=16,
lora_alpha=32,
target_modules=["gate_proj", "up_proj", "down_proj"],
lora_dropout=0.2,
bias="none",
task_type=TaskType.CAUSAL_LM
)
training_args = TrainingArguments(
output_dir='./results',
per_device_train_batch_size=2,
num_train_epochs=1,
gradient_accumulation_steps=16,
fp16=True,
logging_steps=100,
save_steps=500,
save_total_limit=2,
learning_rate=5e-5,
warmup_steps=500,
lr_scheduler_type="linear"
)
The model demonstrates capability in generating contextually relevant scripts and making music recommendations based on emotional analysis, making it a valuable tool for creative writers and content creators.