File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ namespace core {
1616namespace runtime {
1717
1818using EngineID = int64_t ;
19- const std::string ABI_VERSION = " 7 " ;
19+ const std::string ABI_VERSION = " 8 " ;
2020extern bool MULTI_DEVICE_SAFE_MODE;
2121
2222typedef enum {
@@ -46,9 +46,6 @@ std::string base64_encode(const std::string& in);
4646std::string base64_decode (const std::string& in);
4747std::string serialize_bindings (const std::vector<std::string>& bindings);
4848
49- std::string resource_allocation_strategy_to_string (TRTEngine::ResourceAllocationStrategy strategy);
50- TRTEngine::ResourceAllocationStrategy resource_allocation_strategy_from_string (const std::string& str);
51-
5249c10::optional<RTDevice> get_most_compatible_device (
5350 const RTDevice& target_device,
5451 const RTDevice& curr_device = RTDevice(),
Original file line number Diff line number Diff line change 11# %%
2+ import gc
3+ import time
4+
25import numpy as np
36import torch
47import torch_tensorrt as torch_trt
58import torchvision .models as models
6- import time
7- import gc
89
910np .random .seed (5 )
1011torch .manual_seed (5 )
1617 "enabled_precisions" : {torch .float32 },
1718 "immutable_weights" : False ,
1819 "lazy_engine_init" : True ,
19- "dynamically_allocate_resources" : True
20-
20+ "dynamically_allocate_resources" : True ,
2121}
2222
2323model = models .resnet152 (pretrained = True ).eval ().to ("cuda" )
2424compiled_module = torch_trt .compile (model , inputs = inputs , ** settings )
2525print ((torch .cuda .mem_get_info ()[1 ] - torch .cuda .mem_get_info ()[0 ]) / 1024 ** 3 )
2626compiled_module (* inputs )
2727
28+
2829time .sleep (30 )
29- with torch_trt .dynamo .runtime .ResourceAllocationStrategy (compiled_module , dynamically_allocate_resources = False ):
30+ with torch_trt .dynamo .runtime .ResourceAllocationStrategy (
31+ compiled_module , dynamically_allocate_resources = False
32+ ):
3033 print (
3134 "Memory used (GB):" ,
3235 (torch .cuda .mem_get_info ()[1 ] - torch .cuda .mem_get_info ()[0 ]) / 1024 ** 3 ,
You can’t perform that action at this time.
0 commit comments