Commit dcaa837c authored by zhuwenwen's avatar zhuwenwen
Browse files

update glm4.5v conv layout

parent dc6f80a5
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
# limitations under the License. # limitations under the License.
"""Inference-only GLM-4V model compatible with HuggingFace weights.""" """Inference-only GLM-4V model compatible with HuggingFace weights."""
import os
import math import math
from collections.abc import Iterable, Mapping, Sequence from collections.abc import Iterable, Mapping, Sequence
from functools import partial from functools import partial
...@@ -446,6 +447,8 @@ class Glm4vVisionPatchEmbed(nn.Module): ...@@ -446,6 +447,8 @@ class Glm4vVisionPatchEmbed(nn.Module):
L, C = x.shape L, C = x.shape
x = x.view(L, -1, self.temporal_patch_size, self.patch_size, x = x.view(L, -1, self.temporal_patch_size, self.patch_size,
self.patch_size) self.patch_size)
if os.environ.get('PYTORCH_MIOPEN_SUGGEST_NDHWC') == '1':
x = x.to(memory_format=torch.channels_last_3d)
x = self.proj(x).view(L, self.hidden_size) x = self.proj(x).view(L, self.hidden_size)
return x return x
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment