66 parseDatasetSchemaFlag ,
77 formatIssue ,
88 MAX_DATASET_BYTES ,
9+ MAX_MEDIA_ZIP_BYTES ,
910 BailianError ,
1011 ExitCode ,
1112 type DatasetFile ,
@@ -17,7 +18,7 @@ const UPLOAD_FLAGS = {
1718 file : {
1819 type : "string" ,
1920 valueHint : "<path>" ,
20- description : "Local .jsonl dataset file (≤300MB)" ,
21+ description : "Local dataset file (.jsonl or .zip; ≤300MB text, ≤1GB image/video )" ,
2122 required : true ,
2223 } ,
2324 purpose : {
@@ -29,7 +30,7 @@ const UPLOAD_FLAGS = {
2930 type : "string" ,
3031 valueHint : "<s>" ,
3132 description :
32- 'Record schema: "chatml" (SFT), "dpo" (chosen/rejected), or "cpt" (raw text). Default auto-detects per record.' ,
33+ 'Record schema: "chatml" (SFT), "dpo" (chosen/rejected), "cpt" (raw text), "tts" (audio), "image" (image generation), or "video" (video generation ). Default auto-detects per record.' ,
3334 } ,
3435 noValidate : {
3536 type : "switch" ,
@@ -42,30 +43,31 @@ const UPLOAD_FLAGS = {
4243} satisfies FlagsDef ;
4344
4445export default defineCommand ( {
45- description : "Upload a dataset file (.jsonl) to Bailian" ,
46+ description : "Upload a dataset file (.jsonl or .zip ) to Bailian" ,
4647 auth : "apiKey" ,
4748 usageArgs :
48- "--file <path> [--purpose <name>] [--schema <chatml|dpo|cpt>] [--no-validate] [--full-validate]" ,
49+ "--file <path> [--purpose <name>] [--schema <chatml|dpo|cpt|tts|image|video >] [--no-validate] [--full-validate]" ,
4950 flags : UPLOAD_FLAGS ,
5051 exampleArgs : [
5152 "--file train.jsonl" ,
5253 "--file dpo.jsonl --schema dpo" ,
5354 "--file cpt.jsonl --schema cpt" ,
55+ "--file audio.zip --schema tts" ,
5456 "--file eval.jsonl --purpose evaluation" ,
5557 "--file train.jsonl --full-validate" ,
5658 "--file train.jsonl --no-validate" ,
5759 ] ,
5860 notes : [
59- "Only .jsonl is supported in this release. Three record schemas are " ,
60- "recognized: chatml = {messages:[...]} (SFT); dpo = {messages:[...], " ,
61- "chosen, rejected} where chosen/rejected are single assistant messages ;" ,
62- 'cpt = {text:"..."} (continual pre-training, raw text). With no --schema, ' ,
63- "a record carrying chosen/rejected is validated as DPO, one with text (and" ,
64- "no messages) as CPT, otherwise as ChatML. Pass --schema dpo / cpt to" ,
65- "require that shape on every record, or --schema chatml to ignore the" ,
66- "preference / text fields. Other purposes may carry a different schema in " ,
67- "the future and would be served by a purpose-specific validator. " ,
68- "The dataset upload cap is 300MB per file ." ,
61+ "Supports .jsonl (text) and .zip (audio/image/video archives with a " ,
62+ "data.jsonl manifest). Six record schemas are recognized: chatml = " ,
63+ "{messages:[...]} (SFT); dpo = {messages:[...], chosen, rejected} ;" ,
64+ 'cpt = {text:"..."} (continual pre-training, raw text); tts = ' ,
65+ '{wav_fn:"train/xxx.wav", text:"..."} (audio fine-tuning); image =' ,
66+ '{img_path:"..."} (image generation); video = {first_frame_path:"...",' ,
67+ 'video_path:"..."} (video generation). With no --schema, a record' ,
68+ "carrying wav_fn is validated as TTS, img_path as image, video_path / " ,
69+ "first_frame_path as video, chosen/rejected as DPO, text (no messages) " ,
70+ "as CPT, otherwise ChatML. Upload cap: 300MB text, 1GB image/video ." ,
6971 "Upload uses the OpenAI-compatible /compatible-mode/v1/files endpoint so" ,
7072 "the purpose tag is persisted (the DashScope-native /api/v1/files drops it)." ,
7173 ] ,
@@ -75,9 +77,16 @@ export default defineCommand({
7577 const purpose = flags . purpose || "fine-tune" ;
7678 const schema = parseDatasetSchemaFlag ( flags . schema ) ;
7779 const format = detectOutputFormat ( settings . output ) ;
80+ // Image / video schemas allow larger ZIPs (1 GB vs 300 MB for text).
81+ const isMediaSchema = schema === "image" || schema === "video" ;
7882
7983 if ( ! flags . noValidate ) {
80- const result = await validateDataset ( filePath , { fullValidate : flags . fullValidate , schema } ) ;
84+ const maxBytes = isMediaSchema ? MAX_MEDIA_ZIP_BYTES : MAX_DATASET_BYTES ;
85+ const result = await validateDataset ( filePath , {
86+ fullValidate : flags . fullValidate ,
87+ schema,
88+ maxBytes,
89+ } ) ;
8190 if ( ! result . valid ) {
8291 const lines = [
8392 `Dataset validation failed for ${ filePath } ` ,
@@ -112,7 +121,7 @@ export default defineCommand({
112121 action : "dataset.upload" ,
113122 file : filePath ,
114123 purpose,
115- max_bytes : MAX_DATASET_BYTES ,
124+ max_bytes : isMediaSchema ? MAX_MEDIA_ZIP_BYTES : MAX_DATASET_BYTES ,
116125 validate : ! flags . noValidate ,
117126 schema : schema ?? "auto" ,
118127 } ,
0 commit comments