Search

CN-115222031-B - Model parameter calling method, device, equipment and readable storage medium

CN115222031BCN 115222031 BCN115222031 BCN 115222031BCN-115222031-B

Abstract

The application discloses a model parameter calling method, a device, equipment and a readable storage medium. In the scheme, the calculation of each parameter scheduling unit of the model is executed serially, the scheme is applied to equipment adopting the model, and when the model executes the calculation of each parameter scheduling unit, the equipment tunes the parameters of all parameter scheduling units of the model stored in a storage memory into a running memory as required. By the scheme, the dynamic multiplexing of the running memory of the device can be realized, the running memory is ensured to store the parameters of the executing target parameter scheduling unit and the parameters of the next parameter scheduling unit adjacent to the target parameter scheduling unit, so that the calculation of the executing target parameter scheduling unit is not influenced, the required parameters are prepared for the target parameter scheduling unit to be executed, and the neural network model with large adaptation model parameter quantity is adapted to the intelligent hardware device with smaller running memory configuration.

Inventors

  • XU RUIYANG
  • LIU CONG

Assignees

  • 科大讯飞股份有限公司

Dates

Publication Date
20260508
Application Date
20220719

Claims (10)

  1. 1. A model parameter calling method is characterized in that the model comprises a plurality of parameter scheduling units, each parameter scheduling unit is obtained by dividing each sub-network of the model by taking the sub-network of the model as a dividing unit, the calculation of each parameter scheduling unit is performed serially, the method is applied to equipment adopting the model, the equipment comprises a storage memory and a running memory, the storage memory stores parameters of all parameter scheduling units of the model, and the method comprises the following steps: And when the calculation of each parameter scheduling unit is executed, the parameters of all the parameter scheduling units of the model stored in the storage memory are scheduled into the running memory as required, so that the parameters of N parameter scheduling units are stored in the running memory, wherein N is an integer greater than or equal to 2, the storage space occupied by the parameters of the N parameter scheduling units is smaller than or equal to the running memory of the equipment, and the parameters of the N parameter scheduling units comprise the parameters of the executing target parameter scheduling unit and the parameters of the next parameter scheduling unit adjacent to the target parameter scheduling unit.
  2. 2. The method of claim 1, wherein prior to performing the calculation of each parameter scheduling unit, the method further comprises: determining each parameter scheduling unit of the model; Initializing the model, storing parameters of all parameter scheduling units of the model into a memory of equipment, and scheduling parameters of the first N parameter scheduling units of the model into an operation memory of the equipment, wherein N is an integer greater than or equal to 2, and the memory space occupied by the parameters of the first N parameter scheduling units is smaller than or equal to the operation memory of the equipment.
  3. 3. The method according to claim 2, wherein the determining each parameter scheduling unit of the model comprises: and taking a plurality of sub-networks of the model as a parameter scheduling unit.
  4. 4. The method according to claim 2, wherein the determining each parameter scheduling unit of the model comprises: a sub-network of the model is used as a parameter scheduling unit.
  5. 5. The method according to any one of claims 1 to 4, wherein the process of performing the calculation of the target parameter scheduling unit comprises: acquiring parameters of the target parameter scheduling unit from an operation memory of the equipment; And executing the calculation of the target parameter scheduling unit based on the parameters of the target parameter scheduling unit, and updating the running memory of the equipment when the parameters of the next parameter scheduling unit adjacent to the target parameter scheduling unit are not in the running memory of the equipment.
  6. 6. The method of claim 5, wherein when the running memory of the device has parameters of 2 parameter scheduling units stored therein, the running memory of the device has parameters of the target parameter scheduling unit and parameters of a previous parameter scheduling unit adjacent to the target parameter scheduling unit; the updating the running memory of the device comprises the following steps: And dispatching the parameters of the next parameter dispatching unit adjacent to the target parameter dispatching unit from the storage memory of the equipment into the running memory of the equipment, and covering the parameters of the last parameter dispatching unit adjacent to the target parameter dispatching unit.
  7. 7. The method of claim 5, wherein when more than 2 parameters of the parameter scheduling unit are stored in the operation memory of the apparatus, the operation memory of the apparatus includes the parameters of the target parameter scheduling unit, and the calculated parameters of the plurality of parameter scheduling units are executed before the target parameter scheduling unit; the updating the running memory of the device comprises the following steps: and dispatching the parameters of the next parameter dispatching unit adjacent to the target parameter dispatching unit into the running memory of the equipment from the storage memory of the equipment, and covering the parameters of the first parameter dispatching unit in at least one parameter dispatching unit which performs calculation before the target parameter dispatching unit.
  8. 8. A model parameter calling device, wherein the model includes a plurality of parameter scheduling units, each parameter scheduling unit is obtained by dividing each sub-network of the model by taking the sub-network of the model as a dividing unit, and calculation of each parameter scheduling unit is executed in series, the device is applied to a device adopting the model, the device includes a storage memory and an operation memory, parameters of all parameter scheduling units of the model are stored in the storage memory, the device includes: And the calculation execution module is used for calling the parameters of all the parameter scheduling units of the model stored in the storage memory into the running memory as required when the calculation of each parameter scheduling unit is executed, so that the parameters of N parameter scheduling units are stored in the running memory, wherein N is an integer greater than or equal to 2, the storage space occupied by the parameters of the N parameter scheduling units is smaller than or equal to the running memory of the equipment, and the parameters of the N parameter scheduling units comprise the parameters of the executing target parameter scheduling unit and the parameters of the next parameter scheduling unit adjacent to the target parameter scheduling unit.
  9. 9. A model parameter calling device, comprising a memory and a processor; the memory is used for storing programs; The processor is configured to execute the program to implement the respective steps of the model parameter calling method according to any one of claims 1 to 7.
  10. 10. A readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the model parameter invoking method according to any of claims 1-7.

Description

Model parameter calling method, device, equipment and readable storage medium Technical Field The present application relates to the field of machine translation technology, and in particular, to a method, an apparatus, a device, and a readable storage medium for calling model parameters. Background With the development of deep learning, more and more intelligent hardware devices can realize a certain service based on a neural network model, for example, some scanning dictionary pens capable of integrating translation functions, intelligent desk lamps and the like can realize translation service based on a machine translation model. Before implementing a service based on a neural network model, model parameters stored in a storage memory of the intelligent hardware device need to be called into a running memory of the intelligent hardware device. At present, a mode of calling all model parameters stored in a storage memory of the intelligent hardware device into an operation memory of the intelligent hardware device at one time is mainly adopted. For neural network models implementing certain services (such as translation services), the promotion of model parameters will obviously promote corresponding service effects, but in some scenarios, due to cost and other aspects, intelligent hardware devices generally operate with smaller memory configurations. Because the configuration of the running memory of the intelligent hardware equipment is smaller, for the neural network model with the model parameter larger than the running memory of the intelligent hardware equipment, the intelligent hardware equipment cannot adapt to the neural network model with the large model parameter because the model parameter stored in the storage memory of the intelligent hardware equipment cannot be fully transferred into the running memory of the intelligent hardware equipment at one time. Therefore, how to provide a model parameter calling method to realize the adaptation of a neural network model with large model parameters on an intelligent hardware device with smaller running memory configuration becomes a technical problem to be solved urgently by those skilled in the art. Disclosure of Invention In view of the above, the present application provides a method, apparatus, device and readable storage medium for calling model parameters. The specific scheme is as follows: a model parameter calling method, the model including a plurality of parameter scheduling units, calculation of each parameter scheduling unit being executed serially, the method being applied to a device employing the model, the device including a storage memory and an operation memory, the storage memory storing parameters of all parameter scheduling units of the model, the method comprising: And when the calculation of each parameter scheduling unit is executed, the parameters of all the parameter scheduling units of the model stored in the storage memory are scheduled into the running memory as required, so that the parameters of N parameter scheduling units are stored in the running memory, wherein N is an integer greater than or equal to 2, the storage space occupied by the parameters of the N parameter scheduling units is smaller than or equal to the running memory of the equipment, and the parameters of the N parameter scheduling units comprise the parameters of the executing target parameter scheduling unit and the parameters of the next parameter scheduling unit adjacent to the target parameter scheduling unit. Optionally, before performing the calculation of the respective parameter scheduling unit, the method further comprises: determining each parameter scheduling unit of the model; Initializing the model, storing parameters of all parameter scheduling units of the model into a memory of equipment, and scheduling parameters of the first N parameter scheduling units of the model into an operation memory of the equipment, wherein N is an integer greater than or equal to 2, and the memory space occupied by the parameters of the first N parameter scheduling units is smaller than or equal to the operation memory of the equipment. Optionally, each parameter scheduling unit of the determining model includes: and taking a plurality of sub-networks of the model as a parameter scheduling unit. Optionally, each parameter scheduling unit of the determining model includes: a sub-network of the model is used as a parameter scheduling unit. Optionally, the process of performing the calculation of the target parameter scheduling unit includes: acquiring parameters of the target parameter scheduling unit from an operation memory of the equipment; And executing the calculation of the target parameter scheduling unit based on the parameters of the target parameter scheduling unit, and updating the running memory of the equipment when the parameters of the next parameter scheduling unit adjacent to the target parameter scheduling unit are not in the running memory