asigalov61 commited on
Commit
7654a54
·
1 Parent(s): 3772549

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -9
app.py CHANGED
@@ -13,8 +13,6 @@ import tqdm
13
  from midi_synthesizer import synthesis
14
  import TMIDIX
15
 
16
- from math import ceil
17
-
18
  in_space = os.getenv("SYSTEM") == "spaces"
19
 
20
  #=================================================================================================
@@ -48,13 +46,7 @@ def GenerateMIDI():
48
 
49
  logits = torch.FloatTensor(session.run(None, {'input': [torch_in]})[0])[:, -1]
50
 
51
- thres = 0.9
52
- k = ceil((1 - thres) * logits.shape[-1])
53
- val, ind = torch.topk(logits, k)
54
- probs = torch.full_like(logits, float('-inf'))
55
- probs.scatter_(1, ind, val)
56
-
57
- probs = F.softmax(probs / temperature, dim=-1)
58
 
59
  sample = torch.multinomial(probs, 1)
60
 
 
13
  from midi_synthesizer import synthesis
14
  import TMIDIX
15
 
 
 
16
  in_space = os.getenv("SYSTEM") == "spaces"
17
 
18
  #=================================================================================================
 
46
 
47
  logits = torch.FloatTensor(session.run(None, {'input': [torch_in]})[0])[:, -1]
48
 
49
+ probs = F.softmax(logits / temperature, dim=-1)
 
 
 
 
 
 
50
 
51
  sample = torch.multinomial(probs, 1)
52