index
int64
0
731k
package
stringlengths
2
98
name
stringlengths
1
76
docstring
stringlengths
0
281k
code
stringlengths
4
8.19k
signature
stringlengths
2
42.8k
embed_func_code
listlengths
768
768
730,091
mmengine.fileio.backends.http_backend
get
Read bytes from a given ``filepath``. Args: filepath (str): Path to read data. Returns: bytes: Expected bytes object. Examples: >>> backend = HTTPBackend() >>> backend.get('http://path/of/file') b'hello world'
def get(self, filepath: str) -> bytes: """Read bytes from a given ``filepath``. Args: filepath (str): Path to read data. Returns: bytes: Expected bytes object. Examples: >>> backend = HTTPBackend() >>> backend.get('http://path/of/file') b'hello world' """ ...
(self, filepath: str) -> bytes
[ 0.01376148872077465, -0.08237195760011673, -0.039968304336071014, 0.03617203235626221, -0.015408927574753761, -0.015274625271558762, -0.032608550041913986, 0.03892970085144043, 0.048277128487825394, -0.07370499521493912, 0.057266414165496826, 0.05776780843734741, -0.024460889399051666, -0....
730,093
mmengine.fileio.backends.http_backend
get_text
Read text from a given ``filepath``. Args: filepath (str): Path to read data. encoding (str): The encoding format used to open the ``filepath``. Defaults to 'utf-8'. Returns: str: Expected text reading from ``filepath``. Examples: ...
def get_text(self, filepath, encoding='utf-8') -> str: """Read text from a given ``filepath``. Args: filepath (str): Path to read data. encoding (str): The encoding format used to open the ``filepath``. Defaults to 'utf-8'. Returns: str: Expected text reading from ``filep...
(self, filepath, encoding='utf-8') -> str
[ -0.009768260642886162, -0.06801603734493256, 0.0056430017575621605, 0.060003772377967834, 0.025836918503046036, 0.011497781611979008, -0.03522574156522751, -0.009812381118535995, 0.093464694917202, -0.031766701489686966, 0.04588523507118225, 0.011497781611979008, -0.04482634738087654, -0.0...
730,094
mmengine.fileio.file_client
HardDiskBackend
Raw hard disks storage backend.
class HardDiskBackend(LocalBackend): """Raw hard disks storage backend.""" def __init__(self) -> None: print_log( '"HardDiskBackend" is the alias of "LocalBackend" ' 'and the former will be deprecated in future.', logger='current', level=logging.WARNING) ...
() -> None
[ 0.01938740909099579, -0.05122910067439079, -0.031208116561174393, 0.027442868798971176, 0.02011149562895298, -0.029234981164336205, -0.065348781645298, 0.06408163160085678, 0.037055112421512604, -0.07092424482107162, 0.016644932329654694, -0.004896633327007294, -0.024691341444849968, -0.00...
730,095
mmengine.fileio.file_client
__init__
null
def __init__(self) -> None: print_log( '"HardDiskBackend" is the alias of "LocalBackend" ' 'and the former will be deprecated in future.', logger='current', level=logging.WARNING)
(self) -> NoneType
[ -0.00003683979230117984, -0.03332159295678139, 0.00833500362932682, 0.02444320358335972, 0.019654029980301857, -0.02079606242477894, -0.02790614403784275, 0.06605374813079834, 0.00765807181596756, -0.049033764749765396, 0.008882994763553143, 0.008850760757923126, -0.0018650145502761006, -0...
730,096
mmengine.fileio.backends.local_backend
copy_if_symlink_fails
Create a symbolic link pointing to src named dst. If failed to create a symbolic link pointing to src, directly copy src to dst instead. Args: src (str or Path): Create a symbolic link pointing to src. dst (str or Path): Create a symbolic link named dst. Return...
def copy_if_symlink_fails( self, src: Union[str, Path], dst: Union[str, Path], ) -> bool: """Create a symbolic link pointing to src named dst. If failed to create a symbolic link pointing to src, directly copy src to dst instead. Args: src (str or Path): Create a symbolic link pointi...
(self, src: Union[str, pathlib.Path], dst: Union[str, pathlib.Path]) -> bool
[ 0.01876330003142357, -0.012605859898030758, 0.0026962272822856903, 0.0009169284603558481, -0.03298361226916313, -0.006927121430635452, 0.005467545241117477, 0.013394312001764774, 0.0557548813521862, 0.006847337819635868, 0.05714406073093414, 0.003909412305802107, 0.06168704852461815, -0.02...
730,097
mmengine.fileio.backends.local_backend
copyfile
Copy a file src to dst and return the destination file. src and dst should have the same prefix. If dst specifies a directory, the file will be copied into dst using the base filename from src. If dst specifies a file that already exists, it will be replaced. Args: src (str...
def copyfile( self, src: Union[str, Path], dst: Union[str, Path], ) -> str: """Copy a file src to dst and return the destination file. src and dst should have the same prefix. If dst specifies a directory, the file will be copied into dst using the base filename from src. If dst specifies a ...
(self, src: Union[str, pathlib.Path], dst: Union[str, pathlib.Path]) -> str
[ -0.04016052559018135, -0.051974665373563766, -0.0034489361569285393, 0.013154082000255585, -0.058844227343797684, -0.038518622517585754, 0.02811991609632969, 0.0313282273709774, 0.0343855619430542, -0.054843273013830185, -0.01651337370276451, -0.012918176129460335, -0.017324887216091156, 0...
730,098
mmengine.fileio.backends.local_backend
copyfile_from_local
Copy a local file src to dst and return the destination file. Same as :meth:`copyfile`. Args: src (str or Path): A local file to be copied. dst (str or Path): Copy file to dst. Returns: str: If dst specifies a directory, the file will be copied into dst ...
def copyfile_from_local( self, src: Union[str, Path], dst: Union[str, Path], ) -> str: """Copy a local file src to dst and return the destination file. Same as :meth:`copyfile`. Args: src (str or Path): A local file to be copied. dst (str or Path): Copy file to dst. Returns: ...
(self, src: Union[str, pathlib.Path], dst: Union[str, pathlib.Path]) -> str
[ -0.038665737956762314, -0.015993382781744003, -0.017277801409363747, 0.009942347183823586, -0.015755528584122658, -0.057085245847702026, 0.018096022307872772, 0.034783944487571716, 0.05202368646860123, -0.024698883295059204, -0.03813294321298599, -0.0351264551281929, -0.02298632450401783, ...
730,099
mmengine.fileio.backends.local_backend
copyfile_to_local
Copy the file src to local dst and return the destination file. Same as :meth:`copyfile`. If dst specifies a directory, the file will be copied into dst using the base filename from src. If dst specifies a file that already exists, it will be replaced. Args: src (st...
def copyfile_to_local( self, src: Union[str, Path], dst: Union[str, Path], ) -> str: """Copy the file src to local dst and return the destination file. Same as :meth:`copyfile`. If dst specifies a directory, the file will be copied into dst using the base filename from src. If dst specifies ...
(self, src: Union[str, pathlib.Path], dst: Union[str, pathlib.Path]) -> str
[ -0.049807704985141754, -0.024123823270201683, -0.007277099881321192, 0.010501854121685028, -0.008718251250684261, -0.049997955560684204, 0.016190357506275177, 0.03466372936964035, 0.05094921216368675, -0.04364357516169548, -0.03072553314268589, -0.03658526390790939, -0.0304972305893898, -0...
730,100
mmengine.fileio.backends.local_backend
copytree
Recursively copy an entire directory tree rooted at src to a directory named dst and return the destination directory. src and dst should have the same prefix and dst must not already exist. TODO: Whether to support dirs_exist_ok parameter. Args: src (str or Path): A direc...
def copytree( self, src: Union[str, Path], dst: Union[str, Path], ) -> str: """Recursively copy an entire directory tree rooted at src to a directory named dst and return the destination directory. src and dst should have the same prefix and dst must not already exist. TODO: Whether to suppo...
(self, src: Union[str, pathlib.Path], dst: Union[str, pathlib.Path]) -> str
[ -0.03543170168995857, -0.023278705775737762, -0.00973984133452177, -0.04442530870437622, -0.017095603048801422, 0.019392460584640503, 0.033764783293008804, 0.03223354369401932, 0.06454462558031082, -0.05217841640114784, 0.006338165607303381, -0.025352662429213524, -0.03465639054775238, 0.0...
730,101
mmengine.fileio.backends.local_backend
copytree_from_local
Recursively copy an entire directory tree rooted at src to a directory named dst and return the destination directory. Same as :meth:`copytree`. Args: src (str or Path): A local directory to be copied. dst (str or Path): Copy directory to dst. Returns: ...
def copytree_from_local( self, src: Union[str, Path], dst: Union[str, Path], ) -> str: """Recursively copy an entire directory tree rooted at src to a directory named dst and return the destination directory. Same as :meth:`copytree`. Args: src (str or Path): A local directory to be ...
(self, src: Union[str, pathlib.Path], dst: Union[str, pathlib.Path]) -> str
[ -0.023909160867333412, -0.0028553486336022615, -0.01667841710150242, -0.020971963182091713, -0.005523614585399628, -0.00851693656295538, 0.030213844031095505, 0.03543344885110855, 0.0636080950498581, -0.047069989144802094, -0.010719834826886654, -0.04534883052110672, -0.03384324908256531, ...
730,102
mmengine.fileio.backends.local_backend
copytree_to_local
Recursively copy an entire directory tree rooted at src to a local directory named dst and return the destination directory. Args: src (str or Path): A directory to be copied. dst (str or Path): Copy directory to local dst. backend_args (dict, optional): Arguments to...
def copytree_to_local( self, src: Union[str, Path], dst: Union[str, Path], ) -> str: """Recursively copy an entire directory tree rooted at src to a local directory named dst and return the destination directory. Args: src (str or Path): A directory to be copied. dst (str or Path...
(self, src: Union[str, pathlib.Path], dst: Union[str, pathlib.Path]) -> str
[ -0.03477182239294052, -0.0019218961242586374, -0.010745784267783165, -0.015225531533360481, -0.00810376089066267, 0.00014992893557064235, 0.03415457159280777, 0.0307503379881382, 0.0745190680027008, -0.06572791188955307, -0.003062875708565116, -0.04444209486246109, -0.04721037298440933, -0...
730,103
mmengine.fileio.backends.local_backend
exists
Check whether a file path exists. Args: filepath (str or Path): Path to be checked whether exists. Returns: bool: Return ``True`` if ``filepath`` exists, ``False`` otherwise. Examples: >>> backend = LocalBackend() >>> filepath = '/path/of/file' ...
def exists(self, filepath: Union[str, Path]) -> bool: """Check whether a file path exists. Args: filepath (str or Path): Path to be checked whether exists. Returns: bool: Return ``True`` if ``filepath`` exists, ``False`` otherwise. Examples: >>> backend = LocalBackend() >...
(self, filepath: Union[str, pathlib.Path]) -> bool
[ 0.01892116107046604, -0.07531972229480743, -0.05134440213441849, 0.014085955917835236, 0.04528671130537987, 0.007946157827973366, 0.014158939942717552, -0.005888914689421654, -0.033937666565179825, -0.01866571605205536, 0.0234826747328043, -0.0003073320258408785, 0.02536201849579811, -0.08...
730,104
mmengine.fileio.backends.local_backend
get
Read bytes from a given ``filepath`` with 'rb' mode. Args: filepath (str or Path): Path to read data. Returns: bytes: Expected bytes object. Examples: >>> backend = LocalBackend() >>> filepath = '/path/of/file' >>> backend.get(filepa...
def get(self, filepath: Union[str, Path]) -> bytes: """Read bytes from a given ``filepath`` with 'rb' mode. Args: filepath (str or Path): Path to read data. Returns: bytes: Expected bytes object. Examples: >>> backend = LocalBackend() >>> filepath = '/path/of/file' ...
(self, filepath: Union[str, pathlib.Path]) -> bytes
[ 0.04880329594016075, -0.09029333293437958, -0.06266951560974121, 0.04293821007013321, -0.0006533731357194483, -0.03444831818342209, -0.006163769401609898, 0.02552397921681404, 0.05274955555796623, -0.08652810007333755, 0.04909292981028557, 0.04123661294579506, -0.048513662070035934, 0.0008...
730,105
mmengine.fileio.backends.local_backend
get_local_path
Only for unified API and do nothing. Args: filepath (str or Path): Path to be read data. backend_args (dict, optional): Arguments to instantiate the corresponding backend. Defaults to None. Examples: >>> backend = LocalBackend() >>> with ...
def copyfile_from_local( self, src: Union[str, Path], dst: Union[str, Path], ) -> str: """Copy a local file src to dst and return the destination file. Same as :meth:`copyfile`. Args: src (str or Path): A local file to be copied. dst (str or Path): Copy file to dst. Returns: ...
(self, filepath: Union[str, pathlib.Path]) -> Generator[Union[str, pathlib.Path], NoneType, NoneType]
[ -0.038663141429424286, -0.015973281115293503, -0.01721004582941532, 0.009837029501795769, -0.015697387978434563, -0.0571194626390934, 0.01802821271121502, 0.034743551164865494, 0.05198213830590248, -0.02469722367823124, -0.03816843777894974, -0.03512409329414368, -0.023022836074233055, 0.0...
730,106
mmengine.fileio.backends.local_backend
get_text
Read text from a given ``filepath`` with 'r' mode. Args: filepath (str or Path): Path to read data. encoding (str): The encoding format used to open the ``filepath``. Defaults to 'utf-8'. Returns: str: Expected text reading from ``filepath``. ...
def get_text(self, filepath: Union[str, Path], encoding: str = 'utf-8') -> str: """Read text from a given ``filepath`` with 'r' mode. Args: filepath (str or Path): Path to read data. encoding (str): The encoding format used to open the ``filepath``. Defaults...
(self, filepath: Union[str, pathlib.Path], encoding: str = 'utf-8') -> str
[ 0.012682536616921425, -0.07234467566013336, -0.012549223378300667, 0.07977467030286789, 0.03512360528111458, -0.001718630432151258, -0.014655573293566704, -0.02205890417098999, 0.10010938346385956, -0.03999398276209831, 0.041202690452337265, -0.005203661508858204, -0.04909483715891838, -0....
730,107
mmengine.fileio.backends.local_backend
isdir
Check whether a file path is a directory. Args: filepath (str or Path): Path to be checked whether it is a directory. Returns: bool: Return ``True`` if ``filepath`` points to a directory, ``False`` otherwise. Examples: >>> backen...
def isdir(self, filepath: Union[str, Path]) -> bool: """Check whether a file path is a directory. Args: filepath (str or Path): Path to be checked whether it is a directory. Returns: bool: Return ``True`` if ``filepath`` points to a directory, ``False`` otherwise. Exa...
(self, filepath: Union[str, pathlib.Path]) -> bool
[ 0.006510639563202858, 0.020627954974770546, -0.011063403449952602, -0.017864445224404335, 0.050249021500349045, 0.008941590785980225, 0.0236069243401289, -0.0037213691975921392, -0.07104559987783432, -0.011035299859941006, 0.01226248499006033, -0.0087963892146945, -0.006880668923258781, -0...
730,108
mmengine.fileio.backends.local_backend
isfile
Check whether a file path is a file. Args: filepath (str or Path): Path to be checked whether it is a file. Returns: bool: Return ``True`` if ``filepath`` points to a file, ``False`` otherwise. Examples: >>> backend = LocalBackend() ...
def isfile(self, filepath: Union[str, Path]) -> bool: """Check whether a file path is a file. Args: filepath (str or Path): Path to be checked whether it is a file. Returns: bool: Return ``True`` if ``filepath`` points to a file, ``False`` otherwise. Examples: >>> backend...
(self, filepath: Union[str, pathlib.Path]) -> bool
[ 0.03299793228507042, -0.07327894121408463, -0.021027544513344765, 0.012698695063591003, 0.027451591566205025, -0.029244348406791687, 0.06401636451482773, -0.0057797739282250404, -0.03686356544494629, -0.03359551727771759, 0.04395989328622818, 0.0015266445698216558, 0.0008689502137713134, -...
730,109
mmengine.fileio.backends.local_backend
join_path
Concatenate all file paths. Join one or more filepath components intelligently. The return value is the concatenation of filepath and any members of \*filepaths. Args: filepath (str or Path): Path to be concatenated. Returns: str: The result of concatenation. ...
def join_path(self, filepath: Union[str, Path], *filepaths: Union[str, Path]) -> str: r"""Concatenate all file paths. Join one or more filepath components intelligently. The return value is the concatenation of filepath and any members of \*filepaths. Args: filepath (str or Path): ...
(self, filepath: Union[str, pathlib.Path], *filepaths: Union[str, pathlib.Path]) -> str
[ -0.07908722013235092, -0.03125810623168945, -0.03753167763352394, 0.08259895443916321, -0.030544785782694817, -0.0558951273560524, -0.009446934796869755, 0.009483516216278076, -0.0017455796478316188, -0.01026999857276678, 0.02057657763361931, -0.012537994422018528, -0.03359926491975784, 0....
730,110
mmengine.fileio.backends.local_backend
list_dir_or_file
Scan a directory to find the interested directories or files in arbitrary order. Note: :meth:`list_dir_or_file` returns the path relative to ``dir_path``. Args: dir_path (str or Path): Path of the directory. list_dir (bool): List the directories. Defaults to...
def list_dir_or_file(self, dir_path: Union[str, Path], list_dir: bool = True, list_file: bool = True, suffix: Optional[Union[str, Tuple[str]]] = None, recursive: bool = False) -> Iterator[str]: """Scan a directo...
(self, dir_path: Union[str, pathlib.Path], list_dir: bool = True, list_file: bool = True, suffix: Union[str, Tuple[str], NoneType] = None, recursive: bool = False) -> Iterator[str]
[ 0.02276272140443325, -0.023294838145375252, -0.035277292132377625, 0.01678134873509407, 0.050688937306404114, 0.04505245387554169, -0.014583908952772617, -0.014613470993936062, 0.030015259981155396, -0.06479985266923904, 0.03935684636235237, 0.02047659642994404, -0.01697842963039875, -0.01...
730,111
mmengine.fileio.backends.local_backend
put
Write bytes to a given ``filepath`` with 'wb' mode. Note: ``put`` will create a directory if the directory of ``filepath`` does not exist. Args: obj (bytes): Data to be written. filepath (str or Path): Path to write data. Examples: >...
def put(self, obj: bytes, filepath: Union[str, Path]) -> None: """Write bytes to a given ``filepath`` with 'wb' mode. Note: ``put`` will create a directory if the directory of ``filepath`` does not exist. Args: obj (bytes): Data to be written. filepath (str or Path): Path to ...
(self, obj: bytes, filepath: Union[str, pathlib.Path]) -> NoneType
[ 0.00020008532737847418, -0.003701165784150362, -0.09391845762729645, 0.02041475847363472, 0.018107309937477112, -0.1025846004486084, -0.028376339003443718, 0.09307298064231873, -0.06002890318632126, -0.051609355956315994, 0.027601316571235657, -0.019868720322847366, -0.023726211860775948, ...
730,112
mmengine.fileio.backends.local_backend
put_text
Write text to a given ``filepath`` with 'w' mode. Note: ``put_text`` will create a directory if the directory of ``filepath`` does not exist. Args: obj (str): Data to be written. filepath (str or Path): Path to write data. encoding (str): The...
def put_text(self, obj: str, filepath: Union[str, Path], encoding: str = 'utf-8') -> None: """Write text to a given ``filepath`` with 'w' mode. Note: ``put_text`` will create a directory if the directory of ``filepath`` does not exist. Args: obj...
(self, obj: str, filepath: Union[str, pathlib.Path], encoding: str = 'utf-8') -> NoneType
[ -0.0026687774807214737, -0.009232057258486748, -0.05640074238181114, 0.025209950283169746, 0.052645329385995865, -0.06533723324537277, 0.001397413550876081, 0.06738880276679993, -0.014508760534226894, 0.0006563279894180596, 0.010562099516391754, -0.038875482976436615, -0.0029621690046042204,...
730,113
mmengine.fileio.backends.local_backend
remove
Remove a file. Args: filepath (str or Path): Path to be removed. Raises: IsADirectoryError: If filepath is a directory, an IsADirectoryError will be raised. FileNotFoundError: If filepath does not exist, an FileNotFoundError will be r...
def remove(self, filepath: Union[str, Path]) -> None: """Remove a file. Args: filepath (str or Path): Path to be removed. Raises: IsADirectoryError: If filepath is a directory, an IsADirectoryError will be raised. FileNotFoundError: If filepath does not exist, an FileNotF...
(self, filepath: Union[str, pathlib.Path]) -> NoneType
[ -0.009978171437978745, 0.025772297754883766, -0.015348173677921295, 0.001440052641555667, 0.02274354174733162, -0.04675061255693436, -0.026385480538010597, 0.04069310054183006, -0.028708146885037422, 0.004046083427965641, 0.0323500856757164, 0.01074929628521204, -0.0020474297925829887, -0....
730,114
mmengine.fileio.backends.local_backend
rmtree
Recursively delete a directory tree. Args: dir_path (str or Path): A directory to be removed. Examples: >>> dir_path = '/path/of/dir' >>> backend.rmtree(dir_path)
def rmtree(self, dir_path: Union[str, Path]) -> None: """Recursively delete a directory tree. Args: dir_path (str or Path): A directory to be removed. Examples: >>> dir_path = '/path/of/dir' >>> backend.rmtree(dir_path) """ shutil.rmtree(dir_path)
(self, dir_path: Union[str, pathlib.Path]) -> NoneType
[ 0.04231157526373863, 0.021640682592988014, 0.04992622509598732, -0.07614646852016449, 0.04407156631350517, 0.023777812719345093, -0.04170096665620804, 0.025322293862700462, -0.0020731505937874317, -0.017887236550450325, 0.04827398806810379, 0.04554421082139015, 0.014268483966588974, -0.003...
730,115
mmengine.logging.history_buffer
HistoryBuffer
Unified storage format for different log types. ``HistoryBuffer`` records the history of log for further statistics. Examples: >>> history_buffer = HistoryBuffer() >>> # Update history_buffer. >>> history_buffer.update(1) >>> history_buffer.update(2) >>> history_buffer....
class HistoryBuffer: """Unified storage format for different log types. ``HistoryBuffer`` records the history of log for further statistics. Examples: >>> history_buffer = HistoryBuffer() >>> # Update history_buffer. >>> history_buffer.update(1) >>> history_buffer.update(2)...
(log_history: Sequence = [], count_history: Sequence = [], max_length: int = 1000000)
[ 0.005093010608106852, -0.04096551984548569, -0.06010960415005684, 0.011061697266995907, 0.03160484880208969, -0.02606896683573723, -0.08261547982692719, 0.0446493960916996, -0.006019012536853552, 0.0020709228701889515, -0.036556947976350784, -0.008746691979467869, 0.04436757043004036, 0.01...
730,116
mmengine.logging.history_buffer
__getstate__
Make ``_statistics_methods`` can be resumed. Returns: dict: State dict including statistics_methods.
def __getstate__(self) -> dict: """Make ``_statistics_methods`` can be resumed. Returns: dict: State dict including statistics_methods. """ self.__dict__.update(statistics_methods=self._statistics_methods) return self.__dict__
(self) -> dict
[ 0.010019171983003616, -0.05756215378642082, 0.03303004428744316, -0.028833532705903053, 0.027050014585256577, -0.019618691876530647, -0.02210162952542305, 0.004255525302141905, 0.015824345871806145, -0.04018159955739975, -0.023273155093193054, 0.04207003116607666, 0.005695890635251999, 0.0...
730,117
mmengine.logging.history_buffer
__init__
null
def __init__(self, log_history: Sequence = [], count_history: Sequence = [], max_length: int = 1000000): self.max_length = max_length self._set_default_statistics() assert len(log_history) == len(count_history), \ 'The lengths of log_history and count_histroy s...
(self, log_history: Sequence = [], count_history: Sequence = [], max_length: int = 1000000)
[ -0.04381365329027176, 0.03331700339913368, -0.06652653217315674, 0.009574160911142826, -0.017177961766719818, 0.009968233294785023, -0.07788297533988953, 0.027101412415504456, -0.007585887797176838, 0.00850837491452694, -0.016712239012122154, 0.04585566371679306, 0.015995744615793228, 0.00...
730,118
mmengine.logging.history_buffer
__setstate__
Try to load ``_statistics_methods`` from state. Args: state (dict): State dict.
def __setstate__(self, state): """Try to load ``_statistics_methods`` from state. Args: state (dict): State dict. """ statistics_methods = state.pop('statistics_methods', {}) self._set_default_statistics() self._statistics_methods.update(statistics_methods) self.__dict__.update(state...
(self, state)
[ -0.03695530444383621, -0.06277530640363693, 0.03547639772295952, -0.0008753831498324871, 0.0114658884704113, -0.012753408402204514, -0.02655075117945671, 0.01759030856192112, -0.025315428152680397, -0.02804705873131752, -0.02905619703233242, 0.07088319957256317, -0.00033465735032223165, 0....
730,119
mmengine.logging.history_buffer
_set_default_statistics
Register default statistic methods: min, max, current and mean.
def _set_default_statistics(self) -> None: """Register default statistic methods: min, max, current and mean.""" self._statistics_methods.setdefault('min', HistoryBuffer.min) self._statistics_methods.setdefault('max', HistoryBuffer.max) self._statistics_methods.setdefault('current', HistoryBuffer.curren...
(self) -> NoneType
[ -0.003495648968964815, -0.04952746257185936, 0.044785842299461365, -0.015496800653636456, 0.00251357932575047, -0.0036059697158634663, -0.04544343799352646, 0.015142044052481651, -0.028968892991542816, 0.03109743259847164, -0.012122288346290588, 0.04035571217536926, 0.002831562189385295, -...
730,120
mmengine.logging.history_buffer
current
Return the recently updated values in log histories. Returns: np.ndarray: Recently updated values in log histories.
def current(self) -> np.ndarray: """Return the recently updated values in log histories. Returns: np.ndarray: Recently updated values in log histories. """ if len(self._log_history) == 0: raise ValueError('HistoryBuffer._log_history is an empty array! ' 'please c...
(self) -> numpy.ndarray
[ -0.0018820073455572128, -0.028517447412014008, -0.06606004387140274, 0.03762742131948471, 0.023682544007897377, -0.03603275120258331, -0.058663491159677505, 0.031740713864564896, 0.07444054633378983, 0.0076128519140183926, -0.014886412769556046, -0.05737418681383133, 0.0036049718037247658, ...
730,121
mmengine.logging.history_buffer
max
Return the maximum value of the latest ``window_size`` values in log histories. If ``window_size is None`` or ``window_size > len(self._log_history)``, return the global maximum value of history logs. Args: window_size (int, optional): Size of statistics window. Ret...
def max(self, window_size: Optional[int] = None) -> np.ndarray: """Return the maximum value of the latest ``window_size`` values in log histories. If ``window_size is None`` or ``window_size > len(self._log_history)``, return the global maximum value of history logs. Args: window_size (int, ...
(self, window_size: Optional[int] = None) -> numpy.ndarray
[ -0.002803679322823882, 0.00697037810459733, -0.06608056277036667, -0.007449159864336252, 0.020842120051383972, -0.012215415015816689, -0.03561104089021683, 0.031176913529634476, 0.001554963644593954, 0.006366508547216654, -0.0434785932302475, 0.0047231209464371204, 0.009860323742032051, -0...
730,122
mmengine.logging.history_buffer
mean
Return the mean of the latest ``window_size`` values in log histories. If ``window_size is None`` or ``window_size > len(self._log_history)``, return the global mean value of history logs. Args: window_size (int, optional): Size of statistics window. Returns: ...
def mean(self, window_size: Optional[int] = None) -> np.ndarray: """Return the mean of the latest ``window_size`` values in log histories. If ``window_size is None`` or ``window_size > len(self._log_history)``, return the global mean value of history logs. Args: window_size (int, optional): ...
(self, window_size: Optional[int] = None) -> numpy.ndarray
[ -0.04610811918973923, -0.011787233874201775, -0.05936116725206375, -0.0014473837800323963, 0.09075909852981567, 0.010330092161893845, -0.043610163033008575, 0.009167848154902458, -0.002026337431743741, 0.06518973410129547, -0.04711424186825752, -0.03597751632332802, 0.030721399933099747, 0...
730,123
mmengine.logging.history_buffer
min
Return the minimum value of the latest ``window_size`` values in log histories. If ``window_size is None`` or ``window_size > len(self._log_history)``, return the global minimum value of history logs. Args: window_size (int, optional): Size of statistics window. Ret...
def min(self, window_size: Optional[int] = None) -> np.ndarray: """Return the minimum value of the latest ``window_size`` values in log histories. If ``window_size is None`` or ``window_size > len(self._log_history)``, return the global minimum value of history logs. Args: window_size (int, ...
(self, window_size: Optional[int] = None) -> numpy.ndarray
[ -0.017678968608379364, -0.014656184241175652, -0.05472102761268616, -0.013567982241511345, 0.0637030154466629, 0.022264964878559113, 0.010821566917002201, 0.024458641186356544, -0.007207180839031935, 0.0439426451921463, -0.056828342378139496, -0.018775807693600655, 0.023491350933909416, -0...
730,124
mmengine.logging.history_buffer
statistics
Access statistics method by name. Args: method_name (str): Name of method. Returns: Any: Depends on corresponding method.
def statistics(self, method_name: str, *arg, **kwargs) -> Any: """Access statistics method by name. Args: method_name (str): Name of method. Returns: Any: Depends on corresponding method. """ if method_name not in self._statistics_methods: raise KeyError(f'{method_name} has n...
(self, method_name: str, *arg, **kwargs) -> Any
[ 0.007730850018560886, -0.09167462587356567, 0.005725246388465166, -0.0168223287910223, 0.03717876225709915, -0.016769317910075188, -0.010469779372215271, 0.01325288601219654, 0.01557655818760395, 0.008587869815528393, -0.025940313935279846, 0.018766086548566818, 0.047993116080760956, -0.03...
730,125
mmengine.logging.history_buffer
update
update the log history. If the length of the buffer exceeds ``self._max_length``, the oldest element will be removed from the buffer. Args: log_val (int or float): The value of log. count (int): The accumulation times of log, defaults to 1. ``count`` will be...
def update(self, log_val: Union[int, float], count: int = 1) -> None: """update the log history. If the length of the buffer exceeds ``self._max_length``, the oldest element will be removed from the buffer. Args: log_val (int or float): The value of log. count (int): The accumulation tim...
(self, log_val: Union[int, float], count: int = 1) -> NoneType
[ -0.006907567381858826, 0.029117649421095848, -0.07188419997692108, 0.036187078803777695, 0.011627811938524246, -0.0030928754713386297, -0.069259412586689, -0.00423465808853507, -0.015941213816404343, 0.026160389184951782, -0.0438864566385746, -0.03723699599504471, 0.03216240555047989, 0.00...
730,126
mmengine.fileio.handlers.json_handler
JsonHandler
null
class JsonHandler(BaseFileHandler): def load_from_fileobj(self, file): return json.load(file) def dump_to_fileobj(self, obj, file, **kwargs): kwargs.setdefault('default', set_default) json.dump(obj, file, **kwargs) def dump_to_str(self, obj, **kwargs): kwargs.setdefault('d...
()
[ -0.04100905358791351, -0.038584355264902115, -0.016103168949484825, -0.03658134117722511, 0.020100409165024757, -0.015576060861349106, -0.013994734734296799, 0.06638055294752121, -0.004113643895834684, -0.035527125000953674, -0.009092624299228191, -0.022454828023910522, -0.03192521259188652,...
730,127
mmengine.fileio.handlers.json_handler
dump_to_fileobj
null
def dump_to_fileobj(self, obj, file, **kwargs): kwargs.setdefault('default', set_default) json.dump(obj, file, **kwargs)
(self, obj, file, **kwargs)
[ -0.04269329085946083, -0.01770665869116783, -0.004941195249557495, -0.0011034769704565406, 0.01090294774621725, -0.03799872845411301, -0.023710934445261955, 0.054361652582883835, -0.038372933864593506, -0.048646535724401474, -0.01035014633089304, -0.0012916420819237828, -0.04262525215744972,...
730,129
mmengine.fileio.handlers.json_handler
dump_to_str
null
def dump_to_str(self, obj, **kwargs): kwargs.setdefault('default', set_default) return json.dumps(obj, **kwargs)
(self, obj, **kwargs)
[ -0.0476103276014328, -0.03227150812745094, 0.026273086667060852, -0.04860435426235199, 0.01880076713860035, -0.029392264783382416, 0.005252903327345848, 0.01634141430258751, 0.027798399329185486, -0.07547727972269058, -0.015064607374370098, 0.012888036668300629, -0.05292321741580963, -0.02...
730,130
mmengine.fileio.handlers.json_handler
load_from_fileobj
null
def load_from_fileobj(self, file): return json.load(file)
(self, file)
[ -0.011034713126718998, -0.03719139099121094, -0.020928798243403435, -0.01431833952665329, -0.01034342311322689, 0.0018427192699164152, -0.003830177476629615, 0.07721706479787827, 0.01291847787797451, -0.0038431391585618258, 0.010179242119193077, 0.008209066465497017, -0.04178846627473831, ...
730,132
mmengine.fileio.backends.lmdb_backend
LmdbBackend
Lmdb storage backend. Args: db_path (str): Lmdb database path. readonly (bool): Lmdb environment parameter. If True, disallow any write operations. Defaults to True. lock (bool): Lmdb environment parameter. If False, when concurrent access occurs, do not lock the dat...
class LmdbBackend(BaseStorageBackend): """Lmdb storage backend. Args: db_path (str): Lmdb database path. readonly (bool): Lmdb environment parameter. If True, disallow any write operations. Defaults to True. lock (bool): Lmdb environment parameter. If False, when concurrent ...
(db_path, readonly=True, lock=False, readahead=False, **kwargs)
[ 0.04308496043086052, -0.03992442786693573, -0.09212770313024521, 0.0670250803232193, 0.06524500995874405, 0.0019787384662777185, -0.05180366709828377, 0.05866965278983116, -0.0006039523286744952, -0.08202853053808212, -0.011870160698890686, 0.04166816920042038, -0.04381151869893074, 0.0593...
730,133
mmengine.fileio.backends.lmdb_backend
__del__
null
def __del__(self): if self._client is not None: self._client.close()
(self)
[ -0.008701371029019356, -0.02772287093102932, -0.031246816739439964, 0.00497779157012701, -0.023313596844673157, -0.018869604915380478, -0.029979584738612175, 0.10603086650371552, 0.012637601234018803, 0.024007970467209816, -0.028469322249293327, -0.02511896938085556, 0.006922037806361914, ...
730,134
mmengine.fileio.backends.lmdb_backend
__init__
null
def __init__(self, db_path, readonly=True, lock=False, readahead=False, **kwargs): try: import lmdb # noqa: F401 except ImportError: raise ImportError( 'Please run "pip install lmdb" to enable LmdbBackend.') self.d...
(self, db_path, readonly=True, lock=False, readahead=False, **kwargs)
[ 0.0008266390068456531, -0.005941502749919891, -0.011103938333690166, 0.0216168612241745, 0.01680813916027546, -0.006966826040297747, 0.003987119998782873, 0.05362127721309662, -0.018984153866767883, -0.06866532564163208, -0.008095129393041134, 0.11283034831285477, -0.05014682188630104, 0.0...
730,135
mmengine.fileio.backends.lmdb_backend
_get_client
null
def _get_client(self): import lmdb return lmdb.open( self.db_path, readonly=self.readonly, lock=self.lock, readahead=self.readahead, **self.kwargs)
(self)
[ 0.012425944209098816, -0.050288524478673935, -0.04168925806879997, 0.051458027213811874, 0.06597359478473663, -0.012941899709403515, 0.0352570042014122, 0.059678927063941956, -0.02411235123872757, -0.017886480316519737, -0.074641652405262, 0.016183825209736824, -0.06050445884466171, 0.0527...
730,136
mmengine.fileio.backends.lmdb_backend
get
Get values according to the filepath. Args: filepath (str or Path): Here, filepath is the lmdb key. Returns: bytes: Expected bytes object. Examples: >>> backend = LmdbBackend('path/to/lmdb') >>> backend.get('key') b'hello world' ...
def get(self, filepath: Union[str, Path]) -> bytes: """Get values according to the filepath. Args: filepath (str or Path): Here, filepath is the lmdb key. Returns: bytes: Expected bytes object. Examples: >>> backend = LmdbBackend('path/to/lmdb') >>> backend.get('key') ...
(self, filepath: Union[str, pathlib.Path]) -> bytes
[ 0.0412200391292572, -0.05918774753808975, -0.07959731668233871, 0.0569281168282032, 0.018505282700061798, -0.0030751023441553116, -0.033493559807538986, 0.02717023715376854, 0.03429536521434784, -0.0734744444489479, -0.009749213233590126, 0.06126514822244644, -0.057110343128442764, 0.01931...
730,137
mmengine.fileio.backends.lmdb_backend
get_text
null
def get_text(self, filepath, encoding=None): raise NotImplementedError
(self, filepath, encoding=None)
[ 0.0020921211689710617, -0.05740755423903465, 0.00968110654503107, 0.07619006186723709, 0.03551119565963745, -0.006248413119465113, -0.02032287046313286, 0.017623092979192734, 0.11143624782562256, -0.01823592558503151, 0.04266643524169922, -0.0161324180662632, -0.036438725888729095, -0.0189...
730,138
mmengine.fileio.backends.local_backend
LocalBackend
Raw local storage backend.
class LocalBackend(BaseStorageBackend): """Raw local storage backend.""" _allow_symlink = True def get(self, filepath: Union[str, Path]) -> bytes: """Read bytes from a given ``filepath`` with 'rb' mode. Args: filepath (str or Path): Path to read data. Returns: ...
()
[ 0.00031516593298874795, -0.07434733957052231, -0.09484603255987167, 0.052626874297857285, 0.01544189266860485, -0.03457174077630043, -0.021267954260110855, 0.0641658753156662, 0.027127955108880997, -0.07122502475976944, 0.017761005088686943, -0.016516603529453278, -0.008060328662395477, 0....
730,158
mmengine.logging.logger
MMLogger
Formatted logger used to record messages. ``MMLogger`` can create formatted logger to log message with different log levels and get instance in the same way as ``ManagerMixin``. ``MMLogger`` has the following features: - Distributed log storage, ``MMLogger`` can choose whether to save log of dif...
class MMLogger(Logger, ManagerMixin): """Formatted logger used to record messages. ``MMLogger`` can create formatted logger to log message with different log levels and get instance in the same way as ``ManagerMixin``. ``MMLogger`` has the following features: - Distributed log storage, ``MMLogger`...
(name: str, logger_name='mmengine', log_file: Optional[str] = None, log_level: Union[int, str] = 'INFO', file_mode: str = 'w', distributed=False, file_handler_cfg: Optional[dict] = None)
[ 0.04312498867511749, -0.013105157762765884, -0.046138644218444824, 0.0676586925983429, 0.057981040328741074, -0.016829781234264374, -0.04057823866605759, 0.037225015461444855, -0.053651563823223114, 0.0017535444349050522, -0.0029393755830824375, -0.01928102970123291, 0.03132504224777222, 0...
730,159
mmengine.logging.logger
__init__
null
def __init__(self, name: str, logger_name='mmengine', log_file: Optional[str] = None, log_level: Union[int, str] = 'INFO', file_mode: str = 'w', distributed=False, file_handler_cfg: Optional[dict] = None): Logger.__init__(sel...
(self, name: str, logger_name='mmengine', log_file: Optional[str] = None, log_level: Union[int, str] = 'INFO', file_mode: str = 'w', distributed=False, file_handler_cfg: Optional[dict] = None)
[ 0.01496907789260149, -0.004267100244760513, -0.04754406586289406, 0.06867926567792892, 0.05590078607201576, -0.011581766419112682, -0.05371018871665001, 0.04961296170949936, -0.07338499277830124, 0.017403075471520424, 0.004885741043835878, 0.0014794134767726064, 0.012991456314921379, -0.00...
730,165
mmengine.logging.logger
callHandlers
Pass a record to all relevant handlers. Override ``callHandlers`` method in ``logging.Logger`` to avoid multiple warning messages in DDP mode. Loop through all handlers of the logger instance and its parents in the logger hierarchy. If no handler was found, the record will not be output...
def callHandlers(self, record: LogRecord) -> None: """Pass a record to all relevant handlers. Override ``callHandlers`` method in ``logging.Logger`` to avoid multiple warning messages in DDP mode. Loop through all handlers of the logger instance and its parents in the logger hierarchy. If no handler...
(self, record: logging.LogRecord) -> NoneType
[ -0.041962962597608566, 0.00015867131878621876, -0.02871341072022915, 0.08987914770841599, -0.04272526502609253, -0.026698753237724304, -0.02178008295595646, 0.015990210697054863, -0.008893534541130066, 0.003119543194770813, -0.04287046566605568, -0.006978701800107956, 0.05063869431614876, ...
730,183
mmengine.logging.logger
setLevel
Set the logging level of this logger. If ``logging.Logger.selLevel`` is called, all ``logging.Logger`` instances managed by ``logging.Manager`` will clear the cache. Since ``MMLogger`` is not managed by ``logging.Manager`` anymore, ``MMLogger`` should override this method to clear cache...
def setLevel(self, level): """Set the logging level of this logger. If ``logging.Logger.selLevel`` is called, all ``logging.Logger`` instances managed by ``logging.Manager`` will clear the cache. Since ``MMLogger`` is not managed by ``logging.Manager`` anymore, ``MMLogger`` should override this meth...
(self, level)
[ -0.00826833676546812, 0.018607286736369133, -0.0045341732911765575, 0.09494704753160477, 0.018004927784204483, -0.014155467972159386, -0.049242958426475525, 0.07518210262060165, -0.0005429478478617966, 0.008353043347597122, -0.017713159322738647, -0.02921447716653347, 0.024960307404398918, ...
730,186
mmengine.utils.manager
ManagerMeta
The metaclass for global accessible class. The subclasses inheriting from ``ManagerMeta`` will manage their own ``_instance_dict`` and root instances. The constructors of subclasses must contain the ``name`` argument. Examples: >>> class SubClass1(metaclass=ManagerMeta): >>> def __...
class ManagerMeta(type): """The metaclass for global accessible class. The subclasses inheriting from ``ManagerMeta`` will manage their own ``_instance_dict`` and root instances. The constructors of subclasses must contain the ``name`` argument. Examples: >>> class SubClass1(metaclass=Mana...
(*args)
[ 0.05970004200935364, 0.026585789397358894, -0.007560825441032648, -0.014738202095031738, 0.011434642598032951, 0.03268164396286011, -0.005338788498193026, 0.001489551505073905, -0.008362135849893093, 0.010274464264512062, 0.008214655332267284, 0.0286701787263155, -0.009030712768435478, -0....
730,187
mmengine.utils.manager
__init__
null
def __init__(cls, *args): cls._instance_dict = OrderedDict() params = inspect.getfullargspec(cls) params_names = params[0] if params[0] else [] assert 'name' in params_names, f'{cls} must have the `name` argument' super().__init__(*args)
(cls, *args)
[ -0.00932371150702238, -0.023623168468475342, 0.005110602825880051, -0.018954338505864143, -0.04627908766269684, 0.0061755054630339146, -0.012304509058594704, 0.022097893059253693, 0.03150995820760727, 0.01689893566071987, -0.014332008548080921, 0.04873441159725189, -0.028812825679779053, -...
730,188
mmengine.utils.manager
ManagerMixin
``ManagerMixin`` is the base class for classes that have global access requirements. The subclasses inheriting from ``ManagerMixin`` can get their global instances. Examples: >>> class GlobalAccessible(ManagerMixin): >>> def __init__(self, name=''): >>> super().__in...
class ManagerMixin(metaclass=ManagerMeta): """``ManagerMixin`` is the base class for classes that have global access requirements. The subclasses inheriting from ``ManagerMixin`` can get their global instances. Examples: >>> class GlobalAccessible(ManagerMixin): >>> def __init_...
(name: str = '', **kwargs)
[ 0.11606140434741974, -0.02112985961139202, -0.03504663333296776, 0.024593770503997803, 0.016912037506699562, 0.021415121853351593, 0.021109482273459435, -0.023697229102253914, -0.021313242614269257, 0.003924916964024305, 0.007895680144429207, 0.003209211863577366, -0.00001227730535902083, ...
730,189
mmengine.utils.manager
__init__
null
def __init__(self, name: str = '', **kwargs): assert isinstance(name, str) and name, \ 'name argument must be an non-empty string.' self._instance_name = name
(self, name: str = '', **kwargs)
[ 0.036870215088129044, -0.021053630858659744, 0.011976669542491436, -0.02416422590613365, -0.05472538247704506, -0.01975315622985363, 0.033671751618385315, 0.029366126284003258, 0.03778406232595444, 0.014401879161596298, -0.023935765027999878, 0.08765902370214462, -0.019085345789790154, 0.0...
730,190
mmengine.fileio.backends.memcached_backend
MemcachedBackend
Memcached storage backend. Attributes: server_list_cfg (str): Config file for memcached server list. client_cfg (str): Config file for memcached client. sys_path (str, optional): Additional path to be appended to `sys.path`. Defaults to None.
class MemcachedBackend(BaseStorageBackend): """Memcached storage backend. Attributes: server_list_cfg (str): Config file for memcached server list. client_cfg (str): Config file for memcached client. sys_path (str, optional): Additional path to be appended to `sys.path`. Def...
(server_list_cfg, client_cfg, sys_path=None)
[ 0.07748975604772568, -0.09215589612722397, -0.0771249309182167, 0.056074272841215134, 0.03526075929403305, -0.0173841193318367, -0.060014430433511734, 0.07894907146692276, 0.040277160704135895, -0.08033542335033417, 0.036683592945337296, 0.03910970687866211, -0.05169632285833359, 0.0059011...
730,191
mmengine.fileio.backends.memcached_backend
__init__
null
def __init__(self, server_list_cfg, client_cfg, sys_path=None): if sys_path is not None: import sys sys.path.append(sys_path) try: import mc except ImportError: raise ImportError( 'Please install memcached to enable MemcachedBackend.') self.server_list_cfg = s...
(self, server_list_cfg, client_cfg, sys_path=None)
[ 0.06579818576574326, -0.05180422216653824, -0.024347225204110146, 0.040995873510837555, -0.0075326599180698395, -0.01628836989402771, -0.006840546149760485, 0.07683407515287399, 0.010116234421730042, -0.011197068728506565, 0.0017409498104825616, 0.07903367280960083, -0.06955266743898392, 0...
730,192
mmengine.fileio.backends.memcached_backend
get
Get values according to the filepath. Args: filepath (str or Path): Path to read data. Returns: bytes: Expected bytes object. Examples: >>> server_list_cfg = '/path/of/server_list.conf' >>> client_cfg = '/path/of/mc.conf' >>> backend...
def get(self, filepath: Union[str, Path]): """Get values according to the filepath. Args: filepath (str or Path): Path to read data. Returns: bytes: Expected bytes object. Examples: >>> server_list_cfg = '/path/of/server_list.conf' >>> client_cfg = '/path/of/mc.conf' ...
(self, filepath: Union[str, pathlib.Path])
[ 0.06903810054063797, -0.06078638508915901, -0.0601143017411232, 0.015317945741117, 0.013983109034597874, -0.007724314462393522, -0.005768732633441687, 0.011294768191874027, 0.04887554049491882, -0.058098044246435165, -0.0006592503632418811, 0.04592583328485489, -0.06298933178186417, -0.006...
730,194
mmengine.logging.message_hub
MessageHub
Message hub for component interaction. MessageHub is created and accessed in the same way as ManagerMixin. ``MessageHub`` will record log information and runtime information. The log information refers to the learning rate, loss, etc. of the model during training phase, which will be stored as ``Histor...
class MessageHub(ManagerMixin): """Message hub for component interaction. MessageHub is created and accessed in the same way as ManagerMixin. ``MessageHub`` will record log information and runtime information. The log information refers to the learning rate, loss, etc. of the model during training ...
(name: str, log_scalars: Optional[dict] = None, runtime_info: Optional[dict] = None, resumed_keys: Optional[dict] = None)
[ 0.02331327274441719, -0.06832233816385269, -0.11067873239517212, 0.0212536808103323, 0.019398972392082214, 0.001439556828700006, -0.061032894998788834, 0.00019881519256159663, 0.018633363768458366, -0.010777805931866169, -0.012249711900949478, 0.02777751535177231, 0.0354120209813118, 0.031...
730,195
mmengine.logging.message_hub
__init__
null
def __init__(self, name: str, log_scalars: Optional[dict] = None, runtime_info: Optional[dict] = None, resumed_keys: Optional[dict] = None): super().__init__(name) self._log_scalars = self._parse_input('log_scalars', log_scalars) self._runtime_info = self....
(self, name: str, log_scalars: Optional[dict] = None, runtime_info: Optional[dict] = None, resumed_keys: Optional[dict] = None)
[ -0.01857345923781395, -0.02280787192285061, -0.0848751962184906, -0.0015738833462819457, -0.03247317299246788, -0.0291080791503191, -0.039147280156612396, 0.03213666379451752, -0.02473345398902893, 0.026004713028669357, 0.030211081728339195, 0.08883853256702423, 0.022433971986174583, 0.030...
730,196
mmengine.logging.message_hub
_get_valid_value
Convert value to python built-in type. Args: value (torch.Tensor or np.ndarray or np.number or int or float): value of log. Returns: float or int: python built-in type value.
def _get_valid_value( self, value: Union['torch.Tensor', np.ndarray, np.number, int, float], ) -> Union[int, float]: """Convert value to python built-in type. Args: value (torch.Tensor or np.ndarray or np.number or int or float): value of log. Returns: float or int: pytho...
(self, value: Union[ForwardRef('torch.Tensor'), numpy.ndarray, numpy.number, int, float]) -> Union[int, float]
[ 0.003457502694800496, -0.015453851781785488, 0.005916070193052292, 0.06466168910264969, 0.03889918699860573, 0.032330844551324844, -0.005770106799900532, -0.0066458857618272305, -0.03216663375496864, -0.01613805443048477, 0.041745468974113464, 0.05926105007529259, 0.00032129004830494523, -...
730,197
mmengine.logging.message_hub
_parse_input
Parse input value. Args: name (str): name of input value. value (Any): Input value. Returns: dict: Parsed input value.
def _parse_input(self, name: str, value: Any) -> OrderedDict: """Parse input value. Args: name (str): name of input value. value (Any): Input value. Returns: dict: Parsed input value. """ if value is None: return OrderedDict() elif isinstance(value, dict): ...
(self, name: str, value: Any) -> collections.OrderedDict
[ 0.0009125839569605887, 0.018284965306520462, -0.055635999888181686, -0.07477308064699173, -0.04402593523263931, 0.009044844657182693, -0.01936786063015461, 0.0341200977563858, 0.03119095414876938, -0.055245447903871536, 0.008126158267259598, 0.0333389937877655, -0.030374344438314438, -0.02...
730,198
mmengine.logging.message_hub
_set_resumed_keys
Set corresponding resumed keys. This method is called by ``update_scalar``, ``update_scalars`` and ``update_info`` to set the corresponding key is true or false in :attr:`_resumed_keys`. Args: key (str): Key of :attr:`_log_scalrs` or :attr:`_runtime_info`. resum...
def _set_resumed_keys(self, key: str, resumed: bool) -> None: """Set corresponding resumed keys. This method is called by ``update_scalar``, ``update_scalars`` and ``update_info`` to set the corresponding key is true or false in :attr:`_resumed_keys`. Args: key (str): Key of :attr:`_log_scal...
(self, key: str, resumed: bool) -> NoneType
[ 0.007826116867363453, 0.015599295496940613, -0.11011267453432083, 0.039880551397800446, -0.021387269720435143, -0.008134926669299603, -0.016455138102173805, -0.0020282173063606024, 0.06483236700296402, 0.0006551174446940422, -0.0015418421244248748, -0.002393274335190654, 0.056997425854206085...
730,199
mmengine.logging.message_hub
get_info
Get runtime information by key. If the key does not exist, this method will return default information. Args: key (str): Key of runtime information. default (Any, optional): The default returned value for the given key. Returns: Any: A copy o...
def get_info(self, key: str, default: Optional[Any] = None) -> Any: """Get runtime information by key. If the key does not exist, this method will return default information. Args: key (str): Key of runtime information. default (Any, optional): The default returned value for the ...
(self, key: str, default: Optional[Any] = None) -> Any
[ 0.09755701571702957, -0.05745973065495491, -0.03668172284960747, 0.03040206804871559, 0.030313121154904366, -0.052834488451480865, 0.050770919770002365, 0.000726029509678483, 0.04724862053990364, -0.029316915199160576, 0.00820090901106596, 0.020457798615098, -0.03091796115040779, -0.070232...
730,200
mmengine.logging.message_hub
get_scalar
Get ``HistoryBuffer`` instance by key. Note: Considering the large memory footprint of history buffers in the post-training, :meth:`get_scalar` will not return a reference of history buffer rather than a copy. Args: key (str): Key of ``HistoryBuffer``. ...
def get_scalar(self, key: str) -> HistoryBuffer: """Get ``HistoryBuffer`` instance by key. Note: Considering the large memory footprint of history buffers in the post-training, :meth:`get_scalar` will not return a reference of history buffer rather than a copy. Args: key (str...
(self, key: str) -> mmengine.logging.history_buffer.HistoryBuffer
[ 0.026599546894431114, -0.10244444012641907, -0.09729044139385223, 0.049280647188425064, 0.0028991210274398327, -0.003486005589365959, -0.0006745862192474306, 0.043526530265808105, 0.03254782035946846, -0.019821692258119583, -0.0313299223780632, 0.004814217798411846, 0.016988761723041534, -...
730,201
mmengine.logging.message_hub
load_state_dict
Loads log scalars, runtime information and resumed keys from ``state_dict`` or ``message_hub``. If ``state_dict`` is a dictionary returned by :meth:`state_dict`, it will only make copies of data which should be resumed from the source ``message_hub``. If ``state_dict`` is a ``m...
def load_state_dict(self, state_dict: Union['MessageHub', dict]) -> None: """Loads log scalars, runtime information and resumed keys from ``state_dict`` or ``message_hub``. If ``state_dict`` is a dictionary returned by :meth:`state_dict`, it will only make copies of data which should be resumed from the...
(self, state_dict: Union[mmengine.logging.message_hub.MessageHub, dict]) -> NoneType
[ -0.026333123445510864, -0.012488371692597866, -0.1099054217338562, 0.010250347666442394, -0.014300106093287468, -0.030305374413728714, -0.01458107028156519, 0.0273988489061594, 0.05037977918982506, -0.06560997664928436, -0.0024790242314338684, 0.07343821227550507, 0.011761740781366825, 0.0...
730,202
mmengine.logging.message_hub
pop_info
Remove runtime information by key. If the key does not exist, this method will return the default value. Args: key (str): Key of runtime information. default (Any, optional): The default returned value for the given key. Returns: Any: The run...
def pop_info(self, key: str, default: Optional[Any] = None) -> Any: """Remove runtime information by key. If the key does not exist, this method will return the default value. Args: key (str): Key of runtime information. default (Any, optional): The default returned value for the ...
(self, key: str, default: Optional[Any] = None) -> Any
[ 0.09546881914138794, -0.016880622133612633, -0.034125763922929764, -0.016620254144072533, -0.0056500183418393135, -0.05499003827571869, 0.025064904242753983, 0.03558383136987686, 0.068390391767025, -0.021489163860678673, -0.00065309350611642, 0.0157436765730381, -0.042075712233781815, -0.0...
730,203
mmengine.logging.message_hub
state_dict
Returns a dictionary containing log scalars, runtime information and resumed keys, which should be resumed. The returned ``state_dict`` can be loaded by :meth:`load_state_dict`. Returns: dict: A dictionary contains ``log_scalars``, ``runtime_info`` and ``resumed_keys``....
def state_dict(self) -> dict: """Returns a dictionary containing log scalars, runtime information and resumed keys, which should be resumed. The returned ``state_dict`` can be loaded by :meth:`load_state_dict`. Returns: dict: A dictionary contains ``log_scalars``, ``runtime_info`` and ``...
(self) -> dict
[ -0.008975556120276451, -0.03657609224319458, -0.06143435835838318, 0.0033482848666608334, -0.0011623064056038857, -0.02878916636109352, -0.04507432505488396, -0.018746651709079742, 0.03704405575990677, -0.0556316003203392, -0.006209886632859707, 0.05327305942773819, 0.00588231161236763, 0....
730,204
mmengine.logging.message_hub
update_info
Update runtime information. The key corresponding runtime information will be overwritten each time calling ``update_info``. Note: The ``resumed`` argument needs to be consistent for the same ``key``. Examples: >>> message_hub = MessageHub(name='nam...
def update_info(self, key: str, value: Any, resumed: bool = True) -> None: """Update runtime information. The key corresponding runtime information will be overwritten each time calling ``update_info``. Note: The ``resumed`` argument needs to be consistent for the same ``key``. Examp...
(self, key: str, value: Any, resumed: bool = True) -> NoneType
[ 0.07643138617277145, -0.03427223488688469, -0.11027342081069946, 0.01360492967069149, 0.02991650626063347, -0.03617226332426071, -0.015218161977827549, 0.010342614725232124, 0.005256450269371271, -0.015325711108744144, -0.0024310520384460688, -0.014241260476410389, 0.027998551726341248, 0....
730,205
mmengine.logging.message_hub
update_info_dict
Update runtime information with dictionary. The key corresponding runtime information will be overwritten each time calling ``update_info``. Note: The ``resumed`` argument needs to be consistent for the same ``info_dict``. Examples: >>> message_hub ...
def update_info_dict(self, info_dict: dict, resumed: bool = True) -> None: """Update runtime information with dictionary. The key corresponding runtime information will be overwritten each time calling ``update_info``. Note: The ``resumed`` argument needs to be consistent for the same ``...
(self, info_dict: dict, resumed: bool = True) -> NoneType
[ 0.06671547889709473, 0.005198907572776079, -0.09430790692567825, -0.0252899918705225, 0.02066669426858425, -0.04125970974564552, -0.027113523334264755, 0.02029830403625965, 0.0017786342650651932, -0.005898849107325077, 0.001988156232982874, 0.005346263758838177, 0.037557389587163925, 0.003...
730,206
mmengine.logging.message_hub
update_scalar
Update :attr:_log_scalars. Update ``HistoryBuffer`` in :attr:`_log_scalars`. If corresponding key ``HistoryBuffer`` has been created, ``value`` and ``count`` is the argument of ``HistoryBuffer.update``, Otherwise, ``update_scalar`` will create an ``HistoryBuffer`` with value and count v...
def update_scalar(self, key: str, value: Union[int, float, np.ndarray, 'torch.Tensor'], count: int = 1, resumed: bool = True) -> None: """Update :attr:_log_scalars. Update ``HistoryBuffer`` in :attr:`_log_scalars`. If corresponding key ...
(self, key: str, value: Union[int, float, numpy.ndarray, ForwardRef('torch.Tensor')], count: int = 1, resumed: bool = True) -> None
[ -0.039759762585163116, -0.06873025745153427, -0.0929594486951828, 0.06130097061395645, 0.037090446799993515, 0.002746317069977522, -0.052266355603933334, -0.00276498356834054, 0.009771942161023617, -0.007769953925162554, -0.032573141157627106, -0.005968631245195866, 0.042485080659389496, 0...
730,207
mmengine.logging.message_hub
update_scalars
Update :attr:`_log_scalars` with a dict. ``update_scalars`` iterates through each pair of log_dict key-value, and calls ``update_scalar``. If type of value is dict, the value should be ``dict(value=xxx) or dict(value=xxx, count=xxx)``. Item in ``log_dict`` has the same resume option. ...
def update_scalars(self, log_dict: dict, resumed: bool = True) -> None: """Update :attr:`_log_scalars` with a dict. ``update_scalars`` iterates through each pair of log_dict key-value, and calls ``update_scalar``. If type of value is dict, the value should be ``dict(value=xxx) or dict(value=xxx, count=x...
(self, log_dict: dict, resumed: bool = True) -> NoneType
[ 0.00346554396674037, -0.03543911874294281, -0.06911378353834152, 0.050418149679899216, -0.004772455431520939, -0.023594792932271957, -0.06749950349330902, -0.024270540103316307, 0.03194776177406311, 0.03695954382419586, -0.03252965584397316, 0.04332282021641731, 0.03896801173686981, 0.0172...
730,208
mmengine.fileio.backends.petrel_backend
PetrelBackend
Petrel storage backend (for internal usage). PetrelBackend supports reading and writing data to multiple clusters. If the file path contains the cluster name, PetrelBackend will read data from specified cluster or write data to it. Otherwise, PetrelBackend will access the default cluster. Args: ...
class PetrelBackend(BaseStorageBackend): """Petrel storage backend (for internal usage). PetrelBackend supports reading and writing data to multiple clusters. If the file path contains the cluster name, PetrelBackend will read data from specified cluster or write data to it. Otherwise, PetrelBackend wi...
(path_mapping: Optional[dict] = None, enable_mc: bool = True, conf_path: Optional[str] = None)
[ 0.028220580890774727, -0.0860530436038971, -0.10166884958744049, 0.03559240326285362, 0.0193640124052763, -0.00938609428703785, -0.02786756493151188, 0.06541194021701813, 0.007174548227339983, -0.052204959094524384, 0.017079785466194153, -0.005627503618597984, -0.006551577243953943, 0.0052...
730,209
mmengine.fileio.backends.petrel_backend
__init__
null
def __init__(self, path_mapping: Optional[dict] = None, enable_mc: bool = True, conf_path: Optional[str] = None): try: from petrel_client import client except ImportError: raise ImportError('Please install petrel_client to enable ' ...
(self, path_mapping: Optional[dict] = None, enable_mc: bool = True, conf_path: Optional[str] = None)
[ 0.05660098046064377, -0.05196279287338257, -0.0033490171190351248, 0.007852868176996708, -0.04860670492053032, 0.00335844443179667, -0.0013374857371672988, 0.0905766561627388, -0.03026135079562664, -0.006971423514187336, 0.03250502794981003, 0.06139000505208969, -0.017911702394485474, 0.04...
730,210
mmengine.fileio.backends.petrel_backend
_format_path
Convert a ``filepath`` to standard format of petrel oss. If the ``filepath`` is concatenated by ``os.path.join``, in a Windows environment, the ``filepath`` will be the format of 's3://bucket_name\image.jpg'. By invoking :meth:`_format_path`, the above ``filepath`` will be converted to ...
def _format_path(self, filepath: str) -> str: """Convert a ``filepath`` to standard format of petrel oss. If the ``filepath`` is concatenated by ``os.path.join``, in a Windows environment, the ``filepath`` will be the format of 's3://bucket_name\\image.jpg'. By invoking :meth:`_format_path`, the abo...
(self, filepath: str) -> str
[ -0.04808497801423073, -0.004857582971453667, -0.03134043887257576, 0.04278748109936714, 0.006001361180096865, -0.06460724771022797, 0.018744992092251778, 0.0358785055577755, 0.054234523326158524, -0.004628364462405443, 0.025079762563109398, -0.01015045028179884, -0.010317154228687286, 0.02...
730,211
mmengine.fileio.backends.petrel_backend
_map_path
Map ``filepath`` to a string path whose prefix will be replaced by :attr:`self.path_mapping`. Args: filepath (str or Path): Path to be mapped.
def _map_path(self, filepath: Union[str, Path]) -> str: """Map ``filepath`` to a string path whose prefix will be replaced by :attr:`self.path_mapping`. Args: filepath (str or Path): Path to be mapped. """ filepath = str(filepath) if self.path_mapping is not None: for k, v in sel...
(self, filepath: Union[str, pathlib.Path]) -> str
[ 0.015193982049822807, 0.01070061232894659, -0.02122362144291401, 0.0489475317299366, -0.04372598975896835, -0.027368703857064247, 0.035147737711668015, 0.10457295924425125, 0.05512813478708267, -0.0512208566069603, 0.021454505622386932, 0.016481608152389526, -0.017192021012306213, 0.060740...
730,212
mmengine.fileio.backends.petrel_backend
_replace_prefix
null
def _replace_prefix(self, filepath: Union[str, Path]) -> str: filepath = str(filepath) return filepath.replace('petrel://', 's3://')
(self, filepath: Union[str, pathlib.Path]) -> str
[ -0.07722868770360947, -0.03124251589179039, -0.027433738112449646, 0.05799172446131706, -0.030013877898454666, -0.02904851920902729, 0.021588928997516632, 0.08502177149057388, 0.11359638720750809, -0.017788926139473915, 0.01367298886179924, -0.012672525830566883, -0.03080371581017971, 0.02...
730,213
mmengine.fileio.backends.petrel_backend
copy_if_symlink_fails
Create a symbolic link pointing to src named dst. Directly copy src to dst because PetrelBacekend does not support create a symbolic link. Args: src (str or Path): A file or directory to be copied. dst (str or Path): Copy a file or directory to dst. backend_...
def copy_if_symlink_fails( self, src: Union[str, Path], dst: Union[str, Path], ) -> bool: """Create a symbolic link pointing to src named dst. Directly copy src to dst because PetrelBacekend does not support create a symbolic link. Args: src (str or Path): A file or directory to be c...
(self, src: Union[str, pathlib.Path], dst: Union[str, pathlib.Path]) -> bool
[ 0.017480891197919846, -0.027439307421445847, -0.007074487861245871, -0.001821120735257864, -0.03897501528263092, -0.0054971943609416485, 0.010331738740205765, 0.030519230291247368, 0.06499569118022919, -0.020980803295969963, 0.05331065505743027, 0.008675114251673222, 0.06443570554256439, -...
730,214
mmengine.fileio.backends.petrel_backend
copyfile
Copy a file src to dst and return the destination file. src and dst should have the same prefix. If dst specifies a directory, the file will be copied into dst using the base filename from src. If dst specifies a file that already exists, it will be replaced. Args: src (str...
def copyfile( self, src: Union[str, Path], dst: Union[str, Path], ) -> str: """Copy a file src to dst and return the destination file. src and dst should have the same prefix. If dst specifies a directory, the file will be copied into dst using the base filename from src. If dst specifies a ...
(self, src: Union[str, pathlib.Path], dst: Union[str, pathlib.Path]) -> str
[ -0.028364401310682297, -0.06062008813023567, -0.015355308540165424, 0.02323324978351593, -0.06825005263090134, -0.034716349095106125, 0.0250453669577837, 0.040171775966882706, 0.0379781611263752, -0.047954343259334564, -0.009203647263348103, -0.00564617570489645, -0.005441119894385338, 0.0...
730,215
mmengine.fileio.backends.petrel_backend
copyfile_from_local
Upload a local file src to dst and return the destination file. Args: src (str or Path): A local file to be copied. dst (str or Path): Copy file to dst. backend_args (dict, optional): Arguments to instantiate the prefix of uri corresponding backend. Defaults ...
def copyfile_from_local( self, src: Union[str, Path], dst: Union[str, Path], ) -> str: """Upload a local file src to dst and return the destination file. Args: src (str or Path): A local file to be copied. dst (str or Path): Copy file to dst. backend_args (dict, optional): Ar...
(self, src: Union[str, pathlib.Path], dst: Union[str, pathlib.Path]) -> str
[ -0.049093183130025864, -0.01816796138882637, -0.06051470339298248, 0.01480926014482975, -0.030470294877886772, -0.04638298973441124, 0.02448851615190506, 0.028360217809677124, 0.059237040579319, -0.03379995748400688, -0.03316112980246544, -0.03873638063669205, -0.025901686400175095, -0.000...
730,216
mmengine.fileio.backends.petrel_backend
copyfile_to_local
Copy the file src to local dst and return the destination file. If dst specifies a directory, the file will be copied into dst using the base filename from src. If dst specifies a file that already exists, it will be replaced. Args: src (str or Path): A file to be copied. ...
def copyfile_to_local( self, src: Union[str, Path], dst: Union[str, Path], ) -> Union[str, Path]: """Copy the file src to local dst and return the destination file. If dst specifies a directory, the file will be copied into dst using the base filename from src. If dst specifies a file that alrea...
(self, src: Union[str, pathlib.Path], dst: Union[str, pathlib.Path]) -> Union[str, pathlib.Path]
[ -0.04308345913887024, -0.04602009057998657, -0.03375193104147911, 0.015021250583231449, -0.02785934880375862, -0.0523570291697979, 0.015629827976226807, 0.03518160432577133, 0.04041730612516403, -0.03846599534153938, -0.028110507875680923, -0.04497681185603142, -0.022217927500605583, 0.017...
730,217
mmengine.fileio.backends.petrel_backend
copytree
Recursively copy an entire directory tree rooted at src to a directory named dst and return the destination directory. src and dst should have the same prefix. Args: src (str or Path): A directory to be copied. dst (str or Path): Copy directory to dst. backe...
def copytree( self, src: Union[str, Path], dst: Union[str, Path], ) -> str: """Recursively copy an entire directory tree rooted at src to a directory named dst and return the destination directory. src and dst should have the same prefix. Args: src (str or Path): A directory to be co...
(self, src: Union[str, pathlib.Path], dst: Union[str, pathlib.Path]) -> str
[ -0.031520143151283264, -0.018574370071291924, -0.024707600474357605, -0.03761455416679382, -0.03612006455659866, 0.0214080773293972, 0.028705844655632973, 0.04091407731175423, 0.07398693263530731, -0.0587703138589859, 0.005895470269024372, -0.008564201183617115, -0.02268906868994236, 0.014...
730,218
mmengine.fileio.backends.petrel_backend
copytree_from_local
Recursively copy an entire directory tree rooted at src to a directory named dst and return the destination directory. Args: src (str or Path): A local directory to be copied. dst (str or Path): Copy directory to dst. Returns: str: The destination directory....
def copytree_from_local( self, src: Union[str, Path], dst: Union[str, Path], ) -> str: """Recursively copy an entire directory tree rooted at src to a directory named dst and return the destination directory. Args: src (str or Path): A local directory to be copied. dst (str or Pa...
(self, src: Union[str, pathlib.Path], dst: Union[str, pathlib.Path]) -> str
[ -0.026623642072081566, -0.01119447685778141, -0.030740700662136078, -0.01339024119079113, -0.017762163653969765, -0.007797903846949339, 0.031230825930833817, 0.024525903165340424, 0.05618803948163986, -0.03793574869632721, -0.01580166071653366, -0.04575815796852112, -0.020977390930056572, ...
730,219
mmengine.fileio.backends.petrel_backend
copytree_to_local
Recursively copy an entire directory tree rooted at src to a local directory named dst and return the destination directory. Args: src (str or Path): A directory to be copied. dst (str or Path): Copy directory to local dst. backend_args (dict, optional): Arguments to...
def copytree_to_local( self, src: Union[str, Path], dst: Union[str, Path], ) -> Union[str, Path]: """Recursively copy an entire directory tree rooted at src to a local directory named dst and return the destination directory. Args: src (str or Path): A directory to be copied. dst...
(self, src: Union[str, pathlib.Path], dst: Union[str, pathlib.Path]) -> Union[str, pathlib.Path]
[ -0.03645588085055351, -0.014783062972128391, -0.029604723677039146, -0.00869421660900116, -0.027713418006896973, 0.0031602175440639257, 0.02068856917321682, 0.03736293688416481, 0.06638868898153305, -0.057588327676057816, -0.006807735655456781, -0.04971432313323021, -0.03361892327666283, 0...
730,220
mmengine.fileio.backends.petrel_backend
exists
Check whether a file path exists. Args: filepath (str or Path): Path to be checked whether exists. Returns: bool: Return ``True`` if ``filepath`` exists, ``False`` otherwise. Examples: >>> backend = PetrelBackend() >>> filepath = 'petrel://path/...
def exists(self, filepath: Union[str, Path]) -> bool: """Check whether a file path exists. Args: filepath (str or Path): Path to be checked whether exists. Returns: bool: Return ``True`` if ``filepath`` exists, ``False`` otherwise. Examples: >>> backend = PetrelBackend() ...
(self, filepath: Union[str, pathlib.Path]) -> bool
[ 0.01543942466378212, -0.09647573530673981, -0.05867164954543114, 0.025900758802890778, 0.04849503934383392, 0.012022728100419044, 0.01008476410061121, 0.008091690950095654, -0.042984239757061005, -0.013014672324061394, 0.019232692196965218, 0.023769916966557503, 0.041992295533418655, -0.07...
730,221
mmengine.fileio.backends.petrel_backend
generate_presigned_url
Generate the presigned url of video stream which can be passed to mmcv.VideoReader. Now only work on Petrel backend. Note: Now only work on Petrel backend. Args: url (str): Url of video stream. client_method (str): Method of client, 'get_object' or ...
def generate_presigned_url(self, url: str, client_method: str = 'get_object', expires_in: int = 3600) -> str: """Generate the presigned url of video stream which can be passed to mmcv.VideoReader. Now only work on Petrel backend. ...
(self, url: str, client_method: str = 'get_object', expires_in: int = 3600) -> str
[ -0.031490448862314224, -0.038023434579372406, -0.06470590084791183, 0.030315980315208435, -0.017635386437177658, 0.032683271914720535, 0.02798539400100708, 0.023966507986187935, 0.04136332869529724, 0.050428763031959534, 0.00486303586512804, 0.0338393896818161, -0.012891632504761219, 0.034...
730,222
mmengine.fileio.backends.petrel_backend
get
Read bytes from a given ``filepath`` with 'rb' mode. Args: filepath (str or Path): Path to read data. Returns: bytes: Return bytes read from filepath. Examples: >>> backend = PetrelBackend() >>> filepath = 'petrel://path/of/file' >>>...
def get(self, filepath: Union[str, Path]) -> bytes: """Read bytes from a given ``filepath`` with 'rb' mode. Args: filepath (str or Path): Path to read data. Returns: bytes: Return bytes read from filepath. Examples: >>> backend = PetrelBackend() >>> filepath = 'petrel://p...
(self, filepath: Union[str, pathlib.Path]) -> bytes
[ 0.04208141937851906, -0.08070509880781174, -0.06058400124311447, 0.04741516709327698, -0.006092425901442766, -0.02889419160783291, 0.0074120680801570415, 0.035037197172641754, 0.053300678730010986, -0.07367926836013794, 0.035478610545396805, 0.03976399824023247, -0.04079396277666092, -0.01...
730,223
mmengine.fileio.backends.petrel_backend
get_local_path
Download a file from ``filepath`` to a local temporary directory, and return the temporary path. ``get_local_path`` is decorated by :meth:`contxtlib.contextmanager`. It can be called with ``with`` statement, and when exists from the ``with`` statement, the temporary path will be release...
def join_path( self, filepath: Union[str, Path], *filepaths: Union[str, Path], ) -> str: r"""Concatenate all file paths. Join one or more filepath components intelligently. The return value is the concatenation of filepath and any members of \*filepaths. Args: filepath (str or Path):...
(self, filepath: Union[str, pathlib.Path]) -> Generator[Union[str, pathlib.Path], NoneType, NoneType]
[ -0.08099471032619476, -0.0333310030400753, -0.03340565413236618, 0.07547064870595932, -0.03394686058163643, -0.046805236488580704, -0.008715329691767693, 0.016002986580133438, 0.007940840907394886, -0.007441622205078602, 0.020136702805757523, -0.008113468065857887, -0.014388691633939743, 0...
730,224
mmengine.fileio.backends.petrel_backend
get_text
Read text from a given ``filepath`` with 'r' mode. Args: filepath (str or Path): Path to read data. encoding (str): The encoding format used to open the ``filepath``. Defaults to 'utf-8'. Returns: str: Expected text reading from ``filepath``. ...
def get_text( self, filepath: Union[str, Path], encoding: str = 'utf-8', ) -> str: """Read text from a given ``filepath`` with 'r' mode. Args: filepath (str or Path): Path to read data. encoding (str): The encoding format used to open the ``filepath``. Defaults to 'utf-8'...
(self, filepath: Union[str, pathlib.Path], encoding: str = 'utf-8') -> str
[ 0.011480373330414295, -0.1005142331123352, -0.011173265986144543, 0.07312753796577454, 0.03172232210636139, 0.0003390029596630484, -0.015111458487808704, -0.019094813615083694, 0.10318786650896072, -0.03564244881272316, 0.03790058568120003, -0.0013774641556665301, -0.0437898114323616, 0.00...
730,225
mmengine.fileio.backends.petrel_backend
isdir
Check whether a file path is a directory. Args: filepath (str or Path): Path to be checked whether it is a directory. Returns: bool: Return ``True`` if ``filepath`` points to a directory, ``False`` otherwise. Examples: >>> backen...
def isdir(self, filepath: Union[str, Path]) -> bool: """Check whether a file path is a directory. Args: filepath (str or Path): Path to be checked whether it is a directory. Returns: bool: Return ``True`` if ``filepath`` points to a directory, ``False`` otherwise. Exa...
(self, filepath: Union[str, pathlib.Path]) -> bool
[ 0.0018351670587435365, -0.0017294952413067222, -0.016822952777147293, -0.003848802065476775, 0.052300501614809036, 0.014427724294364452, 0.021416153758764267, 0.00786198303103447, -0.07495653629302979, -0.009233367629349232, 0.007223255466669798, 0.0015850771451368928, 0.0003181895590387285,...
730,226
mmengine.fileio.backends.petrel_backend
isfile
Check whether a file path is a file. Args: filepath (str or Path): Path to be checked whether it is a file. Returns: bool: Return ``True`` if ``filepath`` points to a file, ``False`` otherwise. Examples: >>> backend = PetrelBackend() ...
def isfile(self, filepath: Union[str, Path]) -> bool: """Check whether a file path is a file. Args: filepath (str or Path): Path to be checked whether it is a file. Returns: bool: Return ``True`` if ``filepath`` points to a file, ``False`` otherwise. Examples: >>> backend...
(self, filepath: Union[str, pathlib.Path]) -> bool
[ 0.03339789807796478, -0.10319893062114716, -0.025157103314995766, 0.02604544535279274, 0.015612146817147732, -0.02230306714773178, 0.0661153644323349, -0.0028209597803652287, -0.03404052555561066, -0.02362613007426262, 0.031073085963726044, 0.014752155169844627, 0.013447992503643036, -0.05...
730,227
mmengine.fileio.backends.petrel_backend
join_path
Concatenate all file paths. Join one or more filepath components intelligently. The return value is the concatenation of filepath and any members of \*filepaths. Args: filepath (str or Path): Path to be concatenated. Returns: str: The result after concatenation...
def join_path( self, filepath: Union[str, Path], *filepaths: Union[str, Path], ) -> str: r"""Concatenate all file paths. Join one or more filepath components intelligently. The return value is the concatenation of filepath and any members of \*filepaths. Args: filepath (str or Path):...
(self, filepath: Union[str, pathlib.Path], *filepaths: Union[str, pathlib.Path]) -> str
[ -0.08099471032619476, -0.0333310030400753, -0.03340565413236618, 0.07547064870595932, -0.03394686058163643, -0.046805236488580704, -0.008715329691767693, 0.016002986580133438, 0.007940840907394886, -0.007441622205078602, 0.020136702805757523, -0.008113468065857887, -0.014388691633939743, 0...
730,228
mmengine.fileio.backends.petrel_backend
list_dir_or_file
Scan a directory to find the interested directories or files in arbitrary order. Note: Petrel has no concept of directories but it simulates the directory hierarchy in the filesystem through public prefixes. In addition, if the returned path ends with '/', it means t...
def list_dir_or_file(self, dir_path: Union[str, Path], list_dir: bool = True, list_file: bool = True, suffix: Optional[Union[str, Tuple[str]]] = None, recursive: bool = False) -> Iterator[str]: """Scan a directo...
(self, dir_path: Union[str, pathlib.Path], list_dir: bool = True, list_file: bool = True, suffix: Union[str, Tuple[str], NoneType] = None, recursive: bool = False) -> Iterator[str]
[ 0.030386341735720634, -0.039927173405885696, -0.05235430598258972, 0.023330938071012497, 0.03706091269850731, 0.03834371641278267, -0.016225425526499748, 0.006113347131758928, 0.01080358773469925, -0.05343666672706604, 0.04026791453361511, -0.007561509031802416, -0.022449012845754623, -0.0...
730,229
mmengine.fileio.backends.petrel_backend
put
Write bytes to a given ``filepath``. Args: obj (bytes): Data to be saved. filepath (str or Path): Path to write data. Examples: >>> backend = PetrelBackend() >>> filepath = 'petrel://path/of/file' >>> backend.put(b'hello world', filepath) ...
def put(self, obj: bytes, filepath: Union[str, Path]) -> None: """Write bytes to a given ``filepath``. Args: obj (bytes): Data to be saved. filepath (str or Path): Path to write data. Examples: >>> backend = PetrelBackend() >>> filepath = 'petrel://path/of/file' >>> b...
(self, obj: bytes, filepath: Union[str, pathlib.Path]) -> NoneType
[ -0.023425409570336342, -0.030793221667408943, -0.09334911406040192, 0.03867219761013985, -0.0017637358978390694, -0.0786839947104454, 0.004448448307812214, 0.1130906194448471, -0.03891896456480026, -0.0509401299059391, 0.01583726890385151, -0.03331378847360611, -0.009861938655376434, -0.04...
730,230
mmengine.fileio.backends.petrel_backend
put_text
Write text to a given ``filepath``. Args: obj (str): Data to be written. filepath (str or Path): Path to write data. encoding (str): The encoding format used to encode the ``obj``. Defaults to 'utf-8'. Examples: >>> backend = PetrelBacken...
def put_text( self, obj: str, filepath: Union[str, Path], encoding: str = 'utf-8', ) -> None: """Write text to a given ``filepath``. Args: obj (str): Data to be written. filepath (str or Path): Path to write data. encoding (str): The encoding format used to encode the ``o...
(self, obj: str, filepath: Union[str, pathlib.Path], encoding: str = 'utf-8') -> NoneType
[ -0.011061870492994785, -0.04821664094924927, -0.07413696497678757, 0.03271966800093651, 0.03589499369263649, -0.054153118282556534, 0.0038828717079013586, 0.07185901701450348, 0.014910227619111538, -0.014910227619111538, 0.00815403088927269, -0.05001138895750046, -0.005457592196762562, -0....
730,231
mmengine.fileio.backends.petrel_backend
remove
Remove a file. Args: filepath (str or Path): Path to be removed. Raises: FileNotFoundError: If filepath does not exist, an FileNotFoundError will be raised. IsADirectoryError: If filepath is a directory, an IsADirectoryError will be r...
def remove(self, filepath: Union[str, Path]) -> None: """Remove a file. Args: filepath (str or Path): Path to be removed. Raises: FileNotFoundError: If filepath does not exist, an FileNotFoundError will be raised. IsADirectoryError: If filepath is a directory, an IsADirec...
(self, filepath: Union[str, pathlib.Path]) -> NoneType
[ -0.006390711292624474, -0.003369689453393221, -0.03182051330804825, 0.002135589485988021, 0.004716189112514257, -0.04462946206331253, -0.025838108733296394, 0.0690729022026062, -0.03396756947040558, 0.013845776207745075, 0.011001382023096085, 0.011230768635869026, -0.0132952481508255, -0.0...
730,232
mmengine.fileio.backends.petrel_backend
rmtree
Recursively delete a directory tree. Args: dir_path (str or Path): A directory to be removed. Examples: >>> backend = PetrelBackend() >>> dir_path = 'petrel://path/of/dir' >>> backend.rmtree(dir_path)
def rmtree(self, dir_path: Union[str, Path]) -> None: """Recursively delete a directory tree. Args: dir_path (str or Path): A directory to be removed. Examples: >>> backend = PetrelBackend() >>> dir_path = 'petrel://path/of/dir' >>> backend.rmtree(dir_path) """ for pa...
(self, dir_path: Union[str, pathlib.Path]) -> NoneType
[ 0.04809683933854103, 0.006104812491685152, 0.025976741686463356, -0.05881386622786522, 0.04257144778966904, 0.02740444429218769, -0.036341480910778046, 0.030630677938461304, -0.004964505787938833, -0.008983391337096691, 0.03569252789020538, 0.04138479009270668, 0.016418561339378357, 0.0028...
730,233
mmengine.fileio.handlers.pickle_handler
PickleHandler
null
class PickleHandler(BaseFileHandler): str_like = False def load_from_fileobj(self, file, **kwargs): return pickle.load(file, **kwargs) def load_from_path(self, filepath, **kwargs): return super().load_from_path(filepath, mode='rb', **kwargs) def dump_to_str(self, obj, **kwargs): ...
()
[ 0.008117607794702053, -0.022045712918043137, -0.054960474371910095, 0.014133182354271412, 0.023019826039671898, -0.035136424005031586, -0.022917287424206734, 0.06866641342639923, -0.04087856411933899, -0.027668224647641182, -0.0014237856958061457, -0.02168682962656021, -0.04839802905917168, ...
730,234
mmengine.fileio.handlers.pickle_handler
dump_to_fileobj
null
def dump_to_fileobj(self, obj, file, **kwargs): kwargs.setdefault('protocol', 2) pickle.dump(obj, file, **kwargs)
(self, obj, file, **kwargs)
[ -0.017752263695001602, 0.009340629912912846, -0.0375652089715004, 0.006262275855988264, 0.012473879382014275, -0.08769720047712326, -0.039152950048446655, 0.0571923553943634, -0.06334061920642853, -0.029643410816788673, -0.01429808884859085, -0.028967777267098427, -0.055469490587711334, -0...
730,235
mmengine.fileio.handlers.pickle_handler
dump_to_path
null
def dump_to_path(self, obj, filepath, **kwargs): super().dump_to_path(obj, filepath, mode='wb', **kwargs)
(self, obj, filepath, **kwargs)
[ -0.015520463697612286, -0.011158227920532227, -0.023124901577830315, 0.01906583271920681, 0.028952443972229958, -0.07309692353010178, -0.03728953376412392, 0.07693703472614288, -0.041028592735528946, -0.029979843646287918, -0.008623415604233742, -0.010577158071100712, 0.006219133269041777, ...
730,236
mmengine.fileio.handlers.pickle_handler
dump_to_str
null
def dump_to_str(self, obj, **kwargs): kwargs.setdefault('protocol', 2) return pickle.dumps(obj, **kwargs)
(self, obj, **kwargs)
[ -0.02054470218718052, -0.006544617936015129, -0.02592545747756958, -0.03420743718743324, 0.017019379884004593, -0.08130169659852982, -0.014624184928834438, 0.015104910358786583, 0.006489798426628113, -0.056540101766586304, -0.014084422960877419, -0.013595262542366982, -0.06035217270255089, ...
730,237
mmengine.fileio.handlers.pickle_handler
load_from_fileobj
null
def load_from_fileobj(self, file, **kwargs): return pickle.load(file, **kwargs)
(self, file, **kwargs)
[ 0.01803433708846569, -0.03957917541265488, -0.03889084234833717, 0.011994211003184319, -0.015995148569345474, -0.03723884001374245, -0.015100316144526005, 0.06866126507520676, 0.0058809490874409676, -0.001169091439805925, -0.012037231586873531, 0.043743591755628586, -0.06108959764242172, 0...