File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 11import glob
22import hashlib
3+ from importlib .resources import files
34import json
45import logging
56import os
910import zipfile
1011
1112import numpy as np
12- from pkg_resources import resource_filename
1313import torch
1414import torch .nn as nn
1515
@@ -40,15 +40,15 @@ class DeployPkg:
4040
4141 @classmethod
4242 def check_pkg (cls ):
43- deploy_dir = resource_filename ( __name__ , 'deploy_pkg' )
43+ deploy_dir = files ( __package__ ). joinpath ( 'deploy_pkg' )
4444 total = 0
4545 for path in glob .glob (f"{ deploy_dir } /*" ):
4646 total += os .path .getsize (path )
4747 if total == 0 :
4848 msg = ("Downloading GTNet deployment package. This will only happen on the first invocation "
4949 "of gtnet predict or gtnet classify" )
5050 warnings .warn (msg )
51- zip_path = resource_filename ( __name__ , 'deploy_pkg.zip' )
51+ zip_path = files ( __package__ ). joinpath ( 'deploy_pkg.zip' )
5252 urllib .request .urlretrieve (cls ._deploy_pkg_url , zip_path )
5353 dl_checksum = hashlib .md5 (open (zip_path ,'rb' ).read ()).hexdigest ()
5454 if dl_checksum != cls ._checksum :
You can’t perform that action at this time.
0 commit comments