跳转至

Palantir models migration FAQ(Palantir 模型迁移常见问题解答)

Why might a dataset-backed model not appear on the campaign page? Which models are considered in use, and which are ignored?

The upgrade page displays all dataset-backed models that:

  • were built on the default branch in the past 90 days, or,
  • were an input to a build on the default branch within the past 90 days (including batch deployment builds governed by a modeling objective), or,
  • are the latest release on a modeling objective with an active live deployment.

As part of this intervention, dataset-backed models that do not meet these criteria are marked as Ignored, and are filtered out by default from the campaign view.

Models for which a replacement model was selected have their status set to Completed, which also filters them out from the campaign view by default.

What happens after the deprecation date?

Models developed with foundry_ml will no longer be supported in modeling objectives, Python transforms, or modeling objective deployments. More concretely:

  • It will no longer be possible to publish new foundry_ml models
  • Code using foundry_ml will no longer be editable and checks will fail for any code importing foundry_ml
  • Any jobs or live deployments using foundry_ml models may break and will no longer be supported by Palantir

Can a model be migrated without re-training?

It is possible to migrate a model without re-training it. To do so, load the model and write it to an output dataset from a Code Repository with foundry_ml installed and using Python 3.9:

from transforms.api import Input, Output, transform
# Pickle may not be the right choice depending on the class of the models.
# Refer to the documentation of the modeling library you are using to select a serialization method.
import pickle
from foundry_ml import Model


@transform(
    output_dataset=Output("<path_to_output_dataset>"),
    source_model=Input("<path_to_foundry_ml_model>"),
)
def compute(output_dataset, source_model):
    MODEL_STAGE_ID = <index_of_stage_to_save>
    model = Model.load(source_model)
    # Select the relevant model stage.
    model_stage = model.stages[MODEL_STAGE_ID].model
    # Write it to the output dataset.
    with output_dataset.filesystem().open("model.pkl", 'wb') as f:
        pickle.dump(model_stage, f)

From this output dataset, you can then publish a model from a separate repository using palantir_models and a more recent Python version. Refer to this tutorial to learn more.

How are AIP-powered code suggestions generated? What is the resource usage of code suggestions?

AIP-powered code suggestions are automatically generated via AIP and powered by GPT-4o, if enabled on your environment.

In order to reduce unnecessary or duplicative calls to the LLM, AIP-powered code suggestions are generated on an as-needed basis and cached for repeat viewing.

In particular:

  • Code suggestion prompts to the LLM are executed the first time a resource is seen in the Upgrade Assistant resource list. The results are then cached and available for anyone who accesses that resource.
  • As users scroll down the Upgrade Assistant resource list, any new resources that come into view will, if no cached results already exist, trigger a call to AIP to generate their associated code suggestions.
  • If desired, users can override existing cached results on a resource and re-prompt AIP for a fresh response by opening the existing AIP code suggestion and selecting Regenerate fixes.

Resource usage from AIP-powered code suggestions is based on the standard AIP compute measurement.

Why is AIP not able to provide suggestions?

AIP may not be able to provide LLM-generated suggestions in the following cases:

  • The code for the model was not found on the default branch (called master on most environments), most likely because this branch is empty. This can be verified by navigating to the model on the default branch: if Foundry cannot find code for the model, there will be no View Code option.
  • The model is a TypeScript Function that was submitted to an objective. These models are identifiable by the Model execution plan on the model page showing foundryFunctionV2 as its type.
  • AIP might have failed to produce a suggestion due to incorrect LLM output. If the problem persists after reloading the page, contact Palantir support.

中文翻译

Palantir 模型迁移常见问题解答

为什么数据集支持的模型可能不会出现在迁移活动页面上?哪些模型被视为"使用中",哪些被忽略?

升级页面会显示所有满足以下条件的数据集支持模型:

  • 在过去90天内基于默认分支构建的模型,或
  • 在过去90天内作为默认分支上某个构建的输入(包括受建模目标管理的批量部署构建),或
  • 是某个具有活跃在线部署的建模目标的最新发布版本。

作为本次干预措施的一部分,不符合这些条件的数据集支持模型会被标记为已忽略(Ignored),并默认从活动视图中过滤掉。

已选择替换模型的模型,其状态会被设置为已完成(Completed),同样默认从活动视图中过滤掉。

弃用日期之后会发生什么?

使用foundry_ml开发的模型将不再受建模目标、Python转换或建模目标部署的支持。具体来说:

  • 将无法再发布新的foundry_ml模型
  • 使用foundry_ml的代码将无法再编辑,任何导入foundry_ml的代码的检查都将失败
  • 任何使用foundry_ml模型的作业或在线部署可能会中断,并且将不再受Palantir支持

能否在不重新训练的情况下迁移模型?

可以在不重新训练的情况下迁移模型。具体做法是:在安装了foundry_ml并使用Python 3.9的代码仓库中加载模型,并将其写入输出数据集:

from transforms.api import Input, Output, transform
# 根据模型类别,pickle可能不是正确的选择。
# 请参考您使用的建模库的文档来选择序列化方法。
import pickle
from foundry_ml import Model


@transform(
    output_dataset=Output("<path_to_output_dataset>"),
    source_model=Input("<path_to_foundry_ml_model>"),
)
def compute(output_dataset, source_model):
    MODEL_STAGE_ID = <index_of_stage_to_save>
    model = Model.load(source_model)
    # 选择相关的模型阶段。
    model_stage = model.stages[MODEL_STAGE_ID].model
    # 将其写入输出数据集。
    with output_dataset.filesystem().open("model.pkl", 'wb') as f:
        pickle.dump(model_stage, f)

从这个输出数据集,您可以使用palantir_models和更新的Python版本,从另一个仓库发布模型。请参考此教程了解更多信息

AIP驱动的代码建议是如何生成的?代码建议的资源使用情况如何?

AIP驱动的代码建议由AIP自动生成,并由GPT-4o提供支持(前提是您的环境已启用此功能)。

为了减少对LLM的不必要或重复调用,AIP驱动的代码建议会按需生成,并缓存以供重复查看。

具体来说:

  • 当资源首次出现在升级助手资源列表中时,会向LLM发送代码建议提示。结果会被缓存,供任何访问该资源的人使用。
  • 当用户向下滚动升级助手资源列表时,任何新进入视野的资源,如果尚未存在缓存结果,都会触发对AIP的调用,以生成相关的代码建议。
  • 如果需要,用户可以覆盖资源上现有的缓存结果,通过打开现有的AIP代码建议并选择重新生成修复(Regenerate fixes),重新向AIP请求新的响应。

AIP驱动的代码建议的资源使用量基于标准AIP计算度量

为什么AIP无法提供建议?

在以下情况下,AIP可能无法提供LLM生成的建议:

  • 模型的代码未在默认分支(在大多数环境中称为master)上找到,很可能是因为该分支为空。可以通过导航到默认分支上的模型来验证:如果Foundry找不到模型的代码,将不会有查看代码(View Code)选项。
  • 模型是提交到目标的TypeScript函数。这些模型可以通过模型页面上的模型执行计划(Model execution plan)来识别,其类型显示为foundryFunctionV2
  • AIP可能因LLM输出不正确而未能生成建议。如果重新加载页面后问题仍然存在,请联系Palantir支持。