[example] update examples related to zero/gemini (#3431)

* [zero] update legacy import

* [zero] update examples

* [example] fix opt tutorial

* [example] fix opt tutorial

* [example] fix opt tutorial

* [example] fix opt tutorial

* [example] fix import
This commit is contained in:
ver217
2023-04-04 17:32:51 +08:00
committed by GitHub
parent 773955abfa
commit 573af84184
8 changed files with 50 additions and 6 deletions

View File

@@ -1,4 +1,9 @@
from colossalai.zero.shard_utils import TensorShardStrategy
from colossalai.nn.optimizer import FusedAdam
try:
from colossalai.zero.shard_utils import TensorShardStrategy
except ImportError:
# colossalai > 0.2.8
from colossalai.zero.legacy import TensorShardStrategy
clip_grad_norm = 1.0

View File

@@ -1,6 +1,11 @@
from colossalai.zero.shard_utils import TensorShardStrategy
from colossalai.nn.optimizer import FusedAdam
try:
from colossalai.zero.shard_utils import TensorShardStrategy
except ImportError:
# colossalai > 0.2.8
from colossalai.zero.legacy import TensorShardStrategy
# fp16 = dict(
# mode=AMP_TYPE.TORCH,
# )
@@ -29,4 +34,4 @@ optimizer = dict(
weight_decay=1e-2,
)
# 64433
# 64433