File size: 5,553 Bytes
23285f5
 
bcc963f
 
 
 
23285f5
 
bcc963f
23285f5
 
bcc963f
23285f5
 
 
 
 
 
bcc963f
 
 
 
 
 
 
 
23285f5
 
 
 
 
 
bcc963f
23285f5
 
bcc963f
 
23285f5
 
 
 
bcc963f
23285f5
bcc963f
23285f5
 
 
 
bcc963f
23285f5
bcc963f
23285f5
 
 
 
bcc963f
 
23285f5
 
 
 
 
bcc963f
 
 
23285f5
 
 
 
bcc963f
 
23285f5
 
 
 
 
bcc963f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23285f5
 
 
 
 
 
bcc963f
23285f5
 
 
 
 
 
bcc963f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23285f5
 
bcc963f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
---
library_name: transformers
language:
- en
base_model:
- google/gemma-2-2b-it
---

# Model Card for ScriptWave Gemma-2-2b-it

<!-- Provide a quick summary of what the model is/does. -->
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.


## Model Details

<!-- Provide a longer summary of what this model is. -->

- **Developed by:** Chanjeans, mind22
- **Model type:** Causal Language Model (AutoModelForCausalLM)
- **Language(s) (NLP):** English
- **Finetuned from model [optional]:** google/gemma-2-2b-it






### Model Sources [optional]

<!-- Provide the basic links for the model. -->

- **Repository:** https://github.com/minj22/scriptwave



## Uses

### Direct Use

<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
- **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.

### Downstream Use [optional]

<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
- **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.

### Out-of-Scope Use

<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
- The model should not be used to create harmful or misleading content, including hate speech, disinformation, or any adult content.



## Bias, Risks, and Limitations

<!-- This section is meant to convey both technical and sociotechnical limitations. -->
- Bias in Output: The model may reflect biases present in the training data, leading to stereotypical representations of characters or scenarios.
- Limitations in Context Understanding: The model may struggle with understanding nuanced emotional tones or context, impacting script quality.
- Music Recommendation Accuracy: Recommendations may not always align with user expectations, as they are based solely on emotion analysis.

### Recommendations

<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
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.



## How to Get Started with the Model

Use the code below to get started with the model.
```python
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)
```

## Training Details

### Training Data

<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
https://huggingface.co/datasets/li2017dailydialog/daily_dialog


### Training Procedure

<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->

```python
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
)
```
```python
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"
)
```

#### Summary
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.