Media set compute usage(媒体集计算用量)¶
Media sets bring a number of advanced, out-of-the-box transformations to the platform. In addition to being triggered via transforms and pipelines, media transformations are also triggered by interacting with media items in the platform, for example, by previewing a media item. Additionally, there is a cost to download or stream the full contents of a media item.
Usage is tracked in units of Foundry compute-seconds. The table below describes each transformation available, with usage rate in terms of compute-seconds per gigabyte processed.
If you have an enterprise contract with Palantir, contact your Palantir representative before proceeding with usage calculations.
Transformations¶
Usage rate is measured in compute-seconds per GB.
All¶
| Transformation | Usage Rate |
|---|---|
| Download / stream | 2 |
Images¶
| Transformation | Usage Rate |
|---|---|
| Generate PDF | 40 |
| Resize | 40 |
| Resize within bounding box | 40 |
| Rotate | 40 |
| Adjust contrast | 75 |
| Annotate | 75 |
| Crop / chip | 75 |
| Encryption / decryption | 75 |
| Geo tile | 75 |
| Grayscale | 75 |
| Render DICOM image layer | 75 |
| Extract text (OCR) | 275 |
| Generate embedding | 275 |
| Extract text v2 (OCR) | 275 |
| Extract layout aware v2 | 275 |
Audio¶
| Transformation | Usage Rate |
|---|---|
| Chunk | 75 |
| Select channel | 75 |
| Stream with HLS | 75 |
| Transcode | 75 |
| Waveform generation | 75 |
| Transcription | 275 |
Video¶
| Transformation | Usage Rate |
|---|---|
| Get timestamps for scene frames | 40 |
| Extract audio | 75 |
| Extract frames at timestamp | 75 |
| Chunk | 275 |
| Extract all scene frames | 275 |
| Stream with HLS | 275 |
| Transcode | 275 |
Documents¶
| Transformation | Usage Rate |
|---|---|
| Get PDF page dimensions | 40 |
| Render page as image | 40 |
| Render page as image within bounding box | 40 |
| Extract all text (raw) | 75 |
| Extract form fields | 75 |
| Extract table of contents | 75 |
| Extract text from pages to array (raw) | 75 |
| Extract text on page (raw) | 75 |
| Slice PDF range | 75 |
| Extract text (OCR) | 275 |
| Extract text from pages to array (OCR) | 275 |
| Extract layout aware text (raw / OCR) | 275 |
| Extract text using VLM * | 275 |
* This usage is accounted for in addition to VLM usage, which is automatically calculated.
Extract text transformation¶
| Format | Raw text mode | OCR mode | Auto* mode |
|---|---|---|---|
| Text | 75 | 275 | 275 |
| Markdown/HTML | 275 | 275 | 275 |
* Auto mode determines, for each page, whether text can be extracted directly or whether OCR is required.
Spreadsheets¶
| Transformation | Usage Rate |
|---|---|
| Convert sheet to JSON | 275 |
Using media at scale¶
Media set limits¶
- There is no limit to how many media items can be uploaded to a media set.
- Transactional media sets have an upload limit of 10,000 items per transaction.
- Transactionless media sets do not have an item upload limit (since there are no transactions).
- Paths of items in media sets cannot exceed 256 characters. Attempting to add an item with a path longer than 256 characters to a media set will result in a
MediaSet:MediaItemPathInvaliderror. - Each media item can have a maximum file size of 50 GB.
- For incremental transforms, limiting the batch size of media set inputs is supported.
Throttling¶
While it is possible to interact with media sets at scale, such as uploading or transforming millions of media items, error handling should be implemented to ensure pipeline stability. When interacting with media sets at scale, the media set service may throttle by responding with Quality of Service (QoS) errors which have status codes of either 429 or 503. This indicates that the media set service cannot handle the storage or compute load at the moment.
Instead of failing on a QoS error when the service throttles, the client should build an adequate retrying mechanism.
For example, if a client is uploading millions of media items by submitting PUT requests at /{mediaSetRid}/items, the client should retry any media item upload requests that receive a QoS error.
When using the transforms-media library in Python transforms, a retrying mechanism is generally already in place. For example, when uploading media files from a catalog dataset to a media set, the library method provided already has retrying logic to handle QoS errors.
from transforms.api import transform, Input, Output
from transforms.mediasets import MediaSetOutput
@transform(
input_files=Input('/examples/image_files'),
output_media_set=MediaSetOutput('/examples/image_media_set'),
uploaded_media_record=Output('/examples/uploaded_media_record'),
)
def compute(input_files, input_files, output_media_set, uploaded_media_record):
uploaded_media_items = output_files.put_dataset_files_and_get_dataframe_of_uploads(
input_files,
ignore_items_not_matching_schema=False,
ignore_items_failing_to_convert=False,
)
uploaded_media_record.write_dataframe(uploaded_media_items)
中文翻译¶
媒体集计算用量¶
媒体集(Media set)为平台提供了多种开箱即用的高级转换功能。除了通过转换(transforms)和流水线(pipelines)触发外,媒体转换也可以通过平台内与媒体项的交互来触发,例如预览媒体项。此外,下载或流式传输媒体项的完整内容也会产生相应费用。
用量以 Foundry 计算秒(compute-seconds)为单位进行追踪。下表描述了每种可用的转换,以及按每处理千兆字节计算的计算秒数用量率。
如果您与 Palantir 签订了企业合同,在进行用量计算之前,请联系您的 Palantir 代表。
转换¶
用量率以每 GB 计算秒数为单位。
全部¶
| 转换 | 用量率 |
|---|---|
| 下载/流式传输 | 2 |
图像¶
| 转换 | 用量率 |
|---|---|
| 生成 PDF | 40 |
| 调整大小 | 40 |
| 在边界框内调整大小 | 40 |
| 旋转 | 40 |
| 调整对比度 | 75 |
| 标注 | 75 |
| 裁剪/切片 | 75 |
| 加密/解密 | 75 |
| 地理瓦片 | 75 |
| 灰度化 | 75 |
| 渲染 DICOM 图像层 | 75 |
| 提取文本(OCR) | 275 |
| 生成嵌入 | 275 |
| 提取文本 v2(OCR) | 275 |
| 提取布局感知 v2 | 275 |
音频¶
| 转换 | 用量率 |
|---|---|
| 分块 | 75 |
| 选择声道 | 75 |
| 使用 HLS 流式传输 | 75 |
| 转码 | 75 |
| 波形生成 | 75 |
| 转录 | 275 |
视频¶
| 转换 | 用量率 |
|---|---|
| 获取场景帧的时间戳 | 40 |
| 提取音频 | 75 |
| 提取指定时间戳的帧 | 75 |
| 分块 | 275 |
| 提取所有场景帧 | 275 |
| 使用 HLS 流式传输 | 275 |
| 转码 | 275 |
文档¶
| 转换 | 用量率 |
|---|---|
| 获取 PDF 页面尺寸 | 40 |
| 将页面渲染为图像 | 40 |
| 在边界框内将页面渲染为图像 | 40 |
| 提取所有文本(原始) | 75 |
| 提取表单字段 | 75 |
| 提取目录 | 75 |
| 提取页面文本到数组(原始) | 75 |
| 提取页面文本(原始) | 75 |
| 切片 PDF 范围 | 75 |
| 提取文本(OCR) | 275 |
| 提取页面文本到数组(OCR) | 275 |
| 提取布局感知文本(原始/OCR) | 275 |
| 使用 VLM 提取文本 * | 275 |
* 此用量是在 VLM 用量之外额外计算的,VLM 用量会自动计算。
提取文本转换¶
| 格式 | 原始文本模式 | OCR 模式 | 自动*模式 |
|---|---|---|---|
| 文本 | 75 | 275 | 275 |
| Markdown/HTML | 275 | 275 | 275 |
* 自动模式会为每个页面判断是直接提取文本还是需要 OCR。
电子表格¶
| 转换 | 用量率 |
|---|---|
| 将工作表转换为 JSON | 275 |
大规模使用媒体¶
媒体集限制¶
- 媒体集中可上传的媒体项数量没有限制。
- 事务性媒体集(Transactional media sets)每笔事务的上传限制为 10,000 项。
- 非事务性媒体集(Transactionless media sets)没有项上传限制(因为没有事务)。
- 媒体集中项的路径不能超过 256 个字符。尝试向媒体集添加路径超过 256 个字符的项将导致
MediaSet:MediaItemPathInvalid错误。 - 每个媒体项的最大文件大小为 50 GB。
- 对于增量转换(incremental transforms),支持限制媒体集输入的批处理大小。
限流¶
虽然可以大规模使用媒体集,例如上传或转换数百万个媒体项,但应实现错误处理以确保流水线稳定性。当大规模使用媒体集时,媒体集服务可能会通过返回服务质量(Quality of Service,QoS)错误来进行限流,这些错误的状态码为 429 或 503。这表明媒体集服务当前无法处理存储或计算负载。
当服务限流时,客户端不应因 QoS 错误而失败,而应构建适当的重试机制。
例如,如果客户端通过向 /{mediaSetRid}/items 提交 PUT 请求来上传数百万个媒体项,则客户端应重试任何收到 QoS 错误的媒体项上传请求。
在 Python 转换中使用 transforms-media 库时,通常已经内置了重试机制。例如,当从目录数据集(catalog dataset)上传媒体文件到媒体集时,提供的库方法已经包含处理 QoS 错误的重试逻辑。
from transforms.api import transform, Input, Output
from transforms.mediasets import MediaSetOutput
@transform(
input_files=Input('/examples/image_files'),
output_media_set=MediaSetOutput('/examples/image_media_set'),
uploaded_media_record=Output('/examples/uploaded_media_record'),
)
def compute(input_files, input_files, output_media_set, uploaded_media_record):
uploaded_media_items = output_files.put_dataset_files_and_get_dataframe_of_uploads(
input_files,
ignore_items_not_matching_schema=False,
ignore_items_failing_to_convert=False,
)
uploaded_media_record.write_dataframe(uploaded_media_items)