Terminal deployment method and device of large language model, electronic equipment and storage medium

By converting the original large language model into the target model format and calling the word segmenter model, compiling the dynamic link library, and using the open neural network to exchange the running status of the model for prediction, it solves the problem of large amounts of code writing during multi-platform deployment and improves research and development. Efficiency and efficiency of terminal deployment.

CN118860484AInactive Publication Date: 2024-10-29GUANGDONG POLYTECHNIC NORMAL UNIV

Patent Information

Application Number
CN202410845134.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-27
Publication Date
2024-10-29
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the existing technology, when large language models are deployed to multiple terminal devices, different codes need to be written according to each platform, resulting in a heavy workload of code writing and low R&D efficiency.

Method used

By obtaining the original large language model, converting it into the target model format, calling the word segmenter model, compiling dynamic link libraries for different platforms, using the running status of the preset open neural network exchange model to call the target large language model, and converting the input of the word segmenter model Used as input to the target large language model for prediction.

Benefits of technology

It effectively reduces the workload of code writing, improves research and development efficiency, and enables large language models to be deployed on a variety of terminal devices and maintain the original effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118860484A_ABST
    Figure CN118860484A_ABST
Patent Text Reader

Abstract

The invention discloses a terminal deployment method and device for a large language model, electronic equipment and a storage medium, and can be widely applied to the technical field of model processing. According to the method, the original large language model is converted into the target large language model corresponding to the target model format, the word segmentation device model is called, and after the dynamic link libraries corresponding to different platforms are compiled, the word segmentation device model is called through the dynamic link libraries; and after the target large language model is called through the running state of the preset open neural network exchange model, the input of the word segmentation device model is used as the input of the target large language model for prediction, so that terminal deployment and application of large languages are realized, the code writing workload is effectively reduced, and the research and development efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of model processing technology, and in particular to a terminal deployment method and device, electronic device and storage medium for a large language model. Background Art

[0002] In related technologies, in order to deploy large language models to multiple terminal devices during product development, a technology that can deploy language models to different terminals and maintain the original effect is needed. The existing method is to write corresponding codes for each platform to deploy the model, and different platforms need to maintain different Tokenizers and model deployment methods. This deployment method requires a large amount of code writing, resulting in low R&D efficiency.

[0003] In summary, the technical problems existing in the relevant technologies need to be improved. Summary of the invention

[0004] The main purpose of the embodiments of the present application is to propose a terminal deployment method and device, electronic device and storage medium for a large language model, which can effectively reduce the workload of code writing and improve R&D efficiency.

[0005] To achieve the above purpose, an embodiment of the present application provides a terminal deployment method of a large language model, the method comprising the following steps:

[0006] Get the original large language model;

[0007] Converting the original large language model into a target large language model corresponding to the target model format and calling the word segmentation model;

[0008] Compile dynamic link libraries corresponding to different platforms;

[0009] Calling the word segmentation model through the dynamic link library;

[0010] The target large language model is called by presetting the running state of the open neural network exchange model, and the input of the word segmenter model is used as the input of the target large language model for prediction.

[0011] In some embodiments, converting the original large language model into a target large language model corresponding to the target model format includes:

[0012] Install the tool library;

[0013] Downloading the original large language model;

[0014] Obtaining an operation instruction, wherein the operation instruction is used to guide the export format, export name, export location or export model type of the original large language model;

[0015] The original large language model is converted into a target large language model corresponding to the target model format through the installation tool library and the running instruction.

[0016] In some embodiments, converting the original large language model into a target large language model corresponding to the target model format further includes:

[0017] The target large language model is quantized.

[0018] In some embodiments, quantizing the target large language model and the word segmenter model includes:

[0019] Obtain the target operating environment, the target terminal corresponding platform or model address;

[0020] The target large language model and the word segmenter model are quantized according to the target operating environment, the target terminal corresponding platform or the model address.

[0021] In some embodiments, compiling dynamic link libraries corresponding to different platforms includes:

[0022] Compiling preset tools, the preset tools including unsupervised text tokenizer and de-tokenizer tools;

[0023] The dynamic link libraries corresponding to different platforms are output through the preset tool.

[0024] In some embodiments, the outputting the dynamic link libraries corresponding to different platforms through the preset tool includes:

[0025] Download the preset tool source code;

[0026] Construct dynamic link libraries corresponding to different platforms according to the document instructions in the folder of the preset tool source code.

[0027] In some embodiments, the target large language model comprises an open neural network exchange model.

[0028] To achieve the above-mentioned purpose, another aspect of the embodiment of the present application provides a terminal deployment device for a large language model, the device comprising:

[0029] The first module is used to obtain the original large language model;

[0030] The second module is used to convert the original large language model into a target large language model corresponding to the target model format and call a word segmentation model;

[0031] The third module is used to compile dynamic link libraries corresponding to different platforms;

[0032] A fourth module is used to call the word segmentation model through the dynamic link library;

[0033] The fifth module is used to call the target large language model by presetting the running state of the open neural network exchange model, and use the input of the word segmenter model as the input of the target large language model for prediction.

[0034] To achieve the above object, another aspect of an embodiment of the present application provides an electronic device, including:

[0035] at least one processor;

[0036] at least one memory for storing at least one program;

[0037] When the at least one program is executed by the at least one processor, the at least one processor implements the above method.

[0038] To achieve the above objective, another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program implements the above method when executed by a processor.

[0039] The embodiments of the present application include at least the following beneficial effects: The present application provides a terminal deployment method and device of a large language model, an electronic device and a storage medium. The scheme converts the original large language model into a target large language model corresponding to the target model format and calls the word segmenter model, and compiles the dynamic link library corresponding to different platforms, calls the word segmenter model through the dynamic link library, and calls the target large language model through the running state of the preset open neural network exchange model, and uses the input of the word segmenter model as the input of the target large language model for prediction, thereby realizing the terminal deployment and application of the large language, effectively reducing the workload of code writing, and improving R&D efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is a flow chart of a terminal deployment method of a large language model provided in an embodiment of the present application;

[0041] Figure 2 It is an application flow chart of the terminal deployment method of the large language model provided in the embodiment of the present application;

[0042] Figure 3 This is a schematic diagram of the downloaded file directory provided in the embodiment of the present application;

[0043] Figure 4 is a schematic diagram of the exported model file provided in an embodiment of the present application;

[0044] Figure 5It is a structural diagram of a terminal deployment device for a large language model provided in an embodiment of the present application;

[0045] Figure 6 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application, they are only examples of devices and methods consistent with some aspects of the embodiments of the present application.

[0047] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0048] Before describing the embodiments of the present application in detail, some nouns and terms involved in the embodiments of the present application are first described. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations:

[0049] Large Language Model (Large Model): Usually a natural language processing model with large-scale parameters and computing power, such as OpenAI's GPT-3 model. These models can be trained with a large amount of data and parameters to generate human-like text or answer natural language questions. Large language models are widely used in natural language processing, text generation, and intelligent dialogue.

[0050] SentencePiece is an unsupervised text tokenizer and de-tokenizer, mainly used in neural network based text generation systems, where the vocabulary size is predetermined before the neural model is trained.

[0051] A Tokenizer is a language processing tool that breaks down words or phrases in a text into smaller components called morphemes. Morphemes represent the basic units of meaning of a word or phrase.

[0052] Dart FFI (Dart Foreign Function Interface) is a library that allows Dart programs to interact with code written in other programming languages, such as C. It enables Dart programmers to call functions in native code libraries and use data returned from these functions.

[0053] ONNX (Open Neural Network Exchange) model is an open format for representing neural network models. It allows models to be easily exchanged and deployed between different frameworks and tools, thus simplifying the development and deployment process of machine learning models.

[0054] Runtime refers to the state of a program when it is running (or being executed). In other words, when you open a program and run it on your computer, the program is in runtime. In some programming languages, some reusable programs or instances are packaged or rebuilt into "runtime libraries" that can be linked or called by any program when they are running.

[0055] HuggingFace can provide models, datasets (text, images, audio, video), libraries, tutorials and other data.

[0056] Flutter is a user interface (UI) toolkit that helps developers efficiently build beautiful multi-platform applications through a set of code bases, supporting Windows, macOS, Linux and other systems. Flutter can quickly build high-quality native user interfaces and can work with existing code.

[0057] In related technologies, during the development of similar products, it is necessary to write corresponding codes for each platform for model deployment, and different platforms need to maintain different Tokenizers and model deployment methods, which leads to a large workload of code writing and low R&D efficiency.

[0058] In view of this, the embodiments of the present application provide a terminal deployment method and device for a large language model, an electronic device, and a storage medium, which maximize the efficiency of Flutter product development by writing a unified interface.

[0059] The terminal deployment method of the large language model provided in the embodiment of the present application relates to the field of model processing technology. The terminal deployment method of the large language model provided in the embodiment of the present application can be applied to the terminal, can also be applied to the server, and can also be software running in the terminal or the server. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, and a car terminal, etc., but is not limited to this; the server side can be configured as an independent physical server, or it can be configured as a server cluster or distributed system composed of multiple physical servers, and can also be configured to provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms and other basic cloud computing services. The cloud server, the server can also be a node server in the blockchain network; the software can be an application of the terminal deployment method for implementing a large language model, etc., but is not limited to the above forms.

[0060] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0061] Figure 1 is an optional flowchart of the terminal deployment method of the large language model provided in the embodiment of the present application. Figure 1 The method may include but is not limited to steps S110 to S150:

[0062] Step S110, obtaining an original large language model;

[0063] Step S120: convert the original large language model into a target large language model corresponding to the target model format and call the word segmentation model;

[0064] Step S130, compile dynamic link libraries corresponding to different platforms;

[0065] Step S140, calling the word segmentation model through the dynamic link library;

[0066] Step S150: calling the target large language model by presetting the running state of the open neural network exchange model, and using the input of the word segmenter model as the input of the target large language model for prediction.

[0067] In an embodiment of the present application, the target large language model includes an open neural network exchange model, such as an ONNX model. When the present embodiment converts the original large language model into a target large language model corresponding to the target model format, the tool library can be installed and downloaded, and the export format, export name, export location or export model type of the original large language model can be obtained. After the running instruction, the original large language model can be converted into a target large language model corresponding to the target model format by installing the tool library and running the instruction. In addition, the target large language model can also be quantified based on the target operating environment, the corresponding platform of the target terminal or the model address. In the present embodiment, the format of the word segmenter model includes the sentenceprice format. It can be understood that the present embodiment can use the optimumpython tool library provided by huggingface to process the original large language model. Among them, the optimum python tool library can quickly convert the model format of the large language model on huggingface through simple command line instructions and provides a series of model optimizers. Taking the application of the optimum python tool library as an example, this implementation includes but is not limited to the following steps:

[0068] Step 1. Installation environment: Use the following command to install the tool library in an environment with Python 3.9 or above. If an error message is prompted, complete the remaining dependencies as required:

[0069] pip install optimum[exporters,onnxruntime]

[0070] Step 2: Download the model:

[0071] Go to hungryface to download the model you need to convert;

[0072] Step 3: Run the command:

[0073] optimum-cli command line tool instructions

[0074] export xx export format

[0075] --model modelname The name of the model to be converted

[0076] --Task model category, including the model task category attribute in the huggingface model card

[0077] . / onnx export location

[0078] optimum-cli export onnx--model. / bce-embedding-base_v1--task feature-extraction. / onnx

[0079] Step 3: Quantitative model:

[0080] optimum-cli command line tool instructions

[0081] Onnxruntime is optimized for what operating environment, choose according to the model

[0082] Quantize to reduce the model size

[0083] --What target platform does arm64 optimize instructions based on?

[0084] --onnx_model nameModel address

[0085] -o output address

[0086] optimum-cli onnxruntime quantize--arm64--onnx_model. / onnx-oquantized_onnx_arm64

[0087] Through the above conversion method, the onnx model of the large language model and all the required word segmentation models can be obtained.

[0088] In an embodiment of the present application, the dynamic link libraries corresponding to different platforms can be compiled by compiling a preset tool, and then outputting the dynamic link libraries corresponding to different platforms through the preset tool. The preset tool includes an unsupervised text segmenter and de-segmenter tool, such as the sentencepiece tool. It is understandable that when outputting the dynamic link libraries corresponding to different platforms through the preset tool, the preset tool source code can be downloaded first, and then the dynamic link libraries corresponding to different platforms can be constructed according to the document instructions in the folder of the preset tool source code.

[0089] Specifically, Figure 2 For example, the specific application process of the embodiment of the present application after converting the original large language model into the target large language model may include but is not limited to the following steps:

[0090] Step 1. Download the SentencePiece source code from GitHub.

[0091] Step 2: Enter the source code folder and call cmake.. and other instructions according to the instructions in the SentencePiece document to construct dynamic link libraries for different platforms;

[0092] Step 3. According to the DART FFI document, open the dynamic link library through DynamicLibrary.open(libname), and call the dynamic link library function through the .lookup method according to the SentencePiece api document;

[0093] Step 4: Load the word segmentation model. Use processor.Load() or a custom loading function to load the SentencePiece word segmentation model of the model language model.

[0094] Step 5: Get the word segmentation result. Call the EncodeAsId method or the custom EncodeAsId method to get the word segmentation result. The word segmentation result is a list of numbers. Each number is the encoding of a token. The encoding is determined by the word segmentation model.

[0095] Step 6: Call and deploy the language model in the onnx format converted in the previous text through onnxruntime, input the number list output by the word segmenter according to the input format requirements of the language model on the original platform, and obtain the prediction.

[0096] The following takes the deployment of the open source BCEmbedding text feature extraction model as an example. The process of downloading the model from huggingface includes but is not limited to the following steps:

[0097] Step 1: Download the file directory corresponding to the model. The download result is as follows: Figure 3 shown.

[0098] Step 2: Install Python and related toolkits.

[0099] Step 3. Export to onnx: Run the downloaded BCEmbedding text feature extraction model in the parent folder and export the model to . / onnx

[0100] optimum-cli export onnx--model. / bce-embedding-base_v1--task feature-extraction. / onnx

[0101] The exported model file is as follows: Figure 4 shown.

[0102] Step 4. Put the exported onnx model (model.onnx) and SentencePiece word segmenter model (sentencepiece.bpe.model) into the dart or flutter project you need to use.

[0103] Step 5. Download the SentencePiece source code.

[0104] Step 6. Compile and export dynamic link libraries for different platforms according to the document instructions:

[0105] (1)git clone https: / / github.com / google / sentencepiece.git

[0106] (2)cd sentencepiece

[0107] (3)mkdir build

[0108] (4)cd build

[0109] (6)cmake..

[0110] (6)make -j$(nproc)

[0111] Step 7: Configure the file packaging logic for each platform.

[0112] Step 8. DynamicLibrary.open("libsentencepiece.so") loads the dynamic link library.

[0113] Step 9: Define a link function for loading the model. The definition method is as follows:

[0114] .lookup <NativeFunction <loadmodelnative>>('loadModelFile').asFunc tion()

[0115] Define an encoding function. The definition method is as follows:

[0116] .lookup <NativeFunction <encodeasidsnative>>("encodeAsIds").asFunction().

[0117] Step 10. Call these two functions to load the model and encode the ID.

[0118] Step 11: Get the data after successful encoding, which is generally a list of numbers (vector) such as: [1023, 2323].

[0119] Step 12. Call the BCEmbedding text feature extraction model on the training platform. It requires a dictionary input, which includes two fields. One field is keyed as 'input_ids', and the value is a list of numbers (vectors) output by the Tokenizer. The other field is keyed as 'attention_mask', and the value is a list of numbers (vectors) output by the Tokenizer, such as: {'input_ids':[0,3293,83,10,3034,149357,5,2], 'attention_mask':[1,1,1,1,1,1,1,1]}. According to the original model input requirements, load the model through onnxruntime, and pass the encoded vector into the model (docInput) and docOutputs. The required input is as follows:

[0120]

[0121]

[0122] Some models may also need to convert the model output back into text. You can declare and call the decode function of SentencePiece to obtain the readable text output by the model.

[0123] From the above content, it can be seen that the embodiments of the present application can quickly deploy large language models to multiple device terminals without the need for separate encoding for each device, effectively reducing the amount of encoding and improving R&D work efficiency.

[0124] Reference Figure 5 , an embodiment of the present application provides a terminal deployment device for a large language model, the device comprising:

[0125] The first module 510 is used to obtain an original large language model;

[0126] The second module 520 is used to convert the original large language model into a target large language model corresponding to the target model format and call the word segmentation model;

[0127] The third module 530 is used to compile dynamic link libraries corresponding to different platforms;

[0128] The fourth module 540 is used to call the word segmentation model through a dynamic link library;

[0129] The fifth module 550 is used to call the target large language model by presetting the running state of the open neural network exchange model, and use the input of the word segmenter model as the input of the target large language model for prediction.

[0130] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0131] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the terminal deployment method of the large language model when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.

[0132] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0133] See also Figure 6 , Figure 6 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:

[0134] The processor 610 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;

[0135] The memory 620 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 620 can store an operating system and other applications. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 620, and the processor 610 calls and executes the terminal deployment method of the large language model of the embodiment of this application;

[0136] Input / output interface 630, used to implement information input and output;

[0137] Communication interface 640, used to realize communication interaction between the device and other devices, which can be realized through wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);

[0138] bus 650 , which transmits information between the various components of the device (e.g., processor 610 , memory 620 , input / output interface 630 , and communication interface 640 );

[0139] The processor 610 , the memory 620 , the input / output interface 630 , and the communication interface 640 are connected to each other in communication within the device via a bus 650 .

[0140] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the terminal deployment method of the above-mentioned large language model is implemented.

[0141] It can be understood that the contents of the above method embodiments are all applicable to the present storage medium embodiments, the functions specifically implemented by the present storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0142] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0143] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0144] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.

[0145] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0146] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0147] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0148] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or plural.

[0149] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0150] The units described above 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 on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0151] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0152] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.

[0153] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.< / encodeasidsnative> < / loadmodelnative>

Claims

1. A terminal deployment method for a large language model, characterized in that: The method comprises the following steps: Get the original large language model; Converting the original large language model into a target large language model corresponding to the target model format and calling the word segmentation model; Compile dynamic link libraries corresponding to different platforms; Calling the word segmentation model through the dynamic link library; The target large language model is called by presetting the running state of the open neural network exchange model, and the input of the word segmenter model is used as the input of the target large language model for prediction.

2. The method according to claim 1, characterized in that: The converting the original large language model into a target large language model corresponding to the target model format includes: Install the tool library; Downloading the original large language model; Obtaining an operation instruction, wherein the operation instruction is used to guide the export format, export name, export location or export model type of the original large language model; The original large language model is converted into a target large language model corresponding to the target model format through the installation tool library and the running instruction.

3. The method according to claim 2, characterized in that The converting the original large language model into a target large language model corresponding to the target model format further includes: The target large language model is quantized.

4. The method according to claim 3, characterized in that The quantizing of the target large language model and the word segmentation model includes: Obtain the target operating environment, the target terminal corresponding platform or model address; The target large language model and the word segmenter model are quantized according to the target operating environment, the target terminal corresponding platform or the model address.

5. The method according to claim 1, characterized in that The compiling of dynamic link libraries corresponding to different platforms includes: Compiling preset tools, the preset tools including unsupervised text tokenizer and de-tokenizer tools; The dynamic link libraries corresponding to different platforms are output through the preset tool.

6. The method according to claim 5, characterized in that Outputting the dynamic link libraries corresponding to different platforms through the preset tool includes: Download the preset tool source code; Construct dynamic link libraries corresponding to different platforms according to the document instructions in the folder of the preset tool source code.

7. The method according to any one of claims 1 to 5, characterized in that: The target large language model includes an open neural network exchange model.

8. A terminal deployment device for a large language model, characterized in that: The device comprises: The first module is used to obtain the original large language model; The second module is used to convert the original large language model into a target large language model corresponding to the target model format and call a word segmentation model; The third module is used to compile dynamic link libraries corresponding to different platforms; A fourth module is used to call the word segmentation model through the dynamic link library; The fifth module is used to call the target large language model by presetting the running state of the open neural network exchange model, and use the input of the word segmenter model as the input of the target large language model for prediction.

9. An electronic device, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method according to any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Prediction deployment system, method and device based on pre-training normal form model and medium

    CN112507102A

  • Algorithm scheme deployment method, related device, equipment and storage medium

    CN114880995A

  • MLIR-based FPGA neural network model deployment method

    CN116306918A

  • Software engineering intelligent construction engine system based on large language reasoning model

    CN117369772A

  • Model conversion method and related device

    CN117453237A

Cited By

  • Large language model pairing method and device based on hardware and model features, terminal, medium and product

    CN121009379A