feat: update to include rev in kernel for reproducible symbols

#2
by drbh HF Staff - opened
This view is limited to 50 files because it contains too many changes.  See the raw diff here.
Files changed (50) hide show
  1. README.md +0 -3
  2. activation/activation_kernels.cu +7 -28
  3. activation/cuda_compat.h +3 -3
  4. activation/dispatch_utils.h +0 -48
  5. build.toml +7 -8
  6. build/{torch27-cxx11-cu118-x86_64-linux → torch25-cxx11-cu118-x86_64-linux}/activation/__init__.py +0 -5
  7. build/{torch26-cxx11-cu118-x86_64-linux/activation/_activation_be5bedb.abi3.so → torch25-cxx11-cu118-x86_64-linux/activation/_activation_o63kkyjirmkf4.abi3.so} +2 -2
  8. build/{torch27-cxx11-cu118-x86_64-linux → torch25-cxx11-cu118-x86_64-linux}/activation/_ops.py +3 -3
  9. build/{torch27-cxx11-cu128-x86_64-linux → torch25-cxx11-cu118-x86_64-linux}/activation/layers.py +0 -63
  10. build/{torch27-cxx11-cu126-x86_64-linux → torch25-cxx11-cu121-x86_64-linux}/activation/__init__.py +0 -5
  11. build/{torch26-cxx11-cu124-x86_64-linux/activation/_activation_be5bedb.abi3.so → torch25-cxx11-cu121-x86_64-linux/activation/_activation_vrl36m2ejer54.abi3.so} +2 -2
  12. build/{torch27-cxx11-cu126-x86_64-linux → torch25-cxx11-cu121-x86_64-linux}/activation/_ops.py +3 -3
  13. build/{torch27-cxx11-cu118-x86_64-linux → torch25-cxx11-cu121-x86_64-linux}/activation/layers.py +0 -63
  14. build/{torch27-cxx11-cu128-x86_64-linux → torch25-cxx11-cu124-x86_64-linux}/activation/__init__.py +0 -5
  15. build/{torch26-cxx11-cu126-x86_64-linux/activation/_activation_be5bedb.abi3.so → torch25-cxx11-cu124-x86_64-linux/activation/_activation_va3moa75vw7c2.abi3.so} +2 -2
  16. build/{torch27-cxx11-cu128-x86_64-linux → torch25-cxx11-cu124-x86_64-linux}/activation/_ops.py +3 -3
  17. build/{torch28-cxx11-cu126-aarch64-linux → torch25-cxx11-cu124-x86_64-linux}/activation/layers.py +0 -63
  18. build/{torch28-cxx11-cu126-aarch64-linux → torch25-cxx98-cu118-x86_64-linux}/activation/__init__.py +0 -5
  19. build/{torch26-cxx98-cu118-x86_64-linux/activation/_activation_be5bedb.abi3.so → torch25-cxx98-cu118-x86_64-linux/activation/_activation_qr3gs3eckeig4.abi3.so} +2 -2
  20. build/{torch28-cxx11-cu126-aarch64-linux → torch25-cxx98-cu118-x86_64-linux}/activation/_ops.py +3 -3
  21. build/{torch27-cxx11-cu126-x86_64-linux → torch25-cxx98-cu118-x86_64-linux}/activation/layers.py +0 -63
  22. build/torch25-cxx98-cu121-x86_64-linux/activation/__init__.py +52 -0
  23. build/torch25-cxx98-cu121-x86_64-linux/activation/_activation_p7gbzt25w3zg2.abi3.so +3 -0
  24. build/torch25-cxx98-cu121-x86_64-linux/activation/_ops.py +9 -0
  25. build/torch25-cxx98-cu121-x86_64-linux/activation/layers.py +65 -0
  26. build/torch25-cxx98-cu124-x86_64-linux/activation/__init__.py +52 -0
  27. build/torch25-cxx98-cu124-x86_64-linux/activation/_activation_jg7yaigtn7wco.abi3.so +3 -0
  28. build/torch25-cxx98-cu124-x86_64-linux/activation/_ops.py +9 -0
  29. build/torch25-cxx98-cu124-x86_64-linux/activation/layers.py +65 -0
  30. build/torch26-cxx11-cu118-x86_64-linux/activation/__init__.py +0 -5
  31. build/torch26-cxx11-cu118-x86_64-linux/activation/_activation_ncisyrun7guwk.abi3.so +3 -0
  32. build/torch26-cxx11-cu118-x86_64-linux/activation/_ops.py +3 -3
  33. build/torch26-cxx11-cu118-x86_64-linux/activation/layers.py +0 -63
  34. build/torch26-cxx11-cu124-x86_64-linux/activation/__init__.py +0 -5
  35. build/torch26-cxx11-cu124-x86_64-linux/activation/_activation_ochhfvlnc3vyc.abi3.so +3 -0
  36. build/torch26-cxx11-cu124-x86_64-linux/activation/_ops.py +3 -3
  37. build/torch26-cxx11-cu124-x86_64-linux/activation/layers.py +0 -63
  38. build/torch26-cxx11-cu126-x86_64-linux/activation/__init__.py +0 -5
  39. build/torch26-cxx11-cu126-x86_64-linux/activation/_activation_u6vnqubnicksq.abi3.so +3 -0
  40. build/torch26-cxx11-cu126-x86_64-linux/activation/_ops.py +3 -3
  41. build/torch26-cxx11-cu126-x86_64-linux/activation/layers.py +0 -63
  42. build/torch26-cxx98-cu118-x86_64-linux/activation/__init__.py +0 -5
  43. build/torch26-cxx98-cu118-x86_64-linux/activation/_activation_2vn6ty3gfqfb6.abi3.so +3 -0
  44. build/torch26-cxx98-cu118-x86_64-linux/activation/_ops.py +3 -3
  45. build/torch26-cxx98-cu118-x86_64-linux/activation/layers.py +0 -63
  46. build/torch26-cxx98-cu124-x86_64-linux/activation/__init__.py +0 -5
  47. build/torch26-cxx98-cu124-x86_64-linux/activation/_activation_be5bedb.abi3.so +0 -3
  48. build/torch26-cxx98-cu124-x86_64-linux/activation/_activation_myvteedxdpqc6.abi3.so +3 -0
  49. build/torch26-cxx98-cu124-x86_64-linux/activation/_ops.py +3 -3
  50. build/torch26-cxx98-cu124-x86_64-linux/activation/layers.py +0 -63
README.md CHANGED
@@ -2,9 +2,6 @@
2
  tags:
3
  - kernel
4
  ---
5
-
6
- ![Status](https://hubwebhook.dholtz.com/shield?repo=kernels-community/activation)
7
-
8
  ## Activation
9
 
10
  Activation kernels from [vLLM](https://github.com/vllm-project/vllm/blob/main/csrc/activation_kernels.cu).
 
2
  tags:
3
  - kernel
4
  ---
 
 
 
5
  ## Activation
6
 
7
  Activation kernels from [vLLM](https://github.com/vllm-project/vllm/blob/main/csrc/activation_kernels.cu).
activation/activation_kernels.cu CHANGED
@@ -9,16 +9,8 @@
9
 
10
  namespace vllm {
11
 
12
- template <typename scalar_t, scalar_t (*ACT_FN)(const scalar_t&),
13
- bool act_first>
14
- __device__ __forceinline__ scalar_t compute(const scalar_t& x,
15
- const scalar_t& y) {
16
- return act_first ? ACT_FN(x) * y : x * ACT_FN(y);
17
- }
18
  // Activation and gating kernel template.
19
-
20
- template <typename scalar_t, scalar_t (*ACT_FN)(const scalar_t&),
21
- bool act_first>
22
  __global__ void act_and_mul_kernel(
23
  scalar_t* __restrict__ out, // [..., d]
24
  const scalar_t* __restrict__ input, // [..., 2, d]
@@ -27,7 +19,7 @@ __global__ void act_and_mul_kernel(
27
  for (int64_t idx = threadIdx.x; idx < d; idx += blockDim.x) {
28
  const scalar_t x = VLLM_LDG(&input[token_idx * 2 * d + idx]);
29
  const scalar_t y = VLLM_LDG(&input[token_idx * 2 * d + d + idx]);
30
- out[token_idx * d + idx] = compute<scalar_t, ACT_FN, act_first>(x, y);
31
  }
32
  }
33
 
@@ -63,21 +55,16 @@ __device__ __forceinline__ T gelu_tanh_kernel(const T& x) {
63
  } // namespace vllm
64
 
65
  // Launch activation and gating kernel.
66
- // Use ACT_FIRST (bool) indicating whether to apply the activation function
67
- // first.
68
- #define LAUNCH_ACTIVATION_GATE_KERNEL(KERNEL, ACT_FIRST) \
69
  int d = input.size(-1) / 2; \
70
  int64_t num_tokens = input.numel() / input.size(-1); \
71
  dim3 grid(num_tokens); \
72
  dim3 block(std::min(d, 1024)); \
73
- if (num_tokens == 0) { \
74
- return; \
75
- } \
76
  const at::cuda::OptionalCUDAGuard device_guard(device_of(input)); \
77
  const cudaStream_t stream = at::cuda::getCurrentCUDAStream(); \
78
  VLLM_DISPATCH_FLOATING_TYPES( \
79
  input.scalar_type(), "act_and_mul_kernel", [&] { \
80
- vllm::act_and_mul_kernel<scalar_t, KERNEL<scalar_t>, ACT_FIRST> \
81
  <<<grid, block, 0, stream>>>(out.data_ptr<scalar_t>(), \
82
  input.data_ptr<scalar_t>(), d); \
83
  });
@@ -85,27 +72,19 @@ __device__ __forceinline__ T gelu_tanh_kernel(const T& x) {
85
  void silu_and_mul(torch::Tensor& out, // [..., d]
86
  torch::Tensor& input) // [..., 2 * d]
87
  {
88
- LAUNCH_ACTIVATION_GATE_KERNEL(vllm::silu_kernel, true);
89
- }
90
-
91
- void mul_and_silu(torch::Tensor& out, // [..., d]
92
- torch::Tensor& input) // [..., 2 * d]
93
- {
94
- // The difference between mul_and_silu and silu_and_mul is that mul_and_silu
95
- // applies the silu to the latter half of the input.
96
- LAUNCH_ACTIVATION_GATE_KERNEL(vllm::silu_kernel, false);
97
  }
98
 
99
  void gelu_and_mul(torch::Tensor& out, // [..., d]
100
  torch::Tensor& input) // [..., 2 * d]
101
  {
102
- LAUNCH_ACTIVATION_GATE_KERNEL(vllm::gelu_kernel, true);
103
  }
104
 
105
  void gelu_tanh_and_mul(torch::Tensor& out, // [..., d]
106
  torch::Tensor& input) // [..., 2 * d]
107
  {
108
- LAUNCH_ACTIVATION_GATE_KERNEL(vllm::gelu_tanh_kernel, true);
109
  }
110
 
111
  namespace vllm {
 
9
 
10
  namespace vllm {
11
 
 
 
 
 
 
 
12
  // Activation and gating kernel template.
13
+ template <typename scalar_t, scalar_t (*ACT_FN)(const scalar_t&)>
 
 
14
  __global__ void act_and_mul_kernel(
15
  scalar_t* __restrict__ out, // [..., d]
16
  const scalar_t* __restrict__ input, // [..., 2, d]
 
19
  for (int64_t idx = threadIdx.x; idx < d; idx += blockDim.x) {
20
  const scalar_t x = VLLM_LDG(&input[token_idx * 2 * d + idx]);
21
  const scalar_t y = VLLM_LDG(&input[token_idx * 2 * d + d + idx]);
22
+ out[token_idx * d + idx] = ACT_FN(x) * y;
23
  }
24
  }
25
 
 
55
  } // namespace vllm
56
 
57
  // Launch activation and gating kernel.
58
+ #define LAUNCH_ACTIVATION_GATE_KERNEL(KERNEL) \
 
 
59
  int d = input.size(-1) / 2; \
60
  int64_t num_tokens = input.numel() / input.size(-1); \
61
  dim3 grid(num_tokens); \
62
  dim3 block(std::min(d, 1024)); \
 
 
 
63
  const at::cuda::OptionalCUDAGuard device_guard(device_of(input)); \
64
  const cudaStream_t stream = at::cuda::getCurrentCUDAStream(); \
65
  VLLM_DISPATCH_FLOATING_TYPES( \
66
  input.scalar_type(), "act_and_mul_kernel", [&] { \
67
+ vllm::act_and_mul_kernel<scalar_t, KERNEL<scalar_t>> \
68
  <<<grid, block, 0, stream>>>(out.data_ptr<scalar_t>(), \
69
  input.data_ptr<scalar_t>(), d); \
70
  });
 
72
  void silu_and_mul(torch::Tensor& out, // [..., d]
73
  torch::Tensor& input) // [..., 2 * d]
74
  {
75
+ LAUNCH_ACTIVATION_GATE_KERNEL(vllm::silu_kernel);
 
 
 
 
 
 
 
 
76
  }
77
 
78
  void gelu_and_mul(torch::Tensor& out, // [..., d]
79
  torch::Tensor& input) // [..., 2 * d]
80
  {
81
+ LAUNCH_ACTIVATION_GATE_KERNEL(vllm::gelu_kernel);
82
  }
83
 
84
  void gelu_tanh_and_mul(torch::Tensor& out, // [..., d]
85
  torch::Tensor& input) // [..., 2 * d]
86
  {
87
+ LAUNCH_ACTIVATION_GATE_KERNEL(vllm::gelu_tanh_kernel);
88
  }
89
 
90
  namespace vllm {
activation/cuda_compat.h CHANGED
@@ -4,10 +4,10 @@
4
  #include <hip/hip_runtime.h>
5
  #endif
6
 
7
- #if defined(USE_ROCM) && defined(__GFX9__)
8
- #define WARP_SIZE 64
9
- #else
10
  #define WARP_SIZE 32
 
 
11
  #endif
12
 
13
  #ifndef USE_ROCM
 
4
  #include <hip/hip_runtime.h>
5
  #endif
6
 
7
+ #ifndef USE_ROCM
 
 
8
  #define WARP_SIZE 32
9
+ #else
10
+ #define WARP_SIZE warpSize
11
  #endif
12
 
13
  #ifndef USE_ROCM
activation/dispatch_utils.h CHANGED
@@ -6,11 +6,6 @@
6
 
7
  #include <torch/all.h>
8
 
9
- // Need a special dispatch case macro since we will nest the FP8 dispatch.
10
- // Instead of the usual 'scalar_t', this names the dispatched type 'fp8_t'.
11
- #define AT_DISPATCH_FP8_CASE(enum_type, ...) \
12
- AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, fp8_t, __VA_ARGS__)
13
-
14
  #define VLLM_DISPATCH_CASE_FLOATING_TYPES(...) \
15
  AT_DISPATCH_CASE(at::ScalarType::Float, __VA_ARGS__) \
16
  AT_DISPATCH_CASE(at::ScalarType::Half, __VA_ARGS__) \
@@ -19,35 +14,6 @@
19
  #define VLLM_DISPATCH_FLOATING_TYPES(TYPE, NAME, ...) \
20
  AT_DISPATCH_SWITCH(TYPE, NAME, VLLM_DISPATCH_CASE_FLOATING_TYPES(__VA_ARGS__))
21
 
22
- // ROCm devices might use either fn or fnuz, so set up dispatch table for both.
23
- // A host-based check at runtime will create a preferred FP8 type for ROCm
24
- // such that the correct kernel is dispatched.
25
- #ifdef USE_ROCM
26
- #define VLLM_DISPATCH_CASE_FP8_TYPES(...) \
27
- AT_DISPATCH_FP8_CASE(at::ScalarType::Float8_e4m3fn, __VA_ARGS__) \
28
- AT_DISPATCH_FP8_CASE(at::ScalarType::Float8_e4m3fnuz, __VA_ARGS__)
29
-
30
- #define VLLM_DISPATCH_CASE_QUANT_TYPES(...) \
31
- AT_DISPATCH_CASE(at::ScalarType::Float8_e4m3fn, __VA_ARGS__) \
32
- AT_DISPATCH_CASE(at::ScalarType::Float8_e4m3fnuz, __VA_ARGS__) \
33
- AT_DISPATCH_CASE(at::ScalarType::Char, __VA_ARGS__)
34
- #else
35
- #define VLLM_DISPATCH_CASE_FP8_TYPES(...) \
36
- AT_DISPATCH_FP8_CASE(at::ScalarType::Float8_e4m3fn, __VA_ARGS__)
37
-
38
- #define VLLM_DISPATCH_CASE_QUANT_TYPES(...) \
39
- AT_DISPATCH_CASE(at::ScalarType::Float8_e4m3fn, __VA_ARGS__) \
40
- AT_DISPATCH_CASE(at::ScalarType::Char, __VA_ARGS__)
41
- #endif
42
-
43
- // When using this dispatch macro, the type is 'fp8_t' not 'scalar_t'.
44
- // See AT_DISPATCH_FP8_CASE above.
45
- #define VLLM_DISPATCH_FP8_TYPES(TYPE, NAME, ...) \
46
- AT_DISPATCH_SWITCH(TYPE, NAME, VLLM_DISPATCH_CASE_FP8_TYPES(__VA_ARGS__))
47
-
48
- #define VLLM_DISPATCH_QUANT_TYPES(TYPE, NAME, ...) \
49
- AT_DISPATCH_SWITCH(TYPE, NAME, VLLM_DISPATCH_CASE_QUANT_TYPES(__VA_ARGS__))
50
-
51
  #define VLLM_DISPATCH_CASE_FLOATING_AND_BYTE_TYPES(...) \
52
  AT_DISPATCH_CASE(at::ScalarType::Float, __VA_ARGS__) \
53
  AT_DISPATCH_CASE(at::ScalarType::Half, __VA_ARGS__) \
@@ -65,19 +31,5 @@
65
  AT_DISPATCH_CASE(at::ScalarType::Int, __VA_ARGS__) \
66
  AT_DISPATCH_CASE(at::ScalarType::Long, __VA_ARGS__)
67
 
68
- #define VLLM_DISPATCH_CASE_INTEGRAL_AND_UNSIGNED_TYPES(...) \
69
- AT_DISPATCH_CASE(at::ScalarType::Byte, __VA_ARGS__) \
70
- AT_DISPATCH_CASE(at::ScalarType::Char, __VA_ARGS__) \
71
- AT_DISPATCH_CASE(at::ScalarType::Short, __VA_ARGS__) \
72
- AT_DISPATCH_CASE(at::ScalarType::Int, __VA_ARGS__) \
73
- AT_DISPATCH_CASE(at::ScalarType::Long, __VA_ARGS__) \
74
- AT_DISPATCH_CASE(at::ScalarType::UInt16, __VA_ARGS__) \
75
- AT_DISPATCH_CASE(at::ScalarType::UInt32, __VA_ARGS__) \
76
- AT_DISPATCH_CASE(at::ScalarType::UInt64, __VA_ARGS__)
77
-
78
  #define VLLM_DISPATCH_INTEGRAL_TYPES(TYPE, NAME, ...) \
79
  AT_DISPATCH_SWITCH(TYPE, NAME, VLLM_DISPATCH_CASE_INTEGRAL_TYPES(__VA_ARGS__))
80
-
81
- #define VLLM_DISPATCH_INTEGRAL_AND_UNSIGNED_TYPES(TYPE, NAME, ...) \
82
- AT_DISPATCH_SWITCH( \
83
- TYPE, NAME, VLLM_DISPATCH_CASE_INTEGRAL_AND_UNSIGNED_TYPES(__VA_ARGS__))
 
6
 
7
  #include <torch/all.h>
8
 
 
 
 
 
 
9
  #define VLLM_DISPATCH_CASE_FLOATING_TYPES(...) \
10
  AT_DISPATCH_CASE(at::ScalarType::Float, __VA_ARGS__) \
11
  AT_DISPATCH_CASE(at::ScalarType::Half, __VA_ARGS__) \
 
14
  #define VLLM_DISPATCH_FLOATING_TYPES(TYPE, NAME, ...) \
15
  AT_DISPATCH_SWITCH(TYPE, NAME, VLLM_DISPATCH_CASE_FLOATING_TYPES(__VA_ARGS__))
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  #define VLLM_DISPATCH_CASE_FLOATING_AND_BYTE_TYPES(...) \
18
  AT_DISPATCH_CASE(at::ScalarType::Float, __VA_ARGS__) \
19
  AT_DISPATCH_CASE(at::ScalarType::Half, __VA_ARGS__) \
 
31
  AT_DISPATCH_CASE(at::ScalarType::Int, __VA_ARGS__) \
32
  AT_DISPATCH_CASE(at::ScalarType::Long, __VA_ARGS__)
33
 
 
 
 
 
 
 
 
 
 
 
34
  #define VLLM_DISPATCH_INTEGRAL_TYPES(TYPE, NAME, ...) \
35
  AT_DISPATCH_SWITCH(TYPE, NAME, VLLM_DISPATCH_CASE_INTEGRAL_TYPES(__VA_ARGS__))
 
 
 
 
build.toml CHANGED
@@ -1,18 +1,17 @@
1
  [general]
2
  name = "activation"
3
- universal = false
4
 
5
  [torch]
6
  src = [
7
- "torch-ext/torch_binding.cpp",
8
- "torch-ext/torch_binding.h",
9
  ]
10
 
11
  [kernel.activation]
12
- backend = "cuda"
13
- depends = ["torch"]
14
  src = [
15
- "activation/activation_kernels.cu",
16
- "activation/cuda_compat.h",
17
- "activation/dispatch_utils.h",
18
  ]
 
 
1
  [general]
2
  name = "activation"
 
3
 
4
  [torch]
5
  src = [
6
+ "torch-ext/torch_binding.cpp",
7
+ "torch-ext/torch_binding.h"
8
  ]
9
 
10
  [kernel.activation]
11
+ cuda-capabilities = [ "7.0", "7.2", "7.5", "8.0", "8.6", "8.7", "8.9", "9.0" ]
 
12
  src = [
13
+ "activation/activation_kernels.cu",
14
+ "activation/cuda_compat.h",
15
+ "activation/dispatch_utils.h",
16
  ]
17
+ depends = [ "torch" ]
build/{torch27-cxx11-cu118-x86_64-linux → torch25-cxx11-cu118-x86_64-linux}/activation/__init__.py RENAMED
@@ -10,11 +10,6 @@ def silu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
10
  return out
11
 
12
 
13
- def mul_and_silu(out: torch.Tensor, x: torch.Tensor) -> None:
14
- ops.mul_and_silu(out, x)
15
- return out
16
-
17
-
18
  def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
19
  ops.gelu_and_mul(out, x)
20
  return out
 
10
  return out
11
 
12
 
 
 
 
 
 
13
  def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
14
  ops.gelu_and_mul(out, x)
15
  return out
build/{torch26-cxx11-cu118-x86_64-linux/activation/_activation_be5bedb.abi3.so → torch25-cxx11-cu118-x86_64-linux/activation/_activation_o63kkyjirmkf4.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9b6ba32ecc6fc898df3b0cebee85e9afc6881749fe58142280f051ca3332d913
3
- size 2546864
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d50cdabfbed1df74e921ac34ff00bca0555977b14ef8082ddae7b1f30985a494
3
+ size 2370160
build/{torch27-cxx11-cu118-x86_64-linux → torch25-cxx11-cu118-x86_64-linux}/activation/_ops.py RENAMED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _activation_be5bedb_dirty
3
- ops = torch.ops._activation_be5bedb_dirty
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_activation_be5bedb_dirty::{op_name}"
 
1
  import torch
2
+ from . import _activation_o63kkyjirmkf4
3
+ ops = torch.ops._activation_o63kkyjirmkf4
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_activation_o63kkyjirmkf4::{op_name}"
build/{torch27-cxx11-cu128-x86_64-linux → torch25-cxx11-cu118-x86_64-linux}/activation/layers.py RENAMED
@@ -5,17 +5,6 @@ from ._ops import ops
5
 
6
 
7
  class SiluAndMul(nn.Module):
8
- """An activation function for SwiGLU.
9
-
10
- The function computes x -> silu(x[:d]) * x[d:] where d = x.shape[-1] // 2.
11
-
12
- Shapes:
13
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
14
- return: (num_tokens, d) or (batch_size, seq_len, d)
15
- """
16
-
17
- can_torch_compile: bool = True
18
-
19
  def forward(self, x: torch.Tensor):
20
  d = x.shape[-1] // 2
21
  output_shape = x.shape[:-1] + (d,)
@@ -24,38 +13,7 @@ class SiluAndMul(nn.Module):
24
  return out
25
 
26
 
27
- class MulAndSilu(nn.Module):
28
- """An activation function for SwiGLU.
29
-
30
- The function computes x -> x[:d] * silu(x[d:]) where d = x.shape[-1] // 2.
31
-
32
- Shapes:
33
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
34
- return: (num_tokens, d) or (batch_size, seq_len, d)
35
- """
36
-
37
- can_torch_compile: bool = True
38
-
39
- def forward(self, x: torch.Tensor) -> torch.Tensor:
40
- d = x.shape[-1] // 2
41
- output_shape = x.shape[:-1] + (d,)
42
- out = torch.empty(output_shape, dtype=x.dtype, device=x.device)
43
- ops.mul_and_silu(out, x)
44
- return out
45
-
46
-
47
  class GeluAndMul(nn.Module):
48
- """An activation function for GeGLU.
49
-
50
- The function computes x -> GELU(x[:d]) * x[d:] where d = x.shape[-1] // 2.
51
-
52
- Shapes:
53
- x: (batch_size, seq_len, 2 * d) or (num_tokens, 2 * d)
54
- return: (batch_size, seq_len, d) or (num_tokens, d)
55
- """
56
-
57
- can_torch_compile: bool = True
58
-
59
  def forward(self, x: torch.Tensor):
60
  d = x.shape[-1] // 2
61
  output_shape = x.shape[:-1] + (d,)
@@ -65,8 +23,6 @@ class GeluAndMul(nn.Module):
65
 
66
 
67
  class GeluTanhAndMul(nn.Module):
68
- can_torch_compile: bool = True
69
-
70
  def forward(self, x: torch.Tensor):
71
  d = x.shape[-1] // 2
72
  output_shape = x.shape[:-1] + (d,)
@@ -76,19 +32,6 @@ class GeluTanhAndMul(nn.Module):
76
 
77
 
78
  class FatreluAndMul(nn.Module):
79
- """An activation function for FATReLU.
80
-
81
- The function computes x -> FATReLU(x[:d]) * x[d:] where
82
- d = x.shape[-1] // 2.
83
- This is used in openbmb/MiniCPM-S-1B-sft.
84
-
85
- Shapes:
86
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
87
- return: (num_tokens, d) or (batch_size, seq_len, d)
88
- """
89
-
90
- can_torch_compile: bool = True
91
-
92
  def __init__(self, threshold: float = 0.0):
93
  super().__init__()
94
  self.threshold = threshold
@@ -102,8 +45,6 @@ class FatreluAndMul(nn.Module):
102
 
103
 
104
  class FastGELU(nn.Module):
105
- can_torch_compile: bool = True
106
-
107
  def forward(self, x: torch.Tensor) -> torch.Tensor:
108
  out = torch.empty_like(x)
109
  ops.gelu_fast(out, x)
@@ -111,8 +52,6 @@ class FastGELU(nn.Module):
111
 
112
 
113
  class NewGELU(nn.Module):
114
- can_torch_compile: bool = True
115
-
116
  def forward(self, x: torch.Tensor) -> torch.Tensor:
117
  out = torch.empty_like(x)
118
  ops.gelu_new(out, x)
@@ -120,8 +59,6 @@ class NewGELU(nn.Module):
120
 
121
 
122
  class QuickGELU(nn.Module):
123
- can_torch_compile: bool = True
124
-
125
  def forward(self, x: torch.Tensor) -> torch.Tensor:
126
  out = torch.empty_like(x)
127
  ops.gelu_quick(out, x)
 
5
 
6
 
7
  class SiluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
8
  def forward(self, x: torch.Tensor):
9
  d = x.shape[-1] // 2
10
  output_shape = x.shape[:-1] + (d,)
 
13
  return out
14
 
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  class GeluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
17
  def forward(self, x: torch.Tensor):
18
  d = x.shape[-1] // 2
19
  output_shape = x.shape[:-1] + (d,)
 
23
 
24
 
25
  class GeluTanhAndMul(nn.Module):
 
 
26
  def forward(self, x: torch.Tensor):
27
  d = x.shape[-1] // 2
28
  output_shape = x.shape[:-1] + (d,)
 
32
 
33
 
34
  class FatreluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  def __init__(self, threshold: float = 0.0):
36
  super().__init__()
37
  self.threshold = threshold
 
45
 
46
 
47
  class FastGELU(nn.Module):
 
 
48
  def forward(self, x: torch.Tensor) -> torch.Tensor:
49
  out = torch.empty_like(x)
50
  ops.gelu_fast(out, x)
 
52
 
53
 
54
  class NewGELU(nn.Module):
 
 
55
  def forward(self, x: torch.Tensor) -> torch.Tensor:
56
  out = torch.empty_like(x)
57
  ops.gelu_new(out, x)
 
59
 
60
 
61
  class QuickGELU(nn.Module):
 
 
62
  def forward(self, x: torch.Tensor) -> torch.Tensor:
63
  out = torch.empty_like(x)
64
  ops.gelu_quick(out, x)
build/{torch27-cxx11-cu126-x86_64-linux → torch25-cxx11-cu121-x86_64-linux}/activation/__init__.py RENAMED
@@ -10,11 +10,6 @@ def silu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
10
  return out
11
 
12
 
13
- def mul_and_silu(out: torch.Tensor, x: torch.Tensor) -> None:
14
- ops.mul_and_silu(out, x)
15
- return out
16
-
17
-
18
  def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
19
  ops.gelu_and_mul(out, x)
20
  return out
 
10
  return out
11
 
12
 
 
 
 
 
 
13
  def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
14
  ops.gelu_and_mul(out, x)
15
  return out
build/{torch26-cxx11-cu124-x86_64-linux/activation/_activation_be5bedb.abi3.so → torch25-cxx11-cu121-x86_64-linux/activation/_activation_vrl36m2ejer54.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:331dcb3900d5e47a11d3577cdbac54f15a0b6e14910239293323c1d9e4eb9f49
3
- size 2616928
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2bd0709ef09c8f0c18d1dc4a36c8096c59459bece61f5f5dbea95d1e73f54d44
3
+ size 2393264
build/{torch27-cxx11-cu126-x86_64-linux → torch25-cxx11-cu121-x86_64-linux}/activation/_ops.py RENAMED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _activation_be5bedb_dirty
3
- ops = torch.ops._activation_be5bedb_dirty
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_activation_be5bedb_dirty::{op_name}"
 
1
  import torch
2
+ from . import _activation_vrl36m2ejer54
3
+ ops = torch.ops._activation_vrl36m2ejer54
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_activation_vrl36m2ejer54::{op_name}"
build/{torch27-cxx11-cu118-x86_64-linux → torch25-cxx11-cu121-x86_64-linux}/activation/layers.py RENAMED
@@ -5,17 +5,6 @@ from ._ops import ops
5
 
6
 
7
  class SiluAndMul(nn.Module):
8
- """An activation function for SwiGLU.
9
-
10
- The function computes x -> silu(x[:d]) * x[d:] where d = x.shape[-1] // 2.
11
-
12
- Shapes:
13
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
14
- return: (num_tokens, d) or (batch_size, seq_len, d)
15
- """
16
-
17
- can_torch_compile: bool = True
18
-
19
  def forward(self, x: torch.Tensor):
20
  d = x.shape[-1] // 2
21
  output_shape = x.shape[:-1] + (d,)
@@ -24,38 +13,7 @@ class SiluAndMul(nn.Module):
24
  return out
25
 
26
 
27
- class MulAndSilu(nn.Module):
28
- """An activation function for SwiGLU.
29
-
30
- The function computes x -> x[:d] * silu(x[d:]) where d = x.shape[-1] // 2.
31
-
32
- Shapes:
33
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
34
- return: (num_tokens, d) or (batch_size, seq_len, d)
35
- """
36
-
37
- can_torch_compile: bool = True
38
-
39
- def forward(self, x: torch.Tensor) -> torch.Tensor:
40
- d = x.shape[-1] // 2
41
- output_shape = x.shape[:-1] + (d,)
42
- out = torch.empty(output_shape, dtype=x.dtype, device=x.device)
43
- ops.mul_and_silu(out, x)
44
- return out
45
-
46
-
47
  class GeluAndMul(nn.Module):
48
- """An activation function for GeGLU.
49
-
50
- The function computes x -> GELU(x[:d]) * x[d:] where d = x.shape[-1] // 2.
51
-
52
- Shapes:
53
- x: (batch_size, seq_len, 2 * d) or (num_tokens, 2 * d)
54
- return: (batch_size, seq_len, d) or (num_tokens, d)
55
- """
56
-
57
- can_torch_compile: bool = True
58
-
59
  def forward(self, x: torch.Tensor):
60
  d = x.shape[-1] // 2
61
  output_shape = x.shape[:-1] + (d,)
@@ -65,8 +23,6 @@ class GeluAndMul(nn.Module):
65
 
66
 
67
  class GeluTanhAndMul(nn.Module):
68
- can_torch_compile: bool = True
69
-
70
  def forward(self, x: torch.Tensor):
71
  d = x.shape[-1] // 2
72
  output_shape = x.shape[:-1] + (d,)
@@ -76,19 +32,6 @@ class GeluTanhAndMul(nn.Module):
76
 
77
 
78
  class FatreluAndMul(nn.Module):
79
- """An activation function for FATReLU.
80
-
81
- The function computes x -> FATReLU(x[:d]) * x[d:] where
82
- d = x.shape[-1] // 2.
83
- This is used in openbmb/MiniCPM-S-1B-sft.
84
-
85
- Shapes:
86
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
87
- return: (num_tokens, d) or (batch_size, seq_len, d)
88
- """
89
-
90
- can_torch_compile: bool = True
91
-
92
  def __init__(self, threshold: float = 0.0):
93
  super().__init__()
94
  self.threshold = threshold
@@ -102,8 +45,6 @@ class FatreluAndMul(nn.Module):
102
 
103
 
104
  class FastGELU(nn.Module):
105
- can_torch_compile: bool = True
106
-
107
  def forward(self, x: torch.Tensor) -> torch.Tensor:
108
  out = torch.empty_like(x)
109
  ops.gelu_fast(out, x)
@@ -111,8 +52,6 @@ class FastGELU(nn.Module):
111
 
112
 
113
  class NewGELU(nn.Module):
114
- can_torch_compile: bool = True
115
-
116
  def forward(self, x: torch.Tensor) -> torch.Tensor:
117
  out = torch.empty_like(x)
118
  ops.gelu_new(out, x)
@@ -120,8 +59,6 @@ class NewGELU(nn.Module):
120
 
121
 
122
  class QuickGELU(nn.Module):
123
- can_torch_compile: bool = True
124
-
125
  def forward(self, x: torch.Tensor) -> torch.Tensor:
126
  out = torch.empty_like(x)
127
  ops.gelu_quick(out, x)
 
5
 
6
 
7
  class SiluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
8
  def forward(self, x: torch.Tensor):
9
  d = x.shape[-1] // 2
10
  output_shape = x.shape[:-1] + (d,)
 
13
  return out
14
 
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  class GeluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
17
  def forward(self, x: torch.Tensor):
18
  d = x.shape[-1] // 2
19
  output_shape = x.shape[:-1] + (d,)
 
23
 
24
 
25
  class GeluTanhAndMul(nn.Module):
 
 
26
  def forward(self, x: torch.Tensor):
27
  d = x.shape[-1] // 2
28
  output_shape = x.shape[:-1] + (d,)
 
32
 
33
 
34
  class FatreluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  def __init__(self, threshold: float = 0.0):
36
  super().__init__()
37
  self.threshold = threshold
 
45
 
46
 
47
  class FastGELU(nn.Module):
 
 
48
  def forward(self, x: torch.Tensor) -> torch.Tensor:
49
  out = torch.empty_like(x)
50
  ops.gelu_fast(out, x)
 
52
 
53
 
54
  class NewGELU(nn.Module):
 
 
55
  def forward(self, x: torch.Tensor) -> torch.Tensor:
56
  out = torch.empty_like(x)
57
  ops.gelu_new(out, x)
 
59
 
60
 
61
  class QuickGELU(nn.Module):
 
 
62
  def forward(self, x: torch.Tensor) -> torch.Tensor:
63
  out = torch.empty_like(x)
64
  ops.gelu_quick(out, x)
build/{torch27-cxx11-cu128-x86_64-linux → torch25-cxx11-cu124-x86_64-linux}/activation/__init__.py RENAMED
@@ -10,11 +10,6 @@ def silu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
10
  return out
11
 
12
 
13
- def mul_and_silu(out: torch.Tensor, x: torch.Tensor) -> None:
14
- ops.mul_and_silu(out, x)
15
- return out
16
-
17
-
18
  def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
19
  ops.gelu_and_mul(out, x)
20
  return out
 
10
  return out
11
 
12
 
 
 
 
 
 
13
  def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
14
  ops.gelu_and_mul(out, x)
15
  return out
build/{torch26-cxx11-cu126-x86_64-linux/activation/_activation_be5bedb.abi3.so → torch25-cxx11-cu124-x86_64-linux/activation/_activation_va3moa75vw7c2.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:1ce11492b9675a44afb3b896ed80e425f2a47e29481c4aad9c4a6ac59520f011
3
- size 2621472
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8353447f64e7d2df1a6a341d9c53bced53abef267f079923ae774170d0d57c53
3
+ size 2427936
build/{torch27-cxx11-cu128-x86_64-linux → torch25-cxx11-cu124-x86_64-linux}/activation/_ops.py RENAMED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _activation_be5bedb_dirty
3
- ops = torch.ops._activation_be5bedb_dirty
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_activation_be5bedb_dirty::{op_name}"
 
1
  import torch
2
+ from . import _activation_va3moa75vw7c2
3
+ ops = torch.ops._activation_va3moa75vw7c2
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_activation_va3moa75vw7c2::{op_name}"
build/{torch28-cxx11-cu126-aarch64-linux → torch25-cxx11-cu124-x86_64-linux}/activation/layers.py RENAMED
@@ -5,17 +5,6 @@ from ._ops import ops
5
 
6
 
7
  class SiluAndMul(nn.Module):
8
- """An activation function for SwiGLU.
9
-
10
- The function computes x -> silu(x[:d]) * x[d:] where d = x.shape[-1] // 2.
11
-
12
- Shapes:
13
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
14
- return: (num_tokens, d) or (batch_size, seq_len, d)
15
- """
16
-
17
- can_torch_compile: bool = True
18
-
19
  def forward(self, x: torch.Tensor):
20
  d = x.shape[-1] // 2
21
  output_shape = x.shape[:-1] + (d,)
@@ -24,38 +13,7 @@ class SiluAndMul(nn.Module):
24
  return out
25
 
26
 
27
- class MulAndSilu(nn.Module):
28
- """An activation function for SwiGLU.
29
-
30
- The function computes x -> x[:d] * silu(x[d:]) where d = x.shape[-1] // 2.
31
-
32
- Shapes:
33
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
34
- return: (num_tokens, d) or (batch_size, seq_len, d)
35
- """
36
-
37
- can_torch_compile: bool = True
38
-
39
- def forward(self, x: torch.Tensor) -> torch.Tensor:
40
- d = x.shape[-1] // 2
41
- output_shape = x.shape[:-1] + (d,)
42
- out = torch.empty(output_shape, dtype=x.dtype, device=x.device)
43
- ops.mul_and_silu(out, x)
44
- return out
45
-
46
-
47
  class GeluAndMul(nn.Module):
48
- """An activation function for GeGLU.
49
-
50
- The function computes x -> GELU(x[:d]) * x[d:] where d = x.shape[-1] // 2.
51
-
52
- Shapes:
53
- x: (batch_size, seq_len, 2 * d) or (num_tokens, 2 * d)
54
- return: (batch_size, seq_len, d) or (num_tokens, d)
55
- """
56
-
57
- can_torch_compile: bool = True
58
-
59
  def forward(self, x: torch.Tensor):
60
  d = x.shape[-1] // 2
61
  output_shape = x.shape[:-1] + (d,)
@@ -65,8 +23,6 @@ class GeluAndMul(nn.Module):
65
 
66
 
67
  class GeluTanhAndMul(nn.Module):
68
- can_torch_compile: bool = True
69
-
70
  def forward(self, x: torch.Tensor):
71
  d = x.shape[-1] // 2
72
  output_shape = x.shape[:-1] + (d,)
@@ -76,19 +32,6 @@ class GeluTanhAndMul(nn.Module):
76
 
77
 
78
  class FatreluAndMul(nn.Module):
79
- """An activation function for FATReLU.
80
-
81
- The function computes x -> FATReLU(x[:d]) * x[d:] where
82
- d = x.shape[-1] // 2.
83
- This is used in openbmb/MiniCPM-S-1B-sft.
84
-
85
- Shapes:
86
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
87
- return: (num_tokens, d) or (batch_size, seq_len, d)
88
- """
89
-
90
- can_torch_compile: bool = True
91
-
92
  def __init__(self, threshold: float = 0.0):
93
  super().__init__()
94
  self.threshold = threshold
@@ -102,8 +45,6 @@ class FatreluAndMul(nn.Module):
102
 
103
 
104
  class FastGELU(nn.Module):
105
- can_torch_compile: bool = True
106
-
107
  def forward(self, x: torch.Tensor) -> torch.Tensor:
108
  out = torch.empty_like(x)
109
  ops.gelu_fast(out, x)
@@ -111,8 +52,6 @@ class FastGELU(nn.Module):
111
 
112
 
113
  class NewGELU(nn.Module):
114
- can_torch_compile: bool = True
115
-
116
  def forward(self, x: torch.Tensor) -> torch.Tensor:
117
  out = torch.empty_like(x)
118
  ops.gelu_new(out, x)
@@ -120,8 +59,6 @@ class NewGELU(nn.Module):
120
 
121
 
122
  class QuickGELU(nn.Module):
123
- can_torch_compile: bool = True
124
-
125
  def forward(self, x: torch.Tensor) -> torch.Tensor:
126
  out = torch.empty_like(x)
127
  ops.gelu_quick(out, x)
 
5
 
6
 
7
  class SiluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
8
  def forward(self, x: torch.Tensor):
9
  d = x.shape[-1] // 2
10
  output_shape = x.shape[:-1] + (d,)
 
13
  return out
14
 
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  class GeluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
17
  def forward(self, x: torch.Tensor):
18
  d = x.shape[-1] // 2
19
  output_shape = x.shape[:-1] + (d,)
 
23
 
24
 
25
  class GeluTanhAndMul(nn.Module):
 
 
26
  def forward(self, x: torch.Tensor):
27
  d = x.shape[-1] // 2
28
  output_shape = x.shape[:-1] + (d,)
 
32
 
33
 
34
  class FatreluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  def __init__(self, threshold: float = 0.0):
36
  super().__init__()
37
  self.threshold = threshold
 
45
 
46
 
47
  class FastGELU(nn.Module):
 
 
48
  def forward(self, x: torch.Tensor) -> torch.Tensor:
49
  out = torch.empty_like(x)
50
  ops.gelu_fast(out, x)
 
52
 
53
 
54
  class NewGELU(nn.Module):
 
 
55
  def forward(self, x: torch.Tensor) -> torch.Tensor:
56
  out = torch.empty_like(x)
57
  ops.gelu_new(out, x)
 
59
 
60
 
61
  class QuickGELU(nn.Module):
 
 
62
  def forward(self, x: torch.Tensor) -> torch.Tensor:
63
  out = torch.empty_like(x)
64
  ops.gelu_quick(out, x)
build/{torch28-cxx11-cu126-aarch64-linux → torch25-cxx98-cu118-x86_64-linux}/activation/__init__.py RENAMED
@@ -10,11 +10,6 @@ def silu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
10
  return out
11
 
12
 
13
- def mul_and_silu(out: torch.Tensor, x: torch.Tensor) -> None:
14
- ops.mul_and_silu(out, x)
15
- return out
16
-
17
-
18
  def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
19
  ops.gelu_and_mul(out, x)
20
  return out
 
10
  return out
11
 
12
 
 
 
 
 
 
13
  def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
14
  ops.gelu_and_mul(out, x)
15
  return out
build/{torch26-cxx98-cu118-x86_64-linux/activation/_activation_be5bedb.abi3.so → torch25-cxx98-cu118-x86_64-linux/activation/_activation_qr3gs3eckeig4.abi3.so} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:434bd1ae43b7cbdb10d86b82da9a237ec05ef9d9fb4fc15cdc9096d3d5ed3fa7
3
- size 2539352
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df184a6315118d787a1bd6b435cb45f1ca7828445a1f1c0e55c57645cfbba43a
3
+ size 2362600
build/{torch28-cxx11-cu126-aarch64-linux → torch25-cxx98-cu118-x86_64-linux}/activation/_ops.py RENAMED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _activation_0c3eb4e_dirty
3
- ops = torch.ops._activation_0c3eb4e_dirty
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_activation_0c3eb4e_dirty::{op_name}"
 
1
  import torch
2
+ from . import _activation_qr3gs3eckeig4
3
+ ops = torch.ops._activation_qr3gs3eckeig4
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_activation_qr3gs3eckeig4::{op_name}"
build/{torch27-cxx11-cu126-x86_64-linux → torch25-cxx98-cu118-x86_64-linux}/activation/layers.py RENAMED
@@ -5,17 +5,6 @@ from ._ops import ops
5
 
6
 
7
  class SiluAndMul(nn.Module):
8
- """An activation function for SwiGLU.
9
-
10
- The function computes x -> silu(x[:d]) * x[d:] where d = x.shape[-1] // 2.
11
-
12
- Shapes:
13
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
14
- return: (num_tokens, d) or (batch_size, seq_len, d)
15
- """
16
-
17
- can_torch_compile: bool = True
18
-
19
  def forward(self, x: torch.Tensor):
20
  d = x.shape[-1] // 2
21
  output_shape = x.shape[:-1] + (d,)
@@ -24,38 +13,7 @@ class SiluAndMul(nn.Module):
24
  return out
25
 
26
 
27
- class MulAndSilu(nn.Module):
28
- """An activation function for SwiGLU.
29
-
30
- The function computes x -> x[:d] * silu(x[d:]) where d = x.shape[-1] // 2.
31
-
32
- Shapes:
33
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
34
- return: (num_tokens, d) or (batch_size, seq_len, d)
35
- """
36
-
37
- can_torch_compile: bool = True
38
-
39
- def forward(self, x: torch.Tensor) -> torch.Tensor:
40
- d = x.shape[-1] // 2
41
- output_shape = x.shape[:-1] + (d,)
42
- out = torch.empty(output_shape, dtype=x.dtype, device=x.device)
43
- ops.mul_and_silu(out, x)
44
- return out
45
-
46
-
47
  class GeluAndMul(nn.Module):
48
- """An activation function for GeGLU.
49
-
50
- The function computes x -> GELU(x[:d]) * x[d:] where d = x.shape[-1] // 2.
51
-
52
- Shapes:
53
- x: (batch_size, seq_len, 2 * d) or (num_tokens, 2 * d)
54
- return: (batch_size, seq_len, d) or (num_tokens, d)
55
- """
56
-
57
- can_torch_compile: bool = True
58
-
59
  def forward(self, x: torch.Tensor):
60
  d = x.shape[-1] // 2
61
  output_shape = x.shape[:-1] + (d,)
@@ -65,8 +23,6 @@ class GeluAndMul(nn.Module):
65
 
66
 
67
  class GeluTanhAndMul(nn.Module):
68
- can_torch_compile: bool = True
69
-
70
  def forward(self, x: torch.Tensor):
71
  d = x.shape[-1] // 2
72
  output_shape = x.shape[:-1] + (d,)
@@ -76,19 +32,6 @@ class GeluTanhAndMul(nn.Module):
76
 
77
 
78
  class FatreluAndMul(nn.Module):
79
- """An activation function for FATReLU.
80
-
81
- The function computes x -> FATReLU(x[:d]) * x[d:] where
82
- d = x.shape[-1] // 2.
83
- This is used in openbmb/MiniCPM-S-1B-sft.
84
-
85
- Shapes:
86
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
87
- return: (num_tokens, d) or (batch_size, seq_len, d)
88
- """
89
-
90
- can_torch_compile: bool = True
91
-
92
  def __init__(self, threshold: float = 0.0):
93
  super().__init__()
94
  self.threshold = threshold
@@ -102,8 +45,6 @@ class FatreluAndMul(nn.Module):
102
 
103
 
104
  class FastGELU(nn.Module):
105
- can_torch_compile: bool = True
106
-
107
  def forward(self, x: torch.Tensor) -> torch.Tensor:
108
  out = torch.empty_like(x)
109
  ops.gelu_fast(out, x)
@@ -111,8 +52,6 @@ class FastGELU(nn.Module):
111
 
112
 
113
  class NewGELU(nn.Module):
114
- can_torch_compile: bool = True
115
-
116
  def forward(self, x: torch.Tensor) -> torch.Tensor:
117
  out = torch.empty_like(x)
118
  ops.gelu_new(out, x)
@@ -120,8 +59,6 @@ class NewGELU(nn.Module):
120
 
121
 
122
  class QuickGELU(nn.Module):
123
- can_torch_compile: bool = True
124
-
125
  def forward(self, x: torch.Tensor) -> torch.Tensor:
126
  out = torch.empty_like(x)
127
  ops.gelu_quick(out, x)
 
5
 
6
 
7
  class SiluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
8
  def forward(self, x: torch.Tensor):
9
  d = x.shape[-1] // 2
10
  output_shape = x.shape[:-1] + (d,)
 
13
  return out
14
 
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  class GeluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
17
  def forward(self, x: torch.Tensor):
18
  d = x.shape[-1] // 2
19
  output_shape = x.shape[:-1] + (d,)
 
23
 
24
 
25
  class GeluTanhAndMul(nn.Module):
 
 
26
  def forward(self, x: torch.Tensor):
27
  d = x.shape[-1] // 2
28
  output_shape = x.shape[:-1] + (d,)
 
32
 
33
 
34
  class FatreluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  def __init__(self, threshold: float = 0.0):
36
  super().__init__()
37
  self.threshold = threshold
 
45
 
46
 
47
  class FastGELU(nn.Module):
 
 
48
  def forward(self, x: torch.Tensor) -> torch.Tensor:
49
  out = torch.empty_like(x)
50
  ops.gelu_fast(out, x)
 
52
 
53
 
54
  class NewGELU(nn.Module):
 
 
55
  def forward(self, x: torch.Tensor) -> torch.Tensor:
56
  out = torch.empty_like(x)
57
  ops.gelu_new(out, x)
 
59
 
60
 
61
  class QuickGELU(nn.Module):
 
 
62
  def forward(self, x: torch.Tensor) -> torch.Tensor:
63
  out = torch.empty_like(x)
64
  ops.gelu_quick(out, x)
build/torch25-cxx98-cu121-x86_64-linux/activation/__init__.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+
3
+ from ._ops import ops
4
+
5
+ from . import layers
6
+
7
+
8
+ def silu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
9
+ ops.silu_and_mul(out, x)
10
+ return out
11
+
12
+
13
+ def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
14
+ ops.gelu_and_mul(out, x)
15
+ return out
16
+
17
+
18
+ def gelu_tanh_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
19
+ ops.gelu_tanh_and_mul(out, x)
20
+ return out
21
+
22
+
23
+ def fatrelu_and_mul(out: torch.Tensor, x: torch.Tensor, threshold: float = 0.0) -> None:
24
+ ops.fatrelu_and_mul(out, x, threshold)
25
+ return out
26
+
27
+
28
+ def gelu_fast(out: torch.Tensor, x: torch.Tensor) -> None:
29
+ ops.gelu_fast(out, x)
30
+ return out
31
+
32
+
33
+ def gelu_new(out: torch.Tensor, x: torch.Tensor) -> None:
34
+ ops.gelu_new(out, x)
35
+ return out
36
+
37
+
38
+ def gelu_quick(out: torch.Tensor, x: torch.Tensor) -> None:
39
+ ops.gelu_quick(out, x)
40
+ return out
41
+
42
+
43
+ __all__ = [
44
+ "silu_and_mul",
45
+ "gelu_and_mul",
46
+ "gelu_tanh_and_mul",
47
+ "fatrelu_and_mul",
48
+ "gelu_fast",
49
+ "gelu_new",
50
+ "gelu_quick",
51
+ "layers",
52
+ ]
build/torch25-cxx98-cu121-x86_64-linux/activation/_activation_p7gbzt25w3zg2.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ccb13cfc2e45cf483e8b9f77f1760f28b48bcf185508d51b32d45bc759c4e8bb
3
+ size 2385440
build/torch25-cxx98-cu121-x86_64-linux/activation/_ops.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from . import _activation_p7gbzt25w3zg2
3
+ ops = torch.ops._activation_p7gbzt25w3zg2
4
+
5
+ def add_op_namespace_prefix(op_name: str):
6
+ """
7
+ Prefix op by namespace.
8
+ """
9
+ return f"_activation_p7gbzt25w3zg2::{op_name}"
build/torch25-cxx98-cu121-x86_64-linux/activation/layers.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import torch.nn as nn
3
+
4
+ from ._ops import ops
5
+
6
+
7
+ class SiluAndMul(nn.Module):
8
+ def forward(self, x: torch.Tensor):
9
+ d = x.shape[-1] // 2
10
+ output_shape = x.shape[:-1] + (d,)
11
+ out = torch.empty(output_shape, dtype=x.dtype, device=x.device)
12
+ ops.silu_and_mul(out, x)
13
+ return out
14
+
15
+
16
+ class GeluAndMul(nn.Module):
17
+ def forward(self, x: torch.Tensor):
18
+ d = x.shape[-1] // 2
19
+ output_shape = x.shape[:-1] + (d,)
20
+ out = torch.empty(output_shape, dtype=x.dtype, device=x.device)
21
+ ops.gelu_and_mul(out, x)
22
+ return out
23
+
24
+
25
+ class GeluTanhAndMul(nn.Module):
26
+ def forward(self, x: torch.Tensor):
27
+ d = x.shape[-1] // 2
28
+ output_shape = x.shape[:-1] + (d,)
29
+ out = torch.empty(output_shape, dtype=x.dtype, device=x.device)
30
+ ops.gelu_tanh_and_mul(out, x)
31
+ return out
32
+
33
+
34
+ class FatreluAndMul(nn.Module):
35
+ def __init__(self, threshold: float = 0.0):
36
+ super().__init__()
37
+ self.threshold = threshold
38
+
39
+ def forward(self, x: torch.Tensor):
40
+ d = x.shape[-1] // 2
41
+ output_shape = x.shape[:-1] + (d,)
42
+ out = torch.empty(output_shape, dtype=x.dtype, device=x.device)
43
+ ops.fatrelu_and_mul(out, x, self.threshold)
44
+ return out
45
+
46
+
47
+ class FastGELU(nn.Module):
48
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
49
+ out = torch.empty_like(x)
50
+ ops.gelu_fast(out, x)
51
+ return out
52
+
53
+
54
+ class NewGELU(nn.Module):
55
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
56
+ out = torch.empty_like(x)
57
+ ops.gelu_new(out, x)
58
+ return out
59
+
60
+
61
+ class QuickGELU(nn.Module):
62
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
63
+ out = torch.empty_like(x)
64
+ ops.gelu_quick(out, x)
65
+ return out
build/torch25-cxx98-cu124-x86_64-linux/activation/__init__.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+
3
+ from ._ops import ops
4
+
5
+ from . import layers
6
+
7
+
8
+ def silu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
9
+ ops.silu_and_mul(out, x)
10
+ return out
11
+
12
+
13
+ def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
14
+ ops.gelu_and_mul(out, x)
15
+ return out
16
+
17
+
18
+ def gelu_tanh_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
19
+ ops.gelu_tanh_and_mul(out, x)
20
+ return out
21
+
22
+
23
+ def fatrelu_and_mul(out: torch.Tensor, x: torch.Tensor, threshold: float = 0.0) -> None:
24
+ ops.fatrelu_and_mul(out, x, threshold)
25
+ return out
26
+
27
+
28
+ def gelu_fast(out: torch.Tensor, x: torch.Tensor) -> None:
29
+ ops.gelu_fast(out, x)
30
+ return out
31
+
32
+
33
+ def gelu_new(out: torch.Tensor, x: torch.Tensor) -> None:
34
+ ops.gelu_new(out, x)
35
+ return out
36
+
37
+
38
+ def gelu_quick(out: torch.Tensor, x: torch.Tensor) -> None:
39
+ ops.gelu_quick(out, x)
40
+ return out
41
+
42
+
43
+ __all__ = [
44
+ "silu_and_mul",
45
+ "gelu_and_mul",
46
+ "gelu_tanh_and_mul",
47
+ "fatrelu_and_mul",
48
+ "gelu_fast",
49
+ "gelu_new",
50
+ "gelu_quick",
51
+ "layers",
52
+ ]
build/torch25-cxx98-cu124-x86_64-linux/activation/_activation_jg7yaigtn7wco.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4f8048853e8cb06e8574a9a9497800d2be438f7989d79f44dcf2e0ced38a75a9
3
+ size 2420192
build/torch25-cxx98-cu124-x86_64-linux/activation/_ops.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from . import _activation_jg7yaigtn7wco
3
+ ops = torch.ops._activation_jg7yaigtn7wco
4
+
5
+ def add_op_namespace_prefix(op_name: str):
6
+ """
7
+ Prefix op by namespace.
8
+ """
9
+ return f"_activation_jg7yaigtn7wco::{op_name}"
build/torch25-cxx98-cu124-x86_64-linux/activation/layers.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import torch.nn as nn
3
+
4
+ from ._ops import ops
5
+
6
+
7
+ class SiluAndMul(nn.Module):
8
+ def forward(self, x: torch.Tensor):
9
+ d = x.shape[-1] // 2
10
+ output_shape = x.shape[:-1] + (d,)
11
+ out = torch.empty(output_shape, dtype=x.dtype, device=x.device)
12
+ ops.silu_and_mul(out, x)
13
+ return out
14
+
15
+
16
+ class GeluAndMul(nn.Module):
17
+ def forward(self, x: torch.Tensor):
18
+ d = x.shape[-1] // 2
19
+ output_shape = x.shape[:-1] + (d,)
20
+ out = torch.empty(output_shape, dtype=x.dtype, device=x.device)
21
+ ops.gelu_and_mul(out, x)
22
+ return out
23
+
24
+
25
+ class GeluTanhAndMul(nn.Module):
26
+ def forward(self, x: torch.Tensor):
27
+ d = x.shape[-1] // 2
28
+ output_shape = x.shape[:-1] + (d,)
29
+ out = torch.empty(output_shape, dtype=x.dtype, device=x.device)
30
+ ops.gelu_tanh_and_mul(out, x)
31
+ return out
32
+
33
+
34
+ class FatreluAndMul(nn.Module):
35
+ def __init__(self, threshold: float = 0.0):
36
+ super().__init__()
37
+ self.threshold = threshold
38
+
39
+ def forward(self, x: torch.Tensor):
40
+ d = x.shape[-1] // 2
41
+ output_shape = x.shape[:-1] + (d,)
42
+ out = torch.empty(output_shape, dtype=x.dtype, device=x.device)
43
+ ops.fatrelu_and_mul(out, x, self.threshold)
44
+ return out
45
+
46
+
47
+ class FastGELU(nn.Module):
48
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
49
+ out = torch.empty_like(x)
50
+ ops.gelu_fast(out, x)
51
+ return out
52
+
53
+
54
+ class NewGELU(nn.Module):
55
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
56
+ out = torch.empty_like(x)
57
+ ops.gelu_new(out, x)
58
+ return out
59
+
60
+
61
+ class QuickGELU(nn.Module):
62
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
63
+ out = torch.empty_like(x)
64
+ ops.gelu_quick(out, x)
65
+ return out
build/torch26-cxx11-cu118-x86_64-linux/activation/__init__.py CHANGED
@@ -10,11 +10,6 @@ def silu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
10
  return out
11
 
12
 
13
- def mul_and_silu(out: torch.Tensor, x: torch.Tensor) -> None:
14
- ops.mul_and_silu(out, x)
15
- return out
16
-
17
-
18
  def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
19
  ops.gelu_and_mul(out, x)
20
  return out
 
10
  return out
11
 
12
 
 
 
 
 
 
13
  def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
14
  ops.gelu_and_mul(out, x)
15
  return out
build/torch26-cxx11-cu118-x86_64-linux/activation/_activation_ncisyrun7guwk.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cde5439e78ba0e1aaa1937d798b214b46d38cbab8e4384b93a22239fed1a4dd4
3
+ size 2370264
build/torch26-cxx11-cu118-x86_64-linux/activation/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _activation_be5bedb
3
- ops = torch.ops._activation_be5bedb
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_activation_be5bedb::{op_name}"
 
1
  import torch
2
+ from . import _activation_ncisyrun7guwk
3
+ ops = torch.ops._activation_ncisyrun7guwk
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_activation_ncisyrun7guwk::{op_name}"
build/torch26-cxx11-cu118-x86_64-linux/activation/layers.py CHANGED
@@ -5,17 +5,6 @@ from ._ops import ops
5
 
6
 
7
  class SiluAndMul(nn.Module):
8
- """An activation function for SwiGLU.
9
-
10
- The function computes x -> silu(x[:d]) * x[d:] where d = x.shape[-1] // 2.
11
-
12
- Shapes:
13
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
14
- return: (num_tokens, d) or (batch_size, seq_len, d)
15
- """
16
-
17
- can_torch_compile: bool = True
18
-
19
  def forward(self, x: torch.Tensor):
20
  d = x.shape[-1] // 2
21
  output_shape = x.shape[:-1] + (d,)
@@ -24,38 +13,7 @@ class SiluAndMul(nn.Module):
24
  return out
25
 
26
 
27
- class MulAndSilu(nn.Module):
28
- """An activation function for SwiGLU.
29
-
30
- The function computes x -> x[:d] * silu(x[d:]) where d = x.shape[-1] // 2.
31
-
32
- Shapes:
33
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
34
- return: (num_tokens, d) or (batch_size, seq_len, d)
35
- """
36
-
37
- can_torch_compile: bool = True
38
-
39
- def forward(self, x: torch.Tensor) -> torch.Tensor:
40
- d = x.shape[-1] // 2
41
- output_shape = x.shape[:-1] + (d,)
42
- out = torch.empty(output_shape, dtype=x.dtype, device=x.device)
43
- ops.mul_and_silu(out, x)
44
- return out
45
-
46
-
47
  class GeluAndMul(nn.Module):
48
- """An activation function for GeGLU.
49
-
50
- The function computes x -> GELU(x[:d]) * x[d:] where d = x.shape[-1] // 2.
51
-
52
- Shapes:
53
- x: (batch_size, seq_len, 2 * d) or (num_tokens, 2 * d)
54
- return: (batch_size, seq_len, d) or (num_tokens, d)
55
- """
56
-
57
- can_torch_compile: bool = True
58
-
59
  def forward(self, x: torch.Tensor):
60
  d = x.shape[-1] // 2
61
  output_shape = x.shape[:-1] + (d,)
@@ -65,8 +23,6 @@ class GeluAndMul(nn.Module):
65
 
66
 
67
  class GeluTanhAndMul(nn.Module):
68
- can_torch_compile: bool = True
69
-
70
  def forward(self, x: torch.Tensor):
71
  d = x.shape[-1] // 2
72
  output_shape = x.shape[:-1] + (d,)
@@ -76,19 +32,6 @@ class GeluTanhAndMul(nn.Module):
76
 
77
 
78
  class FatreluAndMul(nn.Module):
79
- """An activation function for FATReLU.
80
-
81
- The function computes x -> FATReLU(x[:d]) * x[d:] where
82
- d = x.shape[-1] // 2.
83
- This is used in openbmb/MiniCPM-S-1B-sft.
84
-
85
- Shapes:
86
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
87
- return: (num_tokens, d) or (batch_size, seq_len, d)
88
- """
89
-
90
- can_torch_compile: bool = True
91
-
92
  def __init__(self, threshold: float = 0.0):
93
  super().__init__()
94
  self.threshold = threshold
@@ -102,8 +45,6 @@ class FatreluAndMul(nn.Module):
102
 
103
 
104
  class FastGELU(nn.Module):
105
- can_torch_compile: bool = True
106
-
107
  def forward(self, x: torch.Tensor) -> torch.Tensor:
108
  out = torch.empty_like(x)
109
  ops.gelu_fast(out, x)
@@ -111,8 +52,6 @@ class FastGELU(nn.Module):
111
 
112
 
113
  class NewGELU(nn.Module):
114
- can_torch_compile: bool = True
115
-
116
  def forward(self, x: torch.Tensor) -> torch.Tensor:
117
  out = torch.empty_like(x)
118
  ops.gelu_new(out, x)
@@ -120,8 +59,6 @@ class NewGELU(nn.Module):
120
 
121
 
122
  class QuickGELU(nn.Module):
123
- can_torch_compile: bool = True
124
-
125
  def forward(self, x: torch.Tensor) -> torch.Tensor:
126
  out = torch.empty_like(x)
127
  ops.gelu_quick(out, x)
 
5
 
6
 
7
  class SiluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
8
  def forward(self, x: torch.Tensor):
9
  d = x.shape[-1] // 2
10
  output_shape = x.shape[:-1] + (d,)
 
13
  return out
14
 
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  class GeluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
17
  def forward(self, x: torch.Tensor):
18
  d = x.shape[-1] // 2
19
  output_shape = x.shape[:-1] + (d,)
 
23
 
24
 
25
  class GeluTanhAndMul(nn.Module):
 
 
26
  def forward(self, x: torch.Tensor):
27
  d = x.shape[-1] // 2
28
  output_shape = x.shape[:-1] + (d,)
 
32
 
33
 
34
  class FatreluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  def __init__(self, threshold: float = 0.0):
36
  super().__init__()
37
  self.threshold = threshold
 
45
 
46
 
47
  class FastGELU(nn.Module):
 
 
48
  def forward(self, x: torch.Tensor) -> torch.Tensor:
49
  out = torch.empty_like(x)
50
  ops.gelu_fast(out, x)
 
52
 
53
 
54
  class NewGELU(nn.Module):
 
 
55
  def forward(self, x: torch.Tensor) -> torch.Tensor:
56
  out = torch.empty_like(x)
57
  ops.gelu_new(out, x)
 
59
 
60
 
61
  class QuickGELU(nn.Module):
 
 
62
  def forward(self, x: torch.Tensor) -> torch.Tensor:
63
  out = torch.empty_like(x)
64
  ops.gelu_quick(out, x)
build/torch26-cxx11-cu124-x86_64-linux/activation/__init__.py CHANGED
@@ -10,11 +10,6 @@ def silu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
10
  return out
11
 
12
 
13
- def mul_and_silu(out: torch.Tensor, x: torch.Tensor) -> None:
14
- ops.mul_and_silu(out, x)
15
- return out
16
-
17
-
18
  def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
19
  ops.gelu_and_mul(out, x)
20
  return out
 
10
  return out
11
 
12
 
 
 
 
 
 
13
  def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
14
  ops.gelu_and_mul(out, x)
15
  return out
build/torch26-cxx11-cu124-x86_64-linux/activation/_activation_ochhfvlnc3vyc.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f6bd20d411c51fc8729b15cab6a60c5c9185222474aa035489e1bff299d76682
3
+ size 2428040
build/torch26-cxx11-cu124-x86_64-linux/activation/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _activation_be5bedb
3
- ops = torch.ops._activation_be5bedb
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_activation_be5bedb::{op_name}"
 
1
  import torch
2
+ from . import _activation_ochhfvlnc3vyc
3
+ ops = torch.ops._activation_ochhfvlnc3vyc
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_activation_ochhfvlnc3vyc::{op_name}"
build/torch26-cxx11-cu124-x86_64-linux/activation/layers.py CHANGED
@@ -5,17 +5,6 @@ from ._ops import ops
5
 
6
 
7
  class SiluAndMul(nn.Module):
8
- """An activation function for SwiGLU.
9
-
10
- The function computes x -> silu(x[:d]) * x[d:] where d = x.shape[-1] // 2.
11
-
12
- Shapes:
13
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
14
- return: (num_tokens, d) or (batch_size, seq_len, d)
15
- """
16
-
17
- can_torch_compile: bool = True
18
-
19
  def forward(self, x: torch.Tensor):
20
  d = x.shape[-1] // 2
21
  output_shape = x.shape[:-1] + (d,)
@@ -24,38 +13,7 @@ class SiluAndMul(nn.Module):
24
  return out
25
 
26
 
27
- class MulAndSilu(nn.Module):
28
- """An activation function for SwiGLU.
29
-
30
- The function computes x -> x[:d] * silu(x[d:]) where d = x.shape[-1] // 2.
31
-
32
- Shapes:
33
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
34
- return: (num_tokens, d) or (batch_size, seq_len, d)
35
- """
36
-
37
- can_torch_compile: bool = True
38
-
39
- def forward(self, x: torch.Tensor) -> torch.Tensor:
40
- d = x.shape[-1] // 2
41
- output_shape = x.shape[:-1] + (d,)
42
- out = torch.empty(output_shape, dtype=x.dtype, device=x.device)
43
- ops.mul_and_silu(out, x)
44
- return out
45
-
46
-
47
  class GeluAndMul(nn.Module):
48
- """An activation function for GeGLU.
49
-
50
- The function computes x -> GELU(x[:d]) * x[d:] where d = x.shape[-1] // 2.
51
-
52
- Shapes:
53
- x: (batch_size, seq_len, 2 * d) or (num_tokens, 2 * d)
54
- return: (batch_size, seq_len, d) or (num_tokens, d)
55
- """
56
-
57
- can_torch_compile: bool = True
58
-
59
  def forward(self, x: torch.Tensor):
60
  d = x.shape[-1] // 2
61
  output_shape = x.shape[:-1] + (d,)
@@ -65,8 +23,6 @@ class GeluAndMul(nn.Module):
65
 
66
 
67
  class GeluTanhAndMul(nn.Module):
68
- can_torch_compile: bool = True
69
-
70
  def forward(self, x: torch.Tensor):
71
  d = x.shape[-1] // 2
72
  output_shape = x.shape[:-1] + (d,)
@@ -76,19 +32,6 @@ class GeluTanhAndMul(nn.Module):
76
 
77
 
78
  class FatreluAndMul(nn.Module):
79
- """An activation function for FATReLU.
80
-
81
- The function computes x -> FATReLU(x[:d]) * x[d:] where
82
- d = x.shape[-1] // 2.
83
- This is used in openbmb/MiniCPM-S-1B-sft.
84
-
85
- Shapes:
86
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
87
- return: (num_tokens, d) or (batch_size, seq_len, d)
88
- """
89
-
90
- can_torch_compile: bool = True
91
-
92
  def __init__(self, threshold: float = 0.0):
93
  super().__init__()
94
  self.threshold = threshold
@@ -102,8 +45,6 @@ class FatreluAndMul(nn.Module):
102
 
103
 
104
  class FastGELU(nn.Module):
105
- can_torch_compile: bool = True
106
-
107
  def forward(self, x: torch.Tensor) -> torch.Tensor:
108
  out = torch.empty_like(x)
109
  ops.gelu_fast(out, x)
@@ -111,8 +52,6 @@ class FastGELU(nn.Module):
111
 
112
 
113
  class NewGELU(nn.Module):
114
- can_torch_compile: bool = True
115
-
116
  def forward(self, x: torch.Tensor) -> torch.Tensor:
117
  out = torch.empty_like(x)
118
  ops.gelu_new(out, x)
@@ -120,8 +59,6 @@ class NewGELU(nn.Module):
120
 
121
 
122
  class QuickGELU(nn.Module):
123
- can_torch_compile: bool = True
124
-
125
  def forward(self, x: torch.Tensor) -> torch.Tensor:
126
  out = torch.empty_like(x)
127
  ops.gelu_quick(out, x)
 
5
 
6
 
7
  class SiluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
8
  def forward(self, x: torch.Tensor):
9
  d = x.shape[-1] // 2
10
  output_shape = x.shape[:-1] + (d,)
 
13
  return out
14
 
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  class GeluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
17
  def forward(self, x: torch.Tensor):
18
  d = x.shape[-1] // 2
19
  output_shape = x.shape[:-1] + (d,)
 
23
 
24
 
25
  class GeluTanhAndMul(nn.Module):
 
 
26
  def forward(self, x: torch.Tensor):
27
  d = x.shape[-1] // 2
28
  output_shape = x.shape[:-1] + (d,)
 
32
 
33
 
34
  class FatreluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  def __init__(self, threshold: float = 0.0):
36
  super().__init__()
37
  self.threshold = threshold
 
45
 
46
 
47
  class FastGELU(nn.Module):
 
 
48
  def forward(self, x: torch.Tensor) -> torch.Tensor:
49
  out = torch.empty_like(x)
50
  ops.gelu_fast(out, x)
 
52
 
53
 
54
  class NewGELU(nn.Module):
 
 
55
  def forward(self, x: torch.Tensor) -> torch.Tensor:
56
  out = torch.empty_like(x)
57
  ops.gelu_new(out, x)
 
59
 
60
 
61
  class QuickGELU(nn.Module):
 
 
62
  def forward(self, x: torch.Tensor) -> torch.Tensor:
63
  out = torch.empty_like(x)
64
  ops.gelu_quick(out, x)
build/torch26-cxx11-cu126-x86_64-linux/activation/__init__.py CHANGED
@@ -10,11 +10,6 @@ def silu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
10
  return out
11
 
12
 
13
- def mul_and_silu(out: torch.Tensor, x: torch.Tensor) -> None:
14
- ops.mul_and_silu(out, x)
15
- return out
16
-
17
-
18
  def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
19
  ops.gelu_and_mul(out, x)
20
  return out
 
10
  return out
11
 
12
 
 
 
 
 
 
13
  def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
14
  ops.gelu_and_mul(out, x)
15
  return out
build/torch26-cxx11-cu126-x86_64-linux/activation/_activation_u6vnqubnicksq.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:41c18b20c2bf8c49d2d3088a9bc1aad4293df0b57eafc9b141a9e8e595fe551a
3
+ size 2436672
build/torch26-cxx11-cu126-x86_64-linux/activation/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _activation_be5bedb
3
- ops = torch.ops._activation_be5bedb
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_activation_be5bedb::{op_name}"
 
1
  import torch
2
+ from . import _activation_u6vnqubnicksq
3
+ ops = torch.ops._activation_u6vnqubnicksq
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_activation_u6vnqubnicksq::{op_name}"
build/torch26-cxx11-cu126-x86_64-linux/activation/layers.py CHANGED
@@ -5,17 +5,6 @@ from ._ops import ops
5
 
6
 
7
  class SiluAndMul(nn.Module):
8
- """An activation function for SwiGLU.
9
-
10
- The function computes x -> silu(x[:d]) * x[d:] where d = x.shape[-1] // 2.
11
-
12
- Shapes:
13
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
14
- return: (num_tokens, d) or (batch_size, seq_len, d)
15
- """
16
-
17
- can_torch_compile: bool = True
18
-
19
  def forward(self, x: torch.Tensor):
20
  d = x.shape[-1] // 2
21
  output_shape = x.shape[:-1] + (d,)
@@ -24,38 +13,7 @@ class SiluAndMul(nn.Module):
24
  return out
25
 
26
 
27
- class MulAndSilu(nn.Module):
28
- """An activation function for SwiGLU.
29
-
30
- The function computes x -> x[:d] * silu(x[d:]) where d = x.shape[-1] // 2.
31
-
32
- Shapes:
33
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
34
- return: (num_tokens, d) or (batch_size, seq_len, d)
35
- """
36
-
37
- can_torch_compile: bool = True
38
-
39
- def forward(self, x: torch.Tensor) -> torch.Tensor:
40
- d = x.shape[-1] // 2
41
- output_shape = x.shape[:-1] + (d,)
42
- out = torch.empty(output_shape, dtype=x.dtype, device=x.device)
43
- ops.mul_and_silu(out, x)
44
- return out
45
-
46
-
47
  class GeluAndMul(nn.Module):
48
- """An activation function for GeGLU.
49
-
50
- The function computes x -> GELU(x[:d]) * x[d:] where d = x.shape[-1] // 2.
51
-
52
- Shapes:
53
- x: (batch_size, seq_len, 2 * d) or (num_tokens, 2 * d)
54
- return: (batch_size, seq_len, d) or (num_tokens, d)
55
- """
56
-
57
- can_torch_compile: bool = True
58
-
59
  def forward(self, x: torch.Tensor):
60
  d = x.shape[-1] // 2
61
  output_shape = x.shape[:-1] + (d,)
@@ -65,8 +23,6 @@ class GeluAndMul(nn.Module):
65
 
66
 
67
  class GeluTanhAndMul(nn.Module):
68
- can_torch_compile: bool = True
69
-
70
  def forward(self, x: torch.Tensor):
71
  d = x.shape[-1] // 2
72
  output_shape = x.shape[:-1] + (d,)
@@ -76,19 +32,6 @@ class GeluTanhAndMul(nn.Module):
76
 
77
 
78
  class FatreluAndMul(nn.Module):
79
- """An activation function for FATReLU.
80
-
81
- The function computes x -> FATReLU(x[:d]) * x[d:] where
82
- d = x.shape[-1] // 2.
83
- This is used in openbmb/MiniCPM-S-1B-sft.
84
-
85
- Shapes:
86
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
87
- return: (num_tokens, d) or (batch_size, seq_len, d)
88
- """
89
-
90
- can_torch_compile: bool = True
91
-
92
  def __init__(self, threshold: float = 0.0):
93
  super().__init__()
94
  self.threshold = threshold
@@ -102,8 +45,6 @@ class FatreluAndMul(nn.Module):
102
 
103
 
104
  class FastGELU(nn.Module):
105
- can_torch_compile: bool = True
106
-
107
  def forward(self, x: torch.Tensor) -> torch.Tensor:
108
  out = torch.empty_like(x)
109
  ops.gelu_fast(out, x)
@@ -111,8 +52,6 @@ class FastGELU(nn.Module):
111
 
112
 
113
  class NewGELU(nn.Module):
114
- can_torch_compile: bool = True
115
-
116
  def forward(self, x: torch.Tensor) -> torch.Tensor:
117
  out = torch.empty_like(x)
118
  ops.gelu_new(out, x)
@@ -120,8 +59,6 @@ class NewGELU(nn.Module):
120
 
121
 
122
  class QuickGELU(nn.Module):
123
- can_torch_compile: bool = True
124
-
125
  def forward(self, x: torch.Tensor) -> torch.Tensor:
126
  out = torch.empty_like(x)
127
  ops.gelu_quick(out, x)
 
5
 
6
 
7
  class SiluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
8
  def forward(self, x: torch.Tensor):
9
  d = x.shape[-1] // 2
10
  output_shape = x.shape[:-1] + (d,)
 
13
  return out
14
 
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  class GeluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
17
  def forward(self, x: torch.Tensor):
18
  d = x.shape[-1] // 2
19
  output_shape = x.shape[:-1] + (d,)
 
23
 
24
 
25
  class GeluTanhAndMul(nn.Module):
 
 
26
  def forward(self, x: torch.Tensor):
27
  d = x.shape[-1] // 2
28
  output_shape = x.shape[:-1] + (d,)
 
32
 
33
 
34
  class FatreluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  def __init__(self, threshold: float = 0.0):
36
  super().__init__()
37
  self.threshold = threshold
 
45
 
46
 
47
  class FastGELU(nn.Module):
 
 
48
  def forward(self, x: torch.Tensor) -> torch.Tensor:
49
  out = torch.empty_like(x)
50
  ops.gelu_fast(out, x)
 
52
 
53
 
54
  class NewGELU(nn.Module):
 
 
55
  def forward(self, x: torch.Tensor) -> torch.Tensor:
56
  out = torch.empty_like(x)
57
  ops.gelu_new(out, x)
 
59
 
60
 
61
  class QuickGELU(nn.Module):
 
 
62
  def forward(self, x: torch.Tensor) -> torch.Tensor:
63
  out = torch.empty_like(x)
64
  ops.gelu_quick(out, x)
build/torch26-cxx98-cu118-x86_64-linux/activation/__init__.py CHANGED
@@ -10,11 +10,6 @@ def silu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
10
  return out
11
 
12
 
13
- def mul_and_silu(out: torch.Tensor, x: torch.Tensor) -> None:
14
- ops.mul_and_silu(out, x)
15
- return out
16
-
17
-
18
  def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
19
  ops.gelu_and_mul(out, x)
20
  return out
 
10
  return out
11
 
12
 
 
 
 
 
 
13
  def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
14
  ops.gelu_and_mul(out, x)
15
  return out
build/torch26-cxx98-cu118-x86_64-linux/activation/_activation_2vn6ty3gfqfb6.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cfbcd5da358cd5cb7982d19c8880cf4db6f08b46622a7a953f755ad59e4e1492
3
+ size 2362752
build/torch26-cxx98-cu118-x86_64-linux/activation/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _activation_be5bedb
3
- ops = torch.ops._activation_be5bedb
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_activation_be5bedb::{op_name}"
 
1
  import torch
2
+ from . import _activation_2vn6ty3gfqfb6
3
+ ops = torch.ops._activation_2vn6ty3gfqfb6
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_activation_2vn6ty3gfqfb6::{op_name}"
build/torch26-cxx98-cu118-x86_64-linux/activation/layers.py CHANGED
@@ -5,17 +5,6 @@ from ._ops import ops
5
 
6
 
7
  class SiluAndMul(nn.Module):
8
- """An activation function for SwiGLU.
9
-
10
- The function computes x -> silu(x[:d]) * x[d:] where d = x.shape[-1] // 2.
11
-
12
- Shapes:
13
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
14
- return: (num_tokens, d) or (batch_size, seq_len, d)
15
- """
16
-
17
- can_torch_compile: bool = True
18
-
19
  def forward(self, x: torch.Tensor):
20
  d = x.shape[-1] // 2
21
  output_shape = x.shape[:-1] + (d,)
@@ -24,38 +13,7 @@ class SiluAndMul(nn.Module):
24
  return out
25
 
26
 
27
- class MulAndSilu(nn.Module):
28
- """An activation function for SwiGLU.
29
-
30
- The function computes x -> x[:d] * silu(x[d:]) where d = x.shape[-1] // 2.
31
-
32
- Shapes:
33
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
34
- return: (num_tokens, d) or (batch_size, seq_len, d)
35
- """
36
-
37
- can_torch_compile: bool = True
38
-
39
- def forward(self, x: torch.Tensor) -> torch.Tensor:
40
- d = x.shape[-1] // 2
41
- output_shape = x.shape[:-1] + (d,)
42
- out = torch.empty(output_shape, dtype=x.dtype, device=x.device)
43
- ops.mul_and_silu(out, x)
44
- return out
45
-
46
-
47
  class GeluAndMul(nn.Module):
48
- """An activation function for GeGLU.
49
-
50
- The function computes x -> GELU(x[:d]) * x[d:] where d = x.shape[-1] // 2.
51
-
52
- Shapes:
53
- x: (batch_size, seq_len, 2 * d) or (num_tokens, 2 * d)
54
- return: (batch_size, seq_len, d) or (num_tokens, d)
55
- """
56
-
57
- can_torch_compile: bool = True
58
-
59
  def forward(self, x: torch.Tensor):
60
  d = x.shape[-1] // 2
61
  output_shape = x.shape[:-1] + (d,)
@@ -65,8 +23,6 @@ class GeluAndMul(nn.Module):
65
 
66
 
67
  class GeluTanhAndMul(nn.Module):
68
- can_torch_compile: bool = True
69
-
70
  def forward(self, x: torch.Tensor):
71
  d = x.shape[-1] // 2
72
  output_shape = x.shape[:-1] + (d,)
@@ -76,19 +32,6 @@ class GeluTanhAndMul(nn.Module):
76
 
77
 
78
  class FatreluAndMul(nn.Module):
79
- """An activation function for FATReLU.
80
-
81
- The function computes x -> FATReLU(x[:d]) * x[d:] where
82
- d = x.shape[-1] // 2.
83
- This is used in openbmb/MiniCPM-S-1B-sft.
84
-
85
- Shapes:
86
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
87
- return: (num_tokens, d) or (batch_size, seq_len, d)
88
- """
89
-
90
- can_torch_compile: bool = True
91
-
92
  def __init__(self, threshold: float = 0.0):
93
  super().__init__()
94
  self.threshold = threshold
@@ -102,8 +45,6 @@ class FatreluAndMul(nn.Module):
102
 
103
 
104
  class FastGELU(nn.Module):
105
- can_torch_compile: bool = True
106
-
107
  def forward(self, x: torch.Tensor) -> torch.Tensor:
108
  out = torch.empty_like(x)
109
  ops.gelu_fast(out, x)
@@ -111,8 +52,6 @@ class FastGELU(nn.Module):
111
 
112
 
113
  class NewGELU(nn.Module):
114
- can_torch_compile: bool = True
115
-
116
  def forward(self, x: torch.Tensor) -> torch.Tensor:
117
  out = torch.empty_like(x)
118
  ops.gelu_new(out, x)
@@ -120,8 +59,6 @@ class NewGELU(nn.Module):
120
 
121
 
122
  class QuickGELU(nn.Module):
123
- can_torch_compile: bool = True
124
-
125
  def forward(self, x: torch.Tensor) -> torch.Tensor:
126
  out = torch.empty_like(x)
127
  ops.gelu_quick(out, x)
 
5
 
6
 
7
  class SiluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
8
  def forward(self, x: torch.Tensor):
9
  d = x.shape[-1] // 2
10
  output_shape = x.shape[:-1] + (d,)
 
13
  return out
14
 
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  class GeluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
17
  def forward(self, x: torch.Tensor):
18
  d = x.shape[-1] // 2
19
  output_shape = x.shape[:-1] + (d,)
 
23
 
24
 
25
  class GeluTanhAndMul(nn.Module):
 
 
26
  def forward(self, x: torch.Tensor):
27
  d = x.shape[-1] // 2
28
  output_shape = x.shape[:-1] + (d,)
 
32
 
33
 
34
  class FatreluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  def __init__(self, threshold: float = 0.0):
36
  super().__init__()
37
  self.threshold = threshold
 
45
 
46
 
47
  class FastGELU(nn.Module):
 
 
48
  def forward(self, x: torch.Tensor) -> torch.Tensor:
49
  out = torch.empty_like(x)
50
  ops.gelu_fast(out, x)
 
52
 
53
 
54
  class NewGELU(nn.Module):
 
 
55
  def forward(self, x: torch.Tensor) -> torch.Tensor:
56
  out = torch.empty_like(x)
57
  ops.gelu_new(out, x)
 
59
 
60
 
61
  class QuickGELU(nn.Module):
 
 
62
  def forward(self, x: torch.Tensor) -> torch.Tensor:
63
  out = torch.empty_like(x)
64
  ops.gelu_quick(out, x)
build/torch26-cxx98-cu124-x86_64-linux/activation/__init__.py CHANGED
@@ -10,11 +10,6 @@ def silu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
10
  return out
11
 
12
 
13
- def mul_and_silu(out: torch.Tensor, x: torch.Tensor) -> None:
14
- ops.mul_and_silu(out, x)
15
- return out
16
-
17
-
18
  def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
19
  ops.gelu_and_mul(out, x)
20
  return out
 
10
  return out
11
 
12
 
 
 
 
 
 
13
  def gelu_and_mul(out: torch.Tensor, x: torch.Tensor) -> None:
14
  ops.gelu_and_mul(out, x)
15
  return out
build/torch26-cxx98-cu124-x86_64-linux/activation/_activation_be5bedb.abi3.so DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:53ddfb42466bfe01feb98348f5c2d6beefd589aeb3dec4c5c36609e11a6bde4c
3
- size 2605136
 
 
 
 
build/torch26-cxx98-cu124-x86_64-linux/activation/_activation_myvteedxdpqc6.abi3.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b1bc928823117c800904bcd3492bf1a0c65a32f6d8a842dc039f55e29831ab49
3
+ size 2420344
build/torch26-cxx98-cu124-x86_64-linux/activation/_ops.py CHANGED
@@ -1,9 +1,9 @@
1
  import torch
2
- from . import _activation_be5bedb
3
- ops = torch.ops._activation_be5bedb
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
- return f"_activation_be5bedb::{op_name}"
 
1
  import torch
2
+ from . import _activation_myvteedxdpqc6
3
+ ops = torch.ops._activation_myvteedxdpqc6
4
 
5
  def add_op_namespace_prefix(op_name: str):
6
  """
7
  Prefix op by namespace.
8
  """
9
+ return f"_activation_myvteedxdpqc6::{op_name}"
build/torch26-cxx98-cu124-x86_64-linux/activation/layers.py CHANGED
@@ -5,17 +5,6 @@ from ._ops import ops
5
 
6
 
7
  class SiluAndMul(nn.Module):
8
- """An activation function for SwiGLU.
9
-
10
- The function computes x -> silu(x[:d]) * x[d:] where d = x.shape[-1] // 2.
11
-
12
- Shapes:
13
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
14
- return: (num_tokens, d) or (batch_size, seq_len, d)
15
- """
16
-
17
- can_torch_compile: bool = True
18
-
19
  def forward(self, x: torch.Tensor):
20
  d = x.shape[-1] // 2
21
  output_shape = x.shape[:-1] + (d,)
@@ -24,38 +13,7 @@ class SiluAndMul(nn.Module):
24
  return out
25
 
26
 
27
- class MulAndSilu(nn.Module):
28
- """An activation function for SwiGLU.
29
-
30
- The function computes x -> x[:d] * silu(x[d:]) where d = x.shape[-1] // 2.
31
-
32
- Shapes:
33
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
34
- return: (num_tokens, d) or (batch_size, seq_len, d)
35
- """
36
-
37
- can_torch_compile: bool = True
38
-
39
- def forward(self, x: torch.Tensor) -> torch.Tensor:
40
- d = x.shape[-1] // 2
41
- output_shape = x.shape[:-1] + (d,)
42
- out = torch.empty(output_shape, dtype=x.dtype, device=x.device)
43
- ops.mul_and_silu(out, x)
44
- return out
45
-
46
-
47
  class GeluAndMul(nn.Module):
48
- """An activation function for GeGLU.
49
-
50
- The function computes x -> GELU(x[:d]) * x[d:] where d = x.shape[-1] // 2.
51
-
52
- Shapes:
53
- x: (batch_size, seq_len, 2 * d) or (num_tokens, 2 * d)
54
- return: (batch_size, seq_len, d) or (num_tokens, d)
55
- """
56
-
57
- can_torch_compile: bool = True
58
-
59
  def forward(self, x: torch.Tensor):
60
  d = x.shape[-1] // 2
61
  output_shape = x.shape[:-1] + (d,)
@@ -65,8 +23,6 @@ class GeluAndMul(nn.Module):
65
 
66
 
67
  class GeluTanhAndMul(nn.Module):
68
- can_torch_compile: bool = True
69
-
70
  def forward(self, x: torch.Tensor):
71
  d = x.shape[-1] // 2
72
  output_shape = x.shape[:-1] + (d,)
@@ -76,19 +32,6 @@ class GeluTanhAndMul(nn.Module):
76
 
77
 
78
  class FatreluAndMul(nn.Module):
79
- """An activation function for FATReLU.
80
-
81
- The function computes x -> FATReLU(x[:d]) * x[d:] where
82
- d = x.shape[-1] // 2.
83
- This is used in openbmb/MiniCPM-S-1B-sft.
84
-
85
- Shapes:
86
- x: (num_tokens, 2 * d) or (batch_size, seq_len, 2 * d)
87
- return: (num_tokens, d) or (batch_size, seq_len, d)
88
- """
89
-
90
- can_torch_compile: bool = True
91
-
92
  def __init__(self, threshold: float = 0.0):
93
  super().__init__()
94
  self.threshold = threshold
@@ -102,8 +45,6 @@ class FatreluAndMul(nn.Module):
102
 
103
 
104
  class FastGELU(nn.Module):
105
- can_torch_compile: bool = True
106
-
107
  def forward(self, x: torch.Tensor) -> torch.Tensor:
108
  out = torch.empty_like(x)
109
  ops.gelu_fast(out, x)
@@ -111,8 +52,6 @@ class FastGELU(nn.Module):
111
 
112
 
113
  class NewGELU(nn.Module):
114
- can_torch_compile: bool = True
115
-
116
  def forward(self, x: torch.Tensor) -> torch.Tensor:
117
  out = torch.empty_like(x)
118
  ops.gelu_new(out, x)
@@ -120,8 +59,6 @@ class NewGELU(nn.Module):
120
 
121
 
122
  class QuickGELU(nn.Module):
123
- can_torch_compile: bool = True
124
-
125
  def forward(self, x: torch.Tensor) -> torch.Tensor:
126
  out = torch.empty_like(x)
127
  ops.gelu_quick(out, x)
 
5
 
6
 
7
  class SiluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
8
  def forward(self, x: torch.Tensor):
9
  d = x.shape[-1] // 2
10
  output_shape = x.shape[:-1] + (d,)
 
13
  return out
14
 
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  class GeluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
17
  def forward(self, x: torch.Tensor):
18
  d = x.shape[-1] // 2
19
  output_shape = x.shape[:-1] + (d,)
 
23
 
24
 
25
  class GeluTanhAndMul(nn.Module):
 
 
26
  def forward(self, x: torch.Tensor):
27
  d = x.shape[-1] // 2
28
  output_shape = x.shape[:-1] + (d,)
 
32
 
33
 
34
  class FatreluAndMul(nn.Module):
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  def __init__(self, threshold: float = 0.0):
36
  super().__init__()
37
  self.threshold = threshold
 
45
 
46
 
47
  class FastGELU(nn.Module):
 
 
48
  def forward(self, x: torch.Tensor) -> torch.Tensor:
49
  out = torch.empty_like(x)
50
  ops.gelu_fast(out, x)
 
52
 
53
 
54
  class NewGELU(nn.Module):
 
 
55
  def forward(self, x: torch.Tensor) -> torch.Tensor:
56
  out = torch.empty_like(x)
57
  ops.gelu_new(out, x)
 
59
 
60
 
61
  class QuickGELU(nn.Module):
 
 
62
  def forward(self, x: torch.Tensor) -> torch.Tensor:
63
  out = torch.empty_like(x)
64
  ops.gelu_quick(out, x)