Power consumption control method and electronic equipment
By detecting the resources and operating status of electronic equipment, determine the number of theoretical reasoning, and perform target reasoning tasks based on the number of times, solve the problem of rising power consumption when the electronic equipment is performed in the reasoning of reasoning, and achieves reasonable control and optimization of power consumption.
Patent Information
- Application Number
- CN202411948611.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-12-27
AI Technical Summary
When using models to perform inference tasks in electronic devices, it will cause increased processor load, resulting in increased power consumption and affect user experience.
Through the detection of the resources and operating status of the electronic equipment, the target resource data obtained by the analysis is analyzed to determine the number of theoretical reasoning, and the target reasoning tasks that support the execution of the preset model are determined based on the number of times.
Effectively control and optimize the power consumption of electronic equipment, maintain power consumption at a relatively stable level, and improve the user experience.
Smart Images

Figure CN119376517A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a power consumption control method and an electronic device. Background Art
[0002] As electronic devices become more powerful, model applications continue to expand, and electronic device manufacturers are actively deploying models in electronic devices. One of the important purposes is to improve data security. For example, deploying language models in electronic devices allows electronic devices to process and analyze data with the help of the language models, thereby effectively reducing the risks in the data transmission process and reducing the possibility of security risks such as data leakage and tampering.
[0003] However, when electronic devices use models to perform reasoning tasks, the load on the processor, especially the integrated graphics processor and embedded neural network processor, will be increased, resulting in increased power consumption of the electronic device and affecting the user experience. Summary of the invention
[0004] The present application provides a power consumption control method and an electronic device, which can enable a processor to detect the resources of an electronic device before executing an inference task, reasonably execute the inference task, and reasonably control and optimize the power consumption of the electronic device.
[0005] In a first aspect, a power consumption control method is provided, which is applied to an electronic device, on which a preset model is deployed, including: in response to a first operation, loading the preset model, the first operation being used to trigger a target function, and the electronic device running the preset model when executing the target function; detecting the resources and operating status of the electronic device to obtain target resource data; inputting the target resource data into an inference prediction model to obtain a theoretical number of inferences, wherein the theoretical number of inferences is the maximum number of inference tasks executed corresponding to the target resource data; when the theoretical number of inferences is greater than zero, executing the target inference task based on the preset model, and the target inference task is determined by the theoretical number of inferences.
[0006] It should be understood that the theoretical number of inferences is the maximum number of inference tasks that the target resource data supports through a preset model.
[0007] It should be understood that the preset model is used to perform reasoning tasks, and there may be multiple reasoning tasks. Therefore, in order to reduce the power consumption of the electronic device or suppress the rising trend of the power consumption of the electronic device, when the theoretical reasoning number is greater than zero, the target reasoning tasks that support the execution of the preset model are determined, and these target reasoning tasks are executed based on the preset model.
[0008] After the preset model is loaded, if the corresponding reasoning task is performed directly based on the preset model, the corresponding processor load will be too high, such as the iGPU load reaches 90% or above, which will increase the power consumption of the electronic device; therefore, in an embodiment of the present application, before executing a specific reasoning task through the preset model, the detection of the resources and operating status of the electronic device is increased, and the target resource data obtained through the detection is analyzed to obtain the number of reasoning tasks supported by the preset model by the target resource data, that is, the theoretical number of reasoning times, so that when the processor executes the target reasoning task corresponding to the theoretical number of reasoning times, the power consumption is reasonably controlled and optimized, and the power consumption of the electronic device is maintained at a relatively stable level.
[0009] In one possible implementation, executing a target reasoning task based on a preset model also includes: in the process of executing the target reasoning task, based on a preset first monitoring frequency, detecting the resources and operating status of the electronic device to obtain updated target resource data; inputting the updated target resource data into the reasoning prediction model to obtain an updated theoretical reasoning number; and stopping executing the target reasoning task when the updated theoretical reasoning number is zero.
[0010] During the execution of the target reasoning task, the embodiment of the present application continues to monitor the resources and operating status of the electronic device in real time, which can ensure the smooth execution of the target reasoning task and the rational use of hardware resources; and when the updated theoretical reasoning times determined by the updated target resource data is zero, the target reasoning task is stopped and the power consumption of the electronic device is rationally controlled.
[0011] In a possible implementation, before executing the target reasoning task based on a preset model, it also includes: obtaining alternative reasoning tasks corresponding to the target function; arranging the alternative reasoning tasks in order of priority from high to low to obtain an initial reasoning task queue; and taking the first N alternative reasoning tasks in the initial reasoning task queue as target reasoning tasks, where N is a positive integer less than or equal to the theoretical reasoning number.
[0012] It should be understood that all reasoning tasks involved in the initial reasoning task queue are determined by the application scenario corresponding to the target function, and the initial reasoning task queue contains multiple reasoning tasks.
[0013] After arranging the candidate reasoning tasks in order of priority, a high-priority reasoning task is obtained from the initial reasoning task queue based on the theoretical reasoning times as the target reasoning task, which can ensure the effective implementation of the target function and maintain the power consumption of the electronic equipment at a relatively stable level.
[0014] In one possible implementation, the target resource data is input into the inference prediction model to obtain the theoretical inference number, and it also includes: when the theoretical inference number is zero, based on the preset first monitoring frequency, not executing the inference task in the initial inference task queue, and detecting the resources and operating status of the electronic device to obtain updated target resource data.
[0015] It should be understood that if the theoretical reasoning times are zero before the target reasoning task is executed, it indicates that the electronic device does not meet the requirements for executing the reasoning task, so the reasoning task is not executed, and the resources and operating status of the electronic device are continuously detected based on the preset first monitoring frequency to obtain updated target resource data. This facilitates the timely execution of the reasoning task when the resources and operating status of the electronic device support the execution of the reasoning task, thereby improving the stability of the system.
[0016] In one possible implementation, the resources and operating status of the electronic device are detected to obtain target resource data, including: each time the resources and operating status of the electronic device are detected, the resources and operating status of the electronic device are sampled M times per unit time to obtain M groups of sampled data; and the mean of the M groups of sampled data is calculated to obtain the target resource data.
[0017] Each time the resources and operating status of the electronic device are detected, the number of sampling times per unit time can be increased and the average value of these sampling data can be calculated to improve the accuracy of the target resource data.
[0018] In one possible implementation, in response to a first operation, loading a preset model includes: in response to the first operation, monitoring the memory of the electronic device based on a preset second monitoring frequency to obtain a memory occupancy rate; if the memory occupancy rate is less than a preset threshold, loading the preset model, and the preset threshold is determined by the memory capacity of the electronic device.
[0019] The embodiment of the present application adds monitoring of the memory of the electronic device before loading the preset model, so as to determine in advance whether the electronic device has sufficient space to accommodate the preset model, thereby avoiding failure of loading the preset model due to insufficient memory; at the same time, it can prevent the original insufficient memory situation from being further aggravated due to loading the preset model, thereby causing system performance degradation or even crash; it can also provide a basis for optimizing the preset model, such as determining whether it is necessary to compress the preset model to match the memory capacity.
[0020] It should be noted that in the above methods, the resources of the electronic device include CPU load and GPU load, and the operating status of the electronic device includes the plug-in status and the temperature of the electronic device.
[0021] In one possible implementation, the target function includes a first function, and the electronic device runs a preset language model during the first function. The power consumption control method includes: loading the preset language model in response to a second operation, and the second operation is used to trigger the first function; detecting the CPU load, iGPU load, plug-in status and temperature of the electronic device to obtain first resource data; inputting the first resource data into an inference prediction model to obtain a first inference number; and when the first inference number is greater than zero, determining a first inference task performed by the preset language model based on the first inference number.
[0022] It should be understood that the target function includes multiple functions, among which, when some of the first functions are executed, it is necessary to run a preset language model on the electronic device, for example, the semantic search function requires a preset language model, and then the corresponding function is realized by running the preset language model. Among them, the preset language model can be a large language model; it can also be a multimodal model, etc.
[0023] Taking the function corresponding to executing semantic search on a personal computer as an example, by increasing the periodic monitoring of the power status, case temperature, CPU load, and GPU load in the personal computer, and calculating the number of theoretical reasoning times based on the target resource data obtained from the monitoring, the target reasoning task is obtained from the initial reasoning task queue for execution, so that the personal computer executes the corresponding target reasoning task based on the preset language model. When the processor in the personal computer executes these target reasoning tasks, the power consumption of the electronic device is maintained at a relatively stable level, or even reduced, thereby improving the user experience.
[0024] In a possible implementation, the process of executing the first reasoning task by the preset language model also includes: if the first reasoning task is keyword extraction, determining the queue text after extraction; when the length of the queue text is greater than or equal to the length of the recorded text, stopping the keyword extraction, wherein the recorded text is the text obtained after voice recognition of the voice input by the user when the first function is triggered, or the text input by the user.
[0025] It should be understood that the hardware conditions of the electronic device that deploys the preset model, the number of model parameters, and the model compression during operation may all lead to a reduction in the accuracy of the preset model. When the preset language model in the preset model performs reasoning tasks with low accuracy, especially during the keyword extraction process, there will be repeated extraction of keywords, which will lead to the inability to obtain reasoning results for the reasoning task.
[0026] Therefore, in the reasoning process where the target reasoning task is keyword extraction, the extracted queue text and record text are first compared. By analyzing the queue text, the efficiency of executing the target reasoning task through the preset language model is improved, and the accuracy of reasoning is improved.
[0027] In one possible implementation, the electronic device includes a resource monitoring module, and the power consumption control method includes: in response to a first operation, the resource monitoring module loads a preset model; the resource monitoring module detects the resources and operating status of the electronic device to obtain target resource data; the resource monitoring module inputs the target resource data into an inference prediction model to obtain a theoretical inference number; when the theoretical inference number is greater than zero, the resource monitoring module performs the target inference task based on the preset model.
[0028] In the embodiment of the present application, a resource monitoring module is added, and specific regulation of the model is achieved through the resource monitoring module, so that during the power consumption control process, the memory, resources and operating status of the electronic device can be monitored to maintain the power consumption of the electronic device at a relatively stable level, so as to improve the effect of the model in the process of executing reasoning tasks.
[0029] In a second aspect, an electronic device is provided, the electronic device comprising a processor and a memory, the memory being used to store a computer program, the processor being used to call and run the computer program from the memory, so that the electronic device executes any one of the power consumption control methods in the first aspect.
[0030] In a third aspect, a power consumption control device is provided, comprising a unit for executing any one of the methods in the first aspect. The device may be a terminal device or a chip in the terminal device.
[0031] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed, any one of the power consumption control methods in the first aspect is executed.
[0032] In a fifth aspect, a computer program product is provided. The computer program product includes a computer program. When the computer program is run, any one of the power consumption control methods in the first aspect is executed.
[0033] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 A schematic diagram showing a personal computer entering an intelligent search application to perform semantic search; Figure 2 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown; Figure 3 A schematic diagram of a system architecture of an electronic device according to an embodiment of the present application is shown; Figure 4A schematic diagram showing an application scenario to which the embodiments of the present application are applicable; Figure 5 A schematic diagram of a process flow of a power consumption control method provided by an embodiment of the present application is shown; Figure 6 A schematic diagram of a flow chart of another power consumption control method provided in an embodiment of the present application is shown; Figure 7 A schematic diagram of a flow chart of another power consumption control method provided in an embodiment of the present application is shown; Figure 8 A schematic diagram of a process for power consumption control implemented by a resource monitoring module provided in an embodiment of the present application is shown; Fig. 9 A schematic diagram of a flow chart of another power consumption control method provided in an embodiment of the present application is shown; Fig.10 A schematic diagram of a power consumption control device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0035] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0036] In the following, the terms "first", "second", and "third" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first", "second", and "third" may explicitly or implicitly include one or more of the features.
[0037] To facilitate understanding, the models involved in the embodiments of the present application are introduced and explained.
[0038] In the embodiments of the present application, the model, also known as the end-side model, is deployed in the electronic device, that is, it is installed, stored and run in the electronic device, and does not rely on the cloud side. Its main body covers machine learning models, such as language models, image recognition models, multimodal models, etc., and may also include other intelligent algorithm models. The model mainly performs reasoning work on the data generated inside the electronic device, such as performing image recognition, speech recognition, semantic search, target monitoring, language translation and other functions.
[0039] Directly processing the data generated inside the electronic device can effectively protect data privacy, reduce potential security risks during data transmission, improve the security and timeliness of data processing, give full play to the intelligent processing capabilities of electronic devices, and better adapt to the data processing needs of various application scenarios.
[0040] In addition, the improvement in the performance of electronic devices provides sufficient computing power, storage and other resource support for the end-side models, enabling them to run more complex algorithms and model architectures. With a strong hardware foundation, the models deployed in electronic devices can process and quickly calculate large amounts of data, meeting diverse needs such as real-time and privacy-sensitive data processing in intelligent interaction scenarios. Therefore, electronic device manufacturers are actively deploying models in electronic devices. One of the important purposes is to avoid security risks that may exist during data transmission and cloud storage, thereby improving data security and providing users with a more reliable and secure usage environment.
[0041] It should be understood that the model can be deployed on the processor of electronic products with the help of specific deployment frameworks or technical means, such as integrated graphics processing units (iGPUs), embedded neural network processors (NPUs), etc., so as to enable the processor to perform related reasoning tasks. In this process, the model is loaded into its operating environment in a way that adapts to the processor architecture, and then the processor's computing power is used to process and analyze the input data, and finally the reasoning task is executed, which provides strong support for the local intelligent data processing and decision-making of electronic products.
[0042] For example, by deploying a language model in an electronic device, users can interact with the electronic device naturally and smoothly through voice or text input. The language model can understand the user's intention and accurately give corresponding responses, making the interaction more convenient and humane, as if the user is communicating with an assistant with intelligent thinking, for example, voice interaction, intelligent search for documents, videos, audio, etc.
[0043] For example, an intelligent search application is installed in an electronic device. The application can perform reasoning through the language model deployed in the electronic device, and then implement the corresponding semantic search function, so as to accurately locate information content that is highly consistent with the search intent for users.
[0044] Figure 1 A schematic diagram of a personal computer entering an intelligent search application to perform semantic search is shown; Figure 1As shown in (a) in FIG. 1 , it is a first search window 20 after the smart search application is opened. The first search window 20 has a search area 21 , and the user can input the content to be searched in the search area 21 .
[0045] For example, the user enters the word "paper" in the search area 21 in the first search window 20. Figure 1 As shown in (b) in the figure, the personal computer (PC) searches for documents based on the content "paper" input by the user, and the search results are as follows: Figure 1 As shown in (c) in FIG. 1 , the second search window 30 displays the keyword search results and the semantic search results.
[0046] In the above example, the personal computer performs a search based on the word "paper" input by the user, including a keyword search and a semantic search. In the process of performing the above keyword search and semantic search, it is necessary to perform corresponding multiple reasoning tasks through the language model deployed in the personal computer, among which the reasoning tasks include keyword extraction and semantic analysis.
[0047] It should be understood that in the process of electronic devices using models to perform reasoning tasks, the load on the iGPU often increases significantly. When performing reasoning tasks for more complex or large-scale models, the load on the iGPU may be increased to 90% or even 100%. This is because the model needs to process and calculate a large amount of data at high speed while performing reasoning tasks. The iGPU has a large number of parallel computing units. When faced with such high-intensity reasoning task requirements, its resource occupancy rate will rise sharply, resulting in a significant increase in load. The iGPU often needs to run at full capacity to meet the needs of model reasoning, which in turn causes its load to be at a high level.
[0048] In addition, the increased iGPU load causes its power to increase, which in turn causes the power consumption of electronic devices to increase, and may even cause the electronic devices to freeze, affecting the user experience.
[0049] It should be noted that the high iGPU load is caused by the system framework and the loading and running of models through the inference platform. When the iGPU load cannot be reasonably and effectively controlled, the resources of the electronic device can be monitored to effectively control the power consumption of the electronic device to maintain it at a relatively stable level, thereby improving the user experience of the electronic device.
[0050] In view of this, an embodiment of the present application provides a model operation method and an electronic device, wherein the method is applied to an electronic device, a preset model is deployed on the electronic device, and the power consumption control method includes loading the preset model in response to a first operation, the first operation is used to trigger a target function, and the electronic device runs the preset model when executing the target function; by detecting the resources and operating status of the electronic device, the corresponding target resource data is obtained; so that the target resource data is input into an inference prediction model, the target resource data is analyzed, and the theoretical number of inferences performed by the preset model supported by the target resource data is obtained, so that the electronic device performs the target inference task corresponding to the theoretical number of inferences; and then, when the processor in the electronic device executes these inference tasks, the power consumption of the electronic device is maintained at a relatively stable level, and even the power consumption of the electronic device is reduced, thereby improving the user experience.
[0051] The following is a description of the operating method of the model provided in the embodiment of the present application in conjunction with the accompanying drawings. The method is applied to electronic devices, and the electronic devices may be terminal devices such as personal computers, laptops, tablet computers (Pads), mobile phones, smart TVs, wearable devices, vehicle-mounted electronic devices, laptops, personal digital assistants (PDAs), smart home devices, medical monitoring devices, etc. The embodiments of the present application do not impose any special restrictions on the specific technologies and specific forms adopted by the electronic devices.
[0052] Figure 2 FIG. 1 is a schematic diagram showing a hardware structure of an electronic device provided in an embodiment of the present application. For example, taking a personal computer as an example, Figure 2 As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, a wireless communication module 160, an audio module 170, a speaker 170A, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a camera 193, a display screen 194, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an acceleration sensor 180E, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, etc.
[0053] It should be noted that Figure 2 The connection relationship between the modules shown is only a schematic illustration and does not constitute a limitation on the connection relationship between the modules in the electronic device 100. In other embodiments of the present application, the electronic device 100 may include Figure 2More or fewer components than those shown, or the electronic device 100 may include Figure 2 Combinations of some of the components shown, or the electronic device 100 may include Figure 2 Subassemblies of some of the components shown. Figure 2 The components shown may be implemented in hardware, software, or a combination of software and hardware.
[0054] The processor 110 may include one or more processing units, for example, the processor 110 may include a central processing unit (CPU), a graphics processing unit (GPU), an iGPU, an NPU, a digital signal processor (DSP), an application processor (AP), a modem processor, an image signal processor (ISP), a controller, a video codec, a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or may be integrated into one or more processors.
[0055] Among them, iGPU is usually integrated inside the CPU chip and shares the system memory. The performance of iGPU is relatively weaker than that of GPU, but it has the characteristics of low power consumption. Therefore, for some end-side models, iGPU can be deployed.
[0056] NPU is a processor designed specifically for neural network computing. It has higher efficiency and performance when processing computing tasks related to deep learning models. In some cases, models can be deployed together through iGPU and NPU, and the advantages of the two processors can be fully utilized through collaborative work to improve model processing performance. In some cases, such as some models with low computing performance requirements, iGPU can be given priority. When iGPU cannot meet the performance requirements of model calculation or the model has high requirements for computing resources and efficiency, NPU can be considered.
[0057] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0058] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0059] In some embodiments, the processor 110 may include one or more interfaces, such as an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0060] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0061] The internal memory 121 may be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121 .
[0062] It should be understood that the internal memory 121 may include a high-speed random access memory (RAM) and a hard disk.
[0063] Among them, high-speed random access memory is a type of computer memory. In electronic devices, RAM is used to temporarily store running programs and data during operation. For example, when a user uses a smart search application, the application's code and related data will be loaded into RAM, so that the processor can quickly read and process this information to ensure smooth operation of the application.
[0064] If the electronic device is a terminal device such as a mobile phone or a tablet computer, its internal memory may include RAM and non-volatile memory (NVM). Non-volatile memory is a memory that can retain stored data groups even when power is off. The storage method of non-volatile memory allows data to be saved even when there is no power supply.
[0065] The charging management module 140 is used to receive charging input from a charger, where the charger can be a wireless charger or a wired charger.
[0066] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0067] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc.
[0068] An operating system, such as a Windows operating system, an Android operating system, a Linux operating system, a Unix operating system, an iOS operating system, etc., runs on the electronic device 100. Application programs can be installed and run on the operating system.
[0069] The operating system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Windows operating system as an example to exemplify the system architecture of the electronic device 100.
[0070] It should be noted that although the embodiments of the present application are described using the Windows operating system as an example, its basic principles are also applicable to electronic devices 100 of other operating systems.
[0071] The software system of the electronic device 100 can be divided into several layers, each layer has a clear role and division of labor, and the layers communicate with each other through software interfaces.
[0072] It should be understood that the Windows operating system is mainly divided into a user layer and a kernel layer. Figure 3 A schematic diagram of a system architecture of an electronic device in an embodiment of the present application is shown. In the embodiment of the present application, the reasoning platform layer and the model layer are abstracted, such as Figure 3 As shown, the Windows operating system is divided into an application layer, a system service layer, an inference platform layer, a model layer, and a kernel layer; wherein the inference platform layer and the model layer are used to load the model on the electronic device, obtain the result through model inference, and thus implement the relevant tasks of the model on the electronic device.
[0073] The application layer includes applications, which can include a series of applications, such as smart search applications, document applications, gallery applications, and music applications (applications can be referred to as applications). Users can use these applications to implement various specific functions, among which some functions need to be implemented through models in the model processing layer.
[0074] The system service layer includes system services and interfaces, which provide applications with interfaces and services for interacting with the operating system. System services include services corresponding to applications, such as search services and document services; system interfaces include the Application Programming Interface (Windows API), which enables applications to call operating system functions to implement various operations, such as file reading and writing, memory allocation and release, etc.
[0075] The system service layer also includes a resource monitoring module, which is used to implement the functional requirements of search services and document services, and monitor the operation of models, such as model loading, inference tasks, etc.
[0076] The inference platform layer is built on the system service layer and uses the model provided by the model layer to perform inference tasks. The inference platform can accelerate the inference process of the model in the model layer. By optimizing the model and utilizing the acceleration capabilities of specific hardware, the inference platform enables the model to obtain results faster when processing new data for inference tasks such as prediction, classification, and keyword extraction, which facilitates the deployment of the model on electronic devices corresponding to different application scenarios.
[0077] The reasoning platform layer may include one reasoning platform or multiple reasoning platforms, such as Figure 3 The first inference platform, the second inference platform and the third inference platform in the inference platform. The inference platform is used to deploy the model on processors such as NPU and iGPU in electronic devices, and is also called an inference engine.
[0078] The inference platform can be used to perform inference tasks on trained machine learning or deep learning models. Inference is the process of using a trained model to predict or analyze new data input.
[0079] For example, the inference platform can be OpenVino (Open Visual Inference and Neural Network Optimization) developed by Intel, Qualcomm Neural Network (QNN) released by Qualcomm, TensorRT provided by NVIDIA, etc. The inference platform can help developers optimize the trained model and deploy it to the corresponding electronic devices. Among them, the optimization, such as model quantization, converts the model parameters from high precision to low precision.
[0080] Among them, some inference platforms can support multiple operating systems, such as Windows operating system, Linux operating system, Android operating system, etc., which allows developers to use the inference platform for model inference in different operating system environments.
[0081] It should also be understood that different inference platforms may differ in the physical hardware involved in the inference process. For example, OpenVino can effectively utilize both CPU and iGPU for inference.
[0082] The model layer contains various machine learning and / or deep learning models. These models are trained with a large amount of data and are used to solve specific tasks. In actual applications, the models in the model layer will be called by the inference platform layer to generate corresponding output results based on the input data.
[0083] In scenarios involving semantic search, the models involved may be language models, and / or large language models, etc.; in scenarios involving image recognition through voice or text, the models involved may be multimodal models, and / or language models, image recognition models, etc.
[0084] That is to say, the models involved are related to specific application scenarios, and these models are computing models deployed in electronic devices; the number of models can be one or more. Figure 3 The first model, the second model and the third model in.
[0085] Taking the application of language models as an example, the first model is a large language model on the end, with 3B parameters; the second model is a language model on the end, which is a small language model; the third model is a large language model on the end, with 1.5B parameters.
[0086] It should be understood that the "B" in the number of parameters usually refers to billion, so 3B means that the model has 3 billion parameters.
[0087] It should be noted that different electronic devices have different storage capacities and computing resources, which leads to differences in the models that can be deployed on electronic devices. For example, electronic devices such as smart watches and mobile phones, due to the limitations of their storage capacity and computing resources, often deploy small language models, such as the second model; these small models have relatively few parameters, they occupy little storage space, and have low memory requirements at run time, which enables them to be quickly loaded and run on devices with limited memory. For another example, electronic devices such as personal computers, tablets, and mobile phones can deploy the above-mentioned first model, second model, and / or third model.
[0088] It should be understood that the models deployed on electronic devices are generally small in scale, simple in function, and their reasoning speed is usually fast.
[0089] The kernel layer is mainly responsible for the core functions of the system, including process management, such as creating, terminating and calling processes; thread management, such as coordinating the execution of multiple threads; memory management, such as allocating and reclaiming memory space; file system, such as managing and storing files; device driver, such as realizing communication and control between the operating system and physical hardware, etc. The kernel layer is the key part of the operating system.
[0090] For ease of explanation, Figure 3 It also reflects the hardware layer that interacts with the above system structure. The hardware layer provides physical hardware support for the operating system. All software functions in the operating system rely on the support of the hardware layer to be effectively implemented. The hardware layer and the kernel layer interact through drivers to ensure smooth information exchange and precise regulation of physical hardware.
[0091] In the embodiments of the present application, the hardware layer mainly involves CPU, iGPU, independent GPU (if any) and NPU (equipped with some electronic devices), among which, when the iGPU cannot meet the performance requirements of model calculation or the model has high requirements on computing resources and efficiency, the use of NPU is considered.
[0092] In the embodiment of the present application, the system service layer, the reasoning platform layer and the model layer can better reflect the collaborative relationship of the model in the application of electronic devices, and jointly realize the regulation of the model operation.
[0093] It should be noted that Figure 3 The reasoning platform and model shown in the description are described by taking an electronic device with Windows operating system as an example. For electronic devices with different operating systems, the reasoning platforms and models involved may be different.
[0094] The execution subject of the power consumption control method provided in the embodiment of the present application can be the above-mentioned electronic device (such as a personal computer, a tablet computer, a mobile phone, etc.), or it can be a functional module and / or functional entity in the electronic device that can implement the module operation method, and the solution provided in the embodiment of the present application can be implemented by hardware and / or software, which can be determined according to actual use requirements, and the embodiment of the present application is not limited. The following takes an electronic device as an example, and combines the accompanying drawings to exemplarily illustrate the power consumption control method provided in the embodiment of the present application.
[0095] The following will be combined with the accompanying drawings to illustrate the embodiments of the present application through the following multiple exemplary embodiments. The methods in the following embodiments can be implemented in an electronic device having the above hardware structure and system architecture. The hardware structure diagram of the electronic device can be as follows: Figure 2 As shown, the system structure block diagram of the electronic device can be as follows Figure 3 For the sake of convenience, the embodiments of the present application all take the electronic device as a personal computer as an example.
[0096] Figure 4 A schematic diagram showing an application scenario applicable to the embodiment of the present application is shown. Figure 4 The application scenario of the embodiment of the present application is described. Taking the use of the intelligent search application in a personal computer as an example, the user enters text in the search area of the intelligent search application to search for documents, such as Figure 4As shown in (a), the text entered in the search area 41 in the third search window 40 is "about the development trend of YY", and after the document control 42 in the third search window is clicked, a document search is performed. At this time, the intelligent search application performs an inference task by loading the model deployed in the personal computer. The inference task is a preset inference process in the intelligent search application, which may include key information extraction, summary extraction, semantic analysis, and information slot extraction, etc., and obtains the results corresponding to each inference task, and displays the search results after semantic analysis in the first display area 43 in the third search window 40.
[0097] like Figure 4 As shown in (b) in FIG. 4 , after the user clicks on a search result “Development Analysis Report” in the first display area 43, the user can view the specific content of the “Development Analysis Report” document; Figure 4 As shown in (c) in FIG. 4 , a second display area 44 is presented in the third search window 40 for previewing the document, and a sub-area 45 in the second display area 44 displays search results of abstract extraction.
[0098] In the intelligent search application, you can also search for pictures, videos, audio, folders, etc. It should be understood that in the process of semantic search corresponding to each type, it will also involve the execution of reasoning tasks by loading the model deployed in the personal computer.
[0099] It should also be understood that during the use of a personal computer, other applications can also be used to trigger the loading of models deployed in the personal computer to perform reasoning tasks. The embodiments of the present application do not limit the triggering model loading in each application and the visual design, information presentation, etc. of the reasoning tasks.
[0100] Combine the following Figures 5 to 9 The power consumption control method provided in the embodiment of the present application is described in detail. Figure 5 A schematic diagram of a power consumption control method provided in an embodiment of the present application is shown, and the method is applied to electronic equipment, such as Figure 5 As shown, the power consumption control method provided in the embodiment of the present application includes the following steps: S310: In response to a first operation, load a preset model.
[0101] It should be understood that the preset model is a model deployed on an electronic device; the preset model is installed and stored in the electronic device and can be run in the electronic device.
[0102] The preset model may refer to one or more of a language model, an image recognition model, a multimodal model, etc. It should be understood that in the process of an electronic device implementing a corresponding function through a preset model, one model or multiple models may be involved.
[0103] Among them, the first operation is used to trigger the target model, and the electronic device runs the preset model when executing the target function. That is to say, the realization of the target function requires loading the preset model so that the electronic device can perform the corresponding reasoning task through the preset model.
[0104] It should be noted that the target functions may include speech recognition, image recognition, semantic search, target monitoring, language translation, etc. Therefore, operations in many cases will trigger the target function, such as the various scenarios listed below: First, when the application is started; when some applications in the electronic device are started and start running, and the application needs to rely on relevant preset models to implement the corresponding functions, the target function will be triggered. For example, when an application with image recognition is started, when the application completes image classification, object detection and other reasoning tasks based on the preset model, the corresponding target function will be triggered when the image recognition application is started, ensuring that the application analyzes and processes the image.
[0105] Second, when a specific input event is received; when a user inputs voice or text data in some applications on an electronic device, the corresponding preset model is needed to perform semantic analysis, understanding or processing on the input data to generate a corresponding reply or result, which will also trigger the corresponding target function. For example, when an electronic device collects data through sensors (such as cameras, microphones, etc.) and performs target recognition, behavior analysis, etc. on the collected data according to the corresponding preset model, the corresponding target function will be triggered.
[0106] Third, when a function module is called; when a function module in an application is clicked or triggered by a user, and the function module implements its specific function based on a preset model, the corresponding target function will be triggered and the preset model will be loaded into memory. For example, in a document editing application, when a user clicks on the smart writing assistant function, and the function implements text generation, grammar checking and other functions based on a preset model; or when searching for documents in a smart search application, the corresponding target function will be triggered.
[0107] Fourth, scheduled tasks or periodic operations: When the operating system or application of an electronic device sets a scheduled task and needs to perform operations related to a preset model at a specific time interval or time point, the corresponding target function will be triggered to load the preset model into the memory. For example, a health monitoring application needs to analyze and evaluate the user's physiological data (such as heart rate, blood pressure, etc.) through a preset model every hour. When the scheduled time of each hour arrives, the corresponding target function will be triggered.
[0108] Fifth, when a specific scene or condition is detected, the electronic device will trigger the corresponding target function to load the preset model into the memory. For example, when the environmental sensor in the smart home device detects that the indoor light intensity is lower than the light intensity threshold and there is human activity, and the lighting of the smart home device is regulated based on the preset model, the corresponding target function will be triggered.
[0109] It should be understood that the first operation to trigger the target function may be one or more of the above-mentioned scenarios, and the embodiment of the present application does not limit the scenario type for triggering the target function for indicating loading a preset model.
[0110] for Figure 4 In the example shown in (a), the target function is triggered by the text input by the user and the click of the document control, that is, the target function is triggered, and the preset model needs to be loaded; that is, at this time, the corresponding document semantic search service is started (that is, the target function is triggered), and the loading of the preset model is executed, wherein the preset model can be a language model.
[0111] S320: Detect the resources and operating status of the electronic device to obtain target resource data.
[0112] The target resource data reflects the results of the current detection of the resources and operating status of the electronic device.
[0113] It should be understood that after the preset model is loaded, if the corresponding reasoning task is performed directly based on the preset model, it may cause the corresponding processor load to be too high, such as the iGPU load reaches 90% or above, thereby increasing the power consumption of the electronic device; therefore, in an embodiment of the present application, before executing a specific reasoning task through the preset model, the detection of the resources and operating status of the electronic device is added, and the target resource data obtained through the detection is analyzed to determine the maximum number of reasoning tasks that the processor can execute, so that when the processor executes reasoning tasks equal to the maximum number, or less than the maximum number of reasoning tasks, the power consumption of the electronic device can be maintained at a relatively stable level, and by limiting the number of reasoning tasks, the power consumption of the electronic device can be effectively prevented from increasing.
[0114] It should be understood that in the process of processing different data through the model for reasoning tasks, due to the difference in data volume, the power consumption of the electronic device can sometimes be maintained at a relatively stable level, and sometimes it can be reduced.
[0115] Among them, the resources of electronic devices mainly refer to the utilization of hardware in the system. CPU, GPU, NPU, memory and other hardware are key hardware computing resources in electronic devices. Their conditions directly reflect the degree of resource utilization and can comprehensively reflect the efficiency and quality of electronic devices in completing various tasks; in the application scenarios involved in the embodiments of the present application, resources mainly refer to processing power (such as CPU, GPU, etc.) and storage performance (such as memory).
[0116] The monitoring of the GPU includes the monitoring of the iGPU and / or the GPU. In the embodiment of the present application, the monitoring is mainly the monitoring of the iGPU.
[0117] It should be understood that if the model executes reasoning tasks involving iGPU, the iGPU will be detected; if the model executes reasoning tasks involving NPU, the NPU will be detected; if the model executes reasoning tasks involving iGPU and NPU, both the iGPU and NPU will be detected.
[0118] The operating status of an electronic device refers to the many aspects that characterize its operating characteristics and conditions during the collaborative work of its various components; in the application scenarios involved in the embodiments of the present application, the operating status mainly refers to the temperature of the electronic device (such as casing temperature, ambient temperature, etc.) and the power supply mode (such as plugged in status).
[0119] Taking a personal computer as an example, its power supply methods include using an AC power adapter to power the computer, i.e., plugged in (AC state), and battery power supply, i.e., DC state. In the AC state, personal computers can usually perform at their best. Because the power adapter can provide relatively sufficient power, the processor, graphics card and other hardware components of the personal computer can run at a higher power. In the DC state, in order to extend the battery life, personal computers usually automatically adjust the performance of the hardware, for example, reducing the frequency of the processor, reducing the screen brightness, etc.
[0120] It should be understood that when running the model, the personal computer can maintain higher CPU and GPU frequencies in AC state, reducing performance degradation caused by insufficient power.
[0121] For example, the detection of the resources and operating status of the electronic device includes the detection of the power supply mode of the electronic device, the temperature of the electronic device, and the CPU and GPU in the electronic device, so as to obtain the target resource data; wherein, the detection of the GPU includes the detection of the iGPU. In other words, the resources and operating status of the electronic device include the power supply mode of the electronic device, the temperature of the electronic device, and the CPU, GPU, memory, etc. in the electronic device.
[0122] It should also be understood that there are differences in the processors involved in electronic devices. For example, the processors in some electronic devices involve CPU and iGPU, while the processors in some electronic devices involve CPU, iGPU and NPU. Therefore, for different electronic devices, the target resource data corresponding to their resources and operating states are also different. In some embodiments, the resources and operating states of electronic devices include the power supply mode of the electronic device, the temperature of the electronic device, and the CPU, GPU, and NPU in the electronic device.
[0123] It should be understood that the target resource data obtained by detecting the resources and operating status of the electronic device is determined by the inference prediction model, wherein the inference prediction model is used to determine the theoretical number of times the current resources and operating status of the electronic device can support the execution of the inference task.
[0124] It should be noted that electronic devices have different requirements for power consumption and resource usage. For different types of electronic devices, or electronic devices of the same type but different models, the corresponding inference prediction models are different. Therefore, the inference prediction models in different electronic devices are modeled based on their theoretical inference number predictions.
[0125] S330, input the target resource data into the inference prediction model to obtain the theoretical inference times.
[0126] The theoretical inference times is the maximum number of inference tasks that the target resource data supports to be executed through the preset model. In other words, during the execution of the inference tasks corresponding to the theoretical inference times, the power consumption of the electronic device can be maintained at a relatively stable level.
[0127] It should be understood that the inference prediction model is a trained computing model, whose input data is the target resource data and output data is the number of theoretical inferences.
[0128] Among them, when the electronic device performs task reasoning through the preset model, in order to suppress the continuous increase of the power consumption of the electronic device, the number of reasoning tasks executed is limited by detecting the resources and operating status of the electronic device. Therefore, in order to obtain the theoretical number of reasoning tasks that the electronic device supports to perform reasoning tasks with the preset model, the reasoning prediction model is modeled through the following steps (1)-(6), and the modeling is described by taking the resources and operating status of the electronic device including the power supply mode of the electronic device, the temperature of the electronic device, and the CPU and GPU in the electronic device as examples.
[0129] (1) Obtain multiple pieces of initial data of the electronic device, each piece of initial data includes the power-on status of the electronic device, CPU load, GPU load, case temperature, ambient temperature, and theoretical inference times.
[0130] It should be understood that different types of electronic devices, or electronic devices of the same type but different models, have different corresponding initial data. Therefore, when modeling, it is necessary to obtain corresponding initial data according to the electronic device.
[0131] Also, the initial data is used to train the inference prediction model, so the amount of initial data needs to meet the training requirements, for example, 100 initial data or even more initial data.
[0132] The casing temperature and the ambient temperature are obtained through corresponding temperature sensors, wherein the ambient temperature can also be preset according to time.
[0133] (2) Normalize the feature data in the initial data to eliminate the influence of dimension.
[0134] Feature data include power-on status, CPU load, GPU load, case temperature, and ambient temperature. The value ranges and distributions of these feature data may be different. By normalizing the feature data of the input model, all feature data can be mapped to a similar interval, allowing the model to treat each feature data in a fairer manner during training.
[0135] For example, the minimum and maximum normalization method can be used for processing, and each feature data can be normalized using the following formula:
[0136] In the formula, It is a characteristic data among the plug-in status, CPU load, GPU load, case temperature, and ambient temperature, and is the original data of the characteristic data. is the minimum value of the feature data, is the maximum value of the feature data, The feature data is normalized.
[0137] (3) Establish a multivariate linear regression model and obtain the initial inference model.
[0138] The relationship between the characteristic data and the predicted theoretical inference times were explored through multiple linear regression analysis to obtain the initial inference model.
[0139] Specifically, the initial reasoning model is in the following form:
[0140] In the formula, is the number of theoretical inferences, is the data normalized after plug-in status. This is the data after CPU load normalization. is the data after GPU load normalization, is the normalized data of the casing temperature, is the data normalized to ambient temperature, is the intercept term, is the regression coefficient of the plug-in state, is the regression coefficient of CPU load, is the regression coefficient of GPU load, is the regression coefficient of the casing temperature, is the regression coefficient of ambient temperature, is the error term.
[0141] It should be understood that , , , , , and It is unknown and needs to be determined by training the initial inference model through initial data.
[0142] (4) Based on the training data in the initial data, the initial inference model in (3) is trained to obtain , , , , , .
[0143] It should be understood that the training data is obtained by dividing the initial data according to a preset ratio, such as 8:2, to obtain a training set (ie, training data) and a test set.
[0144] (5) Use the least squares method for regression analysis.
[0145] It should be understood that the goal of the least squares method is to minimize the loss function, thereby determining the optimal model parameters. In regression analysis, the loss function is used to measure the degree of difference between the test value and the true value, and then determine the combination of model parameters that minimizes the difference, where the loss function is as follows:
[0146] In the formula, is the sum of squared errors, is the number of training data, For the The number of theoretical inferences in the training data, For the The plug-in status in the training data, For the The CPU load in the training data, For the GPU load in training data, For the The casing temperature in the training data, For the The ambient temperature in the training data.
[0147] It should also be understood that It is an important indicator for evaluating the goodness of fit of the initial inference model. The smaller is the difference between the model prediction value and the true value, the better the model fits the data. If L is greater than or equal to the error threshold, the model parameters need to be adjusted through the above steps (3) and (4). If L is less than the error threshold, the alternative inference model is obtained through the corresponding model parameters.
[0148] (6) Use the test data in the initial data to evaluate the alternative inference model, calculate the error between the predicted value and the actual value, evaluate the fitting effect of the model, and obtain the target inference model.
[0149] It should be understood that the target reasoning model is the reasoning prediction model in the above embodiment, and the reasoning prediction model is used to predict the theoretical reasoning times in the power consumption control method.
[0150] It should also be understood that in specific application scenarios, it is also possible to detect the resources and operating status of different electronic devices to obtain corresponding target resource data; for example, memory monitoring may also be performed; for another example, when the preset model involves the NPU when performing reasoning tasks, the target resource data corresponding to the NPU is also involved when the corresponding reasoning model is modeled. Therefore, in application scenarios involving the resources and operating status of different electronic devices, the corresponding reasoning prediction model can also be modeled through the modeling method of the above steps (1)-(6).
[0151] S340: When the number of theoretical reasoning times is greater than zero, execute the target reasoning task based on the preset model.
[0152] The target reasoning task is determined by the number of theoretical reasonings. The target reasoning task can be a reasoning task corresponding to the number of theoretical reasonings, or a reasoning task corresponding to the number of theoretical reasonings as an upper limit.
[0153] That is, the number of target reasoning tasks is less than or equal to the number of theoretical reasoning tasks.
[0154] By detecting the resources and operating status of the electronic device and analyzing the target resource data obtained from the detection, the maximum number of reasoning tasks that the processor can perform, that is, the theoretical number of reasoning times, is determined; the electronic device is enabled to perform the target reasoning tasks determined by the theoretical number of reasoning times; thus, when the processor in the electronic device performs these target reasoning tasks, it can achieve reasonable control and optimization of the power consumption of the electronic device, thereby improving the user experience.
[0155] The above embodiment focuses on the target resource data obtained by detecting the resources and operating status of the electronic device, and performs reasoning based on the target resource data to obtain the number of reasoning tasks that the target resource data supports to be executed through the preset model, thereby improving the phenomenon of excessive processor load. Figure 6 The illustrated embodiment describes in detail how to perform a corresponding reasoning task, namely, a target reasoning task, based on the theoretical number of reasoning times.
[0156] Figure 6 A schematic diagram of a flow chart of another power consumption control method provided in an embodiment of the present application is shown, such as Figure 6 As shown, the power consumption control method provided in the embodiment of the present application includes the following steps: S410: In response to a first operation, load a preset model.
[0157] S420: Detect the resources and operating status of the electronic device to obtain target resource data.
[0158] S430, inputting the target resource data into the inference prediction model to obtain the theoretical inference times.
[0159] S440: When the theoretical inference times is zero, the inference task is not executed, and the resources and operating status of the electronic device are detected based on a preset first monitoring frequency to obtain updated target resource data.
[0160] It should be understood that during an analysis process, when the number of theoretical inferences is zero, it indicates that the electronic device at this time does not meet the requirements for executing the inference task and needs to put the inference task on hold. Based on the preset first monitoring frequency, the resources and operating status of the electronic device continue to be detected to obtain updated target resource data.
[0161] It should be understood that by presetting a first monitoring frequency to perform cyclic monitoring of the resources and operating status of the electronic device, dynamic monitoring of the electronic device is achieved to determine whether the electronic device meets the requirements for executing the reasoning task; for example, the resources and operating status of the electronic device are monitored once every 5 seconds and once every 6 seconds.
[0162] It should be understood that the preset first monitoring frequency is determined by the dot data related to various resources and operating states while ensuring the normal operation of the electronic device, and the preset first monitoring frequency will not affect the normal operation of the electronic device.
[0163] The resources and operating status of the electronic device include the power supply mode of the electronic device, the temperature of the electronic device, and multiple or all data of the CPU, GPU, NPU and other data in the electronic device. The frequency of the dot data corresponding to different data is different. Therefore, it is necessary to comprehensively consider the monitored data to determine the preset first monitoring frequency.
[0164] It should be understood that when the number of theoretical inferences is zero, the resources and operating status of the electronic device are continuously detected to facilitate the execution of reasoning tasks in a timely manner when the resources and operating status of the electronic device support the execution of reasoning tasks, thereby improving the stability of the system.
[0165] S450: When the number of theoretical reasoning times is greater than zero, determine the target reasoning task to be performed by the preset model based on the number of theoretical reasoning times.
[0166] It should be understood that the reasoning tasks performed by the preset model, that is, all the candidate reasoning tasks involved in the initial reasoning task queue, are determined by the application scenario corresponding to the target function, and the initial reasoning task queue contains multiple candidate reasoning tasks. For example, in the above-mentioned document search application scenario, the corresponding initial reasoning task queue includes candidate reasoning tasks such as key information extraction, summary extraction, and information slot extraction.
[0167] Based on the functional requirements corresponding to the application scenario, the candidate reasoning tasks are arranged in order of priority to obtain an initial reasoning task queue, and then the first N candidate reasoning tasks in the initial reasoning task queue are used as target reasoning tasks, where N is a positive integer less than or equal to the theoretical number of reasonings.
[0168] For example, the candidate reasoning tasks in the initial reasoning task queue are sorted from high to low according to priority. For example, in the above document search example, the initial reasoning task queue includes key information extraction, summary extraction, and information slot extraction. The priority of each candidate reasoning task in the initial reasoning task queue is shown in the following table: Table 1 Details of the initial inference task queue
[0169] In Table 1, when the priority is 1, the corresponding priority level is the highest.
[0170] It should be understood that the target reasoning task is an alternative reasoning task corresponding to the theoretical number of reasonings obtained from the initial reasoning task queue according to the theoretical number of reasonings; that is, it is obtained in the initial reasoning task queue from high to low priority until the number of reasoning tasks obtained reaches the theoretical number of reasonings, and the corresponding reasoning task obtained is the target reasoning task.
[0171] Alternatively, the target reasoning task is an alternative reasoning task with a smaller number of theoretical reasoning times than the theoretical reasoning times, which is obtained from the initial reasoning task queue as the target reasoning task.
[0172] For the initial reasoning task queue shown in Table 1, if the number of theoretical reasoning times is 1, the target reasoning task is key information extraction. If the number of theoretical reasoning times is 2, the target reasoning tasks can be two, namely key information extraction and summary extraction. The target reasoning task can be one, namely key information extraction.
[0173] S460: Execute the target reasoning task based on the preset model.
[0174] Among them, the target reasoning tasks are executed in order from high to low priority.
[0175] It should be understood that the target reasoning task is determined by fully considering the current resources and operating status of the electronic device. Therefore, when the electronic device is executing the target reasoning task through the preset model, the processor load can be in a more appropriate state, so that the performance of the processor is optimized, the efficiency of processing reasoning tasks is accelerated, and the multi-task parallel processing capability is improved; at the same time, the stability of the electronic device is enhanced, and reasonable control and optimization of power consumption is achieved.
[0176] In order to ensure the smooth execution of the target reasoning task and to reasonably utilize the hardware resources, in the process of executing the target reasoning task, the resources and operating status of the electronic device are monitored in real time. That is, after step 450, the following steps are also included: S470. During the execution of the target reasoning task, based on the preset first monitoring frequency, continue to detect the resources and operating status of the electronic device to obtain updated target resource data.
[0177] It should be noted that the updated target resource data is input into the reasoning prediction model to obtain the updated theoretical reasoning number; if the theoretical reasoning number corresponding to the updated target resource data is zero, the target reasoning task is stopped, so that the hardware resources can be reasonably utilized; if the theoretical reasoning number is greater than zero, the target reasoning task is continued to ensure the smooth execution of the target reasoning task.
[0178] In order to improve the accuracy of the target resource data, each time the resources and operating status of the electronic device are detected, the number of sampling times per unit time can be increased and the average value of the sampling data can be calculated, and then the average value is the target resource data.
[0179] That is to say, each time the resources and operating status of the electronic device are detected, the resources and operating status of the electronic device are sampled M times per unit time to obtain M groups of sampling data, and the average value of the M groups of sampling data is calculated, and the average value is the target resource data.
[0180] Wherein, M is a positive integer, for example, 5, 10, etc.
[0181] For example, each time the resources and operating status of an electronic device are detected, samples are taken 10 times within a unit time of 1 second to obtain 10 sets of sampling data, and then the average value of the 10 sets of sampling data is calculated to obtain the target resource data for this detection of the resources and operating status of the electronic device.
[0182] Regarding the implementation process of step 410 to step 430, reference may be made to the detailed description of the above-mentioned step 310 to step 330, which will not be repeated here.
[0183] It should be noted that, by increasing the real-time monitoring of the resources and operating status of the electronic device during the execution of the target reasoning task, and the method of averaging multiple samples when detecting the resources and operating status of the electronic device each time, the performance of the processor in the power consumption control process is optimized, while also improving the accuracy of the power consumption control method and enhancing the user experience of the electronic device.
[0184] It should be understood that before performing reasoning tasks through a preset model, the preset model needs to be loaded into the memory first. In order to further improve and optimize the preset model to perform reasoning tasks, in some embodiments, before loading the preset model in the above embodiments, the memory is also monitored. Figure 7 A schematic diagram of a flow chart of another power consumption control method provided in an embodiment of the present application is shown, such as Figure 7 As shown, the power consumption control method provided in the embodiment of the present application includes the following steps: S510: In response to the first operation, monitor the memory of the electronic device based on a preset second monitoring frequency to obtain a memory occupancy rate.
[0185] Memory refers to the component in electronic devices used to store running programs and data, such as Figure 2 RAM in an electronic device shown. Memory capacity determines how many programs and data an electronic device can handle simultaneously. For example, a personal computer with 8GB of memory capacity can store 8GB of data in memory and run programs of corresponding size.
[0186] In an embodiment of the present application, when a preset model is running, it is necessary to first read the file corresponding to the preset model from the hard disk, and then load the preset model into the memory. This is because the read and write speed of the hard disk is relatively slow, while the read and write speed of the memory is faster.
[0187] Taking the intelligent search application in a personal computer as an example, when an image recognition application based on a preset model is started, the file corresponding to the preset model (including the model's parameters, structure and other information) will be read from the personal computer's hard disk to the memory, so the corresponding processor can quickly access the data in the preset model, thereby performing efficient reasoning tasks.
[0188] It should be understood that the above process requires a certain amount of memory space. If the memory is insufficient, it may cause loading failure or slow system operation. When the memory usage is high, the performance of the electronic device will also be reduced. Therefore, it is necessary to monitor the memory usage before loading the preset model.
[0189] Among them, the preset second monitoring frequency is determined by relevant information such as the hardware resources of the electronic device, memory fluctuations, etc., and for different types of electronic devices and different models of electronic devices, the corresponding preset second monitoring frequencies are different; the preset second monitoring frequency can be the same as or different from the preset first monitoring frequency.
[0190] It should also be understood that the preset second monitoring frequency does not affect the normal operation of the electronic device. For example, the memory of the electronic device is monitored once every 3 seconds, and the memory status of the electronic device is monitored once every 5 seconds.
[0191] S520: If the memory usage is less than a preset threshold, load a preset model.
[0192] The preset threshold is determined by the memory capacity of the electronic device and the size of the preset model.
[0193] It should be understood that the memory capacity in different types of electronic devices, or in electronic devices of the same type but different models, is different, and therefore, the memory capacity is determined by the corresponding hardware in the electronic device.
[0194] Also, the sizes of the preset models vary, for example, models suitable for simple tasks, models used for complex artificial intelligence tasks, etc. Therefore, by monitoring the memory capacity, it can also be determined whether the memory in the electronic device has enough space to store the preset model.
[0195] For example, the first model in the above example is a large language model on the client side, which has 3B parameters. Since the number of parameters is a key factor affecting the model size, the first model may require a memory capacity of 6GB. Therefore, the preset threshold also needs to consider the size of the preset model.
[0196] Therefore, the preset threshold is smaller than the memory capacity and can satisfy the requirement of loading the preset model into the memory. By limiting the memory capacity by the preset threshold, it is ensured that there is enough space in the memory to load the preset model, thereby increasing the probability of successful loading of the preset model and reducing the occurrence of electronic device freezes, response delays, and the like.
[0197] And, if the memory occupancy rate is greater than or equal to the preset threshold value, the loading of the preset model is not executed, and, based on the preset second monitoring frequency, the memory of the electronic device is monitored to obtain an updated memory occupancy rate.
[0198] For example, if the total memory capacity of a personal computer is 32GB, the corresponding preset threshold may be 50%. If the memory occupancy rate is 32%, which is less than 50%, the preset model is loaded; if the memory occupancy rate is 58%, which is greater than or equal to 50%, the preset model is not loaded, and the memory of the electronic device is periodically monitored based on the preset second monitoring frequency.
[0199] In some embodiments, the memory usage can also be monitored. For example, the total memory capacity of a personal computer is 32 GB, and the corresponding preset threshold can be 16 GB. If the memory usage is 8 GB, which is less than 16 GB, the preset model is loaded.
[0200] S530: Detect the resources and operating status of the electronic device to obtain target resource data.
[0201] S540: Input the target resource data into the inference prediction model to obtain the theoretical inference times.
[0202] S550: When the theoretical inference times is zero, the inference task is not executed, and the resources and operating status of the electronic device are detected based on the preset first monitoring frequency to obtain updated target resource data.
[0203] S560: When the number of theoretical reasoning times is greater than zero, determine the target reasoning task to be performed by the preset model based on the number of theoretical reasoning times.
[0204] S570: Execute the target reasoning task based on the preset model.
[0205] S580. During the execution of the target reasoning task, based on the preset first monitoring frequency, continue to detect the resources and operating status of the electronic device to obtain updated target resource data.
[0206] Regarding the implementation process of step 530 to step 580, reference may be made to the detailed description of the above-mentioned step 420 to step 470, which will not be repeated here.
[0207] The embodiment of the present application adds monitoring of the memory of the electronic device before loading the preset model, so as to determine in advance whether the electronic device has sufficient space to accommodate the preset model, thereby avoiding failure of loading the preset model due to insufficient memory; at the same time, it can prevent the original insufficient memory situation from being further aggravated due to loading the preset model, thereby causing system performance degradation or even crash; it can also provide a basis for optimizing the preset model, such as determining whether it is necessary to compress the preset model to match the memory capacity.
[0208] It should be understood that the target function includes multiple functions, among which, when some of the first functions are executed, it is necessary to run a preset language model on the electronic device, for example, the semantic search function requires a preset language model, and then the corresponding function is realized by running the preset language model. Among them, the preset language model can be a language model; it can also be a multimodal model.
[0209] Taking semantic search in a smart search application in a personal computer as an example, in this application scenario, the first function is a semantic search service triggered by voice or text input by the user; in the embodiment of the present application, the power consumption control method specifically includes the following steps (1)-(6): (1) In response to a second operation, the memory of the personal computer is monitored based on a preset second monitoring frequency to obtain a memory occupancy rate. The second operation is used to trigger the first function.
[0210] (2) When the memory usage is less than the preset threshold, the preset language model is loaded.
[0211] (3) Detecting resources such as CPU load and GPU load in the personal computer, as well as operating states such as power-on state and case temperature, to obtain first resource data of the personal computer.
[0212] (4) Inputting the first resource data into a pre-established inference prediction model to obtain a first inference number supported by the first resource data. The inference prediction model is a model trained based on the first resource data such as CPU load, GPU load, plug-in status, and housing temperature in the personal computer and the corresponding theoretical inference number.
[0213] It should be understood that the first inference number is the maximum number of inference tasks executed corresponding to the first resource data.
[0214] (5) The first inference number is 0, and the inference task is not executed (when the inference task is not executed, the first inference number is obtained when the resources and operating status of the personal computer are monitored), or the inference task is stopped (when the first inference task is executed, the updated first inference number is obtained when the resources and operating status of the personal computer are monitored), and the resources such as the CPU load and GPU load in the personal computer, as well as the operating status such as the power-on status and the casing temperature are continuously detected based on the preset first monitoring frequency, and the first resource data is updated.
[0215] (6) If the first inference number is greater than 0, the inference task corresponding to the first inference number is obtained from the initial inference task queue, that is, the first inference task.
[0216] In some embodiments, the number of the first reasoning tasks may be equal to or less than the first reasoning number.
[0217] It should be understood that in the process of executing the first reasoning task through the preset language model, the personal computer will continue to monitor the CPU load, GPU load and other resources in the personal computer, as well as the plug-in status, casing temperature and other operating status in real time, and stop executing the target reasoning task in time when the reasoning condition is not met. Among them, the reasoning condition is that the first reasoning number is greater than zero.
[0218] The main purpose of using preset language models in semantic search is to better understand user intent, generate high-quality results, realize document search, image search, question and answer, dialogue and other functions, provide rich and reasonable search content, so as to improve the accuracy, efficiency, intelligence and diversity of search.
[0219] The embodiment of the present application periodically monitors the power-on status, case temperature, CPU load, and GPU load of a personal computer, calculates the number of theoretical inferences based on the target resource data obtained from the monitoring, obtains the target inference task from the initial inference task queue for execution, and enables the personal computer to execute the corresponding target inference task based on a preset language model. At this time, the processor in the personal computer is in a more appropriate state when executing these target inference tasks, especially the iGPU load, to reduce power consumption and improve the user experience.
[0220] It should be noted that the preset model involved in the embodiments of the present application is a terminal-side model, and the hardware conditions of the electronic device to which it is applied, the number of model parameters, and model compression during operation may all lead to a reduction in the accuracy of the preset language model. Among them, when the preset language model in the preset model has low accuracy, there will be repeated extraction of keywords during the execution of the reasoning task, especially during the keyword extraction process, which will result in the inability to obtain the reasoning result of the reasoning task.
[0221] In order to solve the above problem of poor keyword reasoning effect, in the application scenario involving semantic search, the above power consumption control method further includes the following steps for performing the target reasoning task based on the preset model: First, if the target reasoning task is keyword extraction, determine the queue text after extraction.
[0222] Secondly, when the length of the queue text is greater than or equal to the length of the recorded text, stop executing the corresponding target reasoning task.
[0223] The recorded text may be a text obtained by recognizing the voice input by the user through Automatic Speech Recognition (ASR); or it may be a text input by the user.
[0224] After stopping the execution of the corresponding target reasoning task, the recorded text can be reasoned again using the preset language model.
[0225] It should be understood that when the length of the queue text is less than the length of the record text, the corresponding target reasoning task continues to be executed.
[0226] In the embodiment of the present application, in the reasoning process where the target reasoning task is keyword extraction, the extracted queue text and the record text are first compared, and by analyzing the queue text, the efficiency of executing the target reasoning task through the preset language model is improved, and the accuracy of reasoning is improved.
[0227] In some embodiments, the system architecture of the electronic device is as follows: Figure 3 As shown, the resource monitoring module is included. When the target function is triggered in the electronic device, the resource monitoring module is used to perform specific regulation. Figure 8 The schematic diagram of the process of power consumption control implemented by the resource monitoring module provided in the embodiment of the present application is shown. Figure 3 The power consumption control method provided by the embodiment of the present application is described in detail in combination with the system architecture of the personal computer.
[0228] like Figure 8 As shown, in the application layer, when the target function is triggered, the resource monitoring module in the system service layer will control whether to load the preset model and the number of executable reasoning tasks, so as to maintain the power consumption of the electronic device at a relatively stable level, reduce the power consumption of the electronic device, and improve the user experience.
[0229] Specifically, the resource monitoring module in the system service layer performs the following steps: S610: Monitor the memory to obtain the memory usage.
[0230] Check whether the memory usage meets the high usage requirement, for example, the memory usage rate is greater than or equal to the preset threshold.
[0231] S620: If the memory usage is high, continue to monitor the memory at a preset second monitoring frequency; for example, monitor the memory once every 5 seconds.
[0232] S630: If the memory usage is low, load the preset model.
[0233] The loaded preset model is obtained from the model layer through the inference platform in the inference platform layer. For example, the first language model, the second language model and / or the third language model in the model layer are deployed on hardware such as iGPU and NPU through OpenVino, QNN, and / or TensorRT in the inference platform layer.
[0234] It should be understood that Figure 8 The kernel layer is omitted.
[0235] After the preset model is loaded, continue to perform the following steps through the resource monitoring module: S640: Detect resources (CPU load, GPU load) and operating status (plugged in status, housing temperature) in the electronic device to obtain target resource data.
[0236] S650: Input the target resource data into the inference prediction model and output the theoretical inference times.
[0237] S660: When the number of theoretical reasonings is zero, put the reasoning task on hold.
[0238] S670: Continue to monitor the resources and operating status of the electronic device at a preset first monitoring frequency; for example, monitor the resources and operating status of the electronic device once every 5 seconds.
[0239] It should be understood that at this time, the resources of the electronic device are insufficient to perform the reasoning task, and the reasoning task has not been performed through the preset model. Therefore, the reasoning task is temporarily put aside and not processed. It will be arranged for execution when the number of subsequent theoretical reasoning times is greater than zero.
[0240] S680: When the number of theoretical reasoning times is greater than zero, determine the reasoning tasks that match the number of theoretical reasoning times from the reasoning task queue, that is, the target reasoning tasks, and then execute the target reasoning tasks through the preset model.
[0241] S690: During the execution of the target reasoning task, the resources and operating status of the electronic device will continue to be detected at a preset first monitoring frequency of once every 5 seconds. If the reasoning condition is not met, the reasoning will be stopped.
[0242] It should be understood that failure to satisfy the inference condition means that the resources and the operating status in the electronic device continue to be detected through the preset first monitoring frequency, and the updated theoretical inference times are zero.
[0243] In an embodiment of the present application, the memory of the electronic device is first monitored, and when the memory is not high, the preset model is loaded; then, the resources and operating status of the electronic device are detected to obtain target resource data corresponding to the detection, and the data is analyzed to obtain the theoretical number of inferences, so that the electronic device executes the inference task corresponding to the theoretical number of inferences; thus, when the processor in the electronic device executes these inference tasks, reasonable control and optimization of the power consumption of the electronic device is achieved, thereby improving the user experience.
[0244] In some embodiments, in order to implement the power consumption control process, the electronic device also includes a functional service module and an inference engine module, wherein the functional service module is a module in the application layer, and the inference engine module is a module in the system service layer. When the target function is triggered in the electronic device, the functional service module will send the loading of the preset model to the inference engine module. The inference engine module is used for process control of running the preset model, and the resource monitoring module is used to execute the specific regulation process. Fig. 9 A flow chart of another power consumption control method provided in an embodiment of the present application is shown.
[0245] Below through Fig. 9 The embodiment shown in the figure is described in detail. When the user clicks Figure 4 After a search result "development analysis report" is found in the first display area 43 shown in (b), the following is executed: Fig. 9 The power consumption control method shown is implemented Figure 4 The result shown in (c) in FIG. 1 is that a second display area 44 is presented in the third search window 40 for previewing the search results, and a sub-area 45 in the second display area 44 displays the search results of the abstract extraction.
[0246] like Fig. 9 As shown in the figure, take the document search in the smart search application as an example. After searching for a document, the following is displayed: Figure 4 When the user clicks on a search result "Development Analysis Report" in the first display area 43, as shown in (a) of FIG. Figure 4 As shown in (b), the target function is triggered.
[0247] S701. The functional service module obtains the document path and document status of the "Development Analysis Report" document.
[0248] The document path is used to clarify the storage location of each document, which is used to help subsequent searches quickly find documents. For example, a document path of "C:\User\……\XXX.pdf" can directly locate the document "XXX.pdf". The document status is used to help filter out documents that meet the specific conditions set by the user. Common document statuses include "modification date", "encryption", "read-only", etc. For example, if the user enters a document search for the most recently modified document about YY Development, then the information can be obtained through the "modification date" in the document status.
[0249] When searching for a document, the information inside the document is often involved. Therefore, S702 is continued to be executed, and the functional service module performs processing operations such as parsing, cleaning and risk control on the "Development Analysis Report" document.
[0250] It should be understood that by processing the document, the analysis of the document content by the preset model can be improved, the efficiency of data processing can be improved, and the accuracy of model processing can be improved.
[0251] S703: The functional service module sends the request for the preset model and the text content to the inference engine module.
[0252] S704: The inference engine module instructs the resource monitoring module to load a preset model.
[0253] S705. The resource monitoring module monitors the memory.
[0254] S706: When the memory usage is low (eg, the memory usage rate is less than a preset threshold), the preset model is loaded through the inference platform.
[0255] S707: The inference platform returns the result of whether the preset model is loaded successfully to the inference engine module.
[0256] When the preset model is loaded successfully, S708 is executed, and the inference engine module instructs the resource monitoring module to execute the inference task and sends the text content to the resource monitoring module.
[0257] S709: The resource monitoring module monitors the temperature, plug-in status, CPU load, and GPU load of the electronic device to obtain target resource data.
[0258] S710: Input the target resource data into a pre-established reasoning prediction model to obtain theoretical reasoning times.
[0259] S711. Determine a target reasoning task in the initial reasoning task queue based on the number of theoretical reasoning times. It should be understood that the target reasoning task at this time includes summary extraction.
[0260] S712: The reasoning platform performs the target reasoning task based on the loaded preset model.
[0261] S713: The reasoning platform returns the result of the target reasoning task to the reasoning engine module.
[0262] S714. The reasoning engine module transmits the result of the target reasoning task to the functional service module and saves it.
[0263] S715: After executing the reasoning task, unload the preset model from the memory.
[0264] The inference engine module transmits the result of the abstract extraction to the functional service module and saves it. The functional service module displays the content of the "development analysis report" document and its abstract according to the functional requirements corresponding to the intelligent search application program.
[0265] It should be understood that the above-mentioned model call may involve more modules during the application process, and the embodiments of the present application do not limit the types and uses of the modules involved.
[0266] In the process of executing power consumption control through the above modules, the memory of the electronic device is monitored, and when the memory is not high, the preset model is loaded; then the resources and operating status of the electronic device are detected, and the target resource data corresponding to the detection is obtained, and the theoretical inference times are obtained, so that the electronic device executes the inference task corresponding to the theoretical inference times; then the processor in the electronic device realizes reasonable control and optimization of the power consumption of the electronic device when executing these inference tasks, thereby improving the user experience.
[0267] It should be noted that in the embodiments of the present application, "greater than" can be replaced by "greater than or equal to", "less than or equal to" can be replaced by "less than", or "greater than or equal to" can be replaced by "greater than", and "less than" can be replaced by "less than or equal to".
[0268] It should be understood that the "embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, the various embodiments in the entire specification do not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner.
[0269] It should also be understood that in the present application, "when", "if" and "if" all refer to the electronic device making corresponding processing under certain objective circumstances, and do not limit the time, nor do they require the electronic device to have a judgment action when implementing it, nor do they mean the existence of other limitations.
[0270] In this application, elements expressed in the singular are intended to mean "one or more" rather than "one and only one", unless otherwise specified. In this application, "at least one" is intended to mean "one or more", and "more than one" is intended to mean "two or more", unless otherwise specified.
[0271] It should be understood that the size of the sequence number of each process in the above embodiment does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention. The various embodiments described herein can be independent schemes, or they can be combined according to internal logic, and these schemes all fall within the scope of protection of this application.
[0272] It should also be understood that, although the various steps in the flow chart in the above-described embodiment are shown in sequence according to the indication of the arrows, these steps are not necessarily performed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have strict order restrictions, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flow chart may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with at least a portion of other steps or sub-steps or stages of other steps.
[0273] Fig.10 FIG. 8 is a schematic diagram of a power consumption control device provided in an embodiment of the present application. The power consumption control device 800 can be used to execute the actions executed by the electronic device in the above method embodiment. Fig.10 As shown, the power consumption control device 800 includes a loading model unit 810 , a resource detection unit 820 and an inference unit 830 .
[0274] The model loading unit 810 is used to load a preset model in response to a first operation. The first operation is used to trigger a target function. The electronic device runs the preset model when executing the target function. The preset model is deployed on the electronic device.
[0275] The resource detection unit 820 is used to detect the resources and operating status of the electronic device to obtain target resource data; and input the target resource data into the inference prediction model to obtain the theoretical inference number, where the theoretical inference number is the number of inference tasks supported by the target resource data.
[0276] The reasoning unit 830 is used to execute the target reasoning task determined by the theoretical reasoning number through a preset model when the theoretical reasoning number is greater than zero.
[0277] The power consumption control device provided in the embodiment of the present application is used to execute the power consumption control method of the above embodiment. The technical principle and technical effect are similar and will not be repeated here.
[0278] It should be understood that the power consumption control device may be a terminal device or a chip within the terminal device.
[0279] It should be noted that the power consumption control device of the above application is embodied in the form of a functional unit. The term "unit" here can be implemented in the form of software and / or hardware, and is not specifically limited to this.
[0280] The embodiment of the present application provides a computer program product, when the computer program product is run on an electronic device, the electronic device executes the technical solution in the above embodiment. Its implementation principle and technical effect are similar to those of the above method-related embodiments, and will not be repeated here.
[0281] The embodiment of the present application provides a readable storage medium, which contains instructions. When the instructions are executed in an electronic device, the electronic device executes the technical solution of the above embodiment. The implementation principle and technical effect are similar and will not be repeated here.
[0282] Among them, a computer-readable storage medium and a computer program product are provided for executing the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0283] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0284] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0285] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation. For example, 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.
[0286] 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 over multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0287] 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.
[0288] If the function 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 the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of 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 various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.
[0289] The same or similar parts between the various embodiments in this application can refer to each other. In the various embodiments in this application, and the various implementation methods / implementation methods / implementation methods in each embodiment, if there is no special explanation and logical conflict, the terms and / or descriptions between different embodiments and the various implementation methods / implementation methods / implementation methods in each embodiment are consistent and can be referenced to each other. The technical features in different embodiments and the various implementation methods / implementation methods / implementation methods in each embodiment can be combined to form new embodiments, implementation methods, implementation methods, or implementation methods according to their inherent logical relationships. The above implementation methods of this application do not constitute a limitation on the scope of protection of this application.
[0290] The above are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims. In short, the above are only preferred embodiments of the technical solution of the present application, and are not used to limit the protection scope of the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
Claims
1. A power consumption control method, characterized in that: Applied to an electronic device, a preset model is deployed on the electronic device, and the power consumption control method includes: In response to a first operation, loading the preset model, the first operation is used to trigger a target function, so that the electronic device runs the preset model when executing the target function; Detecting the resources and operating status of the electronic device to obtain target resource data; Inputting the target resource data into the inference prediction model to obtain a theoretical inference number, wherein the theoretical inference number is the number of inference tasks executed corresponding to the target resource data; When the theoretical reasoning times is greater than zero, a target reasoning task is performed based on the preset model, and the target reasoning task is determined by the theoretical reasoning times.
2. The power consumption control method according to claim 1, characterized in that: The performing of the target reasoning task based on the preset model further includes: In the process of executing the target reasoning task, based on a preset first monitoring frequency, the resources and operating status of the electronic device are detected to obtain updated target resource data; Inputting the updated target resource data into the inference prediction model to obtain an updated theoretical inference number; When the updated theoretical reasoning times is zero, the target reasoning task is stopped.
3. The power consumption control method according to claim 1, characterized in that: Before executing the target reasoning task based on the preset model, the method further includes: Obtaining an alternative reasoning task corresponding to the target function; Arrange the candidate reasoning tasks in descending order of priority to obtain an initial reasoning task queue; The first N candidate reasoning tasks in the initial reasoning task queue are used as the target reasoning tasks, where N is a positive integer less than or equal to the theoretical reasoning number.
4. The power consumption control method according to claim 1, characterized in that: The target resource data is input into the inference prediction model to obtain the theoretical inference times, and the following steps are also included: When the theoretical inference times is zero, based on the preset first monitoring frequency, the inference tasks in the initial inference task queue are not executed, and the resources and operating status of the electronic device are detected to obtain updated target resource data.
5. The power consumption control method according to any one of claims 1 to 4, characterized in that: The detecting of the resources and the operating status of the electronic device to obtain target resource data includes: Each time the resources and the operating state of the electronic device are detected, the resources and the operating state of the electronic device are sampled M times in a unit time to obtain M groups of sampled data, where M is a positive integer; The mean value of the M groups of sampled data is calculated to obtain the target resource data.
6. The power consumption control method according to any one of claims 1 to 4, characterized in that: In response to the first operation, loading the preset model includes: In response to the first operation, monitoring the memory of the electronic device based on a preset second monitoring frequency to obtain a memory occupancy rate; If the memory occupancy rate is less than a preset threshold, the preset model is loaded, and the preset threshold is determined by the memory capacity of the electronic device.
7. The power consumption control method according to any one of claims 1 to 4, characterized in that: The resources of the electronic device include CPU load and GPU load, and the operating status of the electronic device includes power-on status and electronic device temperature.
8. The power consumption control method according to any one of claims 1 to 4, characterized in that: The target function includes a first function, the electronic device runs a preset language model when executing the first function, and the power consumption control method includes: In response to a second operation, loading the preset language model, wherein the second operation is used to trigger the first function; Detecting a CPU load, an iGPU load, a power-on status, and a temperature of the electronic device to obtain first resource data; Inputting the first resource data into the inference prediction model to obtain a first inference number; When the first inference number is greater than zero, a first inference task is performed based on the preset language model, and the number of the first inference tasks is less than or equal to the first inference number.
9. The power consumption control method according to claim 8, characterized in that: The process in which the preset language model performs the first reasoning task also includes: If the first reasoning task is keyword extraction, determining the extracted queue text; When the length of the queue text is greater than or equal to the length of the recorded text, stop executing the keyword extraction, wherein the recorded text is the text obtained after voice recognition of the voice input by the user when the first function is triggered, or the text input by the user.
10. The power consumption control method according to any one of claims 1 to 4, characterized in that: The electronic device includes a resource monitoring module, and the power consumption control method includes: In response to the first operation, the resource monitoring module loads the preset model; The resource monitoring module detects the resources and operating status of the electronic device to obtain target resource data; The resource monitoring module inputs the target resource data into the inference prediction model to obtain the theoretical inference times; When the theoretical inference times is greater than zero, the resource monitoring module performs the target inference task based on the preset model.
11. A power consumption control device, characterized in that: The power consumption control device comprises a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that the power consumption control device executes the method according to any one of claims 1 to 10.
12. A computer program product, characterized in that The computer program product comprises a computer program, which, when executed by a processor, causes the processor to perform the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Queue resource adjustment method and device, electronic equipment and computer readable medium
CN112231100A
Display card resource allocation method and device, electronic equipment and storage medium
CN118484312A
Reasoning board card, reasoning method based on reasoning board card, equipment, medium and product
CN119047584A
Cited By
Control method and artificial intelligence experiment system
CN121354556A