Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ColossalAI
Commits
1a229045
Unverified
Commit
1a229045
authored
Mar 27, 2023
by
YH
Committed by
GitHub
Mar 27, 2023
Browse files
Add interface for colo tesnor dp size (#3227)
parent
1653063f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
colossalai/gemini/chunk/manager.py
colossalai/gemini/chunk/manager.py
+1
-1
colossalai/tensor/colo_tensor.py
colossalai/tensor/colo_tensor.py
+9
-0
No files found.
colossalai/gemini/chunk/manager.py
View file @
1a229045
...
...
@@ -72,7 +72,7 @@ class ChunkManager:
if
tensor
.
numel
()
>
chunk_size
:
chunk_size
=
tensor
.
numel
()
dp_size
=
tensor
.
process_group
.
dp_world_size
()
dp_size
=
tensor
.
get_
dp_world_size
()
chunk_size
=
chunk_size
+
(
-
chunk_size
%
dp_size
)
chunk
=
Chunk
(
...
...
colossalai/tensor/colo_tensor.py
View file @
1a229045
...
...
@@ -138,6 +138,15 @@ class ColoTensor(torch.Tensor):
def
get_tp_world_size
(
self
)
->
int
:
return
self
.
process_group
.
tp_world_size
()
def
get_dp_world_size
(
self
)
->
int
:
"""get_dp_world_size
get the dp world size of the tensor.
Returns:
int: dp world size
"""
return
self
.
process_group
.
dp_world_size
()
def
set_dist_spec
(
self
,
dist_spec
:
_DistSpec
):
"""set_dist_spec
set dist spec and change the payloads.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment