Node resource consumption amount calculation method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202611053360.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-15
- Publication Date
- 2026-10-09
AI Technical Summary
[0004]本申请提供了一种节点资源消耗量计算方法、装置、电子设备及存储介质,以解决现有计算方式计算出的资源消耗量与节点实际算力消耗不匹配的技术问题
[0009]基于此,本申请实施例提供的一个技术方案的有益效果:通过确定目标节点的配置信息中的节点类型、模型等级、执行子类型和参数信息,使跨节点类型的算力差异、同类型不同模型版本的算力差异、同类型不同执行子类型的算力差异以及同节点不同运行参数的算力差异均被纳入计算体系;进而根据上述信息确定单位资源消耗量,使单位资源消耗量同时反映了节点类型差异、模型等级差异、执行子类型差异和参数差异的综合影响,任一差异因子的变化均会驱动单位资源消耗量产生相应的数值变化;再通过将单位资源消耗量与批量数量相乘得到基准资源消耗量,使基准资源消耗量进一步承载了批量规模因子的影响;再通过获取资源调整系数并将基准资源消耗量与资源调整系数相乘得到目标资源消耗量,使资源调整系数作为独立的乘数因子参与最终计算且每一次取值变化均直接作用于目标资源消耗量。由此,目标资源消耗量随节点类型、模型等级、执行子类型、参数信息、批量数量和资源调整系数的变化而相应变化,解决了现有计算方式计算出的资源消耗量与节点实际算力消耗不匹配的技术问题,使得计算得到的资源消耗量与节点实际算力消耗精准匹配。
Smart Images

Figure CN122884677A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus, electronic device and storage medium for calculating node resource consumption. Background Technology
[0002] Canvas-based workflow products encapsulate algorithmic capabilities into standardized functional nodes, allowing users to build automated processing flows through drag-and-drop connections. They are widely used in tasks such as AI content generation and audio / video processing. In these products, the workflow consists of multiple functional nodes linked together according to preset upstream and downstream dependencies. The system executes each node sequentially based on these dependencies until the entire process is complete. Existing workflow products measure resource consumption by multiplying the number of artifacts generated by each node by a fixed single-use measurement value, and then deducting the consumption from the user's account.
[0003] However, the existing calculation method has the following problems: there are fundamental differences in computing power consumption between different node types, and the computing power of the same type of node also varies exponentially under different model levels and different operating parameters. However, the existing calculation method uses the product quantity as the only calculation variable, which makes the calculated resource consumption unable to truly reflect the actual computing power consumption of the node. That is, the resource consumption calculated by the existing calculation method does not match the actual computing power consumption of the node. Summary of the Invention
[0004] This application provides a method, apparatus, electronic device, and storage medium for calculating node resource consumption, in order to solve the technical problem that the resource consumption calculated by existing calculation methods does not match the actual computing power consumption of the node.
[0005] In a first aspect, embodiments of this application provide a method for calculating node resource consumption, including: Determine the configuration information and batch quantity of the target node, wherein the configuration information includes the node type, model level, execution subtype, and parameter information of the target node; The unit resource consumption of the target node is determined based on the node type, the model level, the execution subtype, and the parameter information. Calculate the baseline resource consumption of the target node based on the unit resource consumption and the batch quantity; Obtain the resource adjustment coefficient corresponding to the target node; The target resource consumption of the target node is calculated based on the baseline resource consumption and the resource adjustment coefficient.
[0006] Secondly, embodiments of this application provide a node resource consumption calculation device, comprising: The first determining module is used to determine the configuration information and batch quantity of the target node. The configuration information includes the node type, model level, execution subtype, and parameter information of the target node. The second determining module is used to determine the unit resource consumption of the target node based on the node type, the model level, the execution subtype, and the parameter information. The first calculation module is used to calculate the baseline resource consumption of the target node based on the unit resource consumption and the batch quantity. The acquisition module is used to acquire the resource adjustment coefficient corresponding to the target node; The second calculation module is used to calculate the target resource consumption of the target node based on the baseline resource consumption and the resource adjustment coefficient.
[0007] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the above-described node resource consumption calculation method.
[0008] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method for calculating node resource consumption.
[0009] Based on this, the beneficial effects of a technical solution provided in this application embodiment are as follows: By determining the node type, model level, execution subtype, and parameter information in the configuration information of the target node, the computing power differences across node types, the computing power differences between different model versions of the same type, the computing power differences between different execution subtypes of the same type, and the computing power differences between different operating parameters of the same node are all included in the calculation system; then, the unit resource consumption is determined based on the above information, so that the unit resource consumption simultaneously reflects the comprehensive impact of node type differences, model level differences, execution subtype differences, and parameter differences, and any change in any difference factor will drive the unit resource consumption to produce a corresponding numerical change; then, by multiplying the unit resource consumption by the batch quantity to obtain the baseline resource consumption, the baseline resource consumption further carries the influence of the batch size factor; then, by obtaining the resource adjustment coefficient and multiplying the baseline resource consumption by the resource adjustment coefficient to obtain the target resource consumption, the resource adjustment coefficient participates in the final calculation as an independent multiplier factor, and every change in its value directly affects the target resource consumption. Therefore, the target resource consumption changes accordingly with the node type, model level, execution subtype, parameter information, batch quantity, and resource adjustment coefficient. This solves the technical problem that the resource consumption calculated by the existing calculation method does not match the actual computing power consumption of the node, and makes the calculated resource consumption accurately match the actual computing power consumption of the node. Attached Figure Description
[0010] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is a schematic diagram of an application environment for a node resource consumption calculation method in one embodiment of this application; Figure 2 This is a flowchart illustrating a method for calculating node resource consumption in one embodiment of this application; Figure 3 This is a schematic diagram of a node resource consumption calculation device in one embodiment of this application; Figure 4 This is a schematic diagram of an electronic device according to an embodiment of this application. Detailed Implementation
[0012] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0013] The node resource consumption calculation method provided in this application embodiment can be applied to, for example, Figure 1 The application environment is shown. Specifically, this node resource consumption calculation method is applied in a node resource consumption calculation system, which includes, as shown in the example... Figure 1 The diagram illustrates a client and server that communicate over a network to implement the steps of a method for calculating node resource consumption. The client, also known as the user terminal, refers to the program that provides local services to the client, corresponding to the server. Clients can include, but are not limited to, various personal computers, laptops, smartphones, and tablets. The server can be a standalone server or a server cluster consisting of multiple servers.
[0014] Firstly, such as Figure 2 As shown in the embodiments of this application, a method for calculating node resource consumption is provided, which is then applied to... Figure 1 Taking the server in the example, the following steps are included: S101: Determine the configuration information and batch quantity of the target node. The configuration information includes the node type, model level, execution subtype, and parameter information of the target node.
[0015] As an example, a target node refers to the node that currently requires calculation of resource consumption; it can be any functional node in the canvas workflow. Configuration information refers to the basic attribute configuration of the target node, including its node type, model level, execution subtype, and parameter information. The node type indicates the functional category to which the target node belongs, such as text creation, image generation, video generation, audio generation, or manual proofreading. The model level indicates the capability level of the model called by the target node, such as basic model level and advanced model level. The execution subtype indicates the specific execution method of the target node under its type, such as text-to-image, image-to-image, or image editing subtypes under the image generation type. Parameter information refers to the runtime parameters configured by the user in the target node that are strongly related to the generation effect and computational resource consumption, such as the maximum number of characters generated for a text creation node, the resolution parameter for an image node, the generation duration parameter for a video node, and the audio quality level parameter for an audio node. The batch quantity refers to the total number of products generated in a single execution configured by the user in the target node.
[0016] In a specific example, the server retrieves the configuration information and batch size of an image node in the workflow. This image node is classified as an image generation type, its model level as a basic model level, its execution subtype as a text-to-image subtype, and its parameter information includes a resolution parameter of 2K resolution and a batch size of 100 images.
[0017] As can be seen, this step provides a complete data foundation for subsequent calculation of resource consumption based on multi-dimensional factors by obtaining the node type, model level, execution subtype, parameter information and batch quantity of the target node.
[0018] S102: Determine the unit resource consumption of the target node based on the node type, model level, execution subtype, and parameter information.
[0019] As an example, unit resource consumption refers to the amount of resources consumed by a target node to generate a single artifact. The server determines the unit resource consumption of a target node based on its node type, model level, execution subtype, and parameter information. For different types of nodes, the specific dimensions of the parameter information differ, therefore the calculation method for unit resource consumption also varies.
[0020] In a specific example, for a node of the image generation type, the server determines the unit resource consumption of the node to be 4 consumption values per image based on the node's image generation type, base model level, text-based image subtype, and 2K resolution parameters.
[0021] As can be seen, in this step, by incorporating node type, model level, execution subtype, and parameter information into the calculation of unit resource consumption, the unit resource consumption can simultaneously reflect the combined impact of differences in node type, model level, execution subtype, and parameters. Changes in any one factor will drive corresponding changes in unit resource consumption.
[0022] S103: Calculate the baseline resource consumption of the target node based on the unit resource consumption and batch quantity.
[0023] As an example, the baseline resource consumption refers to the original total resource consumption of the target node without applying any resource adjustment factors. The server multiplies the unit resource consumption by the batch size to obtain the baseline resource consumption of the target node.
[0024] In a specific example, the resource consumption per image node is 4 consumption values per image, and the batch size is 100 images, so the base resource consumption is 400 consumption values.
[0025] As can be seen, in this step, the baseline resource consumption is obtained by multiplying the unit resource consumption by the batch quantity, which further incorporates the influence of the batch size factor into the baseline resource consumption.
[0026] S104: Obtain the resource adjustment coefficient corresponding to the target node; S105: Calculate the target resource consumption of the target node based on the baseline resource consumption and the resource adjustment coefficient.
[0027] As an example, the resource adjustment factor refers to a multiplier factor used to adjust the baseline resource consumption, which includes at least one of the following: batch size factor, tenant level factor, and membership level factor. The server determines the corresponding batch size factor based on the batch quantity of the target node, the corresponding tenant level factor based on the current user's tenant level, and the corresponding membership level factor based on the current user's membership level. The target resource consumption refers to the total resource consumption that the target node ultimately needs to deduct from the user's account. The server multiplies the baseline resource consumption by the resource adjustment factor to obtain the target resource consumption for the target node.
[0028] In a specific example, the user is a Platinum tenant (tenant level coefficient of 0.9) and an annual member (member level coefficient of 0.85), and the batch size coefficient corresponding to 100 images is 0.9. The baseline resource consumption of the image node is 400, then the target resource consumption is 400 × 0.9 × 0.9 × 0.85 = 275.4.
[0029] As can be seen, in this step, by obtaining multiple types of resource adjustment coefficients, subsequent calculations can accommodate differentiated adjustments across multiple dimensions such as tenant level, membership level, and batch size. By multiplying the baseline resource consumption by the resource adjustment coefficient to obtain the target resource consumption, the resource adjustment coefficient is used as an independent multiplier factor in the final calculation. Every change in its value directly affects the target resource consumption, thus achieving a seamless connection between the resource adjustment rules and the resource consumption calculation process.
[0030] In summary, through the above steps S101 to S105, the target resource consumption changes accordingly with the node type, model level, execution subtype, parameter information, batch quantity, and resource adjustment coefficient. This solves the technical problem of the mismatch between the resource consumption calculated by the existing calculation method and the actual computing power consumption of the node, and makes the calculated resource consumption accurately match the actual computing power consumption of the node.
[0031] In one embodiment, when the node type is a text creation type, the parameter information includes a character limit parameter, and the execution subtype is a first type of subtype; wherein, the first type of subtype includes a translation subtype, a professional domain copywriting generation subtype, and a multi-turn dialogue creation subtype; Determining the unit resource consumption of the target node based on node type, model level, execution subtype, and parameter information includes the following steps: S121A: Determine the baseline value of the unit character resource corresponding to the target node based on the text creation type and model level; S122A: Determine the text type correction coefficient corresponding to the target node based on the first subtype; S123A: Determine the number of character calculation units based on the upper limit parameter for the number of characters and the preset character unit length; S124A: The initial text consumption is obtained based on the unit character resource baseline value and the number of character calculation units; S125A: The unit resource consumption is obtained based on the initial text consumption and the text type correction coefficient.
[0032] As an example, the first subtype refers to the specific execution subtype under the text creation node, including translation subtype, professional domain copywriting generation subtype, and multi-turn dialogue creation subtype. The unit character resource baseline value refers to the basic resource consumption corresponding to each unit of characters, such as the consumption value corresponding to 1000 characters. The preset character unit length refers to the pre-set length of the character billing unit, such as 1000 characters. The number of character calculation units refers to the ratio of the upper limit parameter for the number of characters to the preset character unit length. The text type correction coefficient refers to the differentiated adjustment coefficient set for different text creation subtypes. The initial text consumption refers to the initial resource consumption calculated based on the unit character resource baseline value and the number of character calculation units.
[0033] In a specific example, the text creation node's model level is Advanced Model Level, the execution subtype is Marketing Copywriting Generation, and the maximum character count parameter is 5000 characters. The baseline resource value per character for Advanced Model Level is 5 consumption values per 1000 characters. With a preset character unit length of 1000 characters, the number of character calculation units is 5000 ÷ 1000 = 5. The initial text consumption is 5 × 5 = 25 consumption values per piece. The text type correction coefficient for the Marketing Copywriting Generation subtype is 1.0, so the unit resource consumption is 25 consumption values per piece. If the execution subtype is Translation, the corresponding text type correction coefficient is 1.2, so the unit resource consumption is 25 × 1.2 = 30 consumption values per piece.
[0034] As can be seen, in this embodiment, by introducing a character count limit parameter and a text type correction coefficient into the resource consumption calculation of the text creation node, the calculation results can reflect the differences in character size and the differences in computing power consumption between different subtypes, thereby further improving the precision of resource consumption calculation.
[0035] In one embodiment, when the node type is an image generation type, the parameter information includes at least one of the following: image resolution parameter, number of reference images parameter, and modification range parameter, and the execution subtype is a second type; wherein, the second type includes text-to-image subtype, image-to-image subtype, and image editing subtype; Determining the unit resource consumption of the target node based on node type, model level, execution subtype, and parameter information includes the following steps: S121B: Determine the baseline value of the unit image resource corresponding to the target node based on the image generation type, model level, and the first resolution level corresponding to the image resolution parameters; S122B: When the execution subtype is text-based image subtype, the unit image resource baseline value is used as the unit resource consumption; S123B: When the execution subtype is graph-generated graph subtype, determine the reference graph processing resource consumption based on the reference graph quantity parameter; add the unit image resource baseline value to the reference graph processing resource consumption to obtain the unit resource consumption; S124B: When the execution subtype is image editing, match the corresponding editing adjustment coefficient according to the modification range parameter; multiply the unit image resource baseline value by the editing adjustment coefficient to obtain the unit resource consumption.
[0036] As an example, the second subtype refers to the specific execution subtype under the image node, including text-to-image, image-to-image, and image editing subtypes. The first resolution level refers to the resolution level determined based on the image resolution parameters, such as 1K, 2K, or 4K resolution. The unit image resource baseline value refers to the basic resource consumption of a single image at a specific resolution level. The text-to-image subtype refers to the execution method that generates an image based on a text description. The image-to-image subtype refers to the execution method that generates a new image based on an input reference image, which consumes additional reference image processing power on top of the text-to-image subtype. Reference image processing resource consumption refers to the amount of resources consumed in processing each reference image. The image editing subtype refers to the execution method that modifies and edits existing images. The editing adjustment coefficient refers to the adjustment coefficient determined based on the magnitude of the modification.
[0037] In a specific example, the image generation node's model level is the basic model level, the execution subtype is the text-to-image subtype, and the resolution parameter is 2K resolution. The baseline resource consumption per image for the basic model level and 2K resolution is 4 consumption values, so the unit resource consumption is 4 consumption values / image. If the execution subtype is the image-to-image subtype, the reference image quantity parameter is 1 reference image, and the reference image processing resource consumption is 0.5 consumption values per image, then the unit resource consumption is 4 + 0.5 = 4.5 consumption values / image. If the execution subtype is the image editing subtype, the modification magnitude parameter corresponds to an editing adjustment coefficient of 0.8, then the unit resource consumption is 4 × 0.8 = 3.2 consumption values / image.
[0038] As can be seen, in this embodiment, by distinguishing three execution subtypes—text-generated image, image-generated image, and image editing—in the calculation of resource consumption of image nodes, and by superimposing reference image processing resource consumption on the image-generated image subtype and setting a modification range adjustment coefficient for the image editing subtype, the calculation results can reflect the differences in computing power consumption between different execution methods, further improving the fairness and precision of resource consumption calculation.
[0039] In one embodiment, when the node type is a video generation type, the parameter information includes generation duration parameters and video resolution parameters, and the execution subtype is a third type; wherein, the third type includes text-based video subtype and image-based video subtype; Determining the unit resource consumption of the target node based on node type, model level, execution subtype, and parameter information includes the following steps: S121C: Determine the unit duration resource baseline value corresponding to the target node based on the video generation type, model level, and the second resolution level corresponding to the video resolution parameters; S121C: Determine the number of duration calculation units based on the generated duration parameters and the preset duration unit; S122C: The initial video consumption is obtained based on the resource baseline value per unit duration and the number of duration calculation units; S123C: When the execution subtype is text-based video subtype, the initial video consumption is used as the unit resource consumption. S124C: When the execution subtype is the image-generated video subtype, determine the reference image processing resource consumption based on the reference image quantity parameter corresponding to the image-generated video subtype; obtain the unit resource consumption based on the initial video consumption and the reference image processing resource consumption.
[0040] As an example, the third subtype refers to the specific execution subtype under the video node, including text-based video subtypes and image-based video subtypes. The second resolution level refers to the resolution level determined based on the video resolution parameters, such as 1K, 2K, or 4K resolution. The resource baseline value per unit duration refers to the basic resource consumption per unit duration (e.g., 5 seconds) at a specific resolution level. The preset duration unit is a pre-set duration billing unit, such as 5 seconds. The number of duration calculation units refers to the ratio of the generated duration parameter to the preset duration unit.
[0041] In a specific example, the video generation node's model level is the basic model level, the execution subtype is the text-based video subtype, the video resolution parameter is 1K resolution, and the generation duration parameter is 10 seconds. The baseline resource consumption per unit duration corresponding to the basic model level and 1K resolution is 20 consumption values per 5 seconds. The preset duration unit is 5 seconds, and the number of duration calculation units is 10 ÷ 5 = 2. The initial video consumption is 20 × 2 = 40 consumption values / video, so the unit resource consumption is 40 consumption values / video. If the execution subtype is the image-based video subtype, and the number of reference images is 3, then the reference image processing resource consumption is determined based on the number of reference images, and the sum of the initial video consumption and the reference image processing resource consumption is used as the unit resource consumption.
[0042] As can be seen, in this embodiment, by introducing generation duration and resolution parameters into the calculation of resource consumption of video nodes, the calculation results can reflect the impact of changes in the two core dimensions of duration and resolution on computing power consumption. The longer the duration and the higher the resolution, the higher the resource consumption value, which further improves the fairness and precision of resource consumption calculation.
[0043] In one embodiment, when the node type is an audio generation type, the parameter information includes character count parameters, sound quality level parameters, and language type parameters, and the execution subtype is the fourth type; wherein, the fourth type includes speech synthesis subtype, emotional speech synthesis subtype, and real-person replica speech synthesis subtype; Determining the unit resource consumption of the target node based on node type, model level, execution subtype, and parameter information includes the following steps: S121D: Determine the baseline value of the unit character resource corresponding to the target node based on the audio generation type and model level; S122D: Determine the number of character calculation units based on the character count parameter and the preset character unit length; S123D: Determine the sound quality adjustment coefficient based on the sound quality level parameters; S124D: Determine the language adjustment coefficient based on the language type parameter; S125D: The initial audio consumption is obtained based on the unit character resource baseline value, the number of character calculation units, the sound quality adjustment coefficient, and the language adjustment coefficient; S126D: When the execution subtype is speech synthesis subtype, the initial audio consumption is used as the unit resource consumption. S127D: When the execution subtype is the emotional version of speech synthesis or the real person replica version of speech synthesis, determine the corresponding audio type correction coefficient according to the emotional version of speech synthesis or the real person replica version of speech synthesis, and obtain the unit resource consumption based on the initial audio consumption and the audio type correction coefficient.
[0044] As an example, the fourth subtype refers to the specific execution subtype under the audio node, including speech synthesis subtype, emotion-based speech synthesis subtype, and human-like speech synthesis subtype. The audio quality level parameter indicates the audio output quality level, such as standard quality, high-definition quality, or lossless quality. The language type parameter indicates the language of the audio output, such as Chinese, English, or a less commonly spoken language. The audio quality adjustment factor refers to the adjustment factor corresponding to different audio quality levels; for example, standard quality is 1.0x, high-definition quality is 1.5x, and lossless quality is 2.0x. The language adjustment factor refers to the adjustment factor corresponding to different language types; for example, Chinese is 1.0x, and less commonly spoken languages are 3.0x. The audio type correction factor refers to the adjustment factor corresponding to different audio subtypes.
[0045] In a specific example, the audio generation node's model level is advanced, the execution subtype is speech synthesis, the character count parameter is 2000 characters, the sound quality level parameter is high-definition, and the language type parameter is Chinese. The baseline resource consumption per unit character for the advanced model level is 2 consumption values per 1000 characters. The preset character unit length is 1000 characters, and the number of character calculation units is 2000 ÷ 1000 = 2. The sound quality adjustment factor is 1.5 times, and the language adjustment factor is 1.0 times. The initial audio consumption is 2 × 2 × 1.5 × 1.0 = 6 consumption values / unit. If the execution subtype is speech synthesis, the unit resource consumption is 6 consumption values / unit. If the execution subtype is emotional speech synthesis, the corresponding audio type correction factor is 1.5 times, and the unit resource consumption is 6 × 1.5 = 9 consumption values / unit.
[0046] As can be seen, in this embodiment, by introducing parameters of three dimensions—character count, sound quality level, and language type—into the calculation of resource consumption of audio nodes, and setting corresponding adjustment coefficients for different sound qualities, languages, and subtypes, the calculation results can simultaneously reflect the comprehensive impact of character size, sound quality level, language differences, and subtype differences, further improving the precision of resource consumption calculation.
[0047] In one embodiment, the resource adjustment coefficient includes a first type of correction coefficient and a second type of correction coefficient. The first type of correction coefficient is determined according to a preset quantity range in which the batch quantity is located, and the second type of correction coefficient includes a tenant level correction value and a member level correction value. The calculation of the target resource consumption of the target node, based on the baseline resource consumption and the resource adjustment coefficient, includes the following steps: S131: The target resource consumption is obtained based on the baseline resource consumption, the first type of correction coefficient, the tenant level correction value, and the member level correction value.
[0048] As an example, the first type of correction factor refers to the batch size factor determined based on the batch quantity. The preset quantity range refers to a pre-defined batch quantity tier, such as the first range for batches less than 50, the second range for batches between 50 and 100, and the third range for batches greater than or equal to 100. The tenant level correction value refers to a correction factor determined based on the user's tenant level, such as 0.9x for Platinum tenants, 0.95x for Gold tenants, and 1.0x for Regular tenants. The membership level correction value refers to a correction factor determined based on the user's membership level, such as 0.85x for Annual Members, 0.9x for Monthly Members, and 1.0x for Non-Members.
[0049] In a specific example, the batch size is 100 images, with a first-order correction factor of 0.9. The user is a Platinum tenant, with a tenant level correction factor of 0.9. The user is an Annual Member, with a Membership level correction factor of 0.85. The server multiplies the baseline resource consumption by the first-order correction factor, the tenant level correction value, and the membership level correction value to obtain the target resource consumption.
[0050] As can be seen, in this embodiment, by using the first type of correction coefficient, the tenant level correction value, and the member level correction value together as resource adjustment coefficients, the resource consumption calculation result can simultaneously carry the differentiated adjustments of the three dimensions of batch size, tenant level, and member level, thus realizing the superposition calculation of multi-dimensional resource adjustment coefficients.
[0051] In one embodiment, where the first type of correction coefficient is determined based on a preset quantity range in which the batch size falls, the following steps are included: S103A: When the batch size is less than the first threshold, the first type of correction coefficient is 1.0; S103B: When the batch size is greater than or equal to the first threshold and less than the second threshold, the first type of correction coefficient is the first coefficient, and the first coefficient is less than 1.0; S103C: When the batch size is greater than or equal to the second threshold, the first type of correction coefficient is the second coefficient, and the second coefficient is less than the first coefficient.
[0052] As an example, the first threshold refers to the first critical value for batch size classification, such as 50 items. The second threshold refers to the second critical value for batch size classification, such as 100 items. The first coefficient refers to the correction factor corresponding to the batch size being between the first and second thresholds, such as 0.95 times. The second coefficient refers to the correction factor corresponding to the batch size being greater than or equal to the second threshold, such as 0.9 times. The larger the batch size, the smaller the corresponding correction factor.
[0053] In a specific example, the first threshold is 50 records, and the second threshold is 100 records. When the batch size is 20 records, which is less than the first threshold, the first type of correction coefficient is 1.0. When the batch size is 80 records, which is greater than or equal to the first threshold and less than the second threshold, the first type of correction coefficient is 0.95. When the batch size is 100 records, which is greater than or equal to the second threshold, the first type of correction coefficient is 0.9.
[0054] As can be seen, in this embodiment, by setting a tiered threshold for the batch quantity and corresponding to different correction coefficients, the resource consumption of a single product is lower as the batch quantity increases, thus realizing the differentiated resource consumption calculation based on the batch scale effect.
[0055] In one embodiment, the following steps are also included: S201: In response to a pre-computed trigger event, traverse the node sequence of the workflow and obtain the node type of each node; S202: Filter out zero-consumption nodes according to node type to form a valid node sequence; where zero-consumption nodes are nodes of the collation type. S203: For each node in the valid node sequence, execute the above node resource consumption calculation method to obtain the target resource consumption for each node; S204: Accumulate the resource consumption of each target to obtain the total pre-calculated resource consumption of the workflow; S205: After obtaining the total pre-calculated resource consumption, obtain the available resource balance of the current account; S206: Refuse to execute the workflow when the available resource balance is less than the total pre-calculated resource consumption; S207: Workflow execution is permitted when the available resource balance is greater than or equal to the total pre-calculated resource consumption.
[0056] As an example, a pre-computation trigger event refers to a resource pre-computation event triggered by a user after completing workflow orchestration, such as when the user clicks the "Pre-computation" button or triggers an automatic calculation process before workflow execution. A valid node sequence refers to a list of nodes to be billed after filtering out zero-consumption nodes. Zero-consumption nodes refer to manually checked nodes of the check type; they do not consume computing power and are not included in resource consumption calculations.
[0057] In a specific example, the workflow contains five nodes: text creation, image generation, manual proofreading, video generation, and audio generation. The server traverses the workflow node sequence, obtains the node type of each node, filters out manual proofreading nodes (of type proofreading), forming a valid node sequence containing text creation, image generation, video generation, and audio generation nodes. For each node in the valid node sequence, the server calculates its resource consumption, resulting in target resource consumption values of 573.75, 275.4, 1453.5, and 172.125 respectively. These are summed to obtain a total pre-calculated resource consumption of 2474.775. The server checks the current account's available resource balance, which is 5000. If the available resource balance is greater than the total pre-calculated resource consumption, the workflow is allowed to execute. If the available resource balance is 2000, which is less than the total pre-calculated resource consumption, the workflow is rejected and an insufficient resource balance is displayed.
[0058] As can be seen, in this embodiment, by performing resource pre-calculation before triggering workflow execution, users can be informed of the resource consumption of the entire process in advance. At the same time, by performing pre-checking of resource sufficiency, the process can be prevented from being interrupted due to insufficient resources in the middle.
[0059] In one embodiment, the following steps are also included: S301: In response to the workflow execution trigger event, based on the total pre-calculated resource consumption, transfer resources equal to the total pre-calculated resource consumption from the current account's available resource balance to the frozen account, forming a frozen resource quota; S302: Determine the topology execution order of each node in the valid node sequence, and execute each node in turn according to the topology execution order until all nodes in the valid node sequence have been executed; Specifically, for the current node, after the current node is executed and the product is successfully generated, the corresponding target resource consumption is read from the preset mapping relationship according to the node identifier of the current node as the current target resource consumption, the current target resource consumption is deducted from the frozen resource quota, and the deducted current target resource consumption is transferred to the settlement account. The preset mapping relationship is the mapping relationship between the node identifier of each node and the corresponding target resource consumption.
[0060] As an example, an execution trigger event refers to an instruction that a user initiates to execute a workflow, such as clicking the "Execute" button. A frozen account is an account used to temporarily store resources that have been frozen but not yet consumed. Frozen resource quota refers to the total amount of resources transferred from the current account's available resource balance to the frozen account. Topology execution order refers to the execution order determined according to the upstream and downstream dependencies between nodes. A settlement account is an account used to store resources that have actually been consumed.
[0061] In a specific example, a user triggers workflow execution. Based on the total pre-calculated resource consumption of 2474.775, the server transfers 2474.775 from the available resource balance to the frozen account, forming a frozen resource quota. The server determines the topology execution order of the effective node sequence as: text creation node → image generation node → video generation node → audio generation node. The server executes each node sequentially in this order. For the text creation node, after its execution is complete and 50 text entries are successfully generated, the server reads the corresponding target resource consumption of 573.75 from the preset mapping relationship based on its node identifier, deducts 573.75 from the frozen resource quota, and transfers it to the settlement account. Subsequently, the server continues to execute the image generation node. After its execution is complete and 100 images are successfully generated, the server deducts 275.4 from the frozen resource quota and transfers it to the settlement account. After the video generation node is completed and 50 videos are successfully generated, the server deducts 1453.5 from the frozen resource quota and transfers it to the settlement account. After the audio synthesis node completes and 50 audio tracks are successfully generated, 172.125 consumption value will be deducted from the frozen resource quota and transferred to the settlement account. Once the entire workflow is completed, any remaining consumption value in the frozen account will be unfrozen and returned to the available resource balance.
[0062] As can be seen, in this embodiment, by freezing the total pre-calculated resources in full before execution and gradually deducting them according to the execution order of nodes during execution, the process is avoided from being interrupted due to insufficient resource balance during execution, while ensuring the accuracy of resource deduction and the smoothness of the process.
[0063] In one embodiment, when the current node fails to execute, the frozen resources corresponding to the current node are kept unchanged.
[0064] As an example, if the current node fails to execute during the process, such as due to node malfunction or failure to generate artifacts, the server will not deduct resources but will keep the frozen resources corresponding to that node frozen until the user handles the failed node and then re-executes it.
[0065] In a specific example, the video generation node failed to execute and did not generate any video output. The server did not deduct any consumption value, and the consumption value of 1453.5 corresponding to this node remained frozen. After the user resolved the reason for the failure of the video generation node, they re-executed the node. The corresponding consumption value was then deducted from the frozen quota after the node executed successfully.
[0066] In this embodiment, by maintaining the frozen resources unchanged when a node fails, the erroneous deduction of resources when a node fails is avoided, thus protecting the user's resource rights.
[0067] In one embodiment, that is, executing each node sequentially according to the topology execution order, the following steps are also included: S321: When execution reaches the verification node, read the status information of the verification node; S322: When the status information is pending verification, suspend the execution of all downstream nodes of the verification node, and keep the portion of the frozen resource quota corresponding to the downstream nodes frozen; wherein, the portion of the resource consumption is the sum of the target resource consumption corresponding to all downstream nodes. S323: In response to the proofreading completion event, obtain the set of output products from the proofreading node; S324: When the number of products in the product set is greater than or equal to 1, use each product as the input data for the downstream node to resume the execution of each downstream node. S325: When the number of products in the product set is 0, unfreeze the portion of the frozen resource quota corresponding to the downstream node and return it to the available resource balance, thus intercepting the workflow's continuation operation.
[0068] As an example, a proofreading node refers to a node embedded in the workflow used to implement manual proofreading. Status information refers to the current state of the proofreading node, including the state of pending proofreading, proofreading in progress, and proofread completed. The passed product set refers to the set of products that the user has determined to meet expectations and pass the proofreading process. The proofreading completion event is the instruction triggered when the user completes the proofreading operation and clicks the "Proofreading Complete" button.
[0069] In a specific example, when the workflow reaches the manual proofreading node, the server reads the node's status information as pending proofreading. The server suspends the execution of all downstream nodes (video generation node and audio synthesis node) of the proofreading node, and keeps the portion of resource consumption corresponding to the downstream nodes (1453.5 + 172.125 = 1625.625 consumption value) in the frozen resource quota frozen. The user completes the proofreading, selects 50 text items as approved deliverables, and clicks "Proofreading Complete," triggering a proofreading completion event. The server retrieves the set of approved deliverables, which contains 50 items (greater than or equal to 1). The server uses these 50 approved deliverables as input data for the downstream nodes and resumes the execution of the video generation node and audio synthesis node. If the user does not select any deliverables, the number of deliverables in the approved deliverable set is 0. The server unfreezes the 1625.625 consumption value and returns it to the available resource balance, intercepting the workflow's continuation operation.
[0070] As can be seen, in this embodiment, by keeping the resources of the downstream node in a frozen state when the proofreading node triggers an interruption, and only resuming downstream execution and continuing to deduct resources when the proofreading is completed and there are passable products, a deep connection between manual proofreading and resource management is achieved, avoiding the waste of resources caused by the generation of invalid content.
[0071] In one embodiment, the following steps are also included: S303: In response to the user's instruction to enter the proofreading operation interface, the status information of the proofreading node is switched from the pending proofreading state to the proofreading state; S304: In response to the user's instruction to complete the calibration operation, switch the status information of the calibration node from the calibrating state to the calibrated state.
[0072] As an example, when a user clicks on a proofreading node to enter the proofreading operation interface, the server switches the node's status from "Pending Proofreading" to "Proofreading in Progress," and the node visually changes to a "Proofreading in Progress" indicator, making the operation elements operable. After the user completes the proofreading operation and clicks "Proofreading Complete," the server switches the node's status from "Proofreading in Progress" to "Proofread," and the node visually changes to a "Proofread" indicator, while simultaneously recording all information such as the proofreader, proofreading time, approved product list, and regenerated record.
[0073] As can be seen, in this embodiment, by defining three states—to be checked, in the process of checking, and checked—the fine-grained control of the entire process status of the checking node is achieved, enabling the system to accurately identify the current status of the checking node and execute the corresponding interrupt, resume, or refuse to run operations.
[0074] In one embodiment, obtaining the set of outputs from the proofreading node includes the following steps: S3231: Present the calibration operation interface, which contains at least one candidate product output by the generating node located upstream of the calibration node. S3232: In response to the operator's selection operation of at least one candidate product, the selected candidate product is determined as the passing product to obtain a set of passing products; Among them, at least one candidate product that was not selected is identified as a failed product, so as to obtain a set of failed products.
[0075] As an example, the proofreading interface refers to the interactive interface used to display the products generated by upstream nodes and allow operators to perform proofreading operations. Candidate products refer to each product output by the upstream generation nodes, such as a piece of text generated by the text creation node or an image generated by the image generation node. Operators select candidate products that meet their expectations in the proofreading interface; selected candidate products are identified as approved, and unselected candidate products are identified as rejected.
[0076] In a specific example, the proofreading interface displays 100 images generated by the image generation node as candidate products. Each product includes a checkbox, a preview button, and a regenerate button. The content operations manager previews each image, selecting 80 images that meet expectations as approved products and the remaining 20 images that do not meet expectations as rejected products. The server then groups the 80 approved products into a "approved products" set and the 20 rejected products into a "rejected products" set.
[0077] As can be seen, in this embodiment, by presenting candidate products in the proofreading operation interface and supporting the operator's selection operation, the organic combination of manual proofreading and system interaction is realized, providing technical support for the refined proofreading scenario of "partially passing and partially failing".
[0078] In one embodiment, the input data for each downstream node, using the products as input data, includes the following steps: S3241: Obtain the storage address of each product passed through; S3242: Establish reference links between the data input terminals of downstream nodes and each storage address; S3243: Obtain the storage address of each failed product in the set of failed products output by the verification node; S3244: Move the storage addresses of each failed product out of the data input reference range of the downstream node.
[0079] As an example, a storage address refers to the location of an artifact within a storage system, such as a file path or object storage address. A reference link refers to the reference relationship between downstream node data inputs and artifact storage addresses. A set of artifacts that were not selected by the operator is called the "unselected artifact set."
[0080] In a specific example, the output set contains 80 passed output images. The server obtains the storage addresses of these 80 images and establishes reference links between the data input of the downstream video generation node and each storage address. The output set contains 20 failed output images. The server obtains the storage addresses of these 20 images and removes them from the reference range of the data input of the downstream video generation node. When the downstream video generation node executes, it can only access the 80 passed output images used as input and will not receive data from the failed outputs.
[0081] As can be seen, in this embodiment, by using reference links to treat the passed products as input data for downstream nodes and removing the failed products from the reference range, the passed products and failed products are effectively isolated, ensuring that the failed products do not enter the downstream process and avoiding the generation of invalid content.
[0082] In summary, to better understand the overall technical solution of the embodiments of this application, a complete application scenario example will be used for illustration below.
[0083] In a specific application scenario, an enterprise tenant is a Platinum tenant (tenant level coefficient of 0.9x) and its account is an Annual Membership (membership level coefficient of 0.85x). This tenant's content operations team needs to produce a batch of product promotional short videos for distribution on multiple social media platforms. The team leader logs into the AI Creation Workflow Canvas platform and begins orchestrating the workflow.
[0084] This workflow comprises five nodes, executed in the following order: Product Selling Point Text Creation, Product Promotional Image Generation, Manual Proofreading, Short Video Generation, and Narration Audio Synthesis. The team leader configured the parameters for each node based on business needs. The Product Selling Point Text Creation node is a text creation node, a high-level model, a marketing copy generation subtype, a character limit of 3000 characters, and a batch size of 50 pieces of copy. The Product Promotional Image Generation node is an image generation node, a basic model, a text-to-image subtype, a 2K resolution, and a batch size of 100 images (i.e., 2 images generated per piece of copy). The Manual Proofreading node is a proofreading node, configured with the content operations manager for the tenant, and is set to "skip" by default (i.e., not skipped). The short video generation node is classified as a video generation node, with a basic model level, an execution subtype of text-based video, a video resolution of 1K, a generation duration of 10 seconds, and a batch size of 50 videos (i.e., one video is generated for each verified text). The narration audio synthesis node is classified as an audio generation node, with an advanced model level, an execution subtype of speech synthesis, a character count of 1500 characters, a sound quality of high definition, a language of Chinese, and a batch size of 50 audio files (i.e., one audio file is generated for each verified text).
[0085] After the team leader completes the workflow orchestration, a pre-computation instruction is triggered. In response to this pre-computation trigger event, the server iterates through the workflow's node sequence to obtain the node type for each node. Based on the node type, the server filters out zero-consumption nodes and removes manually proofread nodes (of the proofreading type), forming a valid node sequence that includes nodes for creating product selling point text, generating product promotional images, generating short videos, and synthesizing narration audio.
[0086] The server performs a node resource consumption calculation method for each node in the valid node sequence.
[0087] For the product selling point text creation node, the server first determines the node's configuration information and batch quantity. The node type is text creation, the model level is advanced model level, the execution subtype is marketing copy generation, the maximum character limit is 3000 characters, and the batch quantity is 50 entries. Based on the text creation type and advanced model level, the server determines the baseline resource value per unit character for this node to be 5 consumption values per 1000 characters. Based on the ratio of 3000 characters to the preset character unit length of 1000 characters, the server determines the number of character calculation units to be 3. Based on the baseline resource value of 5 consumption values per unit character and the number of character calculation units of 3, the server obtains an initial text consumption of 15 consumption values per entry. The text type correction coefficient for the marketing copy generation subtype is 1.0, so the unit resource consumption is 15 × 1.0 = 15 consumption values per entry. Based on the unit resource consumption of 15 consumption values per entry and the batch quantity of 50 entries, the server calculates the baseline resource consumption to be 15 × 50 = 750 consumption values. Server resource acquisition adjustment coefficients: The first type of adjustment coefficient for a batch quantity of 50 items is 1.0 times (not reaching the 50-item threshold), the adjustment value for Platinum tenant level is 0.9 times, and the adjustment value for annual membership level is 0.85 times. The server calculates the target resource consumption as 750 × 1.0 × 0.9 × 0.85 = 573.75 by multiplying the baseline resource consumption value of 750 by the resource adjustment coefficients (1.0 times, 0.9 times, and 0.85 times).
[0088] For the product promotional image generation node, the server determines the node type as image generation, the model level as basic model level, the execution subtype as text-to-image subtype, the resolution parameter as 2K resolution, and the batch quantity as 100 images. Based on the image generation type, basic model level, and 2K resolution, the server determines the baseline resource consumption per image to be 4 consumption values, resulting in a resource consumption of 4 consumption values / image. Based on the unit resource consumption of 4 consumption values / image and the batch quantity of 100 images, the server calculates the baseline resource consumption as 4 × 100 = 400 consumption values. The server obtains resource adjustment coefficients: the first type of correction coefficient for a batch quantity of 100 images is 0.9 times (reaching the 100-image threshold), the correction value for Platinum tenant level is 0.9 times, and the correction value for annual membership level is 0.85 times. The server multiplies the baseline resource consumption of 400 consumption values with the resource adjustment coefficients (0.9 times, 0.9 times, 0.85 times) to calculate the target resource consumption as 400 × 0.9 × 0.9 × 0.85 = 275.4 consumption values.
[0089] For a short video generation node, the server determines the node type as video generation, the model level as basic model level, the execution subtype as text-based video subtype, the video resolution parameter as 1K resolution, the generation duration parameter as 10 seconds, and the batch quantity as 50 videos. Based on the video generation type, basic model level, 1K resolution, and preset duration unit of 5 seconds, the server determines the resource baseline value per unit duration to be 20 consumption values per 5 seconds. Based on the ratio of the generation duration of 10 seconds to the preset duration unit of 5 seconds, the server determines the number of duration calculation units to be 2. Based on the resource baseline value of 20 consumption values per unit duration and the number of duration calculation units of 2, the server obtains an initial video consumption of 20 × 2 = 40 consumption values / video, with the execution subtype being text-based video subtype and the unit resource consumption being 40 consumption values / video. Based on the unit resource consumption of 40 consumption values / video and the batch quantity of 50 videos, the server calculates the baseline resource consumption to be 40 × 50 = 2000 consumption values. Server resource acquisition adjustment coefficients: The first type of adjustment coefficient for a batch quantity of 50 items is 0.95 times (reaching the 50-item threshold), the adjustment value for Platinum tenant level is 0.9 times, and the adjustment value for annual membership level is 0.85 times. The server calculates the target resource consumption as 2000 × 0.95 × 0.9 × 0.85 = 1453.5 consumption value by multiplying the baseline resource consumption of 2000 consumption value by the resource adjustment coefficients (0.95 times, 0.9 times, 0.85 times).
[0090] For the narration audio synthesis node, the server determines the node type as audio generation, the model level as advanced model level, the execution subtype as speech synthesis subtype, the character count parameter as 1500 characters, the sound quality level parameter as high-definition sound quality, the language type parameter as Chinese, and the batch quantity as 50. Based on the audio generation type and advanced model level, the server determines the resource base value per unit character to be 2 consumption values per 1000 characters. Based on the ratio of 1500 characters to the preset character unit length of 1000 characters, the server determines the number of character calculation units to be 2. Based on the high-definition sound quality parameter, the server determines the sound quality adjustment coefficient to be 1.5 times. Based on the Chinese language type, the server determines the language adjustment coefficient to be 1.0 times. Based on the resource base value of 2 consumption values per unit character, the number of character calculation units of 2, the sound quality adjustment coefficient of 1.5 times, and the language adjustment coefficient of 1.0 times, the server calculates the initial audio consumption as 2 × 2 × 1.5 × 1.0 = 6 consumption values / node. The execution subtype is speech synthesis subtype, and the resource consumption per unit is 6 consumption values / node. The server calculates a baseline resource consumption of 6 consumption values per item and a batch size of 50 items, resulting in a baseline resource consumption of 6 × 50 = 300 consumption values. The server then applies resource adjustment coefficients: a first-class adjustment coefficient of 1.0 (for batches under 50 items), a 0.9-fold adjustment for Platinum tenants, and a 0.85-fold adjustment for annual members. Finally, the server multiplies the baseline resource consumption of 300 consumption values with the resource adjustment coefficients (1.0, 0.9, and 0.85) to calculate the target resource consumption of 300 × 1.0 × 0.9 × 0.85 = 229.5 consumption values.
[0091] The server sums up the target resource consumption of each node, resulting in a total pre-calculated resource consumption of 573.75 + 275.4 + 1453.5 + 229.5 = 2532.15. The server then retrieves the available resource balance of the current account, assuming it is 5000. Since the available resource balance is greater than the total pre-calculated resource consumption, the verification passes, and the workflow is allowed to execute.
[0092] The team leader triggers workflow execution. In response to the execution trigger event, the server transfers resources equal to the total pre-calculated resource consumption of 2532.15 from the current account's available resource balance of 5000 consumption value to the frozen account, forming a frozen resource quota. The server determines the topology execution order of the valid node sequence and executes each node sequentially according to that order.
[0093] The server first executes the product selling point text creation node. After this node is executed, 50 pieces of copy are successfully generated. Based on the node identifier of this node, the server reads the corresponding target resource consumption value of 573.75 from the preset mapping relationship, deducts 573.75 consumption value from the frozen resource quota, and transfers it to the settlement account.
[0094] The server continued executing the product promotional image generation node. After this node was executed, 100 images were successfully generated. The server deducted 275.4 consumption value from the frozen resource quota and transferred it to the settlement account.
[0095] When the server continues execution to the manual verification node, it reads the verification node's status information as pending verification. The server suspends the execution of all downstream nodes (short video generation node and narration audio synthesis node) of the verification node, and keeps the portion of the frozen resource quota corresponding to the downstream nodes frozen. This portion of resource consumption is 1453.5 + 229.5 = 1683 consumption value.
[0096] The content operations manager clicks on the manual proofreading node to enter the proofreading interface. The interface displays 50 pieces of text and 100 corresponding images generated by the upstream node as candidate outputs. The content operations manager previews each piece, selecting 40 pieces that meet quality requirements and their corresponding 80 images as approved outputs. For the 10 pieces that do not meet quality requirements, the manager clicks the "regenerate" button. The server determines that the upstream node corresponding to these 10 pieces of text is the product selling point text creation node. It obtains the original configuration information (advanced model, marketing copy generation subtype, 3000 character limit) and original parameter information of this node during execution, as well as the current configuration information and current parameter information (advanced model, marketing copy generation subtype, 3000 character limit). The server compares the current configuration information with the original configuration information; they match. It also compares the current parameter information with the original parameter information; they match. The server maintains the deducted cost of 573.75 and re-executes the product selling point text creation node to generate 10 replacement pieces of text. After the replacement text is generated, the content operations manager reviews it, confirms that it meets all requirements, and selects it as an approved product. At this point, all 50 pieces of text have passed proofreading. The content operations manager clicks the "Proofreading Complete" button, and the server switches the status of the proofreading node from "Proofreading in progress" to "Proofread," recording all information such as the proofreader, proofreading time, approved product list, and regeneration record. Simultaneously, the server retrieves the approved product set, which contains 50 pieces of text and their corresponding 100 images. The product count is 50, greater than or equal to 1. The server uses these 50 approved products as input data for downstream nodes, resuming the execution of the short video generation node and the narration audio synthesis node.
[0097] The server continues executing the short video generation node. After this node is executed, 50 videos are successfully generated. Based on the node identifier, the server deducts 1453.5 consumption value from the frozen resource quota and transfers it to the settlement account. The server then continues executing the narration audio synthesis node. After this node is executed, 50 audio clips are successfully generated. The server deducts 229.5 consumption value from the frozen resource quota and transfers it to the settlement account. After the entire workflow is completed, the server unfreezes any remaining consumption value in the frozen account and returns it to the available resource balance.
[0098] As can be seen from the above complete example, the node resource consumption calculation method provided in this application, by determining the node type, model level, execution subtype, parameter information, and batch quantity of the target node, incorporates the following into the calculation: differences in computing power consumption across node types (different billing dimensions for text creation nodes versus image generation nodes, video generation nodes, and audio generation nodes), differences in computing power consumption between different model levels of the same type (different baseline values for advanced models versus basic models), differences in computing power consumption between different execution subtypes of the same type (different text type correction coefficients for marketing copywriting generation versus translation subtypes), and differences in computing power consumption between different operating parameters of the same node (different resource consumption adjustment coefficients corresponding to different character counts, resolutions, durations, and audio qualities). The system obtains the target resource consumption by multiplying the baseline resource consumption by resource adjustment coefficients (batch size coefficient, tenant level coefficient, and member level coefficient). This achieves seamless integration of multi-dimensional resource adjustment coefficients and resource consumption calculation processes. By freezing the total pre-calculated resources before execution, deducting them step by step according to the node sequence during execution, keeping downstream resources frozen when the verification node is interrupted, and comparing whether the configuration parameters have changed during regeneration to determine whether to deduct the difference, the system achieves deep integration of manual verification and resource control. This solves the technical problem of the mismatch between the resource consumption calculated by the existing calculation method and the actual computing power consumption of the node, making the calculated resource consumption accurately match the actual computing power consumption of the node, and effectively avoiding the resource waste caused by the generation of invalid content.
[0099] In one embodiment, the following steps are also included: S401: In response to the operator's instruction to regenerate any candidate product, determine the upstream node corresponding to the candidate product; S402: Obtain the original configuration information and original parameter information of the upstream node, as well as the current configuration information and current parameter information; S403: Compare the current configuration information with the original configuration information to obtain the first comparison result; S404: Compare the current parameter information with the original parameter information to obtain the second comparison result; S405: When the first comparison result and the second comparison result are consistent, maintain the target resource consumption already deducted by the upstream node and re-execute the upstream node; S406: When the first comparison result and / or the second comparison result are inconsistent, recalculate the updated resource consumption of the upstream node based on the current configuration information and the current parameter information, calculate the difference between the updated resource consumption and the target resource consumption already deducted by the upstream node, transfer resources equal to the difference from the current account to the frozen account, and re-execute the upstream node.
[0100] As an example, a regenerate instruction refers to the instruction triggered by an operator clicking the "Regenerate" button for a specific candidate product in the verification interface. Original configuration information refers to the configuration information used by the upstream node during execution. Original parameter information refers to the parameter information used by the upstream node during execution. Current configuration information refers to the configuration information of the upstream node during re-execution. Current parameter information refers to the parameter information of the upstream node during re-execution.
[0101] In a specific example, an operator clicks the "Regenerate" button on a piece of text that does not meet expectations. The server determines that the upstream node corresponding to the text is the text creation node, and obtains the original configuration and parameter information (advanced model, marketing copy generation subtype, 3000 character limit) of that node during execution, as well as the current configuration and parameter information (advanced model, marketing copy generation subtype, 3000 character limit). The server compares the current configuration information with the original configuration information; they match. It also compares the current parameter information with the original parameter information; they match. The server maintains the deducted consumption value of 573.75 unchanged and re-executes the text creation node. If the operator modifies the model level, changing the advanced model in the original configuration information to the basic model in the current configuration information, the server's comparison will be inconsistent. It will recalculate the update resource consumption under the basic model level, calculate the difference between the recalculated value and the deducted consumption value, transfer the difference from the current account to the frozen account, and re-execute the text creation node.
[0102] As can be seen, in this embodiment, by comparing whether the configuration information and parameter information have changed in the regenerated scenario, the resource consumption is recalculated and the difference is deducted only when changes occur. If there are no changes, the deduction is not repeated, thus avoiding duplicate deductions of resource consumption caused by regeneration and protecting the user's resource rights.
[0103] In one embodiment, when the workflow is in batch execution mode, there are multiple verification nodes, each corresponding to one of multiple batch tasks. The process also includes the following steps: S501: Obtain the pass product set for each verification node; S502: Count the number of products in each product set; S503: For a verification node whose number of products in the product set is greater than or equal to 1, resume the execution of the downstream node corresponding to the verification node, and use the products in the product set as the input data of the downstream node. S504: For a verification node with a product quantity of 0 in the product set, maintain the interruption state of the downstream node corresponding to the verification node, and keep the portion of the frozen resource quota corresponding to the downstream node in a frozen state.
[0104] As an example, batch execution mode refers to a workflow that executes multiple sets of tasks in batches. In batch execution mode, each batch of tasks corresponds to an independent verification node, and multiple verification nodes execute their respective verification processes in parallel or sequentially.
[0105] In a specific example, the workflow runs in batch execution mode, containing three sets of batch tasks, each corresponding to one of three verification nodes. The verification node corresponding to the first set of batch tasks has a pass set containing 10 pass products (product count greater than or equal to 1), and the server resumes execution of the downstream node corresponding to that verification node. The verification node corresponding to the second set of batch tasks has a pass set containing 0 pass products (product count is 0), and the server maintains the interrupted state of the downstream node corresponding to that verification node, while preserving the corresponding frozen resources. The verification node corresponding to the third set of batch tasks has a pass set containing 5 pass products (product count greater than or equal to 1), and the server resumes execution of the downstream node corresponding to that verification node.
[0106] As can be seen, in this embodiment, by configuring corresponding proofreading nodes for each batch task in batch execution mode and counting the number of passed products of each proofreading node to determine whether to continue running, group proofreading and group continued running in batch production scenarios are realized, which adapts to the full process requirements of industrialized batch content production.
[0107] In one embodiment, the verification node is configured as follows: In response to the user's dragging and dropping of a node into the workflow, obtain the connection relationship between the dragged node and other nodes in the workflow; Verify whether the connection relationships meet the preset topology rules; When the connection relationship meets the preset topology rules, establish the connection relationship and configure the dragged node as a proofreading node; The default topology rules are: dragged nodes are only allowed to be downstream of the generated node, dragged nodes are prohibited from connecting with each other, and any generated node is only allowed to connect to one dragged node. Among them, the generating node is the functional node that produces the product.
[0108] As an example, a user drags a node from the toolbar on the left side of the canvas into the canvas workflow and establishes connections with other nodes. The server retrieves the connections between the dragged node and other nodes in the workflow and verifies whether these connections meet the preset topology rules. The preset topology rules include three sub-rules: First, the dragged node is only allowed to be downstream of a functional node, meaning it must be connected after the functional node used to generate the artifact to ensure the artifact is fully generated during proofreading; second, proofreading nodes are prohibited from connecting to each other, meaning multiple proofreading nodes cannot be chained together; third, any functional node is only allowed to connect to one proofreading node, avoiding duplicate proofreading. When the connection meets all the above preset topology rules, the server establishes the connection and configures the dragged node as a proofreading node. Node parameter configuration items support configuring the caller, proofreader, and whether to skip by default. By default, the node is active and not skipped; if default skipping is enabled, the workflow skips the node directly without triggering interruption or resource freezing.
[0109] In a specific example, a user drags a "Manual Proofreading" node from the left toolbar of the canvas to the downstream of the image generation node, establishing a connection. The server verifies the connection, confirming that the dragged node is downstream of the image generation node and that the image generation node is not connected to any other proofreading nodes, satisfying the preset topology rules. The server then establishes the connection and configures the node as a proofreading node. If the user attempts to connect two proofreading nodes in series, the server's verification fails to meet the rule of "prohibiting connections between proofreading nodes," rejecting the connection and prompting the user that "connections between proofreading nodes are prohibited."
[0110] As can be seen, in this embodiment, the configuration of the verification nodes is verified and constrained by preset topology rules, which ensures the correct deployment position and structure of the verification nodes in the workflow, avoids process chaos or repeated verification caused by incorrect configuration, and ensures the standardization and reliability of the verification process.
[0111] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0112] Secondly, embodiments of this application provide a node resource consumption calculation device, which corresponds one-to-one with the node resource consumption calculation method in the above embodiments. For example... Figure 3As shown, the node resource consumption calculation device includes a first determination module 601, a second determination module 602, a first calculation module 603, an acquisition module 604, and a second calculation module 605. Detailed descriptions of each functional module are as follows: The first determining module 601 is used to determine the configuration information and batch quantity of the target node. The configuration information includes the node type, model level, execution subtype and parameter information of the target node. The second determining module 602 is used to determine the unit resource consumption of the target node based on the node type, the model level, the execution subtype and the parameter information; The first calculation module 603 is used to calculate the baseline resource consumption of the target node based on the unit resource consumption and the batch quantity. The acquisition module 604 is used to acquire the resource adjustment coefficient corresponding to the target node; The second calculation module 605 is used to calculate the target resource consumption of the target node based on the baseline resource consumption and the resource adjustment coefficient.
[0113] In one embodiment, when the node type is a text creation type, the parameter information includes a character limit parameter, and the execution subtype is a first type of subtype; wherein, the first type of subtype includes a translation subtype, a professional field copywriting generation subtype, and a multi-turn dialogue creation subtype; The second determining module 602 is further configured to: Based on the text creation type and the model level, determine the unit character resource baseline value corresponding to the target node; Based on the first subtype, determine the text type correction coefficient corresponding to the target node; The number of character calculation units is determined based on the upper limit parameter for the number of characters and the preset character unit length; The initial text consumption is obtained based on the unit character resource baseline value and the number of character calculation units; The unit resource consumption is obtained based on the initial text consumption and the text type correction coefficient.
[0114] In one embodiment, when the node type is an image generation type, the parameter information includes at least one of image resolution parameters, reference image quantity parameters, and modification magnitude parameters, and the execution subtype is a second type of subtype; wherein, the second type of subtype includes text-to-image subtype, image-to-image subtype, and image editing subtype; The second determining module 602 is further configured to: Based on the image generation type, the model level, and the first resolution level corresponding to the image resolution parameter, determine the unit image resource baseline value corresponding to the target node; When the execution subtype is the text image subtype, the unit image resource baseline value is used as the unit resource consumption; When the execution subtype is the graph-generated graph subtype, the reference graph processing resource consumption is determined according to the reference graph quantity parameter; the unit image resource baseline value is added to the reference graph processing resource consumption to obtain the unit resource consumption. When the execution subtype is image editing subtype, the corresponding editing adjustment coefficient is matched according to the modification range parameter; the unit image resource baseline value is multiplied by the editing adjustment coefficient to obtain the unit resource consumption.
[0115] In one embodiment, when the node type is a video generation type, the parameter information includes generation duration parameters and video resolution parameters, and the execution subtype is a third type; wherein, the third type includes text-based video subtype and image-based video subtype; The second determining module 602 is further configured to: Based on the video generation type, the model level, and the second resolution level corresponding to the video resolution parameters, determine the unit duration resource benchmark value corresponding to the target node; The number of duration calculation units is determined based on the generated duration parameters and the preset duration unit; The initial video consumption is obtained based on the unit duration resource baseline value and the number of duration calculation units; When the execution subtype is the text-based video subtype, the initial video consumption is used as the unit resource consumption. When the execution subtype is the image-generated video subtype, the reference image processing resource consumption is determined according to the reference image quantity parameter corresponding to the image-generated video subtype; the unit resource consumption is obtained according to the initial video consumption and the reference image processing resource consumption.
[0116] In one embodiment, when the node type is an audio generation type, the parameter information includes a character count parameter, a sound quality level parameter, and a language type parameter, and the execution subtype is a fourth type of subtype; wherein, the fourth type of subtype includes a speech synthesis subtype, an emotional speech synthesis subtype, and a real-person replica speech synthesis subtype; The second determining module 602 is further configured to: Based on the audio generation type and the model level, determine the unit character resource baseline value corresponding to the target node; The number of character calculation units is determined based on the character count parameter and the preset character unit length. Determine the sound quality adjustment coefficient based on the aforementioned sound quality level parameters; Determine the language adjustment coefficient based on the language type parameter; The initial audio consumption is obtained based on the unit character resource baseline value, the number of character calculation units, the sound quality adjustment coefficient, and the language adjustment coefficient. When the execution subtype is the speech synthesis subtype, the initial audio consumption is used as the unit resource consumption. When the execution subtype is the emotional version of the speech synthesis subtype or the real-person replica version of the speech synthesis subtype, the corresponding audio type correction coefficient is determined according to the emotional version of the speech synthesis subtype or the real-person replica version of the speech synthesis subtype, and the unit resource consumption is obtained according to the initial audio consumption and the audio type correction coefficient.
[0117] In one embodiment, the resource adjustment coefficient includes a first type of correction coefficient and a second type of correction coefficient. The first type of correction coefficient is determined based on a preset quantity range in which the batch quantity is located, and the second type of correction coefficient includes a tenant level correction value and a member level correction value. The second calculation module 605 is also used for: The target resource consumption is obtained based on the baseline resource consumption, the first type of correction coefficient, the tenant level correction value, and the member level correction value.
[0118] In one embodiment, the node resource consumption calculation device further includes a processing module (not shown in the figure); the processing module is used for: In response to pre-computed trigger events, traverse the workflow's node sequence and obtain the node type of each node; Zero-consumption nodes are filtered out according to the node type to form a valid node sequence; wherein, the zero-consumption node is a node of the collation type; For each node in the effective node sequence, the node resource consumption calculation method described above is executed to obtain the target resource consumption corresponding to each node; The total pre-calculated resource consumption of the workflow is obtained by summing up the resource consumption of each target. After obtaining the total pre-calculated resource consumption, obtain the current account's available resource balance; If the available resource balance is less than the total pre-calculated resource consumption, the workflow will be rejected. The workflow is allowed to be executed when the available resource balance is greater than or equal to the total pre-calculated resource consumption.
[0119] It should be noted that, in order to avoid redundancy, the embodiments of this application only list some steps of the node resource consumption calculation method described in the first aspect above, and do not list all the steps of the node resource consumption calculation method in the second aspect embodiments.
[0120] It should be understood that the node resource consumption calculation device in the second aspect embodiment can implement all the steps of the node resource consumption calculation method in the first aspect embodiment, and will not be repeated here.
[0121] Specific limitations regarding the node resource consumption calculation device can be found in the limitations of the node resource consumption calculation method described above, and will not be repeated here. Each module in the aforementioned node resource consumption calculation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in the electronic device, or stored in software in the memory of the electronic device, so that the processor can call and execute the corresponding operations of each module.
[0122] Thirdly, embodiments of this application provide an electronic device whose internal structure diagram can be as follows: Figure 4 As shown, the electronic device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores data required for executing the node resource consumption calculation method. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements the steps of the node resource consumption calculation method described above.
[0123] In one embodiment, this application provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the node resource consumption calculation method described in the first aspect above.
[0124] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the node resource consumption calculation method described in the first aspect.
[0125] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or electronic device described above can be referred to the relevant descriptions in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.
[0126] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0127] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0128] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for calculating node resource consumption, characterized in that, include: Determine the configuration information and batch quantity of the target node, wherein the configuration information includes the node type, model level, execution subtype, and parameter information of the target node; The unit resource consumption of the target node is determined based on the node type, the model level, the execution subtype, and the parameter information. Calculate the baseline resource consumption of the target node based on the unit resource consumption and the batch quantity; Obtain the resource adjustment coefficient corresponding to the target node; The target resource consumption of the target node is calculated based on the baseline resource consumption and the resource adjustment coefficient.
2. The method according to claim 1, characterized in that, When the node type is a text creation type, the parameter information includes a character limit parameter, and the execution subtype is a first type of subtype; wherein, the first type of subtype includes a translation subtype, a professional field copywriting generation subtype, and a multi-turn dialogue creation subtype; Determining the unit resource consumption of the target node based on the node type, the model level, the execution subtype, and the parameter information includes: Based on the text creation type and the model level, determine the unit character resource baseline value corresponding to the target node; Based on the first subtype, determine the text type correction coefficient corresponding to the target node; The number of character calculation units is determined based on the upper limit parameter for the number of characters and the preset character unit length; The initial text consumption is obtained based on the unit character resource baseline value and the number of character calculation units; The unit resource consumption is obtained based on the initial text consumption and the text type correction coefficient.
3. The method according to claim 1, characterized in that, When the node type is an image generation type, the parameter information includes at least one of the following: image resolution parameter, number of reference images parameter, and modification range parameter, and the execution subtype is a second type of subtype; wherein, the second type of subtype includes text-to-image subtype, image-to-image subtype, and image editing subtype; Determining the unit resource consumption of the target node based on the node type, the model level, the execution subtype, and the parameter information includes: Based on the image generation type, the model level, and the first resolution level corresponding to the image resolution parameter, determine the unit image resource baseline value corresponding to the target node; When the execution subtype is the text image subtype, the unit image resource baseline value is used as the unit resource consumption; When the execution subtype is the graph-generated graph subtype, the reference graph processing resource consumption is determined according to the reference graph quantity parameter; the unit image resource baseline value is added to the reference graph processing resource consumption to obtain the unit resource consumption. When the execution subtype is image editing subtype, the corresponding editing adjustment coefficient is matched according to the modification range parameter; the unit image resource baseline value is multiplied by the editing adjustment coefficient to obtain the unit resource consumption.
4. The method according to claim 1, characterized in that, When the node type is a video generation type, the parameter information includes generation duration parameters and video resolution parameters, and the execution subtype is a third type; wherein, the third type includes text-based video subtype and image-based video subtype; Determining the unit resource consumption of the target node based on the node type, the model level, the execution subtype, and the parameter information includes: Based on the video generation type, the model level, and the second resolution level corresponding to the video resolution parameters, determine the unit duration resource benchmark value corresponding to the target node; The number of duration calculation units is determined based on the generated duration parameters and the preset duration unit; The initial video consumption is obtained based on the unit duration resource baseline value and the number of duration calculation units; When the execution subtype is the text-based video subtype, the initial video consumption is used as the unit resource consumption. When the execution subtype is the image-generated video subtype, the reference image processing resource consumption is determined according to the reference image quantity parameter corresponding to the image-generated video subtype; the unit resource consumption is obtained according to the initial video consumption and the reference image processing resource consumption.
5. The method according to claim 1, characterized in that, When the node type is an audio generation type, the parameter information includes character count parameters, sound quality level parameters, and language type parameters, and the execution subtype is a fourth type of subtype; wherein, the fourth type of subtype includes speech synthesis subtype, emotional speech synthesis subtype, and real person replica speech synthesis subtype; Determining the unit resource consumption of the target node based on the node type, the model level, the execution subtype, and the parameter information includes: Based on the audio generation type and the model level, determine the unit character resource baseline value corresponding to the target node; The number of character calculation units is determined based on the character count parameter and the preset character unit length. Determine the sound quality adjustment coefficient based on the aforementioned sound quality level parameters; Determine the language adjustment coefficient based on the language type parameter; The initial audio consumption is obtained based on the unit character resource baseline value, the number of character calculation units, the sound quality adjustment coefficient, and the language adjustment coefficient. When the execution subtype is the speech synthesis subtype, the initial audio consumption is used as the unit resource consumption. When the execution subtype is the emotional version of the speech synthesis subtype or the real-person replica version of the speech synthesis subtype, the corresponding audio type correction coefficient is determined according to the emotional version of the speech synthesis subtype or the real-person replica version of the speech synthesis subtype, and the unit resource consumption is obtained according to the initial audio consumption and the audio type correction coefficient.
6. The method according to any one of claims 1 to 5, characterized in that, The resource adjustment coefficient includes a first type of correction coefficient and a second type of correction coefficient. The first type of correction coefficient is determined based on the preset quantity range in which the batch quantity is located. The second type of correction coefficient includes a tenant level correction value and a member level correction value. The step of calculating the target resource consumption of the target node based on the baseline resource consumption and the resource adjustment coefficient includes: The target resource consumption is obtained based on the baseline resource consumption, the first type of correction coefficient, the tenant level correction value, and the member level correction value.
7. The method according to any one of claims 1 to 5, characterized in that, Also includes: In response to pre-computed trigger events, traverse the workflow's node sequence and obtain the node type of each node; Zero-consumption nodes are filtered out based on the node type to form a valid node sequence; wherein, the zero-consumption node is a node of the collation type. For each node in the effective node sequence, the node resource consumption calculation method described above is executed to obtain the target resource consumption corresponding to each node; The total pre-calculated resource consumption of the workflow is obtained by summing up the resource consumption of each target. After obtaining the total pre-calculated resource consumption, obtain the current account's available resource balance; If the available resource balance is less than the total pre-calculated resource consumption, the workflow will be rejected. The workflow is allowed to be executed when the available resource balance is greater than or equal to the total pre-calculated resource consumption.
8. A node resource consumption calculation device, characterized in that, include: The first determining module is used to determine the configuration information and batch quantity of the target node. The configuration information includes the node type, model level, execution subtype, and parameter information of the target node. The second determining module is used to determine the unit resource consumption of the target node based on the node type, the model level, the execution subtype, and the parameter information. The first calculation module is used to calculate the baseline resource consumption of the target node based on the unit resource consumption and the batch quantity. The acquisition module is used to acquire the resource adjustment coefficient corresponding to the target node; The second calculation module is used to calculate the target resource consumption of the target node based on the baseline resource consumption and the resource adjustment coefficient.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the node resource consumption calculation method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the node resource consumption calculation method as described in any one of claims 1 to 7.