oriyonay commited on
Commit
6b9e1e5
·
verified ·
1 Parent(s): ea6c6aa

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. myna.py +3 -3
myna.py CHANGED
@@ -20,7 +20,7 @@ import shutil
20
 
21
 
22
  def pair(t):
23
- return t if isinstance(t, tuple) else (t, t)
24
 
25
 
26
  def posemb_sincos_2d(h, w, dim, temperature: int = 10000, dtype = torch.float32):
@@ -268,7 +268,7 @@ class Myna(PreTrainedModel, PyTorchModelHubMixin):
268
 
269
  def _make_embeddings(self, patch_height, patch_width, patch_dim, dim, image_height, image_width):
270
  to_patch_embedding = nn.Sequential(
271
- Rearrange("b c (h p1) (w p2) -> b (h w) (p1 p2 c)", p1 = patch_height, p2 = patch_width),
272
  nn.LayerNorm(patch_dim),
273
  nn.Linear(patch_dim, dim),
274
  nn.LayerNorm(dim),
@@ -286,7 +286,7 @@ class Myna(PreTrainedModel, PyTorchModelHubMixin):
286
  n_frames = self.config.n_frames
287
  if n_samples and n_samples != self.config.n_samples:
288
  n_frames = self.config._get_n_frames(n_samples)
289
- spec = self.preprocessor(filename, n_frames)
290
  return self(spec)
291
 
292
  @property
 
20
 
21
 
22
  def pair(t):
23
+ return t if isinstance(t, (tuple, list)) else (t, t)
24
 
25
 
26
  def posemb_sincos_2d(h, w, dim, temperature: int = 10000, dtype = torch.float32):
 
268
 
269
  def _make_embeddings(self, patch_height, patch_width, patch_dim, dim, image_height, image_width):
270
  to_patch_embedding = nn.Sequential(
271
+ Rearrange('b c (h p1) (w p2) -> b (h w) (p1 p2 c)', p1 = patch_height, p2 = patch_width),
272
  nn.LayerNorm(patch_dim),
273
  nn.Linear(patch_dim, dim),
274
  nn.LayerNorm(dim),
 
286
  n_frames = self.config.n_frames
287
  if n_samples and n_samples != self.config.n_samples:
288
  n_frames = self.config._get_n_frames(n_samples)
289
+ spec = self.preprocessor(filename, n_frames).to(self.device)
290
  return self(spec)
291
 
292
  @property