mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-09-16 22:52:25 +00:00
[feat] refactored extension module (#5298)
* [feat] refactored extension module * polish * polish * polish * polish * polish * polish * polish * polish * polish * polish
This commit is contained in:
@@ -4,6 +4,7 @@ from .common import (
|
||||
disposable,
|
||||
ensure_path_exists,
|
||||
free_storage,
|
||||
get_current_device,
|
||||
is_ddp_ignored,
|
||||
set_seed,
|
||||
)
|
||||
@@ -22,5 +23,6 @@ __all__ = [
|
||||
"_cast_float",
|
||||
"free_storage",
|
||||
"set_seed",
|
||||
"get_current_device",
|
||||
"is_ddp_ignored",
|
||||
]
|
||||
|
@@ -10,6 +10,15 @@ from typing import Callable
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
from colossalai.accelerator import get_accelerator
|
||||
|
||||
|
||||
def get_current_device():
|
||||
"""
|
||||
A wrapper function for accelerator's API for backward compatibility.
|
||||
"""
|
||||
return get_accelerator().get_current_device()
|
||||
|
||||
|
||||
def ensure_path_exists(filename: str):
|
||||
# ensure the path exists
|
||||
|
Reference in New Issue
Block a user