IP Library › Granted Patent US 12,387,136
Granted Patent B2
US 12,387,136 · App. 17/604,670 · Granted Aug 12, 2025

Method and apparatus for adapting deep learning model, and electronic device

Inventors: Tuobang Wu (Beijing, CN); En Shi (Beijing, CN); Yongkang Xie (Beijing, CN); Xiaoyu Chen (Beijing, CN); Lianghuo Zhang (Beijing, CN); Jie Liu (Beijing, CN); Binbin Xu (Beijing, CN)
Assignee: BEIJING BAIDU NETCOM SCIENCE AND TECHNOLOGY CO., LTD.
G06N20/00G06F16/242G06F16/258
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,387,136
App. No.
17/604,670
Granted
Aug 12, 2025
Kind
B2
Abstract

The present disclosure discloses a method and an apparatus for adapting a deep learning model, an electronic device and a medium, which relates to technology fields of artificial intelligence, deep learning, and cloud computing. The specific implementation plan is: obtaining model information of an original deep learning model and hardware information of a target hardware to be adapted; querying a conversion path table according to the model information and the hardware information to obtain a matched target conversion path; and converting, according to the target conversion path, the original deep learning model to an intermediate deep learning model in the conversion path, and converting the intermediate deep learning model to the target deep learning model. Therefore, the deep learning model conversion is performed based on the model conversion path determined by the model information of the original deep learning model and the hardware information of the target hardware, which realizes converting any type of original deep learning model into the target deep learning model adapted to any target hardware, and solves the problem that the deep learning model is difficult to be applied to different hardware terminals.

Claims (59)

1. A method for adapting a deep learning model, comprising:

obtaining model structure information of an original deep learning model and hardware information of a target hardware to be adapted;

querying a conversion path table according to the model structure information and the hardware information to obtain a matched target conversion path; and

converting, according to the target conversion path, the original deep learning model to an intermediate deep learning model in the conversion path, and converting the intermediate deep learning model to a target deep learning model;

wherein there are a plurality of intermediate deep learning models, and the target conversion path is configured to indicate a conversion sequence of the plurality of intermediate deep learning models;

wherein converting, according to the target conversion path, the original deep learning model to the intermediate deep learning model in the conversion path, and converting the intermediate deep learning model to the target deep learning model comprises:

determining a model before conversion and a model after conversion for each model conversion and an execution sequence of respective model conversions according to the conversion sequence of the plurality of intermediate deep learning models in the target conversion path;

generating a conversion task of each model conversion according to a mapping relation between the model before conversion and the model after conversion of each model conversion; and

sequentially executing the conversion tasks of respective model conversions on the original deep learning model according to the execution sequence of respective model conversions, to obtain the target deep learning model;

wherein the model structure information of the deep learning model comprises a fully-connected layer, a loop structure, a convolutional layer and a pooling layer;

wherein the hardware information is an artificial intelligence, AI, inference accelerator chip information.

2. The method of claim 1 , wherein generating the conversion task of each model conversion according to the mapping relation between the model before conversion and the model after conversion of each model conversion comprises:

querying at least one of an operator mapping relation, a tensor mapping relation, and a model parameter mapping relation for the model before conversion and the model after conversion of each model conversion; and

generating the conversion task for each model conversion according to at least one of the operator mapping relation, the tensor mapping relation, and the model parameter mapping relation.

3. The method of claim 1 , wherein there are at least two target hardware, and querying the conversion path table according to the model structure information and the hardware information to obtain the matched target conversion path comprises:

combining the hardware information of each target hardware with the model structure information to obtain at least two pieces of combined information;

querying the conversion path table according to at least two pieces of combined information to obtain at least two candidate conversion paths, wherein each candidate conversion path matches one piece of combined information; and

generating the target conversion path according to the at least two candidate conversion paths.

4. The method of claim 3 , wherein generating the target conversion path according to the at least two candidate conversion paths comprises:

determining overlapping parts of the at least two candidate conversion paths; and

merging the overlapping parts of the at least two candidate conversion paths to obtain the target conversion path.

5. The method of claim 1 , wherein the model structure information comprises model structure information and training framework information.

6. An electronic device, comprising:

at least one processor; and

a memory communicatively coupled to the at least one processor;

wherein the memory is configured to store instructions executable by the at least one processor;

when the instructions are executed by the at least one processor, the at least one processor is configured to:

obtain model structure information of an original deep learning model and hardware information of a target hardware to be adapted;

query a conversion path table according to the model structure information and the hardware information to obtain a matched target conversion path; and

convert, according to the target conversion path, the original deep learning model to an intermediate deep learning model in the conversion path, and convert the intermediate deep learning model to a target deep learning model;

wherein there are a plurality of intermediate deep learning models, and the target conversion path is configured to indicate a conversion sequence of the plurality of intermediate deep learning models;

wherein the at least one processor is configured to:

determine a model before conversion and a model after conversion for each model conversion and an execution sequence of respective model conversions according to the conversion sequence of the plurality of intermediate deep learning models in the target conversion path;

generate a conversion task of each model conversion according to a mapping relation between the model before conversion and the model after conversion of each model conversion; and

sequentially execute the conversion tasks of respective model conversions on the original deep learning model according to the execution sequence of respective model conversions, to obtain the target deep learning model;

wherein the model structure information of the deep learning model comprises a fully-connected layer, a loop structure, a convolutional layer and a pooling layer;

wherein the hardware information is an artificial intelligence, AI, inference accelerator chip information.

7. The electronic device of claim 6 , wherein the at least one processor is configured to:

query at least one of an operator mapping relation, a tensor mapping relation, and a model parameter mapping relation for the model before conversion and the model after conversion of each model conversion; and

generate the conversion task for each model conversion according to at least one of the operator mapping relation, the tensor mapping relation, and the model parameter mapping relation.

8. The electronic device of claim 6 , wherein there are at least two target hardware, and the at least one processor is configured to:

combine the hardware information of each target hardware with the model structure information to obtain at least two pieces of combined information;

query the conversion path table according to at least two pieces of combined information to obtain at least two candidate conversion paths, wherein each candidate conversion path matches one piece of combined information; and

generate the target conversion path according to the at least two candidate conversion paths.

9. The electronic device of claim 8 , wherein the at least one processor is configured to:

determine overlapping parts of the at least two candidate conversion paths; and

merge the overlapping parts of the at least two candidate conversion paths to obtain the target conversion path.

10. The electronic device of claim 6 , wherein the model structure information comprises model structure information and training framework information.

11. A non-transitory computer-readable storage medium having computer instructions stored thereon, wherein the computer instructions are configured to enable a computer to implement a method for adapting a deep learning model, the method comprising:

obtaining model structure information of an original deep learning model and hardware information of a target hardware to be adapted;

querying a conversion path table according to the model information and the hardware information to obtain a matched target conversion path; and

converting, according to the target conversion path, the original deep learning model to an intermediate deep learning model in the conversion path, and converting the intermediate deep learning model to a target deep learning model;

wherein there are a plurality of intermediate deep learning models, and the target conversion path is configured to indicate a conversion sequence of the plurality of intermediate deep learning models;

wherein converting, according to the target conversion path, the original deep learning model to the intermediate deep learning model in the conversion path, and converting the intermediate deep learning model to the target deep learning model comprises:

determining a model before conversion and a model after conversion for each model conversion and an execution sequence of respective model conversions according to the conversion sequence of the plurality of intermediate deep learning models in the target conversion path;

generating a conversion task of each model conversion according to a mapping relation between the model before conversion and the model after conversion of each model conversion; and

sequentially executing the conversion tasks of respective model conversions on the original deep learning model according to the execution sequence of respective model conversions, to obtain the target deep learning model;

wherein the model structure information of the deep learning model comprises a fully-connected layer, a loop structure, a convolutional layer and a pooling layer;

wherein the hardware information is an artificial intelligence, AI, inference accelerator chip information.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 18, 2021
From: WU, TUOBANG; SHI, EN; XIE, YONGKANG; CHEN, XIAOYU; ZHANG, LIANGHUO; LIU, JIE; XU, BINBIN
To: BEIJING BAIDU NETCOM SCIENCE AND TECHNOLOGY CO., LTD.
Reel/Frame 057823/0606 →
Priority Claims (1)
CN 202010601781.5 · Jun 29, 2020 · national
Continuity (1)
Related Publication 20220309395A1 · Sep 29, 2022
References Cited (29)
US 20190370685A1 · Xie et al. · 2019 [cited by applicant]
US 20190391796A1 · Brady · 2019 [cited by examiner]
US 20190392296A1 · Brady · 2019 [cited by applicant]
US 20200104129A1 · Liu et al. · 2020 [cited by applicant]
US 20200410354A1 · Zejda · 2020 [cited by examiner]
CN 106650922A · 2017 [cited by applicant]
CN 108764487A · 2018 [cited by applicant]
CN 109492241A · 2019 [cited by applicant]
CN 111191789A · 2020 [cited by applicant]
CN 111275199A · 2020 [cited by applicant]
CN 111291882A · 2020 [cited by applicant]
JP H0981569A · 1997 [cited by applicant]
KR 20200023238A · 2020 [cited by applicant]
WO WO2020005806A1 · 2020 [cited by examiner]
WO 2020102888A1 · 2020 [cited by applicant]
Scott Cyphers, etc., “Intel nGraph: An Intermediate Representation, Compiler, and Executor for Deep Learning”, published via arXiv as of Jan. 30, 2018, retrieved Dec. 11, 2024. (Year: 2018). [cited by examiner]
Abhishek Dubey, “A quick intro to Intel's OpenVINO toolkit for faster deep learning inference”, published on May 18, 2020 to https://towardsdatascience.com/a-quick-intro-to-intels-openvino-toolkit-for-faster-deep-learni… [cited by examiner]
Amit Dhurandhar, etc., “Improving Simple Models with Confidence Profiles”, published as of Nov. 19, 2018 via arXiv, retrieved Dec. 11, 2024. (Year: 2018). [cited by examiner]
Jared Roesch, etc., “Relay: A High-Level Compiler for Deep Learning”, published to arXiv on Aug. 24, 2019, retrieved Jun. 25, 2025. (Year: 2019). [cited by examiner]
Fred Chow, “Intermediate Representation—Communications of the ACM”, published to https://cacm.acm.org/practice/intermediate-representation on Dec. 1, 2013, retrieved Jun. 25, 2025. (Year: 2013). [cited by examiner]
Diana Marculescu, etc., “Hardware-Aware Machine Learning: Modeling and Optimization”, published to arXiv on Sep. 14, 2018, retrieved Jun. 25, 2025. (Year: 2018). [cited by examiner]
Tianqi Chen, etc., “TVM: An Automated End-to-End Optimizing Compiler for Deep Learning”, published to arXiv on Oct. 5, 2018, retrieved Jun. 25, 2025. (Year: 2018). [cited by examiner]
Design & Reuse, “HW/SW Interface Generation Flow Based on Abstract Models of System Applications and Hardware Architectures”, published on Oct. 11, 2010, retrieved Jun. 25, 2025. (Year: 2010). [cited by examiner]
Office Action for Chinese Patent Application No. 202010601781.5, dated Jun. 8, 2023, 21 pages. [cited by applicant]
PCT/ISA/210 and PCT/ISA/237 for PCT/CN2020/115660, dated Apr. 1, 2021. [cited by applicant]
European Extended Search Report of European Application No. 20930649.7 dated Jan. 27, 2023, 12 pages. [cited by applicant]
Office Action of Japanese Application No. 2021-562306 dated Dec. 5, 2022, 7 pages. [cited by applicant]
Hannes Fassold (Joanneum) et al: “Neural Network Exchange Formats and Acceleration Libraries”, 124. MPEG Meeting; Oct. 8, 2018-Oct. 12, 2018; Macao; (Motion Picture Expert Group or ISO/IEC JTC1/SC29/WG11), No. m44592, O… [cited by applicant]
Engl Translation & Office Action dated Nov. 19, 2024(KR 10-2021-7033450), 13 pgs. [cited by applicant]