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
2bde9d2b
Commit
2bde9d2b
authored
Jan 06, 2023
by
oahzxl
Browse files
code format
parent
8a634af2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
7 deletions
+13
-7
colossalai/autochunk/autochunk_codegen.py
colossalai/autochunk/autochunk_codegen.py
+3
-1
colossalai/autochunk/chunk_region_search.py
colossalai/autochunk/chunk_region_search.py
+9
-5
colossalai/autochunk/memory_estiamtor.py
colossalai/autochunk/memory_estiamtor.py
+1
-1
No files found.
colossalai/autochunk/autochunk_codegen.py
View file @
2bde9d2b
...
...
@@ -220,7 +220,9 @@ if CODEGEN_AVAILABLE:
self
.
max_memory
=
max_memory
self
.
meta_node
=
list
(
meta_graph
.
graph
.
nodes
)
# find the chunk regions
self
.
chunk_region_search
=
ChunkRegionSearch
(
meta_graph
,
max_memory
,
print_mem
)
self
.
chunk_region_search
=
ChunkRegionSearch
(
meta_graph
,
max_memory
,
print_mem
)
self
.
chunk_infos
=
self
.
chunk_region_search
.
search_region
()
def
_gen_python_code
(
...
...
colossalai/autochunk/chunk_region_search.py
View file @
2bde9d2b
import
copy
from
.chunk_selector
import
ChunkSelector
from
.index_tracer
import
IndexTracer
from
.memory_estiamtor
import
MemoryEstimator
from
.chunk_selector
import
ChunkSelector
import
copy
from
.utils
import
is_non_compute_node
,
is_non_compute_node_except_placeholder
,
get_node_shape
from
.utils
import
(
get_node_shape
,
is_non_compute_node
,
is_non_compute_node_except_placeholder
,
)
class
ChunkRegionSearch
(
object
):
...
...
@@ -11,7 +16,7 @@ class ChunkRegionSearch(object):
self
.
print_mem
=
print_mem
self
.
index_tracer
=
IndexTracer
(
list
(
gm
.
graph
.
nodes
))
self
.
index_tracer
.
trace_index
()
self
.
memory_estimator
=
MemoryEstimator
(
self
.
index_tracer
)
self
.
memory_estimator
=
MemoryEstimator
()
self
.
chunk_selector
=
ChunkSelector
(
self
.
index_tracer
,
self
.
memory_estimator
,
max_memory
=
max_memory
)
...
...
@@ -211,4 +216,3 @@ class ChunkRegionSearch(object):
self
.
index_tracer
.
node_list
,
chunk_infos
,
print_mem
=
True
)
return
chunk_infos
colossalai/autochunk/memory_estiamtor.py
View file @
2bde9d2b
...
...
@@ -16,7 +16,7 @@ from .utils import (
class
MemoryEstimator
(
object
):
def
__init__
(
self
,
index_tracer
:
IndexTracer
)
->
None
:
def
__init__
(
self
)
->
None
:
pass
def
_get_meta_node_size
(
self
,
x
):
...
...
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