marcoyang commited on
Commit
58a7c12
·
verified ·
1 Parent(s): 4390a1a

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. model.safetensors +1 -1
  2. spear_modules.py +4 -2
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:42406134550a2fb1f39a3fd02a83cfc137fbadbe537be5d2ce86e5d03bc481fb
3
  size 373237404
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6abd721b0161d32c8c80c7eb7c6de54fc5198e4ebbff35b61b6c6a2019038afc
3
  size 373237404
spear_modules.py CHANGED
@@ -1547,7 +1547,8 @@ class SwooshROnnx(torch.nn.Module):
1547
  # ActivationDropoutAndLinearFunction.
1548
  def SwooshLForward(x: Tensor):
1549
  x_offset = x - 4.0
1550
- log_sum = (1.0 + x_offset.exp()).log().to(x.dtype)
 
1551
  log_sum = torch.where(log_sum == float("inf"), x_offset, log_sum)
1552
  return log_sum - 0.08 * x - 0.035
1553
 
@@ -1556,7 +1557,8 @@ def SwooshLForward(x: Tensor):
1556
  # ActivationDropoutAndLinearFunction.
1557
  def SwooshRForward(x: Tensor):
1558
  x_offset = x - 1.0
1559
- log_sum = (1.0 + x_offset.exp()).log().to(x.dtype)
 
1560
  log_sum = torch.where(log_sum == float("inf"), x_offset, log_sum)
1561
  return log_sum - 0.08 * x - 0.313261687
1562
 
 
1547
  # ActivationDropoutAndLinearFunction.
1548
  def SwooshLForward(x: Tensor):
1549
  x_offset = x - 4.0
1550
+ # log_sum = (1.0 + x_offset.exp()).log().to(x.dtype)
1551
+ log_sum = torch.nn.functional.softplus(x_offset)
1552
  log_sum = torch.where(log_sum == float("inf"), x_offset, log_sum)
1553
  return log_sum - 0.08 * x - 0.035
1554
 
 
1557
  # ActivationDropoutAndLinearFunction.
1558
  def SwooshRForward(x: Tensor):
1559
  x_offset = x - 1.0
1560
+ # log_sum = (1.0 + x_offset.exp()).log().to(x.dtype)
1561
+ log_sum = torch.nn.functional.softplus(x_offset)
1562
  log_sum = torch.where(log_sum == float("inf"), x_offset, log_sum)
1563
  return log_sum - 0.08 * x - 0.313261687
1564