layer-workflow-import
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLayer Workflow Import
Layer 工作流导入
Overview
概述
Read what the source does, rebuild it from Layer's node kinds, and hand the whole graph to
. The result is always private; sharing is a separate step in the Layer app. To run
a workflow that already exists, use . The spend gate and polling rules live in the skill.
import_workflowlayer-workflowslayerIf a sibling skill named here is missing from your available skills, ask the user to install it
(); unattended, proceed from tool schemas and flag the
gap.
npx skills add layerai/skills --skill <name>先了解源工作流的功能,再基于Layer的节点类型进行重构,最后将完整的图提交给。导入结果默认是私有的;分享操作需要在Layer应用中单独执行。如果要运行已有的工作流,请使用。消费门槛和轮询规则在技能中定义。
import_workflowlayer-workflowslayer如果此处提到的关联技能不在你的可用技能列表中,请让用户安装();若处于无人值守模式,则基于工具schema继续操作并标记缺失项。
npx skills add layerai/skills --skill <name>Translate intent, not nodes
转换意图,而非节点
Other tools expose the machinery; Layer exposes the task. A low-level text-to-image graph is a model
loader, a text encoder per prompt, an empty latent, a sampler and a decoder. In Layer that is one
generate node. Read what goes in, what each step does, and what comes out, then use the fewest Layer
nodes that do the same job.
How to read an unfamiliar source, and what common node patterns mean, is in
references/sources.md.
其他工具展示底层机制,而Layer聚焦任务本身。一个底层的文生图节点图包含模型加载器、每个提示词对应的文本编码器、空潜变量、采样器和解码器。在Layer中,这仅需一个generate节点即可实现。先理清输入内容、每一步的作用以及输出结果,再用最少的Layer节点实现相同功能。
如何解读不熟悉的源工作流,以及常见节点模式的含义,请参考references/sources.md。
Quick reference
快速参考
| Step | Tool | Notes |
|---|---|---|
| Learn the parts | | Node kinds, their ports and value schemas. Call once, reuse. |
| Pick models | | Discover by use case. Never copy the source's model name. |
| Sample files | | Only for the proof run: a file input's value is a |
| Check the graph | | Creates nothing. Fix every problem it reports. |
| Import | | Publishes privately by default so it can run. |
| Prove it runs | | Run shape as in |
| File it | | Optional: land the workflow in a project for review. |
| 步骤 | 工具 | 说明 |
|---|---|---|
| 了解组件 | | 获取节点类型、其端口及值schema。只需调用一次,可重复使用。 |
| 选择模型 | | 按用例查找模型。切勿直接复制源工作流的模型名称。 |
| 示例文件 | | 仅用于验证运行:文件输入的值为 |
| 检查节点图 | 开启 | 不创建任何内容。修复其报告的所有问题。 |
| 导入 | | 默认以私有状态发布,导入后即可运行。 |
| 验证运行 | | 按照 |
| 归档项目 | 先调用 | 可选:将工作流归档到某个项目以供审核。 |
The graph
图结构
graphinputsnodesoutputsget_blueprint_system_configvalidate_onlyThere is no edge list. Whatever is fed names its source in , , holding
for a node output or for a
workflow input.
refs{"_default": [...]}nodes::<node id>[<kind key>]::<port key>blueprint::<input key>An output of type A may feed an input of type B only when A equals B or (A, B) is a casting rule. A
rule carrying a is blocked, not allowed: insert the named transformer node kind between
the two and wire through it.
transformerStatic values must conform to their type's JSON schema in the system config. Where a port selects a
model, discover it with filtered by the use case that node serves.
list_base_modelsgraphinputsnodesoutputsget_blueprint_system_configvalidate_only没有单独的边列表。所有输入的源都通过中的指定,节点输出的格式为,工作流输入的格式为。
refs{"_default": [...]}nodes::<node id>[<kind key>]::<port key>blueprint::<input key>类型为A的输出只能连接到类型为B的输入,当且仅当A等于B,或(A, B)符合类型转换规则。如果某条规则带有属性,则表示该转换被禁止,不允许直接连接:需要在两者之间插入指定的transformer节点类型,通过该节点完成连接。
transformer静态值必须符合系统配置中对应类型的JSON schema规范。如果某个端口用于选择模型,需通过按该节点的用例过滤来查找合适的模型。
list_base_modelsThe loop
操作流程
- for the workspace.
get_blueprint_system_config - Read the source and write down inputs, steps and outputs in plain words.
- Map each step to a node kind. When nothing fits, stop and tell the user which step has no Layer equivalent, rather than approximating it with an unrelated node.
- Build the graph, then with
import_workflow. The result groups problems by node, input and output. Fix and repeat untilvalidate_only: trueis true.is_valid - for real, with a clear
import_workflowand anamethat says where it came from. Passdescriptionwhen the user wants it filed in a project.project_id - Prove it: upload a sample for each file input, , confirm above 20 CUs, then
estimate_workflow_pricewith aexecute_workflowand poll. A graph that validates can still produce the wrong thing; look at the output.session_name - Report: the workflow id, what was mapped to what, and anything dropped or approximated.
publish: false- 调用获取工作区配置。
get_blueprint_system_config - 解读源工作流,用简明的语言记录输入、步骤和输出。
- 将每个步骤映射到对应的节点类型。如果没有匹配的节点类型,请停止并告知用户哪个步骤没有对应的Layer等效节点,切勿用不相关的节点勉强近似。
- 构建节点图,然后调用并开启
import_workflow参数。返回结果会按节点、输入、输出对问题进行分组。修复问题后重复此步骤,直到validate_only: true为true。is_valid - 正式调用,设置清晰的
import_workflow和说明来源的name。如果用户希望将工作流归档到项目中,需传入description。project_id - 验证运行:为每个文件输入上传示例文件,调用预估费用,确认超过20 CUs后,调用带有
estimate_workflow_price参数的session_name并轮询状态。通过验证的节点图仍可能产出错误结果,因此必须检查输出内容。execute_workflow - 报告内容需包含:工作流ID、各步骤的映射关系,以及所有被舍弃或近似处理的内容。
publish: falseWorked example
实操示例
"Import this workflow." The user attaches a node-graph JSON: a top-level list and a
list of .
nodeslinks[link, from node, from slot, to node, to slot]- Reading it: a checkpoint loader, a pixel-art style adapter, positive and negative text encoders, an empty 1024x1024 latent, a sampler, a decoder, a 2x upscale and a save node.
- Intent: text in, pixel-art image out, upscaled 2x. Inputs: the prompt. Fixed: size, the style.
- , then pick generate-image and upscale node kinds whose ports fit. If the generate kind has a style port, check
get_blueprint_system_configfor a pixel-art set; otherwise fold the style into the prompt.list_reference_sets - with the text-to-image use case; take the first result for the generate node.
list_base_models - Graph: input ; the generate node's prompt port refs
prompt; the upscale node's image port refsblueprint::prompt; an output refs the upscale node's output.nodes::<generate id>[<generate kind>]::<image port> - reports the upscale node's image port as the wrong type. The casting rule for that pair carries a
validate_only, so it is blocked: insert that transformer node kind and wire through it.transformer - Import, estimate (6 CUs), execute with a and a sample prompt, poll, and check the image is upscaled and pixel-styled.
session_name - Report: "Imported as a private workflow. The sampler, latent and decoder plumbing became one generate node. The style adapter became a reference set. The negative prompt was dropped: the chosen model has no negative prompt port."
"导入这个工作流。" 用户附上了一个node-graph JSON:顶层包含列表和列表,的元素格式为。
nodeslinkslinks[link, 源节点, 源插槽, 目标节点, 目标插槽]- 解读源文件:包含检查点加载器、像素风格适配器、正向与负向文本编码器、空的1024x1024潜变量、采样器、解码器、2倍超分节点和保存节点。
- 工作流意图:输入文本,输出像素风格图像,并完成2倍超分。输入:提示词。固定参数:尺寸、风格。
- 调用,然后选择端口匹配的generate-image和upscale节点类型。如果generate节点类型有风格端口,调用
get_blueprint_system_config查找像素风格参考集;否则将风格融入提示词中。list_reference_sets - 按文生图用例调用;将第一个返回结果用于generate节点。
list_base_models - 节点图结构:输入;generate节点的prompt端口引用
prompt;upscale节点的图像端口引用blueprint::prompt;输出引用upscale节点的输出。nodes::<generate id>[<generate kind>]::<image port> - 报告upscale节点的图像端口类型错误。该端口对的类型转换规则带有
validate_only属性,因此被禁止直接连接:需要插入对应的transformer节点类型并通过其连接。transformer - 执行导入、预估费用(6 CUs)、使用和示例提示词运行、轮询状态,并检查图像是否完成超分且具备像素风格。
session_name - 报告内容:"已作为私有工作流导入。采样器、潜变量和解码器的底层逻辑合并为一个generate节点。风格适配器转换为参考集。负向提示词被舍弃:所选模型没有负向提示词端口。"
Common mistakes
常见错误
- Copying a checkpoint or weights file name into a model port instead of discovering a .
base_model_id - Inventing field names inside instead of taking them from the system config and validation.
graph - Wiring a pair whose casting rule carries a instead of routing through that node kind.
transformer - Silently approximating a step Layer has no node for. Say which step and why.
- Promising the workflow is shared. It is private; sharing happens in the Layer app.
- Skipping the test run. Validation checks wiring, not whether the output is right.
- 将检查点或权重文件名直接填入模型端口,而不是通过查找获取。
base_model_id - 自行臆造内部的字段名,而不是从系统配置和验证结果中获取。
graph - 直接连接类型转换规则带有的端口对,而不是通过对应节点类型路由。
transformer - 对于Layer没有对应节点的步骤,默默进行近似处理。应当明确告知用户具体步骤及原因。
- 承诺工作流已共享。导入的工作流默认是私有的;共享操作需在Layer应用中完成。
- 跳过测试运行。验证仅检查连接是否正确,无法保证输出结果正确。