Views
No views yet
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.💡 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 viams-swift.
1import os
2from huggingface_hub import snapshot_download
3
4os.environ['CUDA_VISIBLE_DEVICES'] = '0'
5
6model_name = "XD-MU/ScriptAgent"
7local_path = "./models/ScriptAgent"
8
9# 下载整个仓库的所有文件
10print("下载模型所有文件...")
11snapshot_download(
12 repo_id=model_name,
13 local_dir=local_path,
14 local_dir_use_symlinks=False,
15 resume_download=True
16)
17
18print(f"模型已完整下载到: {local_path}")
19
20# 使用 SWIFT 加载
21from swift.llm import PtEngine, RequestConfig, InferRequest
22
23engine = PtEngine(local_path, max_batch_size=1)
24request_config = RequestConfig(max_tokens=8192, temperature=0.7)
25
26infer_request = InferRequest(messages=[
27 {"role": "user", "content": "你的对话上下文(Your Dialogue)"}
28])
29response = engine.infer([infer_request], request_config)[0]
30
31print(response.choices[0].message.content)