mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-09-01 09:07:51 +00:00
[Tensor] get named parameters for model using ColoTensors (#874)
This commit is contained in:
@@ -7,6 +7,7 @@ from colossalai.testing import parameterize, rerun_if_address_is_in_use
|
||||
from colossalai.utils.cuda import get_current_device
|
||||
from colossalai.utils import free_port
|
||||
from colossalai.utils import ColoInitContext
|
||||
from colossalai.tensor import named_params_with_colotensor
|
||||
|
||||
from functools import partial
|
||||
|
||||
@@ -19,6 +20,8 @@ def run_simple_net():
|
||||
with ColoInitContext(device=get_current_device()):
|
||||
model = model_builder(checkpoint=True)
|
||||
|
||||
for param in named_params_with_colotensor(model):
|
||||
print(param)
|
||||
# we set the Specs for weight of each linear.
|
||||
# model.proj1.weight.set_spec('1Drow')
|
||||
# model.proj2.weight.set_spec('1Drow')
|
||||
|
Reference in New Issue
Block a user