Spaces:
Paused
Paused
Commit
Β·
e74c01b
1
Parent(s):
e9ed143
return to old version
Browse files- README.md +1 -1
- modules/__pycache__/__init__.cpython-310.pyc +0 -0
- modules/__pycache__/attention.cpython-310.pyc +0 -0
- modules/__pycache__/autoencoder.cpython-310.pyc +0 -0
- modules/__pycache__/conditioner.cpython-310.pyc +0 -0
- modules/__pycache__/connector_edit.cpython-310.pyc +0 -0
- modules/__pycache__/layers.cpython-310.pyc +0 -0
- modules/__pycache__/model_edit.cpython-310.pyc +0 -0
- modules/attention.py +1 -1
- modules/conditioner.py +1 -1
- modules/layers.py +14 -13
- requirements.txt +8 -4
README.md
CHANGED
|
@@ -3,7 +3,7 @@ title: Test
|
|
| 3 |
emoji: π
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: pink
|
| 6 |
-
sdk:
|
| 7 |
app_file: app.py
|
| 8 |
pinned: false
|
| 9 |
license: mit
|
|
|
|
| 3 |
emoji: π
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: pink
|
| 6 |
+
sdk: gradio
|
| 7 |
app_file: app.py
|
| 8 |
pinned: false
|
| 9 |
license: mit
|
modules/__pycache__/__init__.cpython-310.pyc
CHANGED
|
Binary files a/modules/__pycache__/__init__.cpython-310.pyc and b/modules/__pycache__/__init__.cpython-310.pyc differ
|
|
|
modules/__pycache__/attention.cpython-310.pyc
CHANGED
|
Binary files a/modules/__pycache__/attention.cpython-310.pyc and b/modules/__pycache__/attention.cpython-310.pyc differ
|
|
|
modules/__pycache__/autoencoder.cpython-310.pyc
CHANGED
|
Binary files a/modules/__pycache__/autoencoder.cpython-310.pyc and b/modules/__pycache__/autoencoder.cpython-310.pyc differ
|
|
|
modules/__pycache__/conditioner.cpython-310.pyc
CHANGED
|
Binary files a/modules/__pycache__/conditioner.cpython-310.pyc and b/modules/__pycache__/conditioner.cpython-310.pyc differ
|
|
|
modules/__pycache__/connector_edit.cpython-310.pyc
CHANGED
|
Binary files a/modules/__pycache__/connector_edit.cpython-310.pyc and b/modules/__pycache__/connector_edit.cpython-310.pyc differ
|
|
|
modules/__pycache__/layers.cpython-310.pyc
CHANGED
|
Binary files a/modules/__pycache__/layers.cpython-310.pyc and b/modules/__pycache__/layers.cpython-310.pyc differ
|
|
|
modules/__pycache__/model_edit.cpython-310.pyc
CHANGED
|
Binary files a/modules/__pycache__/model_edit.cpython-310.pyc and b/modules/__pycache__/model_edit.cpython-310.pyc differ
|
|
|
modules/attention.py
CHANGED
|
@@ -43,7 +43,7 @@ def attention(
|
|
| 43 |
q,
|
| 44 |
k,
|
| 45 |
v,
|
| 46 |
-
mode="
|
| 47 |
drop_rate=0,
|
| 48 |
attn_mask=None,
|
| 49 |
causal=False,
|
|
|
|
| 43 |
q,
|
| 44 |
k,
|
| 45 |
v,
|
| 46 |
+
mode="torch",
|
| 47 |
drop_rate=0,
|
| 48 |
attn_mask=None,
|
| 49 |
causal=False,
|
modules/conditioner.py
CHANGED
|
@@ -73,7 +73,7 @@ class Qwen25VL_7b_Embedder(torch.nn.Module):
|
|
| 73 |
self.model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
| 74 |
model_path,
|
| 75 |
torch_dtype=dtype,
|
| 76 |
-
attn_implementation="
|
| 77 |
).to(torch.cuda.current_device())
|
| 78 |
|
| 79 |
self.model.requires_grad_(False)
|
|
|
|
| 73 |
self.model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
| 74 |
model_path,
|
| 75 |
torch_dtype=dtype,
|
| 76 |
+
attn_implementation="eager",
|
| 77 |
).to(torch.cuda.current_device())
|
| 78 |
|
| 79 |
self.model.requires_grad_(False)
|
modules/layers.py
CHANGED
|
@@ -24,7 +24,7 @@ from functools import partial
|
|
| 24 |
import torch
|
| 25 |
import torch.nn.functional as F
|
| 26 |
from einops import rearrange
|
| 27 |
-
from liger_kernel.ops.rms_norm import LigerRMSNormFunction
|
| 28 |
from torch import Tensor, nn
|
| 29 |
|
| 30 |
|
|
@@ -60,7 +60,7 @@ def attention(
|
|
| 60 |
q,
|
| 61 |
k,
|
| 62 |
v,
|
| 63 |
-
mode="
|
| 64 |
drop_rate=0,
|
| 65 |
attn_mask=None,
|
| 66 |
causal=False,
|
|
@@ -436,16 +436,16 @@ class RMSNorm(torch.nn.Module):
|
|
| 436 |
super().__init__()
|
| 437 |
self.scale = nn.Parameter(torch.ones(dim))
|
| 438 |
|
| 439 |
-
@staticmethod
|
| 440 |
-
def rms_norm_fast(x, weight, eps):
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
|
| 450 |
@staticmethod
|
| 451 |
def rms_norm(x, weight, eps):
|
|
@@ -455,7 +455,8 @@ class RMSNorm(torch.nn.Module):
|
|
| 455 |
return (x * rrms).to(dtype=x_dtype) * weight
|
| 456 |
|
| 457 |
def forward(self, x: Tensor):
|
| 458 |
-
return self.rms_norm_fast(x, self.scale, 1e-6)
|
|
|
|
| 459 |
|
| 460 |
|
| 461 |
class QKNorm(torch.nn.Module):
|
|
|
|
| 24 |
import torch
|
| 25 |
import torch.nn.functional as F
|
| 26 |
from einops import rearrange
|
| 27 |
+
# from liger_kernel.ops.rms_norm import LigerRMSNormFunction
|
| 28 |
from torch import Tensor, nn
|
| 29 |
|
| 30 |
|
|
|
|
| 60 |
q,
|
| 61 |
k,
|
| 62 |
v,
|
| 63 |
+
mode="torch",
|
| 64 |
drop_rate=0,
|
| 65 |
attn_mask=None,
|
| 66 |
causal=False,
|
|
|
|
| 436 |
super().__init__()
|
| 437 |
self.scale = nn.Parameter(torch.ones(dim))
|
| 438 |
|
| 439 |
+
# @staticmethod
|
| 440 |
+
# def rms_norm_fast(x, weight, eps):
|
| 441 |
+
# return LigerRMSNormFunction.apply(
|
| 442 |
+
# x,
|
| 443 |
+
# weight,
|
| 444 |
+
# eps,
|
| 445 |
+
# 0.0,
|
| 446 |
+
# "gemma",
|
| 447 |
+
# True,
|
| 448 |
+
# )
|
| 449 |
|
| 450 |
@staticmethod
|
| 451 |
def rms_norm(x, weight, eps):
|
|
|
|
| 455 |
return (x * rrms).to(dtype=x_dtype) * weight
|
| 456 |
|
| 457 |
def forward(self, x: Tensor):
|
| 458 |
+
# return self.rms_norm_fast(x, self.scale, 1e-6)
|
| 459 |
+
return self.rms_norm(x, self.scale, 1e-6)
|
| 460 |
|
| 461 |
|
| 462 |
class QKNorm(torch.nn.Module):
|
requirements.txt
CHANGED
|
@@ -1,8 +1,12 @@
|
|
| 1 |
-
|
| 2 |
-
liger_kernel==0.5.4
|
| 3 |
-
einops==0.8.1
|
| 4 |
transformers==4.49.0
|
| 5 |
qwen_vl_utils==0.0.10
|
| 6 |
safetensors==0.4.5
|
| 7 |
pillow==11.1.0
|
| 8 |
-
huggingface_hub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
einops
|
|
|
|
|
|
|
| 2 |
transformers==4.49.0
|
| 3 |
qwen_vl_utils==0.0.10
|
| 4 |
safetensors==0.4.5
|
| 5 |
pillow==11.1.0
|
| 6 |
+
huggingface_hub
|
| 7 |
+
transformers
|
| 8 |
+
diffusers
|
| 9 |
+
peft
|
| 10 |
+
opencv-python
|
| 11 |
+
sentencepiece
|
| 12 |
+
boto3
|