File tree Expand file tree Collapse file tree 3 files changed +11
-11
lines changed
Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 11import os
2- import torch
2+
33
44PACKAGE_ROOT = os .path .dirname (os .path .dirname (os .path .abspath (__file__ )))
55REPO_ROOT = os .path .dirname (PACKAGE_ROOT )
3434MB = 1024 * KB
3535GB = 1024 * MB
3636TB = 1024 * GB
37-
38- # data type
39- # AMD only support e4m3fnuz
40- # https://onnx.ai/onnx/technical/float8.html
41- if torch .version .hip and "gfx94" in torch .cuda .get_device_properties (0 ).gcnArchName :
42- DTYPE_FP8 = torch .float8_e4m3fnuz
43- else :
44- DTYPE_FP8 = torch .float8_e4m3fn
Original file line number Diff line number Diff line change 22import torch .nn as nn
33import torch .nn .functional as F
44from contextlib import contextmanager
5- from diffsynth_engine .utils .constants import DTYPE_FP8
5+ from diffsynth_engine .utils .platform import DTYPE_FP8
66
77
88def enable_fp8_linear (module : nn .Module ):
Original file line number Diff line number Diff line change 1+ # cross-platform definitions and utilities
12import torch
23import gc
34
4- # 存放跨平台的工具类
5+
6+ # data type
7+ # AMD only supports float8_e4m3fnuz
8+ # https://onnx.ai/onnx/technical/float8.html
9+ if torch .version .hip and "gfx94" in torch .cuda .get_device_properties (0 ).gcnArchName :
10+ DTYPE_FP8 = torch .float8_e4m3fnuz
11+ else :
12+ DTYPE_FP8 = torch .float8_e4m3fn
513
614
715def empty_cache ():
You can’t perform that action at this time.
0 commit comments