Method, device and processor for building a fault diagnosis language model
By building a fault diagnosis language model and using the historical operating data of construction machinery and the reward model to optimize fault diagnosis, the problem of poor fault diagnosis effect in existing technologies is solved, and higher accuracy and stronger fault diagnosis capabilities are achieved.
Patent Information
- Application Number
- CN202310716886.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-15
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2043-06-15
AI Technical Summary
Existing knowledge graph-based fault diagnosis technology relies on manual construction and is unable to identify complex fault data, resulting in poor diagnostic results and large errors.
Construct a fault diagnosis language model. By determining the objective function and error function of the initial language model, use the historical operating data of construction machinery to train fault data and solutions, and combine the reward model and error function to optimize the fault diagnosis capability.
It improves the accuracy and capability of fault diagnosis, can better solve fault problems, provide more suitable solutions, and improve work efficiency.
Smart Images

Figure CN116881711B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of fault diagnosis, and particularly relates to a method and device for constructing a fault diagnosis language model, a storage medium and a processor. BACKGROUND
[0002] Text-based fault diagnosis is a method for understanding and mastering the state of a machine in the running process through text information, and determining the overall or local normality or abnormality. Current fault diagnosis techniques mostly perform fault diagnosis based on a knowledge graph, mainly rely on a knowledge graph constructed based on multi-source knowledge, and perform fault analysis by querying the knowledge graph. The construction of the knowledge graph relies on a large amount of manual work, and cannot identify relatively complex fault data, resulting in poor fault diagnosis effect. Moreover, there is a large error in matching fault solutions, which makes it difficult to solve the faults well. SUMMARY
[0003] The embodiments of the present application aim to provide a method and device for constructing a fault diagnosis language model, a storage medium and a processor.
[0004] To achieve the above-mentioned purpose, the first aspect of the present application provides a method for constructing a fault diagnosis language model, comprising:
[0005] determining a first objective function of an initial language model, the initial language model being trained based on historical working condition data of engineering machinery;
[0006] determining fault data corresponding to each fault type and fault solutions corresponding to each fault type in the historical working condition data;
[0007] for any fault type, converting the fault data corresponding to the fault type into first fault data corresponding to the fault type according to a preset data format;
[0008] inputting the first fault data of each fault type into the initial language model respectively, so as to output at least two first fault solutions through the initial language model;
[0009] for any fault type, determining any two first fault solutions corresponding to the fault type as a first sample data;
[0010] for any fault type, sequentially inputting a plurality of first sample data included in the fault type into the trained reward model, so as to output a first score and a second score of the ability of each first sample data to solve the fault type through the trained reward model;
[0011] determining a second objective function of the initial language model according to all the first scores and the second scores;
[0012] determining an error function of the initial language model according to the first objective function and the second objective function;
[0013] inputting each first fault data of each fault type into the error function in sequence to output a corresponding function value through the error function;
[0014] determining the initial language model as the fault diagnosis language model in a case that all the function values are less than the first preset value.
[0015] In the embodiments of the present application, the method further comprises: after determining the initial language model as the fault diagnosis language model, obtaining working condition data of the engineering machinery at the current time, and determining fault data corresponding to each fault type at the current time in the working condition data at the current time; converting the fault data corresponding to each fault type at the current time according to a preset data format to obtain second fault data corresponding to each fault type at the current time; and inputting the second fault data of each fault type at the current time into the fault diagnosis language model respectively to output a corresponding second fault solution through the fault diagnosis language model.
[0016] In the embodiments of the present application, the method further comprises: for any fault type at the current time, after outputting the second fault solution corresponding to the fault type at the current time through the fault diagnosis language model, sending the second fault solution to the client for display.
[0017] In the embodiments of the present application, the method further comprises: obtaining a plurality of second sample data, wherein each second sample data comprises a first historical solution and a second historical solution for solving any fault type, and the ability of the first historical solution to solve the fault type is greater than that of the second historical solution; and inputting the plurality of second sample data into the reward model in sequence to train the reward model.
[0018] In the embodiment of the present application, the method further comprises: selecting a first number of second sample data from the plurality of second sample data as training data, and selecting a second number of second sample data as validation data; inputting each training data into the reward model in turn to train the reward model; inputting each validation data into the reward model in turn to output a third score and a fourth score corresponding to each validation data through the reward model; inputting the third score and the fourth score of each validation data into the objective function of the reward model to output a function value corresponding to each validation data through the objective function of the reward model; in the case that the function values of the first preset number of validation data are all less than a second preset value, determining the reward model as a trained reward model; in the case that the function values of the second preset number of validation data are greater than the second preset value, returning to the step of selecting a first number of second sample data from the plurality of second sample data as training data, and selecting a second number of second sample data as validation data, until the function values of the first preset number of validation data are all less than the second preset value, wherein the first preset number is greater than the second preset number.
[0019] In the embodiment of the present application, the expression of the objective function of the reward model is as shown in formula (1):
[0020]
[0021] wherein, L rm represents the objective function of the reward model, represents the first historical solution in the first validation data, represents the second historical solution in the first validation data, and n represents the number of validation data, represents the third score of the first historical solution in the first validation data, represents the fourth score of the second historical solution in the first validation data, represents the standardization function of the third score and the fourth score, and log represents the logarithmic function.
[0022] In the embodiment of the present application, the expression of the second objective function is as shown in formula (2):
[0023] L ppo =e(h new -h old )W advantage (2)
[0024] wherein, L ppo represents the second objective function, e and W advantage are both constants, h new represents the first score, and h old represents the second score.
[0025] The second aspect of the present application provides a processor configured to perform the method for constructing a fault diagnosis language model described above.
[0026] The third aspect of the present application provides an apparatus for constructing a fault diagnosis language model, comprising the processor described above.
[0027] The fourth aspect of the present application provides a machine-readable storage medium having instructions stored thereon, which, when executed by a processor, cause the processor to be configured to perform the method for constructing a fault diagnosis language model described above.
[0028] The technical solution described above determines a first objective function of an initial language model, determines fault data corresponding to each fault type and a fault solution corresponding to each fault type in historical working condition data, converts the fault data corresponding to the fault type into first fault data corresponding to the fault type according to a preset data format for any fault type, inputs the first fault data of each fault type into the initial language model respectively to output at least two first fault solutions through the initial language model, determines any two first fault solutions corresponding to the fault type as a first sample data for any fault type, inputs the plurality of first sample data included in the fault type into the trained reward model in turn for any fault type to output a first score and a second score of the ability of each first sample data to solve the fault type through the trained reward model, determines a second objective function of the initial language model according to all the first scores and the second scores, determines an error function of the initial language model according to the first objective function and the second objective function, inputs each first fault data of each fault type into the error function in turn to output a corresponding function value through the error function, and determines the initial language model as a fault diagnosis language model in the case where all the function values are less than a first preset value. The technical solution described above can construct a fault diagnosis language model with higher precision, and the fault diagnosis language model has stronger fault diagnosis capability, can better solve fault problems, provide more matched fault solutions, and greatly improves work efficiency.
[0029] Other features and advantages of the embodiments of the present application will be described in detail in the following specific implementation part. BRIEF DESCRIPTION OF DRAWINGS
[0030] The accompanying drawings are included to provide a further understanding of the embodiments of the present application, and constitute a part of the specification, and are used together with the following specific implementation part to explain the embodiments of the present application, but do not constitute a limitation on the embodiments of the present application. In the drawings:
[0031] Figure 1A flowchart of a method for constructing a fault diagnosis language model according to an embodiment of the present application is schematically shown.
[0032] Figure 2 A schematic diagram of a method for constructing a fault diagnosis language model according to an embodiment of the present application is schematically shown.
[0033] Figure 3 An internal structure diagram of a computer device according to an embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0034] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. It should be understood that the specific embodiments described herein are merely used to explain and illustrate the embodiments of the present application, and are not used to limit the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0035] Figure 1 A flowchart of a method for constructing a fault diagnosis language model according to an embodiment of the present application is schematically shown. As shown in Figure 1 In an embodiment of the present application, a method for constructing a fault diagnosis language model is provided, comprising the following steps:
[0036] Step 101, determining a first objective function of an initial language model, the initial language model being trained based on historical working condition data of the engineering machinery.
[0037] Step 102, determining fault data corresponding to each fault type and a fault solution corresponding to each fault type in the historical working condition data.
[0038] Step 103, for any fault type, converting the fault data corresponding to the fault type according to a preset data format to obtain first fault data corresponding to the fault type.
[0039] Step 104, inputting the first fault data of each fault type into the initial language model respectively to output at least two first fault solutions through the initial language model.
[0040] Step 105, for any fault type, determining any two first fault solutions corresponding to the fault type as a first sample data.
[0041] In step 106, for any fault type, the plurality of first sample data included in the fault type is sequentially input to the trained reward model to output, by the trained reward model, a first score and a second score of the ability of each first sample data to solve the fault type.
[0042] In step 107, a second objective function of the initial language model is determined according to all the first scores and the second scores.
[0043] In step 108, an error function of the initial language model is determined according to the first objective function and the second objective function.
[0044] In step 109, each first fault data of each fault type is sequentially input to the error function to output, by the error function, a corresponding function value.
[0045] In step 110, in a case where all the function values are less than a first preset value, the initial language model is determined as a fault diagnosis language model.
[0046] Construction machinery is an important part of the equipment industry. In general, the machinery and equipment necessary for comprehensive mechanized construction work required for earthwork construction, pavement construction and maintenance, mobile hoisting and unloading operations, and various building projects are referred to as construction machinery. The processor can determine a first objective function of an initial language model, wherein the initial language model is trained based on historical working condition data of the construction machinery. The processor can determine fault data corresponding to each fault type and a fault solution corresponding to each fault type in the historical working condition data. After determining the fault data corresponding to each fault type, for any fault type, the processor can convert the fault data corresponding to the fault type according to a preset data format to obtain first fault data corresponding to the fault type. After determining the first fault data corresponding to the fault type, the processor can input the first fault data of each fault type to the initial language model to output at least two first fault solutions by the initial language model. After obtaining the first fault solutions, for any fault type, the processor can determine any two first fault solutions corresponding to the fault type as a first sample data. After obtaining the first sample data, for any fault type, the processor can sequentially input a plurality of first sample data included in the fault type to the trained reward model to output, by the trained reward model, a first score and a second score of the ability of each first sample data to solve the fault type. After obtaining the first score and the second score, the processor can determine a second objective function of the initial language model according to all the first scores and the second scores. In an embodiment, the expression of the second objective function is shown in formula (2):
[0047] Lppo = e(h new -h old )W advantage (2)
[0048] wherein L ppo represents the second objective function, e and W advantage are constants, h new represents the first score, and h old represents the second score.
[0049] After determining the second objective function, the processor can determine an error function of the initial language model according to the first objective function and the second objective function. After obtaining the error function, the processor can input each first fault data of each fault type into the error function in turn to output a corresponding function value through the error function. In the case that all function values are less than a first preset value, the processor can determine the initial language model as the fault diagnosis language model.
[0050] For example, the processor can determine the first objective function L lm of the initial language model, which is trained based on historical working condition data of engineering analysis. The processor can determine fault data corresponding to each fault type and fault solutions corresponding to each fault type in the historical working condition data.
[0051] Suppose that the fault data corresponding to a fault type is A1, and the fault solutions corresponding to the fault type include B1, B2, B3, and B4. For this fault type, the processor can convert the fault data corresponding to the fault type according to a preset data format to obtain first fault data corresponding to the fault type. Specifically, the processor can convert the fault data according to a question and answer format to obtain the first fault data corresponding to the fault type. The processor can process the fault data as "Ask: Send fault A1, how to handle", and then prompt "Ask: Send fault A1, how to handle" to obtain the first fault data.
[0052] After obtaining the first fault data, the processor can input the first fault data "\n Fault phenomenon: Send fault A1, how to handle" into the initial language model to output first fault solutions through the fault language model, including "\n Fault solutions: Send fault A1, it may be a fault, which needs to be excluded. Here are some possible solutions B1, B2, B3, and B4."
[0053] For this fault type, the processor can determine any two first fault solutions as a first sample data, i.e. (B1, B2), (B1, B3), (B1, B4), (B2, B3), (B2, B3), (B3, B4). The processor can input (B1, B2), (B1, B3), (B1, B4), (B2, B3), (B2, B3), (B3, B4) to the trained reward model in turn, so as to output the first score and the second score of the ability of (B1, B2), (B1, B3), (B1, B4), (B2, B3), (B2, B3), (B3, B4) to solve the fault type through the trained reward model.
[0054] The processor can determine the second objective function L ppo of the initial language model according to all the first scores and the second scores. lm The processor can determine the error function L of the initial language model according to the first objective function L ppo and the second objective function L lm . ppo The processor can input each first fault data of the fault type to the error function L, so as to output the corresponding function value through the error function. In the case that all the function values are less than the first preset value, the processor can determine the initial language target as the fault diagnosis language model.
[0055] Through the above technical solution, a fault diagnosis language model with higher precision can be constructed, and the fault diagnosis language model has stronger fault diagnosis capability, can better solve fault problems, provide more matched fault solutions, and greatly improve work efficiency.
[0056] In one embodiment, the method further comprises: after determining the initial language model as the fault diagnosis language model, acquiring working condition data of the engineering machinery at the current time, and determining fault data corresponding to each fault type at the current time in the working condition data at the current time; converting the fault data corresponding to each fault type at the current time according to a preset data format, to obtain second fault data corresponding to each fault type at the current time; and inputting the second fault data of each fault type at the current time to the fault diagnosis language model respectively, so as to output corresponding second fault solutions through the fault diagnosis language model.
[0057] After determining the initial language model as the fault diagnosis language model, the processor can acquire working condition data of the engineering machine at the current time, and determine fault data corresponding to each fault type at the current time in the working condition data at the current time. After determining the fault data corresponding to each fault type at the current time, the processor can convert the fault data corresponding to each fault type at the current time into a preset data format to obtain second fault data corresponding to each fault type at the current time. After obtaining the second fault data, the processor can input the second fault data of each fault type at the current time into the fault diagnosis language model respectively, so as to output a corresponding second fault solution through the fault diagnosis language model.
[0058] In one embodiment, for any kind of fault type at the current time, after outputting the second fault solution corresponding to the fault type at the current time through the fault diagnosis language model, the second fault solution is sent to the client for display.
[0059] For any kind of fault type at the current time, after outputting the second fault solution corresponding to the fault type at the current time through the fault diagnosis language model, the second fault solution is sent to the client for display.
[0060] For example, the processor can obtain the working condition data of the engineering machinery at the current time, and determine the fault data corresponding to each fault type at the current time in the working condition data at the current time. Assuming that the fault data corresponding to one fault type at the current time is: "fault phenomenon: pumping pressure is small, how to deal with the pump often blocked". The processor can convert the fault data into a question and answer format to obtain the first fault data corresponding to the fault type. The processor can process the fault data as "question: how to deal with the pump often blocked with small pumping pressure", and prompt "question: how to deal with the pump often blocked with small pumping pressure" to obtain the second fault data: "\n fault phenomenon: pumping pressure is small, how to deal with the pump often blocked". The processor can input the second fault data "\n fault phenomenon: pumping pressure is small, how to deal with the pump often blocked" to the fault diagnosis language model, so as to output the corresponding second fault solution through the fault diagnosis language model: "\n fault solution: pumping pressure is small and the pump is often blocked, which may be due to pump failure and needs to be excluded. Here are some possible solutions: \n\n1. Check if the inlet and outlet of the pump are blocked. If they are blocked, clean the pipes and the inlet and outlet of the pump. \n\n2. Check if the impeller of the pump is excessively worn. If it is excessively worn, replace the impeller. \n\n3. Check if the motor of the pump is running normally. If the motor has a problem, replace the motor. \n\n4. Check if the cooling system of the pump is running normally. If the cooling system has a problem, replace the water pump. \n\n5. Check if the fuse of the pump is burned out. If it is burned out, replace the fuse. \n\nIf the above methods cannot solve the problem, it is recommended to contact professional mechanical maintenance personnel for repair or replacement."
[0061] After outputting the second fault solution corresponding to the fault type at the current time through the fault diagnosis language model, the processor can send the second fault solution to the client for display.
[0062] In one embodiment, the method further comprises: obtaining a plurality of second sample data, wherein each second sample data comprises a first historical solution and a second historical solution for solving any fault type, and the first historical solution has a greater ability to solve the fault type than the second historical solution; and sequentially inputting the plurality of second sample data to the reward model to train the reward model.
[0063] The processor can obtain a plurality of second sample data, wherein each second sample data comprises a first historical solution and a second historical solution for solving any fault type, and the first historical solution has a greater ability to solve the fault type than the second historical solution. After obtaining the plurality of second sample data, the processor can sequentially input the plurality of second sample data to the reward model to train the reward model.
[0064] In an embodiment, the method further comprises: selecting a first number of the second sample data from the plurality of second sample data as training data, and selecting a second number of the second sample data as validation data; inputting each of the training data into the reward model in sequence to train the reward model; inputting each of the validation data into the reward model in sequence to output a third score and a fourth score corresponding to each of the validation data through the reward model; inputting the third score and the fourth score of each of the validation data into an objective function of the reward model to output a function value corresponding to each of the validation data through the objective function of the reward model; in a case where the function values of a first preset number of the validation data are all less than a second preset value, determining the reward model as a trained reward model; in a case where the function values of a second preset number of the validation data are greater than the second preset value, returning to the step of selecting the first number of the second sample data from the plurality of second sample data as training data, and selecting the second number of the second sample data as validation data, until the function values of the first preset number of the validation data are all less than the second preset value, wherein the first preset number is greater than the second preset number.
[0065] The processor can obtain a plurality of second sample data, wherein each second sample data includes a first historical solution and a second historical solution for solving any type of fault, and the ability of the first historical solution to solve the fault type is greater than that of the second historical solution. After obtaining the plurality of second sample data, the processor can input the plurality of second sample data into the reward model in sequence to train the reward model. Specifically, the processor can select a first number of the second sample data from the plurality of second sample data as training data, and select a second number of the second sample data as validation data. After selecting the training data and the validation data, the processor can input each of the validation data into the reward model in sequence to output a third score and a fourth score corresponding to each of the validation data through the reward model. After obtaining the third score and the fourth score, the processor can input the third score and the fourth score of each of the validation data into an objective function of the reward model to output a function value corresponding to each of the validation data through the objective function of the reward model. In an embodiment, the expression of the objective function of the reward model is shown in formula (1):
[0066]
[0067] wherein, L rm represents the objective function of the reward model, represents the first historical solution in the first validation data, represents the second historical solution in the first validation data, and n represents the number of validation data, represents the third score of the first historical solution in the first validation data, represents the fourth score of the second historical solution in the first validation data, represents the normalization function of the third score and the fourth score, and log represents the logarithmic function.
[0068] After obtaining the function value, the processor can determine whether the function value corresponding to each verification data is less than the second preset value. When the function values of the first preset number of verification data are all less than the second preset value, the processor can determine the reward model as a trained reward model. When the function values of the second preset number of verification data are greater than the second preset value, the processor can return to the step of selecting the first number of second sample data from multiple second sample data as training data and selecting the second number of second sample data as verification data, until the function values of the first preset number of verification data are all less than the second preset value. Wherein, the first preset number is greater than the second preset number.
[0069] In one embodiment, Figure 2 As shown, the processor can train the fault diagnosis language model. Specifically, the processor can train the fault diagnosis language model through the historical working condition data of the engineering machinery, and determine the first objective function L of the trained fault diagnosis language model. lm =-∑logP(X i+1 |{X1, X2, X3, …, X i}), where log represents the logarithmic function, P(X i+1 |{X1, X2, X3, …, X i} represents the probability of occurrence of the i+1th historical operating condition data, X i represents the i-th historical operating condition data. After obtaining the trained fault diagnosis language model, the processor can determine the fault data and fault solutions corresponding to each fault type in the historical operating condition data. For any fault type, the processor can prompt the fault data of that fault type and perform prompt training on the trained fault diagnosis language model based on the prompted fault data.
[0070] Specifically, the processor can input the prompted fault data into the trained fault diagnosis language model to output at least two fault solutions through the trained fault diagnosis language model. After performing prompt training on the trained fault diagnosis language model, the processor can perform fault diagnosis reward model training on the prompted fault diagnosis language model.
[0071] Specifically, the processor can determine any two fault solutions output by the trained fault diagnosis language model as a sample data. The processor can select a first number of sample data as training data and a second number of sample data as validation data from the sample data. The processor can input each training data to the fault diagnosis reward model in turn to train the fault diagnosis reward model. The processor can input each validation data to the fault diagnosis reward model to output a score of the ability of each validation data to solve the fault type through the fault diagnosis reward model, wherein the score includes a high score and a low score. The processor can input the score of each validation data to the objective function of the fault diagnosis reward model to output a function value corresponding to each validation data through the fault diagnosis reward model. Wherein, the expression of the objective function of the reward model is shown in formula (1):
[0072]
[0073] Wherein, L rm represents the objective function of the reward model, represents the first historical solution in the first validation data, represents the second historical solution in the first validation data, and n represents the number of validation data, represents the third score of the first historical solution in the first validation data, represents the fourth score of the second historical solution in the first validation data, represents the standardization function of the third score and the fourth score, and log represents the logarithmic function.
[0074] After obtaining the function value, the processor can determine whether the function value corresponding to each validation data is less than a second preset value. In the case that the function values of the first preset number of validation data are all less than the second preset value, the processor can determine the reward model as a trained reward model. In the case that the second preset number of function values are greater than the second preset value, the processor can return to the step of selecting a first number of second sample data as training data and a second number of second sample data as validation data from a plurality of second sample data, until the function values of the first preset number of validation data are all less than the second preset value. Wherein, the first preset number is greater than the second preset number.
[0075] After the fault diagnosis reward model is trained, the processor can determine any two fault solutions output by the fault diagnosis language model as a sample data, and input each sample data to the trained fault diagnosis reward model for diagnosis model reinforcement learning training.
[0076] For example, for any type of fault, the processor can input a plurality of sample data to the trained fault diagnosis reward model to output, by the trained fault diagnosis reward model, a first score and a second score of the ability of each sample data to solve the type of fault. And determine a second objective function according to the first score and the second score, the expression of the second objective function is as shown in formula (2):
[0077] L ppo =e(h new -h old )W advantage (2)
[0078] Wherein, L ppo represents the second objective function, e and W advantage are constants, h new represents the first score, and h old represents the second score.
[0079] The processor can determine the error function of the fault diagnosis language model according to the first objective function l lm and the second objective function L ppo . After obtaining the error function, the processor can input each first fault data of each type of fault to the error function in turn to output the corresponding function value by the error function. In the case where all the function values are less than the first preset value, the processor can determine that the diagnosis model reinforcement learning training is completed.
[0080] The technical solution is as follows: a first objective function of an initial language model is determined, and fault data corresponding to each fault type and a fault solution corresponding to each fault type in historical working condition data are determined; for any fault type, the fault data corresponding to the fault type is converted according to a preset data format to obtain first fault data corresponding to the fault type; the first fault data of each fault type is input into the initial language model, so that at least two first fault solutions are output by the initial language model; for any fault type, any two first fault solutions corresponding to the fault type are determined as a first sample data; for any fault type, the plurality of first sample data included in the fault type are sequentially input into the trained reward model, so that a first score and a second score of the ability of each first sample data to solve the fault type are output by the trained reward model; a second objective function of the initial language model is determined according to all the first scores and the second scores; an error function of the initial language model is determined according to the first objective function and the second objective function; each first fault data of each fault type is sequentially input into the error function, so that a corresponding function value is output by the error function; in the case that all the function values are less than a first preset value, the initial language model is determined as a fault diagnosis language model. By using the technical solution, a fault diagnosis language model with higher precision can be constructed, the fault diagnosis language model has stronger fault diagnosis capability, can better solve fault problems, provide more matched fault solutions, and greatly improves work efficiency.
[0081] Figure 1 A flowchart of a method for constructing a fault diagnosis language model in an embodiment is shown. It should be understood that, although the steps in the flowchart are shown in sequence according to the arrows, the steps are not necessarily executed in sequence according to the arrows. Unless otherwise specified herein, the steps are not strictly limited in sequence, and the steps can be executed in other sequences. Moreover, Figure 1 The steps in the flowchart are not necessarily executed in sequence according to the arrows. Unless otherwise specified herein, the steps are not strictly limited in sequence, and the steps can be executed in other sequences. Moreover, Figure 1 At least part of the steps in the flowchart can include multiple sub-steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of the sub-steps or stages is not necessarily sequential, but can be executed in rotation or alternation with other steps or sub-steps or stages of other steps.
[0082] An embodiment of the present application provides a processor for running a program, wherein the program performs the method for constructing a fault diagnosis language model when running.
[0083] An embodiment of the present application provides an apparatus for constructing a fault diagnosis language model, comprising the processor.
[0084] The embodiment of the present application provides a storage medium, which stores a program, and the program is executed by a processor to realize the method for constructing a fault diagnosis language model.
[0085] In one embodiment, a computer device is provided, which can be a server, and an internal structure diagram of the computer device can be as shown in FIG. 1. Figure 3 The computer device includes a processor A01, a network interface A02, a memory (not shown in the figure) and a database (not shown in the figure) connected through a system bus. The processor A01 of the computer device is used to provide computing and control capabilities. The memory of the computer device includes an internal memory A03 and a non-volatile storage medium A04. The non-volatile storage medium A04 stores an operating system B01, a computer program B02 and a database (not shown in the figure). The internal memory A03 provides an environment for running the operating system B01 and the computer program B02 in the non-volatile storage medium A04. The database of the computer device is used to store historical working condition data, fault data and fault solution data. The network interface A02 of the computer device is used to communicate with an external terminal through network connection. The computer program B02 is executed by the processor A01 to realize a method for constructing a fault diagnosis language model.
[0086] Those skilled in the art can understand that Figure 3 The structure shown in FIG. 1 is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. Specifically, the computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0087] The embodiment of the application provides a device, the device comprises a processor, a memory and a program stored on the memory and executable on the processor, and the processor implements the following steps when executing the program: determining a first objective function of an initial language model, the initial language model being trained based on historical working condition data of the engineering machinery; determining fault data corresponding to each fault type and a fault solution corresponding to each fault type in the historical working condition data; for any fault type, converting the fault data corresponding to the fault type according to a preset data format to obtain first fault data corresponding to the fault type; inputting the first fault data of each fault type into the initial language model respectively to output at least two first fault solutions through the initial language model; for any fault type, determining any two first fault solutions corresponding to the fault type as a first sample data; for any fault type, inputting a plurality of first sample data included in the fault type into the trained reward model in sequence to output a first score and a second score of the ability of each first sample data to solve the fault type through the trained reward model; determining a second objective function of the initial language model according to all the first scores and the second scores; determining an error function of the initial language model according to the first objective function and the second objective function; inputting each first fault data of each fault type into the error function in sequence to output a corresponding function value through the error function; and determining the initial language model as a fault diagnosis language model in the case that all the function values are less than a first preset value.
[0088] In one embodiment, the method further comprises: after determining the initial language model as the fault diagnosis language model, obtaining working condition data of the engineering machinery at a current time, and determining fault data corresponding to each fault type at the current time in the working condition data at the current time; converting the fault data corresponding to each fault type at the current time according to the preset data format to obtain second fault data corresponding to each fault type at the current time; inputting the second fault data of each fault type at the current time into the fault diagnosis language model respectively to output corresponding second fault solutions through the fault diagnosis language model.
[0089] In one embodiment, the method further comprises: for any fault type at the current time, after outputting the second fault solution corresponding to the fault type at the current time through the fault diagnosis language model, sending the second fault solution to a client for display.
[0090] In one embodiment, the method further includes: obtaining a plurality of second sample data, wherein each second sample data includes a first historical solution and a second historical solution for solving any one type of fault, and the ability of the first historical solution to solve the fault type is greater than that of the second historical solution; and sequentially inputting the plurality of second sample data into the reward model to train the reward model.
[0091] In one embodiment, the method also includes: selecting a first number of second sample data from multiple second sample data as training data, and selecting a second number of second sample data as verification data; inputting each training data into the reward model in turn to train the reward model; inputting each verification data into the reward model in turn to output a third score and a fourth score corresponding to each verification data through the reward model; inputting the third score and the fourth score of each verification data into the objective function of the reward model to output a function value corresponding to each verification data through the objective function of the reward model; when the function values of the first preset number of verification data are all less than the second preset value, determining the reward model as a reward model that has completed training; when the function values of the second preset number of verification data are greater than the second preset value, returning to the step of selecting the first number of second sample data from multiple second sample data as training data and selecting the second number of second sample data as verification data, until the function values of the first preset number of verification data are all less than the second preset value, wherein the first preset number is greater than the second preset number.
[0092] In one embodiment, the objective function of the reward model is expressed as formula (1):
[0093]
[0094] Among them, L rm represents the objective function of the reward model, represents the first historical solution in the first validation data, represents the second historical solution in the first validation data, n represents the number of validation data, represents the third score of the first historical solution in the first validation data, represents the fourth score of the second historical solution in the first validation data, represents the normalization function of the third score and the fourth score, and log represents the logarithmic function.
[0095] In one embodiment, the expression of the second objective function is shown in formula (2):
[0096] L ppo =e(h new -h old )Wadvantage (2)
[0097] wherein L ppo represents a second objective function, e and W advantage are constants, h new represents a first score, h old represents a second score.
[0098] The application also provides a computer program product adapted to perform the steps of a method for building a failure diagnosis language model when executed on a data processing device.
[0099] Those skilled in the art will appreciate that embodiments of the application can be supplied as methods, systems, or computer program products. Accordingly, the application can be embodied in the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the application can be embodied in the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk memory, CD-ROMs, optical storage media, etc.) having computer usable program code embodied therein.
[0100] The application is described herein with reference to the flowchart and / or block diagrams of the methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each block of the flowchart and / or block diagrams, and combinations of blocks in the flowchart and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processing element or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart and / or block diagram block or blocks. Figure 1 The flowchart and / or block diagrams can also be implemented by one or more of the following: Figure 1 Means for performing the function specified by one or more of the flowchart or block diagrams blocks.
[0101] These computer program instructions can also be stored in a computer- readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the flowchart and / or block diagram block or blocks. Figure 1 The flowchart and / or block diagrams can also be implemented by one or more of the following: Figure 1 Means for performing the function specified by one or more of the flowchart or block diagrams blocks.
[0102] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the flowchart and / or block diagram block or blocks. Figure 1one or more processes and / or blocks Figure 1 steps of a function specified in one or more blocks.
[0103] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0104] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) about which the computer stores information about an operating system. Memory is an example of computer readable media.
[0105] Computer readable media includes permanent and non-permanent, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital versatile disc (DVD), or other optical storage, magnetic cassette, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer readable media does not include transitory media such as modulated data signals and carrier waves.
[0106] It should also be noted that the terms "comprising", "containing", or any other variant thereof are intended to cover a non-exclusive inclusion, such that a process, method, article or apparatus that comprises a list of elements does not only include those elements, but can also include other elements not expressly listed or inherent to such process, method, article or apparatus. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.
[0107] The above merely provides examples of the present application and is not intended to limit the present application. The present application can have various modifications and changes for those skilled in the art. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of the present application shall be included in the scope of claims of the present application.
Claims
1. A method for constructing a fault diagnosis language model, characterized in that: The method comprises: Determining a first objective function of an initial language model, wherein the initial language model is trained based on historical operating condition data of the construction machinery; Determining fault data corresponding to each fault type and a fault solution corresponding to each fault type in the historical operating condition data; For any fault type, converting the fault data corresponding to the fault type according to a preset data format to obtain first fault data corresponding to the fault type; inputting first fault data of each fault type into the initial language model respectively, so as to output at least two first fault solutions through the initial language model; For any fault type, determining any two first fault solutions corresponding to the fault type as a first sample data; Acquire a plurality of second sample data, wherein each second sample data includes a first historical solution and a second historical solution for solving any one type of fault, and the capability of the first historical solution for solving the type of fault is greater than that of the second historical solution; sequentially inputting the plurality of second sample data into a reward model to train the reward model; For any fault type, sequentially input a plurality of first sample data included in the fault type into the trained reward model, so that the trained reward model outputs a first score and a second score of each first sample data's ability to resolve the fault type; determining a second objective function of the initial language model according to all the first scores and the second scores; Determining an error function of the initial language model according to the first objective function and the second objective function; sequentially inputting each first fault data of each fault type into the error function so as to output a corresponding function value through the error function; When all function values are smaller than a first preset value, the initial language model is determined as the fault diagnosis language model.
2. The method for constructing a fault diagnosis language model according to claim 1, characterized in that: The method further comprises: After determining the initial language model as the fault diagnosis language model, obtaining operating condition data of the engineering machinery at a current moment, and determining fault data corresponding to each fault type at the current moment in the operating condition data at the current moment; Converting the fault data corresponding to each fault type at the current moment according to the preset data format to obtain second fault data corresponding to each fault type at the current moment; The second fault data of each fault type at the current moment is respectively input into the fault diagnosis language model, so as to output a corresponding second fault solution through the fault diagnosis language model.
3. The method for constructing a fault diagnosis language model according to claim 2, characterized in that: The method further comprises: For any of the fault types at the current moment, after the second fault solution corresponding to the fault type at the current moment is output through the fault diagnosis language model, the second fault solution is sent to the client for display.
4. The method for constructing a fault diagnosis language model according to claim 1, wherein: The method further comprises: Selecting a first amount of second sample data from the plurality of second sample data as training data, and selecting a second amount of second sample data as verification data; Inputting each training data into the reward model in sequence to train the reward model; Inputting each verification data into the reward model in sequence, so as to output a third score and a fourth score corresponding to each verification data through the reward model; Inputting the third score and the fourth score of each verification data into the objective function of the reward model, so as to output a function value corresponding to each verification data through the objective function of the reward model; When the function values of the first preset number of verification data are all less than the second preset value, determining the reward model as the trained reward model; When the function value of the second preset number of verification data is greater than the second preset value, return to the step of selecting the first number of second sample data from the multiple second sample data as training data and selecting the second number of second sample data as verification data until the function values of the first preset number of verification data are all less than the second preset value, wherein the first preset number is greater than the second preset number.
5. The method for constructing a fault diagnosis language model according to claim 4, characterized in that: The objective function of the reward model is expressed as formula (1): in, represents the objective function of the reward model, represents the first historical solution in the first validation data, represents the second historical solution in the first validation data, n represents the number of validation data, represents the third score of the first historical solution in the first validation data, represents the fourth score of the second historical solution in the first validation data, represents the normalization function of the third and fourth scores, Represents a logarithmic function.
6. The method for constructing a fault diagnosis language model according to claim 1, wherein: The expression of the second objective function is shown in formula (2): in, Denotes the second objective function, e and are all constants, represents the first score, represents the second score.
7. A processor, characterized in that: The method is configured to execute the method for constructing a fault diagnosis language model according to any one of claims 1 to 6.
8. A device for constructing a fault diagnosis language model, characterized in that: The apparatus comprises a processor according to claim 7.
9. A machine-readable storage medium having instructions stored thereon, characterized in that: When the instruction is executed by a processor, the processor is configured to execute the method for constructing a fault diagnosis language model according to any one of claims 1 to 6.
Citation Information
Patent Citations
Reinforcement learning-based power grid regulation and control strategy optimization method
CN113988508A
Method and device for determining engineering machinery fault solution
CN114020882A