mind22's picture
Update README.md
b1ddd48 verified
|
raw
history blame
5.72 kB
---
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
### Model Description
<!-- 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
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
### 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.