Parameter synchronization method and device for large model, equipment and medium
By generating differential files in the central storage service and merging them on the client, the efficiency of large-scale model parameter synchronization is achieved, and the problem of large-scale model parameter synchronization time and resource consumption is solved, reducing the cost of model migration.
Patent Information
- Application Number
- CN202411261537.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-09
- Publication Date
- 2024-12-27
AI Technical Summary
Synchronization of large model parameters requires copying the complete large model parameters, resulting in large consumption of time and disk resources, increasing the cost of model migration.
Generate the difference files of the first and second model in the central storage service, and send the difference files and synchronization commands to the client. The client merges the difference files with the local stored parameters and reloads the big model service.
It reduces the time and disk resource consumption required for synchronization of large model parameters, and reduces the cost of model migration.
Smart Images

Figure CN119211260A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, especially to technical fields such as machine learning and deep learning, and can be used in application scenarios such as generative search, intelligent document editing, intelligent assistants, virtual assistants, and intelligent e-commerce. It specifically relates to a parameter synchronization method for large models, a parameter synchronization device for large models, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] Artificial intelligence is a discipline that studies how to use computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.). It includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include natural language processing technology, computer vision technology, speech recognition technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.
[0003] The methods described in this section are not necessarily methods that have been previously conceived or employed. Unless otherwise indicated, it should not be assumed that any method described in this section is considered to be prior art simply because it is included in this section. Similarly, unless otherwise indicated, the issues mentioned in this section should not be considered to have been recognized in any prior art. Summary of the invention
[0004] The present disclosure provides a parameter synchronization method for a large model, a parameter synchronization device for a large model, an electronic device, a computer-readable storage medium, and a computer program product.
[0005] According to one aspect of the present disclosure, a parameter synchronization method for a large model is provided. A central storage service stores a first parameter file of a first large model and a second parameter file of a second large model, a client runs a large model service corresponding to the first large model, and the client stores a third parameter file that is the same as the first parameter file. The method includes: generating a difference file between the first parameter file and the second parameter file in the central storage service; and sending the difference file and a synchronization command to the client, the synchronization command instructing the client to complete the synchronization operation, the synchronization operation including: merging the difference file and the third parameter file to obtain a fourth parameter file; and reloading the large model service using the fourth parameter file.
[0006] According to another aspect of the present disclosure, a parameter synchronization method for a large model is provided. A central storage service stores a first parameter file of a first large model and a second parameter file of a second large model, a client runs a large model service corresponding to the first large model, and the client stores a third parameter file that is the same as the first parameter file. The method includes: receiving a difference file and a synchronization command between the first parameter file and the second parameter file from the central storage service; performing a synchronization operation, the synchronization operation including: merging the difference file and the third parameter file to obtain a fourth parameter file; and reloading the large model service using the fourth parameter file.
[0007] According to another aspect of the present disclosure, a parameter synchronization device for a large model is provided. A central storage service stores a first parameter file of a first large model and a second parameter file of a second large model, a client runs a large model service corresponding to the first large model, and the client stores a third parameter file that is the same as the first parameter file. The device includes: a generation unit, configured to generate a difference file of the first parameter file and the second parameter file in the central storage service; and a sending unit, configured to send a difference file and a synchronization command to the client, the synchronization command instructing the client to complete a synchronization operation, the synchronization operation including: merging the difference file and the third parameter file to obtain a fourth parameter file; and reloading the large model service using the fourth parameter file.
[0008] According to another aspect of the present disclosure, a parameter synchronization device for a large model is provided. A central storage service stores a first parameter file of a first large model and a second parameter file of a second large model, a client runs a large model service corresponding to the first large model, and the client stores a third parameter file that is the same as the first parameter file. The device includes: a receiving unit configured to receive a difference file and a synchronization command between the first parameter file and the second parameter file from the central storage service; a synchronization unit configured to: merge the difference file and the third parameter file to obtain a fourth parameter file; and reload the large model service using the fourth parameter file.
[0009] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the above method.
[0010] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the above method.
[0011] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein the computer program implements the above method when executed by a processor.
[0012] According to one or more embodiments of the present disclosure, the present disclosure stores the parameters of the currently running first large model on the client, and stores the parameters of multiple large models in the central storage service. When it is necessary to synchronize the large model parameters of the client with the parameters of the second large model, the central storage service generates a difference file between the first parameter file of the first large model and the second parameter file of the second large model, and sends the difference file and the synchronization command to the client. After receiving the synchronization command, the client merges the parameters of the first large model stored locally with the difference file, obtains the parameters of the second large model and reloads the large model service, so that the client can run the large model service corresponding to the second large model. In the above manner, the time and disk resource consumption required for large model parameter synchronization can be reduced, thereby reducing the model migration cost.
[0013] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0015] Figure 1 A schematic diagram showing an exemplary system in which the various methods described herein may be implemented according to an embodiment of the present disclosure;
[0016] Figure 2 A flow chart of a parameter synchronization method for a large model according to an embodiment of the present disclosure is shown;
[0017] Figure 3 A flowchart of generating a difference file between a first parameter file and a second parameter file in a central storage service according to an embodiment of the present disclosure is shown;
[0018] Figure 4 A schematic diagram showing a large model structure according to an exemplary embodiment of the present disclosure;
[0019] Figure 5 A flowchart of comparing a first parameter subfile with a second parameter subfile to obtain a difference subfile according to an embodiment of the present disclosure is shown;
[0020] Figure 6 A flow chart of merging a difference file and a third parameter file to obtain a fourth parameter file according to an embodiment of the present disclosure is shown;
[0021] Figure 7 A flow chart of a parameter synchronization method for a large model according to an embodiment of the present disclosure is shown;
[0022] Figure 8 A structural block diagram of a parameter synchronization device for a large model according to an embodiment of the present disclosure is shown;
[0023] Fig. 9 A structural block diagram of a parameter synchronization device for a large model according to an embodiment of the present disclosure is shown; and
[0024] Fig.10 A structural block diagram of an exemplary electronic device that can be used to implement the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0025] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0026] In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, temporal relationship, or importance relationship of these elements, and such terms are only used to distinguish one element from another element. In some examples, the first element and the second element may refer to the same instance of the element, and in some cases, based on the description of the context, they may also refer to different instances.
[0027] The terms used in the description of various examples in this disclosure are only for the purpose of describing specific examples and are not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the element can be one or more. In addition, the term "and / or" used in this disclosure covers any one of the listed items and all possible combinations.
[0028] In the related art, parameter synchronization of a large model requires copying the complete large model parameters. Since the large model parameters occupy a large space, a complete copy requires a lot of time and additional disk space resources.
[0029] In order to solve the above problems, the present invention stores the parameters of the currently running first large model on the client, and stores the parameters of multiple large models in the central storage service. When it is necessary to synchronize the large model parameters of the client with the parameters of the second large model, the central storage service generates a difference file between the first parameter file of the first large model and the second parameter file of the second large model, and sends the difference file and the synchronization command to the client. After receiving the synchronization command, the client merges the parameters of the first large model stored locally with the difference file, obtains the parameters of the second large model and reloads the large model service, so that the client can run the large model service corresponding to the second large model. In the above manner, the time and disk resource consumption required for large model parameter synchronization can be reduced, thereby reducing the model migration cost.
[0030] The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0031] Figure 1 FIG. 1 is a schematic diagram of an exemplary system 100 in which various methods and apparatuses described herein may be implemented according to an embodiment of the present disclosure. Figure 1 , the system 100 includes one or more client devices 101, 102, 103, 104, 105, and 106, a server 120, and one or more communication networks 110 coupling the one or more client devices to the server 120. The client devices 101, 102, 103, 104, 105, and 106 may be configured to execute one or more applications.
[0032] In an embodiment of the present disclosure, the server 120 may run one or more services or software applications that enable execution of the methods of the present disclosure.
[0033] In some embodiments, server 120 may also provide other services or software applications, which may include non-virtualized environments and virtualized environments. In some embodiments, these services may be provided as web-based services or cloud services, such as provided to users of client devices 101, 102, 103, 104, 105, and / or 106 under a software as a service (SaaS) model.
[0034] exist Figure 1 In the configuration shown, the server 120 may include one or more components that implement the functions performed by the server 120. These components may include software components, hardware components, or a combination thereof that can be executed by one or more processors. Users operating client devices 101, 102, 103, 104, 105, and / or 106 may in turn utilize one or more client applications to interact with the server 120 to utilize the services provided by these components. It should be understood that a variety of different system configurations are possible, which may differ from the system 100. Therefore, Figure 1 is one example of a system for implementing the various methods described herein and is not intended to be limiting.
[0035] The user can use client devices 101, 102, 103, 104, 105 and / or 106 to perform human-computer interaction. The client device can provide an interface that enables the user of the client device to interact with the client device. The client device can also output information to the user via the interface. Figure 1 Only six client devices are depicted, but one skilled in the art will appreciate that the present disclosure may support any number of client devices.
[0036] Client devices 101, 102, 103, 104, 105 and / or 106 may include various types of computer devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptop computers), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, game systems, thin clients, various messaging devices, sensors or other sensing devices, etc. These computer devices may run various types and versions of software applications and operating systems, such as MICROSOFT Windows, APPLE iOS, UNIX-like operating systems, Linux or Linux-like operating systems (such as GOOGLE Chrome OS); or include various mobile operating systems, such as MICROSOFT Windows Mobile OS, iOS, Windows Phone, Android. Portable handheld devices may include cellular phones, smart phones, tablet computers, personal digital assistants (PDAs), etc. Wearable devices may include head-mounted displays (such as smart glasses) and other devices. Game systems may include various handheld game devices, Internet-enabled game devices, etc. Client devices are capable of executing various different applications, such as various Internet-related applications, communication applications (such as email applications), short message service (SMS) applications, and may use various communication protocols.
[0037] The network 110 may be any type of network known to those skilled in the art that may support data communications using any of a variety of available protocols, including but not limited to TCP / IP, SNA, IPX, etc. By way of example only, the one or more networks 110 may be a local area network (LAN), an Ethernet-based network, a token ring, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a blockchain network, a public switched telephone network (PSTN), an infrared network, a wireless network (e.g., Bluetooth, WIFI), and / or any combination of these and / or other networks.
[0038] Server 120 may include one or more general purpose computers, dedicated server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. Server 120 may include one or more virtual machines running virtual operating systems, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that may be virtualized to maintain a server's virtual storage device). In various embodiments, server 120 may run one or more services or software applications that provide the functionality described below.
[0039] The computing units in the server 120 may run one or more operating systems including any of the above operating systems and any commercially available server operating systems. The server 120 may also run any of a variety of additional server applications and / or middle-tier applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, etc.
[0040] In some implementations, server 120 may include one or more applications to analyze and consolidate data feeds and / or event updates received from users of client devices 101, 102, 103, 104, 105, and / or 106. Server 120 may also include one or more applications to display data feeds and / or real-time events via one or more display devices of client devices 101, 102, 103, 104, 105, and / or 106.
[0041] In some embodiments, the server 120 may be a server of a distributed system, or a server combined with a blockchain. The server 120 may also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. A cloud server is a host product in a cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private servers (VPS) services.
[0042] The system 100 may also include one or more databases 130. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 130 may be used to store information such as audio files and video files. The databases 130 may reside in various locations. For example, the database used by the server 120 may be local to the server 120, or may be remote from the server 120 and may communicate with the server 120 via a network-based or dedicated connection. The databases 130 may be of different types. In some embodiments, the databases used by the server 120 may be, for example, relational databases. One or more of these databases may store, update, and retrieve data to and from the databases in response to commands.
[0043] In some embodiments, one or more of the databases 130 may also be used by applications to store application data. The databases used by the applications may be different types of databases, such as a key-value store, an object store, or a conventional store backed by a file system.
[0044] Figure 1 The system 100 may be configured and operated in various ways to enable the application of various methods and apparatuses described in the present disclosure.
[0045] According to one aspect of the present disclosure, a parameter synchronization method for a large model is provided. A central storage service stores a first parameter file of a first large model and a second parameter file of a second large model, a client runs a large model service corresponding to the first large model, and the client stores a third parameter file that is the same as the first parameter file. The method can be executed by the central storage service. Figure 2 As shown, the method includes: step S201, generating a difference file between a first parameter file and a second parameter file in a central storage service; and step S202, sending the difference file and a synchronization command to a client, the synchronization command instructing the client to complete the synchronization operation. The synchronization operation includes: step S203, merging the difference file and the third parameter file to obtain a fourth parameter file; and step S204, reloading the large model service using the fourth parameter file.
[0046] Since the parameter files of large models are often large, directly copying them from the central storage service to the client consumes a lot of time, network, and hard disk resources. Therefore, the above method can reduce the time and disk resource consumption required for large model parameter synchronization, thereby reducing the cost of model migration.
[0047] The central storage service may be, for example, the server 120, or may be provided by the server 120. The client may be, for example, the client devices 101, 102, 103, 104, 105 and / or 106.
[0048] In some embodiments, a user of a client can use a console to trigger a parameter synchronization method for a large model. The console can be, for example, a web page console. A plurality of large models can be stored in the central storage service, and the user can select the large model (i.e., the second large model) that he or she wishes to migrate in the console according to the needs. In addition, the console and the central storage service can serve multiple users and corresponding clients at the same time.
[0049] In step S201, the central storage service may generate a difference file between the first parameter file and the second parameter file in various ways.
[0050] In some embodiments, the common large model file uses the .bin format to save the model, but this format is unreadable. Therefore, it can be converted into a readable format (such as .onnx format) through a format conversion tool, so that the names of each field in the large model file are readable. In some embodiments, after converting to the .onnx format, it is also read into memory, so the SerializeToString method can be called to convert it to json format and save it on disk, called .onnx.json, and then it is used as a parameter file and used to generate a difference file or for merging.
[0051] In step S202, the central storage service sends a difference file and a synchronization command to the client. The synchronization command is used to instruct the client to complete the synchronization operation, that is, to synchronize the third parameter file of the first large model stored on the client with the fourth parameter file of the second large model, and reload the large model service using the fourth parameter file. It can be understood that steps S203 and S204 can be sub-steps of step S202.
[0052] In step S203, the client may merge the difference file and the third parameter file in various ways to obtain a fourth parameter file of the second largest model.
[0053] In step S204, after obtaining the fourth parameter file, it is used to complete the restart of the large model service.
[0054] In some embodiments, when restarting the big model service, a restart command can be issued to the big model service, and the big model service will remove its own registration information from the name service, indicating that the service is unavailable, and then the big model executes a restart command, which includes a combination of stop and start commands, and then the service will reload the big model service. After the big model service is successfully restarted, the registration information of the big model service itself is reported to the name service again, indicating that the service is currently available.
[0055] According to some embodiments, Figure 3 As shown, step S201, generating a difference file of the first parameter file and the second parameter file in the central storage service may include: step S301, performing a split operation on the first parameter file and the second parameter file according to the file keyword to obtain multiple first parameter sub-files and multiple second parameter sub-files, wherein the multiple first parameter sub-files and the multiple second parameter sub-files correspond one to one; and step S302, comparing each first parameter sub-file in the multiple first parameter sub-files with the corresponding second parameter sub-file to obtain multiple difference sub-files, wherein the difference file includes the multiple difference sub-files.
[0056] Therefore, by splitting the parameter file of a large model into multiple small files according to the file keywords, the content in each sub-file is more concentrated, so that a more detailed comparison of local differences in model parameters can be made. This helps to avoid unnecessary complexity caused by global comparison and improves the accuracy of difference file generation.
[0057] The parameter files of different large models stored in the central storage service may include multiple components, for example, an input array, an output array, a node array, and a weight array. In some embodiments, the first three parts are usually only extracted without comparison. For the weight array of the fourth part, it can be divided into multiple small files according to the file keywords in the parameter file of the large model, and then compared one by one. In this way, it is possible to avoid comparing the same content in different parameter files, and instead focus on the difference content in the weight array part, thereby improving the efficiency of difference file generation.
[0058] According to some embodiments, the file keyword may include the data type data_type and the original weight data raw_data of the weight array, the first parameter file, the second parameter file, and the third parameter file may each include a corresponding weight array, and the weight array may include multiple substructures, each of which may include a field corresponding to the data type and a field corresponding to the original weight data. In other words, in each parameter file, multiple substructures may be included, each of which corresponds to a set of weights. In each substructure, a field representing the data type of the substructure (corresponding set of weights) and a field representing the original weight data of the corresponding set of weights may be included.
[0059] In an exemplary embodiment, Figure 4A schematic diagram of a large model structure according to an exemplary embodiment of the present disclosure is shown. The large model structure includes an input (input), a first convolutional layer (Conv), a first rectified linear unit (Relu), a maximum pooling layer (MaxPool), a second convolutional layer (Conv), a second rectified linear unit (Relu), and an output (Output). The weight array in the parameter file of the large model can have the following form:
[0060] [dims:64
[0061] Dims:3
[0062] Dims:3
[0063] Dims:3
[0064] data_type:1
[0065] name:"23"
[0066] raw_data:"..."
[0067] Dims:64
[0068] data_type:1
[0069] name:"24"
[0070] raw_data:"..."
[0071] Dims:32
[0072] Dims:64
[0073] Dims:3
[0074] Dims:3
[0075] data_type:1
[0076] name:"26"
[0077] raw_data:"..." ]
[0079] The above weight array example includes three substructures, each having a field corresponding to the data type (data_type) and a field corresponding to the raw weight data (raw_data).
[0080] In some embodiments, the segmentation operation may include: identifying multiple substructures in the parameter file to be segmented based on the file keyword; and segmenting the multiple substructures according to a preset number to obtain multiple parameter subfiles, wherein each parameter subfile includes at least one substructure.
[0081] By identifying such fields in the parameter file, it is possible to locate multiple substructures of the weight array describing the model in the parameter file, and then segment them to obtain corresponding parameter subfiles.
[0082] In an exemplary embodiment, the data type (data_type) can be divided into small files according to the number of data_types, that is, every 100 data_type substructures are divided into a small file. If there are 1000 data_type structures in total, 10 parameter subfiles will be generated.
[0083] According to some embodiments, the first parameter file, the second parameter file, and the third parameter file may all include the same input array, output array, and node array. In other words, the multiple large models stored in the central storage service all have the same input and output structure and model structure. Therefore, these parts may be skipped when generating a difference file or performing a split operation.
[0084] The file keywords may also include other file keywords for identifying input arrays, output arrays, and node arrays.
[0085] In an exemplary embodiment, Figure 4 The input array in the parameter file for the large model shown can have the following form:
[0086]
[0087]
[0088] The output array can have the following forms:
[0089] These two parts can be considered fixed and are uniquely identified by the two fields (file keywords) name:input and name:output. Both file keywords are keywords that describe the name.
[0090] The node array contains all the computing nodes in the large model ( Figure 4 "Conv_0", "Relu_1", "MaxPool_2", "Conv_3", "Relu_4") in the corresponding embodiment, as well as the attributes of each node, for example, can be:
[0091] [input:"input"
[0092] input:"23"
[0093] input:"24"
[0094] output:"22"
[0095] name:"Conv_0"
[0096] op_type:"Conv"
[0097] attribute{
[0098] …
[0099] }
[0100] ,
[0101] input:"22"
[0102] output:"17"
[0103] name:"Relu_1"
[0104] op_type:"Relu"
[0105] ,
[0106] input:"17"
[0107] output:"18"
[0108] name:"MaxPool_2"
[0109] op_type:"MaxPool"
[0110] attribute{
[0111] …
[0112] }
[0113] ,
[0114] input:"18"
[0115] input:"26"
[0116] input:"27"
[0117] output:"25"
[0118] name:"Conv_3"
[0119] op_type:"Conv"
[0120] attribute{
[0121] …
[0122] }
[0123] ,
[0124] input:"25"
[0125] output:"output"
[0126] name:"Relu_4"
[0127] op_type:"Relu" ]
[0129] The node array can be uniquely identified by the input:input field (file keyword), which is usually unchanged. The file keyword is the keyword describing the input.
[0130] The splitting operation may include: identifying an input array, an output array, and a node array in the parameter file to be split based on other file keywords; and skipping the input array, the output array, and the node array.
[0131] According to some embodiments, Figure 5 As shown, step S302, comparing each first parameter subfile in a plurality of first parameter subfiles with the corresponding second parameter subfile to obtain a plurality of difference subfiles includes: step S501, for each first parameter subfile in a plurality of first parameter subfiles, extracting a field corresponding to the original weight data from at least one substructure in the first parameter subfile to obtain first weight data; step S502, extracting a field corresponding to the original weight data from at least one substructure in the second parameter subfile corresponding to the first parameter subfile to obtain second weight data; and step S503, comparing the first weight data with the second weight data to obtain a difference subfile corresponding to the first parameter subfile.
[0132] In some embodiments, since the multiple large models stored in the central storage service have the same input and output structure and model structure, when generating difference sub-files, the fields corresponding to the original weight data can be extracted and compared, thereby further improving the efficiency of the difference file generation process and reducing the size of the difference files.
[0133] According to some embodiments, in step S302, each of the plurality of first parameter subfiles may be compared with the corresponding second parameter subfile to obtain a plurality of difference subfiles and a variable data file. The difference file may include the plurality of difference subfiles and the variable data file, and the variable data file may indicate the unchanged start and end line numbers in the plurality of first parameter subfiles.
[0134] Variable data files (mutable files) can be used to record data ranges that do not need to be changed during data comparison and file merging, so as to optimize subsequent transmission and processing processes.
[0135] According to some embodiments, Figure 6 As shown, step S203, merging the difference file and the third parameter file to obtain the fourth parameter file may include: step S601, performing a segmentation operation on the third parameter file according to the file keyword to obtain multiple third parameter sub-files, wherein the multiple third parameter sub-files correspond to the multiple first parameter sub-files one-to-one; and step S602, merging each third parameter sub-file in the multiple third parameter sub-files and the corresponding difference sub-file to obtain multiple fourth parameter sub-files, wherein the fourth parameter file includes multiple fourth parameter sub-files.
[0136] After sending the difference file to the client, the client can split the local large model parameter file into several small files according to the same file keyword, combine each small file with the transmitted difference file, and then splice the several small files into a large model parameter file, that is, the large model (the second largest model) that is expected to be synchronized.
[0137] According to another aspect of the present disclosure, a parameter synchronization method for a large model is provided. A central storage service stores a first parameter file of a first large model and a second parameter file of a second large model, a client runs a large model service corresponding to the first large model, and the client stores a third parameter file that is the same as the first parameter file. The method can be executed by the client. Figure 7 As shown, the method includes: step S701, receiving a difference file and a synchronization command between a first parameter file and a second parameter file from a central storage service; step S702, performing a synchronization operation, the synchronization operation including: step S703, merging the difference file and the third parameter file to obtain a fourth parameter file; and step S704, reloading the large model service using the fourth parameter file.
[0138] Understandably, Figure 7 The operations and effects of steps S601 to S604 in the Figure 2 Steps S201 to S204 in the embodiment are not described in detail here. In addition, steps S703 and S704 can be sub-steps of step S702.
[0139] According to some embodiments, the difference file can be obtained by performing the following operations in the central storage service: performing a splitting operation on the first parameter file and the second parameter file according to the file keywords respectively to obtain multiple first parameter sub-files and multiple second parameter sub-files, wherein the multiple first parameter sub-files and the multiple second parameter sub-files correspond one to one; and comparing each first parameter sub-file in the multiple first parameter sub-files with the corresponding second parameter sub-file to obtain multiple difference sub-files, wherein the difference file includes the multiple difference sub-files.
[0140] According to some embodiments, the file keyword may include the data type and the original weight data of the weight array, the first parameter file, the second parameter file, and the third parameter file may each include a corresponding weight array, the weight array may include multiple substructures, and each substructure may include a field corresponding to the data type and a field corresponding to the original weight data. The segmentation operation may include: based on the file keyword, identifying multiple substructures in the parameter file to be segmented; and segmenting the multiple substructures according to a preset number to obtain multiple parameter subfiles, wherein each parameter subfile includes at least one substructure.
[0141] According to some embodiments, the first parameter file, the second parameter file, and the third parameter file may all include the same input array, output array, and node array.
[0142] According to some embodiments, comparing each first parameter subfile in a plurality of first parameter subfiles with the corresponding second parameter subfile to obtain a plurality of difference subfiles may include: for each first parameter subfile in the plurality of first parameter subfiles, extracting a field corresponding to original weight data from at least one substructure in the first parameter subfile to obtain first weight data; extracting a field corresponding to the original weight data from at least one substructure in the second parameter subfile corresponding to the first parameter subfile to obtain second weight data; and comparing the first weight data and the second weight data to obtain a difference subfile corresponding to the first parameter subfile.
[0143] According to some embodiments, by comparing each first parameter subfile in a plurality of first parameter subfiles with the corresponding second parameter subfile, a plurality of difference subfiles and a variable data file may be obtained. The difference file may include the plurality of difference subfiles and the variable data file. The variable data file may indicate the unchanged starting and ending line numbers in the plurality of first parameter subfiles.
[0144] According to some embodiments, merging the difference file and the third parameter file to obtain a fourth parameter file may include: performing a segmentation operation on the third parameter file according to the file keyword to obtain multiple third parameter sub-files, wherein the multiple third parameter sub-files correspond one-to-one to the multiple first parameter sub-files; and merging each third parameter sub-file in the multiple third parameter sub-files with the corresponding difference sub-file to obtain multiple fourth parameter sub-files, wherein the fourth parameter file includes the multiple fourth parameter sub-files.
[0145] According to another aspect of the present disclosure, a parameter synchronization device for a large model is provided. A central storage service stores a first parameter file of a first large model and a second parameter file of a second large model, a client runs a large model service corresponding to the first large model, and the client stores a third parameter file that is the same as the first parameter file. The device can be used for the central storage service. Figure 8 As shown, the device 800 includes: a generating unit 810, configured to generate a difference file between a first parameter file and a second parameter file in a central storage service; and a sending unit 820, configured to send a difference file and a synchronization command to a client, the synchronization command instructing the client to complete a synchronization operation, the synchronization operation including: merging the difference file and the third parameter file to obtain a fourth parameter file; and reloading the large model service using the fourth parameter file.
[0146] It is understood that the operations and effects of the units 810 to 820 in the device 800 can be referred to as Figure 2 Steps S201-S202 in are not described in detail here.
[0147] According to another aspect of the present disclosure, a parameter synchronization device for a large model is provided. A central storage service stores a first parameter file of a first large model and a second parameter file of a second large model, a client runs a large model service corresponding to the first large model, and the client stores a third parameter file that is the same as the first parameter file. The device can be used for a client. Fig. 9 As shown, the device 900 includes: a receiving unit 910, configured to receive a difference file and a synchronization command between a first parameter file and a second parameter file from a central storage service; a synchronization unit 920, configured to: merge the difference file and the third parameter file to obtain a fourth parameter file; and reload the large model service using the fourth parameter file.
[0148] It is understood that the operations and effects of the units 810 to 820 in the device 800 can be referred to as Figure 7 Steps S701-S702 in are not described in detail here.
[0149] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0150] According to an embodiment of the present disclosure, an electronic device, a readable storage medium and a computer program product are also provided.
[0151] refer to Fig.10 , a block diagram of an electronic device 1000 that can be used as a server or client of the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0152] like Fig.10 As shown, the electronic device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1002 or a computer program loaded from a storage unit 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the electronic device 1000 can also be stored. The computing unit 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0153] Multiple components in the electronic device 1000 are connected to the I / O interface 1005, including: an input unit 1006, an output unit 1007, a storage unit 1008, and a communication unit 1009. The input unit 1006 can be any type of device that can input information to the electronic device 1000. The input unit 1006 can receive input digital or character information, and generate key signal input related to user settings and / or function control of the electronic device, and can include but is not limited to a mouse, a keyboard, a touch screen, a track pad, a track ball, a joystick, a microphone, and / or a remote controller. The output unit 1007 can be any type of device that can present information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 1008 can include but is not limited to a disk and an optical disk. The communication unit 1009 allows the electronic device 1000 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and may include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver and / or a chipset, such as a Bluetooth device, an 802.11 device, a WiFi device, a WiMax device, a cellular communication device and / or the like.
[0154] The computing unit 1001 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1001 performs the various methods, processes, and / or processes described above. For example, in some embodiments, these methods, processes, and / or processes may be implemented as computer software programs, which are tangibly included in machine-readable media, such as storage units 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 1000 via ROM 1002 and / or communication unit 1009. When the computer program is loaded into RAM 1003 and executed by the computing unit 1001, one or more steps of the methods, processes, and / or processes described above may be performed. Alternatively, in other embodiments, the computing unit 1001 may be configured to perform these methods, processes and / or processing in any other suitable manner (eg, by means of firmware).
[0155] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0156] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0157] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0158] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0159] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.
[0160] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0161] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be performed in parallel, sequentially or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document is not limited here.
[0162] Although the embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it should be understood that the above-mentioned methods, systems and devices are merely exemplary embodiments or examples, and the scope of the present invention is not limited by these embodiments or examples, but only by the claims after authorization and their equivalent scope. Various elements in the embodiments or examples can be omitted or replaced by their equivalent elements. In addition, each step can be performed in an order different from that described in the present disclosure. Further, the various elements in the embodiments or examples can be combined in various ways. It is important that with the evolution of technology, many elements described herein can be replaced by equivalent elements that appear after the present disclosure.
Claims
1. A parameter synchronization method for a large model, wherein: The central storage service stores a first parameter file of a first large model and a second parameter file of a second large model, a client runs a large model service corresponding to the first large model, and the client stores a third parameter file that is the same as the first parameter file, and the method includes: generating a difference file between the first parameter file and the second parameter file in the central storage service; and Sending a difference file and a synchronization command to the client, wherein the synchronization command instructs the client to complete a synchronization operation, wherein the synchronization operation includes: Merging the difference file and the third parameter file to obtain a fourth parameter file; The large model service is reloaded using the fourth parameter file.
2. The method according to claim 1, wherein: Generating a difference file between the first parameter file and the second parameter file in the central storage service includes: Performing a splitting operation on the first parameter file and the second parameter file according to the file keywords to obtain a plurality of first parameter sub-files and a plurality of second parameter sub-files, wherein the plurality of first parameter sub-files correspond to the plurality of second parameter sub-files in one-to-one correspondence; and Each first parameter subfile in the plurality of first parameter subfiles is compared with the corresponding second parameter subfile to obtain a plurality of difference subfiles, wherein the difference file includes the plurality of difference subfiles.
3. The method according to claim 2, wherein: The difference file and the third parameter file are combined to obtain a fourth parameter file including: Performing the splitting operation on the third parameter file according to the file keyword to obtain a plurality of third parameter sub-files, wherein the plurality of third parameter sub-files correspond one-to-one to the plurality of first parameter sub-files; and Each third parameter subfile in the plurality of third parameter subfiles is merged with the corresponding difference subfile to obtain a plurality of fourth parameter subfiles, wherein the fourth parameter file includes the plurality of fourth parameter subfiles.
4. The method according to claim 2, wherein: The file keyword includes a data type and original weight data of a weight array, the first parameter file, the second parameter file and the third parameter file each include a corresponding weight array, the weight array includes a plurality of substructures, each substructure includes a field corresponding to the data type and a field corresponding to the original weight data, The segmentation operation includes: Based on the file keyword, identifying a plurality of substructures in the parameter file to be segmented; and The multiple substructures are divided according to a preset number to obtain multiple parameter subfiles, wherein each parameter subfile includes at least one substructure.
5. The method according to claim 4, wherein: Comparing each first parameter subfile in the plurality of first parameter subfiles with the corresponding second parameter subfile to obtain a plurality of difference subfiles includes: For each first parameter subfile in the plurality of first parameter subfiles, extracting a field corresponding to the original weight data from at least one substructure in the first parameter subfile to obtain first weight data; Extracting a field corresponding to the original weight data from at least one substructure in the second parameter subfile corresponding to the first parameter subfile to obtain second weight data; and The first weight data and the second weight data are compared to obtain a difference subfile corresponding to the first parameter subfile.
6. The method according to claim 4, wherein: The first parameter file, the second parameter file and the third parameter file all include the same input array, output array and node array.
7. The method according to claim 2, wherein: Each first parameter subfile in the plurality of first parameter subfiles is compared with the corresponding second parameter subfile to obtain the plurality of difference subfiles and a variable data file, wherein the difference file includes the plurality of difference subfiles and the variable data file, and the variable data file indicates the unchanged starting point and end point row numbers in the plurality of first parameter subfiles.
8. A parameter synchronization method for a large model, wherein: The central storage service stores a first parameter file of a first large model and a second parameter file of a second large model, a client runs a large model service corresponding to the first large model, and the client stores a third parameter file that is the same as the first parameter file, and the method includes: receiving a difference file and a synchronization command between the first parameter file and the second parameter file from the central storage service; Performing a synchronization operation, the synchronization operation comprising: Merging the difference file and the third parameter file to obtain a fourth parameter file; The large model service is reloaded using the fourth parameter file.
9. The method according to claim 8, wherein: The difference file is obtained by performing the following operations on the central storage service: Performing a splitting operation on the first parameter file and the second parameter file according to the file keywords to obtain a plurality of first parameter sub-files and a plurality of second parameter sub-files, wherein the plurality of first parameter sub-files correspond to the plurality of second parameter sub-files in one-to-one correspondence; and Each first parameter subfile in the plurality of first parameter subfiles is compared with the corresponding second parameter subfile to obtain a plurality of difference subfiles, wherein the difference file includes the plurality of difference subfiles.
10. The method according to claim 9, wherein: The difference file and the third parameter file are combined to obtain a fourth parameter file including: Performing the splitting operation on the third parameter file according to the file keyword to obtain a plurality of third parameter sub-files, wherein the plurality of third parameter sub-files correspond one-to-one to the plurality of first parameter sub-files; and Each third parameter subfile in the plurality of third parameter subfiles is merged with the corresponding difference subfile to obtain a plurality of fourth parameter subfiles, wherein the fourth parameter file includes the plurality of fourth parameter subfiles.
11. The method according to claim 9, wherein: The file keyword includes a data type and original weight data of a weight array, the first parameter file, the second parameter file and the third parameter file each include a corresponding weight array, the weight array includes a plurality of substructures, each substructure includes a field corresponding to the data type and a field corresponding to the original weight data, The segmentation operation includes: Based on the file keyword, identifying a plurality of substructures in the parameter file to be segmented; and The multiple substructures are divided according to a preset number to obtain multiple parameter subfiles, wherein each parameter subfile includes at least one substructure.
12. The method according to claim 11, wherein: Comparing each first parameter subfile in the plurality of first parameter subfiles with the corresponding second parameter subfile to obtain a plurality of difference subfiles includes: For each first parameter subfile in the plurality of first parameter subfiles, extracting a field corresponding to the original weight data from at least one substructure in the first parameter subfile to obtain first weight data; Extracting a field corresponding to the original weight data from at least one substructure in the second parameter subfile corresponding to the first parameter subfile to obtain second weight data; and The first weight data and the second weight data are compared to obtain a difference subfile corresponding to the first parameter subfile.
13. The method according to claim 11, wherein: The first parameter file, the second parameter file and the third parameter file all include the same input array, output array and node array.
14. The method according to claim 9, wherein: Each first parameter subfile in the plurality of first parameter subfiles is compared with the corresponding second parameter subfile to obtain the plurality of difference subfiles and a variable data file, wherein the difference file includes the plurality of difference subfiles and the variable data file, and the variable data file indicates the unchanged starting point and end point row numbers in the plurality of first parameter subfiles.
15. A parameter synchronization device for a large model, wherein: The central storage service stores a first parameter file of a first large model and a second parameter file of a second large model, a client runs a large model service corresponding to the first large model, and the client stores a third parameter file that is the same as the first parameter file, and the device includes: A generating unit, configured to generate a difference file between the first parameter file and the second parameter file in the central storage service; and A sending unit is configured to send a difference file and a synchronization command to the client, wherein the synchronization command instructs the client to complete a synchronization operation, and the synchronization operation includes: Merging the difference file and the third parameter file to obtain a fourth parameter file; The large model service is reloaded using the fourth parameter file.
16. A parameter synchronization device for a large model, wherein: The central storage service stores a first parameter file of a first large model and a second parameter file of a second large model, a client runs a large model service corresponding to the first large model, and the client stores a third parameter file that is the same as the first parameter file, and the device includes: A receiving unit, configured to receive a difference file between the first parameter file and the second parameter file and a synchronization command from the central storage service; The synchronization unit is configured as: Merging the difference file and the third parameter file to obtain a fourth parameter file; The large model service is reloaded using the fourth parameter file.
17. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively coupled to the at least one processor; wherein The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.
18. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-7.
19. A computer program product comprising a computer program, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Processing method and device for parameter editing of pre-trained large model
CN120255930A
