Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,52 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: XD-MU/ScriptAgent
|
| 3 |
+
library_name: peft
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
tags:
|
| 6 |
+
- base_model:adapter:XD-MU/ScriptAgent
|
| 7 |
+
- lora
|
| 8 |
+
- transformers
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
# ScriptAgent: Dialogue-to-Shooting-Script Generation Model
|
| 13 |
+
|
| 14 |
+
This model is a fine-tuned adapter (LoRA) on top of the `XD-MU/ScriptAgent` base model, designed to **generate detailed shooting scripts from dialogue inputs**. It is trained to transform conversational text into structured screenplay formats suitable for film or video production.
|
| 15 |
+
|
| 16 |
+
The model is compatible with [ms-swift](https://github.com/modelscope/swift) and supports efficient inference via the **vLLM backend**.
|
| 17 |
+
|
| 18 |
+
> 💡 Note: This repository contains a **PEFT adapter** (e.g., LoRA). To use it, you must merge it with the original base model or load it via `ms-swift`.
|
| 19 |
+
|
| 20 |
+
## ▶️ Inference with ms-swift (vLLM Backend)
|
| 21 |
+
|
| 22 |
+
To generate shooting scripts from dialogue inputs, use the following command with **ms-swift**:
|
| 23 |
+
|
| 24 |
+
You can find **DialoguePrompts** here: https://huggingface.co/datasets/XD-MU/DialoguePrompts
|
| 25 |
+
```bash
|
| 26 |
+
import os
|
| 27 |
+
from huggingface_hub import snapshot_download
|
| 28 |
+
from swift.llm import PtEngine, RequestConfig, InferRequest
|
| 29 |
+
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
|
| 30 |
+
|
| 31 |
+
model_name = "XD-MU/ScriptAgent"
|
| 32 |
+
local_path = "./models/ScriptAgent"
|
| 33 |
+
|
| 34 |
+
snapshot_download(
|
| 35 |
+
repo_id=model_name,
|
| 36 |
+
local_dir=local_path,
|
| 37 |
+
local_dir_use_symlinks=False,
|
| 38 |
+
resume_download=True
|
| 39 |
+
)
|
| 40 |
+
|
| 41 |
+
engine = PtEngine(local_path, max_batch_size=1)
|
| 42 |
+
request_config = RequestConfig(max_tokens=8192, temperature=0.7)
|
| 43 |
+
|
| 44 |
+
infer_request = InferRequest(messages=[
|
| 45 |
+
{"role": "user", "content": "Your Dialogue"}
|
| 46 |
+
])
|
| 47 |
+
response = engine.infer([infer_request], request_config)[0]
|
| 48 |
+
|
| 49 |
+
print(response.choices[0].message.content)
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
|