asigalov61 commited on
Commit
40e152c
1 Parent(s): bf77b44

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -314,7 +314,7 @@ def tokens_to_MIDI(tokens, MIDI_name):
314
 
315
  # =================================================================================================
316
 
317
- @spaces.GPU
318
  def CompareMIDIs(input_src_midi, input_trg_midi, input_sampling_resolution, input_sampling_overlap):
319
 
320
  print('=' * 70)
@@ -325,7 +325,7 @@ def CompareMIDIs(input_src_midi, input_trg_midi, input_sampling_resolution, inpu
325
 
326
  SEQ_LEN = 8192 # Models seq len
327
  PAD_IDX = 19463 # Models pad index
328
- DEVICE = 'cuda' # 'cuda'
329
 
330
  # instantiate the model
331
 
@@ -411,7 +411,7 @@ def CompareMIDIs(input_src_midi, input_trg_midi, input_sampling_resolution, inpu
411
 
412
  inp = [input_src_tokens[i:i+sampling_resolution]]
413
 
414
- inp = torch.LongTensor(inp).cuda()
415
 
416
  with ctx:
417
  with torch.no_grad():
@@ -422,7 +422,7 @@ def CompareMIDIs(input_src_midi, input_trg_midi, input_sampling_resolution, inpu
422
 
423
  inp = [input_trg_tokens[i:i+sampling_resolution]]
424
 
425
- inp = torch.LongTensor(inp).cuda()
426
 
427
  with ctx:
428
  with torch.no_grad():
 
314
 
315
  # =================================================================================================
316
 
317
+ # @spaces.GPU
318
  def CompareMIDIs(input_src_midi, input_trg_midi, input_sampling_resolution, input_sampling_overlap):
319
 
320
  print('=' * 70)
 
325
 
326
  SEQ_LEN = 8192 # Models seq len
327
  PAD_IDX = 19463 # Models pad index
328
+ DEVICE = 'cpu' # 'cuda'
329
 
330
  # instantiate the model
331
 
 
411
 
412
  inp = [input_src_tokens[i:i+sampling_resolution]]
413
 
414
+ inp = torch.LongTensor(inp).to(DEVICE)
415
 
416
  with ctx:
417
  with torch.no_grad():
 
422
 
423
  inp = [input_trg_tokens[i:i+sampling_resolution]]
424
 
425
+ inp = torch.LongTensor(inp).to(DEVICE)
426
 
427
  with ctx:
428
  with torch.no_grad():