Model weight file distribution method and device, computer program product, host and storage medium

By accessing the host directory when the container is started, and automatically managing the distribution and loading of model weight files, the time-consuming and security problems caused by the binding of model weight files and container images are solved, and the model weight file sharing and security improvement between containers is achieved.

CN120336272AActive Publication Date: 2025-07-18FLYING FOX INFORMATION TECH TIANJIN CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202510829153.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-20
Publication Date
2025-07-18
Estimated Expiration
2045-06-20

AI Technical Summary

Technical Problem

In a container environment, the push and pulling of image files caused by binding to the model weight file and container image takes a long time, and manual storage in the host directory brings workload and security risks.

Method used

By monitoring the working status of the container, it allows it to access the host directory at startup, query and load the model weight files, and use the weight file registry and warehouse management file addresses to achieve automated distribution and loading.

Benefits of technology

Unbound model weight files and container images, reduce the workload of multi-host deployment, improve security, and realize the physical storage of multiple containers that share the same model weight files, and shorten the container startup time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120336272A_ABST
    Figure CN120336272A_ABST
Patent Text Reader

Abstract

The invention provides a model weight file distribution method and device, a computer program product, a host and a storage medium, and relates to the technical field of software, the host monitors the working state of a target container executing a model running task, the working state comprises a starting state, and the target container can access a host directory of the host in the starting state; in response to a first query request which is sent by the target container in the starting state and aims at the target model weight file, querying a target file address of the target model weight file in a host directory; and returning the target file address to the target container, so that the target container loads the target model weight file under the host directory based on the target file address. According to the method, binding between the model weight file and the container mirror image and disk occupation when multiple containers deploy the same model can be removed, automatic loading of the containers on the model weight file under the host directory can be achieved, the workload during multi-host deployment is reduced, and safety is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software technology, and in particular to a method, device, computer program product, host, and storage medium for distributing model weight files. Background Art

[0002] A model weight file is a file used to store model weight parameters. Before a model runs, the model weight parameters need to be filled in its framework for subsequent model inference. In a container environment, there are generally two ways to distribute model weight files:

[0003] The first is the scheme of binding the model weight file to the container image. This requires that when creating the container image, the model weight file needs to be packaged into the image file together. However, due to the extremely large data volume of the model weight file, the process of pushing the image file to the image repository and pulling the image file from the image repository during container deployment takes a long time, resulting in difficult model deployment. In addition, due to the caching mechanism of the container image, once the image content changes slightly, the cache of the image file will become invalid, causing the same content to repeatedly occupy the disk space of the host.

[0004] To solve the problem of binding the model weight file to the container image, the second scheme of storing the model weight file under the host directory is generated. This requires the user to manually transfer the model weight file, which brings a great deal of workload in multi-host deployment. Moreover, due to the need for manual operation, there are unstable factors in container deployment, posing a security risk to the process of running the model in the container. Summary of the Invention

[0005] In view of the above problems, this application provides a method, device, computer program product, host, and storage medium for distributing model weight files to achieve the purpose of automatically distributing model weight files under the host directory. The specific scheme is as follows:

[0006] The first aspect of this application provides a method for distributing model weight files. The method for distributing model weight files is applied to a host, and the method for distributing model weight files includes:

[0007] Monitoring the working state of a target container executing a model running task, where the working state includes a startup state, and the target container can access the host directory of the host in the startup state;

[0008] Responding to a first query request for a target model weight file sent by the target container in the startup state, and querying the target file address of the target model weight file in the host directory;

[0009] Return the target file address to the target container so that the target container loads the target model weight file under the host directory based on the target file address.

[0010] In a possible implementation, the first query request includes a target file identifier for uniquely identifying the target model weight file. Querying the target file address of the target model weight file under the host directory includes:

[0011] Retrieve the weight file registry table, which records the registration information of the downloaded model weight files. The registration information includes at least the file identifier of the model weight file and its file address under the host directory.

[0012] Query the weight file registry table based on the target file identifier.

[0013] If the target file identifier is found in the weight file registry table, use the file address corresponding to the target file identifier as the target file address.

[0014] In a possible implementation, querying the target file address of the target model weight file under the host directory further includes:

[0015] If the target file identifier is not found in the weight file registry table, pull the target model weight file from the weight file repository based on the target file identifier.

[0016] Store the target model weight file under the host directory and use the file address of the target model weight file under the host directory as the target file address.

[0017] Record the target file identifier and the target file address as the registration information of the target model weight file in the weight file registry table.

[0018] In a possible implementation, the registration information further includes the file checksum of the model weight file, and the file checksum corresponds one-to-one with the file identifier of the model weight file.

[0019] Pulling the target model weight file from the weight file repository based on the target file identifier includes:

[0020] Send a second query request containing the target file identifier to the weight file repository so that the weight file repository responds to the second query request and returns the candidate model weight file and its corresponding candidate file checksum.

[0021] Determine the target file check value corresponding to the target file identifier, and compare the target file check value with the candidate file check value;

[0022] If the target file check value is the same as the candidate file check value, use the candidate model weight file as the target model weight file;

[0023] Correspondingly, recording the target file identifier and the target file address as the registration information of the target model weight file into the weight file registration table includes:

[0024] Record the target file identifier, the target file address, and the target file check value into the weight file registration table as the registration information of the target model weight file.

[0025] In a possible implementation, the working state further includes an offline state, the registration information further includes the number of times the model weight file to which it belongs is loaded, and the method for distributing the model weight file further includes:

[0026] After returning the target file address to the target container, query the target load count of the target model weight file in the weight file registration table, and increment the target load count by 1;

[0027] In response to a release request for the target model weight file sent by the target container in the offline state, decrement the target load count by 1.

[0028] In a possible implementation, the method for distributing the model weight file further includes:

[0029] When the target load count meets the corresponding deletion condition, delete the target model weight file in the host directory.

[0030] A second aspect of the present application provides a model weight file distribution device. The model weight file distribution device is applied to a host, and the model weight file distribution device includes:

[0031] A container monitoring module, configured to monitor the working state of a target container executing a model running task. The working state includes a startup state, and the target container can access the host directory of the host in the startup state;

[0032] A file distribution module is used to respond to a first query request for a target model weight file sent by the target container in the startup state, query the target file address of the target model weight file in the host directory; and return the target file address to the target container so that the target container loads the target model weight file in the host directory based on the target file address.

[0033] The third aspect of the present application provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on a host, the host implements the method for distributing model weight files of the above-mentioned first aspect or any implementation of the first aspect.

[0034] A fourth aspect of the present application provides a host, comprising at least one processor and a memory connected to the processor, wherein:

[0035] The memory is used to store computer programs;

[0036] The processor is used to execute the computer program so that the host can implement the distribution method of the model weight file of the above-mentioned first aspect or any implementation manner of the first aspect.

[0037] The fifth aspect of the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by a host, the host can implement the distribution method of the model weight file of the above-mentioned first aspect or any implementation method of the first aspect.

[0038] By means of the above technical scheme, a distribution method, device, computer program product, host and storage medium of a model weight file provided by the present application are applied to the host to monitor the working state of the target container that executes the model running task, the working state includes the startup state, and the target container can access the host directory of the host in the startup state; respond to the first query request for the target model weight file sent by the target container in the startup state, query the target file address of the target model weight file in the host directory; return the target file address to the target container, so that the target container loads the target model weight file in the host directory based on the target file address. In the present application, when the container is started, it can access the host directory, and then query the host for the file address of the required model weight file in the host directory, and finally load the model weight file with the file address. Multiple containers can share the physical storage of the same model weight file, which can not only release the binding of the model weight file and the container image, and the disk occupancy of multiple containers when deploying the same model, but also realize the automatic loading of the model weight file by the container in the host directory, reduce the workload when deploying multiple hosts, and improve security. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In conjunction with the accompanying drawings and with reference to the following specific embodiments, the above and other features, advantages, and aspects of the various embodiments of the present disclosure will become more apparent. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic and that the original elements and elements are not necessarily drawn to scale.

[0040] Figure 1 It is a schematic flowchart of a method for distributing a model weight file provided by an embodiment of the present application;

[0041] Figure 2 It is a partial schematic flowchart of a method for distributing a model weight file provided by an embodiment of the present application;

[0042] Figure 3 It is another partial schematic flowchart of a method for distributing a model weight file provided by an embodiment of the present application;

[0043] Figure 4 It is another partial schematic flowchart of a method for distributing a model weight file provided by an embodiment of the present application;

[0044] Figure 5 It is a schematic structural diagram of a device for distributing a model weight file provided by an embodiment of the present application;

[0045] Figure 6 It is a schematic structural diagram of a host provided by an embodiment of the present application. Specific Embodiments

[0046] The following describes the embodiments of the present application in conjunction with the accompanying drawings in the embodiments of the present application. The terms used in the embodiments of the present application are only used to explain the specific embodiments of the present application and are not intended to limit the present application.

[0047] The following describes the embodiments of the present application in conjunction with the accompanying drawings. Those skilled in the art will know that with the development of technology and the emergence of new scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.

[0048] The terms "first", "second", etc. in the specification, claims, and above-mentioned drawings of the present application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms can be interchanged under appropriate circumstances, which is only a way of distinguishing when describing objects with the same attributes in the embodiments of the present application. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion, so that a process, method, system, product, or device including a series of units does not have to be limited to those units, but may include other units that are not clearly listed or are inherent to these processes, methods, products, or devices.

[0049] See Figure 1 , Figure 1 which is a schematic flowchart of a method for distributing a model weight file provided by an embodiment of the present application. As Figure 1 shown, a method for distributing a model weight file provided by an embodiment of the present application, which is applied to a host, may include steps S101 to S103, and the following will describe these steps in detail respectively.

[0050] S101. Monitor the working state of a target container that executes a model running task. The working state includes a startup state, and the target container can access the host directory of the host in the startup state.

[0051] In an embodiment of the present application, a container is a process isolation environment implemented by an operating system-level virtualization technology. It can share the host kernel but has an independent file system view. Based on the container, file access permission isolation can be achieved. The isolation mechanism of the container is based on Linux namespace isolation and supports read and write permission control for file directories. For a target container that executes a model running task, the host can monitor its working state, such as a creation state, a startup state, a running state, a shutdown state, etc. Before the target container is created, it can mount the host directory of the host. After creation, it first pulls an image file from an image repository. Since the image file is not bound to the model weight file, the target container also needs to load the target model weight file it needs. This requires the target container to be able to access the host directory in the startup state, so as to load the target model weight file under the host directory.

[0052] In an embodiment of the present application, to facilitate sharing of disks between containers running on the same host, it is allowed to mount one or more host directories before a container is created. Multiple containers can mount the same host directory, and the host directory is persistent. The host directory does not change when the container is destroyed or restarted. In an embodiment of the present application, the permission of the container for the host directory is read-only.

[0053] S102. Respond to a first query request for a target model weight file sent by the target container in the startup state, and query the target file address of the target model weight file under the host directory.

[0054] In an embodiment of the present application, the target container can send a query request for a target model weight file (i.e., the first query request) to the host in the startup state. The host responds to the first query request and queries the file address of the target model file under the host directory (i.e., the target file address).

[0055] It should be noted that the target container can query the target file address corresponding to the target model weight file from the host through IPC (Inter Process Communication). When the target container and the host interact through IPC, semaphore, message queue, http (HyperText Transfer Protocol), etc. can be used. Taking http as an example, the host can start http listening on a fixed port, and the container communicates with the host through the http protocol.

[0056] In a possible implementation, the host can perform shared storage management on the model weight file through a unique file identifier. See Figure 2 , Figure 2 which is a partial process schematic diagram of a method for distributing model weight files provided by an embodiment of this application. As Figure 2 shown, in a method for distributing model weight files provided by an embodiment of this application, the first query request includes a target file identifier, and the target file identifier is used to uniquely identify the target model weight file. In this regard, "query the target file address of the target model weight file in the host directory" in step S102 may include steps S201 to S203, and these steps will be described in detail below.

[0057] S201, retrieve the weight file registry, where the registration information of the downloaded model weight files is recorded, and the registration information at least includes the file identifier of the model weight file to which it belongs and its file address in the host directory.

[0058] S202, query the weight file registry based on the target file identifier.

[0059] S203, if the target file identifier is found in the weight file registry, use the file address corresponding to the target file identifier as the target file address.

[0060] In the embodiment of this application, a weight file registry is configured in the host, and the registration information of the model weight files downloaded by the host is recorded in the weight file registry. The registration information at least includes the file identifier of the model weight file to which it belongs and the file address of the model weight file to which it belongs in the host directory. Among them, the file identifier corresponds to the model weight file one by one and is used to uniquely identify the model weight file to which it belongs. For example, the file identifier corresponding to the model weight file can be generated in the way of UUID (Universally Unique Identifier), and the uniqueness is ensured through file SHA verification.

[0061] The host queries the file identifier in the weight file registry based on the target file identifier. If the target file identifier hits the file identifier in the weight file registry, it means that the target file identifier is found in the weight file registry. The file address corresponding to the target file identifier is used as the target file address, that is, the file address in the weight file registry that belongs to the same model weight file as the target file identifier is used as the target file address.

[0062] In a possible implementation, when the target model weight file is missing in the host directory, the host can pull the target model weight file from the weight file repository and update the weight file registry. See Figure 3 , Figure 3 which is another part of the flowchart of a method for distributing model weight files provided by an embodiment of the present application. As Figure 3 shown, for a method for distributing model weight files provided by an embodiment of the present application, in step S102, "query the target file address of the target model weight file in the host directory" may further include steps S301 to S303, which are described in detail below.

[0063] S301, if the target file identifier is not found in the weight file registry, pull the target model weight file from the weight file repository based on the target file identifier.

[0064] S302, store the target model weight file in the host directory, and use the file address of the target model weight file in the host directory as the target file address.

[0065] S303, record the target file identifier and the target file address as the registration information of the target model weight file in the weight file registry.

[0066] In an embodiment of the present application, if the target file identifier does not hit the file identifier in the weight file registry, it means that the target file identifier is not found in the weight file registry. Then the host pulls the target model weight file from the weight file repository based on the target file identifier. It should be noted that the model weight files in the weight file repository are verified content and are trustworthy.

[0067] The host stores the target model weight file in the host directory, uses the file address of the target model file in the host directory as the target file address, and records the target file identifier and the target file address as the registration information of the target model weight file in the weight file registry.

[0068] In a possible implementation, the host can perform security verification on the model weight file fed back by the weight file repository. In this regard, the registration information further includes the file check value of the model weight file to which it belongs, and the file check value corresponds one-to-one with the file identifier of the model weight file to which it belongs. See Figure 4 , Figure 4 which is another part of the flowchart of the method for distributing a model weight file provided by an embodiment of the present application. As Figure 4 shown, in the method for distributing a model weight file provided by an embodiment of the present application, in step S301, "pull the target model weight file from the weight file repository based on the target file identifier" may include steps S401 to S403, and these steps will be described in detail below.

[0069] S401, send a second query request including the target file identifier to the weight file repository, so that the weight file repository responds to the second query request and returns the candidate model weight file and its corresponding candidate file check value.

[0070] S402, determine the target file check value corresponding to the target file identifier, and compare the target file check value with the candidate file check value.

[0071] S403, if the target file check value is the same as the candidate file check value, use the candidate model weight file as the target model weight file.

[0072] Correspondingly, the above step S303, "record the target file identifier and the target file address as the registration information of the target model weight file in the weight file registry", includes:

[0073] Record the target file identifier, the target file address, and the target file check value as the registration information of the target model weight file in the weight file registry.

[0074] In an embodiment of the present application, the host sends a query request (i.e., the second query request) including the target file identifier to the weight file repository. The weight file repository responds to the second query request, queries the model weight files inside it based on the target file identifier, and returns the queried model weight files (i.e., the candidate model weight files). When returning the candidate model weight files, the weight file repository also returns the corresponding file check values (i.e., the candidate file check values).

[0075] The host determines the corresponding file check value based on the target file identifier (i.e., the target file check value). For example, the model file repository and the host can generate file check values (including candidate file check values and target file check values) in the MD5 manner. In this regard, the host can compare the target file check value with the candidate file check value. If the two are the same, it means that the candidate file check value passes the file integrity verification based on MD5. At this time, the candidate model weight file can be used as the target model weight file. On the contrary, if the target file check value is different from the candidate file check value, it means that the candidate file check value fails the file integrity verification based on MD5. At this time, the candidate model weight file can be discarded, and the target model weight file can be obtained from other channels.

[0076] In a possible implementation, a counting mechanism can be introduced to manage the life cycle of the model weight file. In this regard, the working state of the target container further includes a offline state, and the registration information of the model weight file in the weight file registry further includes the number of times the model weight file belongs to is loaded. In this regard, a model weight file distribution method provided by an embodiment of the present application further includes the following steps:

[0077] After returning the target file address to the target container, query the target load count of the target model weight file in the weight file registry, and increment the target load count by 1; in response to a release request for the target model weight file sent by the target container in the offline state, decrement the target load count by 1.

[0078] In an embodiment of the present application, after the host returns the target file address to the target container, it can query the load count of the target model weight file in the weight file registry (i.e., the target load count), and increment the target load count by 1, which means that the number of times the target model weight file is being loaded by the container is increased by 1. After the target container loads the target weight file, it can enter the running state to execute the model running task, and enter the offline state after the model running task is completed.

[0079] The host responds to a release request for the target model weight file sent by the target container in the offline state. At this time, the host can decrement the target load count by 1, which means that the number of times the target model weight file is being loaded by the container is decreased by 1.

[0080] In this way, the number of times the target model weight file is loaded by the container at different times can be tracked, so as to determine the life cycle of the target model file, such as not being loaded, or being loaded by how many containers at the same time, etc.

[0081] On this basis, the target model weight file can be periodically cleaned according to the target load count to release the disk space occupation. In this regard, a model weight file distribution method provided by an embodiment of the present application further includes the following steps:

[0082] When the target loading times meet the corresponding deletion condition, delete the target model weight file in the host directory.

[0083] In the embodiments of the present application, if the target loading times are equal to 0, or the duration when the target loading times are equal to 0 reaches the upper limit, it can be determined that the deletion condition is met, and the target model weight file is deleted in the host directory.

[0084] S103, return the target file address to the target container, so that the target container can load the target model weight file in the host directory based on the target file address.

[0085] In the embodiments of the present application, the host returns the target file address to the target container. The target container can load the target model weight file in the host directory based on the target file address and enter the running state to execute the model running task.

[0086] Through the above description, for a model weight file distribution method provided by the embodiments of the present application, containers on the host can mount the same host directory, and load the model weight file in the host directory by querying the file address from the host. The same model weight file is stored only once in the host, thereby realizing the physical storage of the same model weight file by multiple containers. In addition, since the model weight file can be reused when stored on the host disk without secondary pulling, the container startup time can be shortened. The container time is only prolonged when the model weight file is first pulled by the host for the first time. Since the container image is not bound to the model weight file, the host pulls the container image in the same way as a normal image. In addition, the host can also introduce a counting mechanism to track the life cycle of the model weight file and automatically clean up expired files to release the disk space occupied.

[0087] The above introduces a model weight file distribution method provided by the embodiments of the present application. The following will introduce the device for executing the above model weight file distribution method.

[0088] See Figure 5 , Figure 5 is a schematic structural diagram of a model weight file distribution device provided by the embodiments of the present application. As Figure 5 shown, a model weight file distribution device provided by the embodiments of the present application includes:

[0089] The container monitoring module 501 is used to monitor the working state of the target container executing the model running task. The working state includes the startup state, and the target container can access the host directory of the host in the startup state;

[0090] A file distribution module 502, which is configured to query the target file address of the target model weight file in the host directory in response to a first query request for the target model weight file sent by the target container in the startup state; and return the target file address to the target container, so that the target container can load the target model weight file in the host directory based on the target file address.

[0091] In a possible implementation, the first query request includes a target file identifier, which is used to uniquely identify the target model weight file. The file distribution module 502 for querying the target file address of the target model weight file in the host directory is specifically configured to:

[0092] Retrieve the weight file registry, which records the registration information of the downloaded model weight files. The registration information at least includes the file identifier of the model weight file to which it belongs and its file address in the host directory; query the weight file registry based on the target file identifier; if the target file identifier is found in the weight file registry, use the file address corresponding to the target file identifier as the target file address.

[0093] In a possible implementation, the file distribution module 502 for querying the target file address of the target model weight file in the host directory is further configured to:

[0094] If the target file identifier is not found in the weight file registry, pull the target model weight file from the weight file repository based on the target file identifier; store the target model weight file in the host directory, and use the file address of the target model weight file in the host directory as the target file address; record the target file identifier and the target file address as the registration information of the target model weight file in the weight file registry.

[0095] In a possible implementation, the registration information further includes the file checksum of the model weight file to which it belongs, and the file checksum corresponds one-to-one with the file identifier of the model weight file to which it belongs;

[0096] The file distribution module 502 for pulling the target model weight file from the weight file repository based on the target file identifier is specifically configured to:

[0097] Send a second query request including the target file identifier to the weight file repository, so that the weight file repository responds to the second query request and returns the candidate model weight file and its corresponding candidate file checksum; determine the target file checksum corresponding to the target file identifier, and compare the target file checksum with the candidate file checksum; if the target file checksum is the same as the candidate file checksum, use the candidate model weight file as the target model weight file;

[0098] Correspondingly, the file distribution module 502 that records the target file identifier and the target file address as the registration information of the target model weight file into the weight file registration table is specifically used for:

[0099] Record the target file identifier, the target file address, and the target file check value as the registration information of the target model weight file into the weight file registration table.

[0100] In a possible implementation, the working state further includes an offline state, and the registration information further includes the number of times the weight file of the affiliated model is loaded. The file distribution module 502 is further used for:

[0101] After returning the target file address to the target container, query the target loading times of the target model weight file in the weight file registration table and increment the target loading times by 1; in response to the release request for the target model weight file sent by the target container in the offline state, decrement the target loading times by 1.

[0102] In a possible implementation, the file distribution module 502 is further used for:

[0103] Delete the target model weight file in the host directory when the target loading times meet the corresponding deletion conditions.

[0104] It should be noted that the detailed functions of each module in the embodiments of the present application can be referred to the corresponding disclosed parts in the embodiments of the distribution method of the model weight file above, and will not be elaborated here.

[0105] An embodiment of the present application also provides a host. Refer to Figure 6 , Figure 6 is a schematic structural diagram of a host provided by an embodiment of the present application. The host in the embodiment of the present application may include, but is not limited to, fixed terminals such as mobile phones, laptop computers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), desktop computers, and the like. Figure 6 The host shown is only an example and should not impose any limitation on the functions and usage scope of the embodiments of the present application.

[0106] As Figure 6 shown, the host may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage device 608 into the random access memory (RAM) 603. When the host is powered on, various programs and data required for the operation of the host are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. The input / output (I / O) interface 605 is also connected to the bus 604.

[0107] Typically, the following devices can be connected to the I / O interface 605: input devices 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 608 including, for example, a memory card, a hard disk, etc.; and a communication device 609. The communication device 609 can allow the host to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 6 a host with various devices is shown, it should be understood that it is not required to implement or have all the shown devices. Instead, more or fewer devices can be implemented or had.

[0108] An embodiment of the present application also provides a computer program product including computer-readable instructions, which, when running on the host, enable the host to implement any one of the model weight file distribution methods provided by the embodiments of the present application.

[0109] An embodiment of the present application also provides a computer-readable storage medium carrying one or more computer programs, which, when executed by the host, can enable the host to implement any one of the model weight file distribution methods provided by the embodiments of the present application.

[0110] In addition, it should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present application, the connection relationships between the modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines.

[0111] Through the description of the above embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general hardware. Of course, it can also be implemented by dedicated hardware including application-specific integrated circuits, dedicated CPUs, dedicated memories, dedicated components, etc. Generally, functions accomplished by computer programs can be easily implemented by corresponding hardware, and the specific hardware structures for implementing the same function can also be diverse, such as analog circuits, digital circuits or dedicated circuits, etc. However, for this application, in more cases, software program implementation is a better embodiment. Based on such understanding, the technical solution of this application, in essence, or the part that makes contributions to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk or optical disc of a computer, etc., and includes several instructions to enable a computer device (which can be a personal computer, training device, or network device, etc.) to execute the methods described in various embodiments of this application.

[0112] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product.

[0113] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of this application are generated in whole or in part. The computer can be a general-purpose computer, a dedicated computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, training device or data center to another website, computer, training device or data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a training device or data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)), etc.

Claims

1. A method for distributing model weight files, characterized in that, The distribution method of the model weight file is applied to a host, and the distribution method of the model weight file includes: Monitoring the working status of a target container that executes a model running task, where the working status includes a startup status, and the target container can access the host directory of the host in the startup status; Responding to a first query request for a target model weight file sent by the target container in the startup status, and querying the target file address of the target model weight file in the host directory; Returning the target file address to the target container, so that the target container loads the target model weight file in the host directory based on the target file address.

2. The distribution method of the model weight file according to claim 1, wherein The first query request contains a target file identifier, and the target file identifier is used to uniquely identify the target model weight file. The querying of the target file address of the target model weight file in the host directory includes: Retrieving a weight file registry, where the registration information of the downloaded model weight files is recorded in the weight file registry, and the registration information at least includes the file identifier of the model weight file to which it belongs and its file address in the host directory; Querying the weight file registry based on the target file identifier; If the target file identifier is found in the weight file registry, using the file address corresponding to the target file identifier as the target file address.

3. The distribution method of the model weight file according to claim 2, wherein The querying of the target file address of the target model weight file in the host directory further includes: If the target file identifier is not found in the weight file registry, pulling the target model weight file from a weight file repository based on the target file identifier; Storing the target model weight file in the host directory, and using the file address of the target model weight file in the host directory as the target file address; Recording the target file identifier and the target file address as the registration information of the target model weight file in the weight file registry.

4. The method for distributing the model weight file according to claim 3, wherein The registration information further includes the file checksum of the model weight file to which it belongs, and the file checksum corresponds to the file identifier of the model weight file to which it belongs one by one; The pulling of the target model weight file from the weight file repository based on the target file identifier includes: Sending a second query request including the target file identifier to the weight file repository, so that the weight file repository responds to the second query request and returns a candidate model weight file and its corresponding candidate file checksum; Determining the target file checksum corresponding to the target file identifier, and comparing the target file checksum with the candidate file checksum; If the target file checksum is the same as the candidate file checksum, using the candidate model weight file as the target model weight file; Correspondingly, the recording of the target file identifier and the target file address as the registration information of the target model weight file in the weight file registry includes: Record the target file identifier, the target file address, and the target file check value as the registration information of the target model weight file in the weight file registration table.

5. The distribution method of the model weight file according to claim 2, wherein The working state further includes an offline state, the registration information further includes the number of times the model weight file to which it belongs has been loaded, and the method for distributing the model weight file further includes: After returning the target file address to the target container, query the target load count of the target model weight file in the weight file registration table, and increment the target load count by 1; In response to a release request for the target model weight file sent by the target container in the offline state, decrement the target load count by 1.

6. The method for distributing the model weight file according to claim 5, wherein, The method for distributing the model weight file further includes: When the target load count meets the corresponding deletion condition, delete the target model weight file in the host directory.

7. A distribution device for model weight files, characterized in that, The apparatus for distributing the model weight file is applied to a host, and the apparatus for distributing the model weight file includes: A container monitoring module, configured to monitor the working state of a target container that executes a model running task, where the working state includes a startup state, and the target container can access the host directory of the host in the startup state; A file distribution module, configured to respond to a first query request for a target model weight file sent by the target container in the startup state, query the target file address of the target model weight file in the host directory; and return the target file address to the target container, so that the target container loads the target model weight file in the host directory based on the target file address.

8. A computer program product, characterized in that, Includes computer-readable instructions that, when running on a host, cause the host to implement the method for distributing a model weight file according to any one of claims 1 to 6.

9. A host, characterized in that, Includes at least one processor and a memory connected to the processor, where: The memory is used to store a computer program; The processor is configured to execute the computer program so that the host can implement the method for distributing a model weight file according to any one of claims 1 to 6.

10. A computer storage medium, characterized in that, The storage medium carries one or more computer programs that, when executed by a host, can cause the host to implement the method for distributing a model weight file according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Container application deployment method and device, computer equipment and storage medium

    CN108958927A

  • Model file calling system and method

    CN110795398A

  • Model file loading method and device

    CN111562949A

  • Model management method, model management service, client and storage medium

    CN114398188A

  • Container-based service deployment method and device and server

    CN115480785A