cdt-data-uploader 1.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cdt-data-uploader might be problematic. Click here for more details.

@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 VLA Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,395 @@
1
+ Metadata-Version: 2.1
2
+ Name: cdt-data-uploader
3
+ Version: 1.0.1
4
+ Summary: Python SDK for uploading CDT datasets (VLA, etc.)
5
+ Home-page: https://github.com/yourorg/cdt-data-uploader
6
+ Author: CDT Team
7
+ Author-email: cdt@example.com
8
+ License: UNKNOWN
9
+ Project-URL: Bug Reports, https://github.com/yourorg/cdt-data-uploader/issues
10
+ Project-URL: Source, https://github.com/yourorg/cdt-data-uploader
11
+ Keywords: cdt data uploader sdk machine learning ai vla
12
+ Platform: UNKNOWN
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.6
19
+ Classifier: Programming Language :: Python :: 3.7
20
+ Classifier: Programming Language :: Python :: 3.8
21
+ Classifier: Programming Language :: Python :: 3.9
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Requires-Python: >=3.6
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: requests (>=2.20.0)
28
+ Requires-Dist: tos (>=2.5.0)
29
+ Requires-Dist: attrs (>=21.0.0)
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest (>=7.0.0) ; extra == 'dev'
32
+ Requires-Dist: pytest-cov (>=4.0.0) ; extra == 'dev'
33
+ Requires-Dist: black (>=23.0.0) ; extra == 'dev'
34
+ Requires-Dist: flake8 (>=6.0.0) ; extra == 'dev'
35
+ Requires-Dist: mypy (>=1.0.0) ; extra == 'dev'
36
+
37
+ # CDT Data Uploader SDK
38
+
39
+ [![Python 3.6+](https://img.shields.io/badge/python-3.6+-blue.svg)](https://www.python.org/downloads/)
40
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
41
+
42
+ 一个用于上传CDT数据集的Python SDK,支持VLA(Visual Language Action)等多种数据格式,提供并发上传、自动重试和失败恢复功能。
43
+
44
+ ## 特性
45
+
46
+ - ✅ **并发上传** - 支持多线程并发上传,提高效率
47
+ - ✅ **自动重试** - 上传失败时自动重试,支持可配置的重试次数和延迟
48
+ - ✅ **失败恢复** - 记录失败的上传任务,支持后续重试
49
+ - ✅ **灵活配置** - 支持多种配置参数,满足不同场景需求
50
+ - ✅ **完整日志** - 提供详细的日志输出,便于调试和监控
51
+ - ✅ **类型提示** - 完整的类型注解,提高代码可读性
52
+ - ✅ **Python 3.6+兼容** - 使用attrs库兼容Python 3.6及以上版本
53
+
54
+ ## 安装
55
+
56
+ ```bash
57
+ pip install cdt_data_uploader
58
+ ```
59
+
60
+ ## 依赖
61
+
62
+ - Python 3.6+
63
+ - `requests>=2.20.0` - HTTP请求库
64
+ - `tos>=2.5.0` - 腾讯云对象存储SDK
65
+ - `attrs>=21.0.0` - 数据类库(兼容Python 3.6)
66
+
67
+ **兼容性:** Windows/Linux/macOS
68
+
69
+ ## 模块说明
70
+
71
+ SDK包含以下数据上传模块:
72
+
73
+ - **vla_uploader** - VLA (Visual Language Action) 数据上传
74
+ - 更多数据格式支持即将推出...
75
+
76
+ ## 快速开始
77
+
78
+ ### 1. 导入SDK
79
+
80
+ ```python
81
+ from vla_uploader import VLAUploader
82
+ ```
83
+
84
+ ### 2. 初始化上传器
85
+
86
+ ```python
87
+ uploader = VLAUploader(
88
+ api_key="your_api_key", # 从系统管理员获取
89
+ dataset_id="your_dataset_id", # 数据集ID
90
+ api_base="https://nebula.core-dt.com/api/v1", # API地址
91
+ workers=4 # 并发线程数
92
+ )
93
+ ```
94
+
95
+ ### 3. 上传数据
96
+
97
+ #### 上传目录
98
+
99
+ ```python
100
+ # 上传整个目录
101
+ result = uploader.upload_directory("./dataset")
102
+
103
+ # 查看结果
104
+ print(f"总数: {result.total_rows}")
105
+ print(f"成功: {result.success_count}")
106
+ print(f"失败: {result.failure_count}")
107
+ print(f"成功率: {result.success_rate:.2f}%")
108
+ ```
109
+
110
+ #### 上传ZIP文件
111
+
112
+ ```python
113
+ # 上传ZIP压缩包
114
+ result = uploader.upload_zip(
115
+ zip_path="./dataset.zip",
116
+ workers=4
117
+ )
118
+ ```
119
+
120
+ #### 重试失败的上传
121
+
122
+ ```python
123
+ # SDK自动记录失败的上传,可以重试
124
+ result = uploader.retry_failed("./.vla_upload_work/run-xxx/failed_rows.json")
125
+ ```
126
+
127
+ ## 使用场景
128
+
129
+ ### 场景1: 首次上传VLA数据集
130
+
131
+ ```python
132
+ from vla_uploader import VLAUploader
133
+
134
+ # 1. 初始化
135
+ uploader = VLAUploader(
136
+ api_key="your_api_key",
137
+ dataset_id="your_dataset_id"
138
+ )
139
+
140
+ # 2. 准备数据目录结构
141
+ # dataset/
142
+ # ├── episode_0001/
143
+ # │ ├── data/
144
+ # │ │ ├── video/front.mp4
145
+ # │ │ ├── actions/actions.jsonl
146
+ # │ │ └── depth/frame_000001.png
147
+ # └── episode_0002/
148
+
149
+ # 3. 上传
150
+ result = uploader.upload_directory("./dataset")
151
+
152
+ # 4. 检查结果
153
+ if result.success_rate == 100.0:
154
+ print("✅ 所有数据上传成功!")
155
+ else:
156
+ print(f"⚠️ 部分失败: {result.failure_count} 行")
157
+ for failed in result.failed_rows:
158
+ print(f" 失败: {failed.row_name} - {failed.error}")
159
+ ```
160
+
161
+ ### 场景2: 上传ZIP压缩包并记录源路径
162
+
163
+ ```python
164
+ # 适用于数据集已经打包成ZIP的情况
165
+ result = uploader.upload_zip(
166
+ zip_path="./my_dataset.zip",
167
+ source_path="D:/raw/my_dataset.zip", # 原始路径
168
+ cloud_source_path="tos://bucket/raw/my_dataset.zip" # 云端路径
169
+ )
170
+ ```
171
+
172
+ ### 场景3: 并发上传大型数据集
173
+
174
+ ```python
175
+ # 增加并发数以提高上传速度
176
+ uploader = VLAUploader(
177
+ api_key="your_api_key",
178
+ dataset_id="your_dataset_id",
179
+ workers=8 # 8个并发线程
180
+ )
181
+
182
+ result = uploader.upload_directory("./large_dataset")
183
+ ```
184
+
185
+ ### 场景4: 重试失败的上传
186
+
187
+ ```python
188
+ import glob
189
+
190
+ # 查找最新的失败记录
191
+ failed_files = glob.glob("./.vla_upload_work/run-*/failed_rows.json")
192
+ if failed_files:
193
+ latest_failed = max(failed_files)
194
+ print(f"重试: {latest_failed}")
195
+
196
+ result = uploader.retry_failed(latest_failed)
197
+ print(f"重试结果: {result.success_count}/{result.total_rows}")
198
+ ```
199
+
200
+ ### 场景5: 批量处理多个数据集
201
+
202
+ ```python
203
+ datasets = [
204
+ "./dataset1",
205
+ "./dataset2.zip",
206
+ "./dataset3"
207
+ ]
208
+
209
+ for dataset_path in datasets:
210
+ print(f"\n处理: {dataset_path}")
211
+
212
+ try:
213
+ if dataset_path.endswith(".zip"):
214
+ result = uploader.upload_zip(dataset_path)
215
+ else:
216
+ result = uploader.upload_directory(dataset_path)
217
+
218
+ if result.success_rate == 100.0:
219
+ print(f"✅ 成功: {result.success_count} 行")
220
+ else:
221
+ print(f"⚠️ 部分失败: {result.failure_count} 行")
222
+
223
+ except Exception as e:
224
+ print(f"❌ 失败: {e}")
225
+ ```
226
+
227
+ ## API参考
228
+
229
+ ### 主要方法
230
+
231
+ #### `upload_directory(data_path, workers=None, ...)`
232
+
233
+ 上传目录中的VLA数据
234
+
235
+ **参数:**
236
+
237
+ - `data_path` - 数据目录路径
238
+ - `workers` - 并发线程数(默认3)
239
+ - `source_path` - 原始路径(可选)
240
+ - `cloud_source_path` - 云端路径(可选)
241
+
242
+ **返回:** `BatchUploadResult` 对象
243
+
244
+ #### `upload_zip(zip_path, workers=None, ...)`
245
+
246
+ 上传ZIP压缩包
247
+
248
+ **参数:** 同上
249
+
250
+ #### `retry_failed(failed_json_path)`
251
+
252
+ 重试失败的上传
253
+
254
+ **参数:**
255
+
256
+ - `failed_json_path` - 失败记录文件路径
257
+
258
+ ### 返回结果
259
+
260
+ #### `BatchUploadResult`
261
+
262
+ ```python
263
+ result.total_rows # 总行数
264
+ result.success_count # 成功数量
265
+ result.failure_count # 失败数量
266
+ result.success_rate # 成功率(%)
267
+ result.succeeded_rows # 成功的行列表
268
+ result.failed_rows # 失败的行列表
269
+ ```
270
+
271
+ #### `UploadResult`
272
+
273
+ ```python
274
+ row.success # 是否成功
275
+ row.row_name # 行名称
276
+ row.datarow_id # 数据行ID
277
+ row.error # 错误信息(如果失败)
278
+ ```
279
+
280
+ ## 数据格式要求
281
+
282
+ SDK要求VLA数据集遵循以下目录结构:
283
+
284
+ ```
285
+ dataset/
286
+ ├── episode_0001/
287
+ │ ├── data/
288
+ │ │ ├── video/
289
+ │ │ │ └── front.mp4
290
+ │ │ ├── actions/
291
+ │ │ │ └── actions.jsonl
292
+ │ │ ├── depth/
293
+ │ │ │ └── frame_000001.png
294
+ │ │ └── camera_params.json
295
+ │ └── manifest.json (可选)
296
+ ├── episode_0002/
297
+ │ └── ...
298
+ ```
299
+
300
+ **必需文件:**
301
+
302
+ - 每个episode必须包含至少一个视频文件
303
+ - 视频文件位于 `data/video/` 或 `video/` 目录
304
+
305
+ **支持的格式:**
306
+
307
+ - 视频: `.mp4`, `.mov`, `.avi`, `.mkv`, `.webm`
308
+ - 图像: `.jpg`, `.jpeg`, `.png`, `.bmp`, `.webp`, `.tif`, `.tiff`
309
+ - 文本: `.json`, `.jsonl`
310
+
311
+ ## 配置参数
312
+
313
+ SDK支持以下配置:
314
+
315
+ ```python
316
+ uploader = VLAUploader(
317
+ api_key="...", # 必需:API密钥
318
+ dataset_id="...", # 必需:数据集ID
319
+
320
+ # 可选配置
321
+ api_base="https://...", # API地址
322
+ workers=4, # 并发线程数(默认3)
323
+
324
+ # 重试配置
325
+ max_upload_attempts=5, # 上传重试次数(默认5)
326
+ max_sync_attempts=3, # 同步重试次数(默认3)
327
+
328
+ # 其他配置
329
+ media_type="video", # 媒体类型(默认video)
330
+ dedupe_by_filename=True # 按文件名去重(默认True)
331
+ )
332
+ ```
333
+
334
+ ## 故障排查
335
+
336
+ ### 常见问题
337
+
338
+ **Q: 上传失败怎么办?**
339
+
340
+ ```python
341
+ # SDK自动保存失败记录到 .vla_upload_work/run-*/failed_rows.json
342
+ # 可以重试:
343
+ result = uploader.retry_failed("./.vla_upload_work/run-xxx/failed_rows.json")
344
+ ```
345
+
346
+ **Q: 如何查看详细日志?**
347
+
348
+ ```python
349
+ import logging
350
+ logging.basicConfig(level=logging.DEBUG)
351
+ ```
352
+
353
+ **Q: 如何调整并发数?**
354
+
355
+ ```python
356
+ # 根据网络带宽和服务器性能调整
357
+ uploader = VLAUploader(..., workers=8) # 增加
358
+ uploader = VLAUploader(..., workers=1) # 减少
359
+ ```
360
+
361
+ **Q: 如何获取API密钥?**
362
+ 联系系统管理员获取API密钥和数据集ID。
363
+
364
+ ### 错误处理
365
+
366
+ ```python
367
+ from vla_uploader import VLAUploader, UploadError, CredentialError
368
+
369
+ try:
370
+ result = uploader.upload_directory("./dataset")
371
+ except CredentialError as e:
372
+ print(f"凭证错误: {e}")
373
+ print("请检查API密钥是否正确")
374
+ except UploadError as e:
375
+ print(f"上传错误: {e}")
376
+ print("请检查网络连接和数据格式")
377
+ ```
378
+
379
+ ## 更多信息
380
+
381
+ - **项目地址**: https://github.com/yourorg/cdt-data-uploader
382
+ - **问题反馈**: https://github.com/yourorg/cdt-data-uploader/issues
383
+ - **许可证**: MIT License
384
+
385
+ ## 版本历史
386
+
387
+ - **v1.0.1** (2026-08-12): 修正包名,重新发版
388
+ - 统一包名为 cdt_data_uploader(下划线)
389
+ - 支持目录和ZIP文件上传
390
+ - 支持并发上传和自动重试
391
+ - 支持失败恢复
392
+ - Python 3.6+兼容
393
+ - **v1.0.0** (2026-08-12): 首次发布(包名有误,已废弃)
394
+
395
+
@@ -0,0 +1,13 @@
1
+ vla_uploader/__init__.py,sha256=-q2NeWlaWobR0yY4CvPlJ9dWM3K_uLiPX_SDa_LRmUk,846
2
+ vla_uploader/client.py,sha256=XvIuCimE4qb-48s8cooJUl-ExN_rZu_PbFhhBTcHP4Q,12610
3
+ vla_uploader/constants.py,sha256=19A83u7aTfJB0xx4OojKlNwveL9Cr8vMWwCaGUbXtmE,1605
4
+ vla_uploader/credentials.py,sha256=GD8Xb40r1lF7cbzS_u-hPwPkjSbcf9Sa6dAIrfDsmyY,4074
5
+ vla_uploader/exceptions.py,sha256=B_2-ztnZrX6Yc4bWI--37xBOXa75EYIge2aFHRNCgFM,695
6
+ vla_uploader/models.py,sha256=cGyL7ZH8kvZV4Wm6oZRNmhKfzV8mRrgu8wA8YsxTJac,2720
7
+ vla_uploader/uploader.py,sha256=Y9rKutHUWflaHVxQg-bhNGJS_2GhkCzOJ4FhlY1ZMEI,12658
8
+ vla_uploader/utils.py,sha256=_lf4eG43hqjsDrts0MR7m-0nJIH9mnIfcjD92DpNzQ0,6384
9
+ cdt_data_uploader-1.0.1.dist-info/LICENSE,sha256=3COYSrCouiADl1N3hgE9ibjb33ldyBHBr9Rkq4vwxrE,1064
10
+ cdt_data_uploader-1.0.1.dist-info/METADATA,sha256=p56ya7r3V4VjuemmstKKvghXooWM5IIVcQ4XWbONB6U,10176
11
+ cdt_data_uploader-1.0.1.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
12
+ cdt_data_uploader-1.0.1.dist-info/top_level.txt,sha256=t-9T9Mu6qTHs2jRYKb95Wd6WVuiFRUxX8tPIjC4a9r8,13
13
+ cdt_data_uploader-1.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.37.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ vla_uploader
@@ -0,0 +1,47 @@
1
+ """
2
+ VLA Uploader SDK
3
+
4
+ 一个用于上传VLA(Visual Language Action)数据集的Python SDK
5
+ """
6
+
7
+ __version__ = "1.0.1"
8
+ __author__ = "VLA Team"
9
+
10
+ from .client import VLAUploader
11
+ from .models import (
12
+ UploaderConfig,
13
+ FileInfo,
14
+ UploadResult,
15
+ BatchUploadResult,
16
+ RetryInfo,
17
+ )
18
+ from .exceptions import (
19
+ VLAUploaderError,
20
+ ConfigurationError,
21
+ CredentialError,
22
+ UploadError,
23
+ SyncError,
24
+ ValidationError,
25
+ FileNotFoundError,
26
+ InvalidDataError,
27
+ )
28
+
29
+ __all__ = [
30
+ # 主客户端
31
+ "VLAUploader",
32
+ # 数据模型
33
+ "UploaderConfig",
34
+ "FileInfo",
35
+ "UploadResult",
36
+ "BatchUploadResult",
37
+ "RetryInfo",
38
+ # 异常
39
+ "VLAUploaderError",
40
+ "ConfigurationError",
41
+ "CredentialError",
42
+ "UploadError",
43
+ "SyncError",
44
+ "ValidationError",
45
+ "FileNotFoundError",
46
+ "InvalidDataError",
47
+ ]