Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ import soundfile as sf
|
|
4 |
from snac import SNAC
|
5 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
6 |
|
7 |
-
device = torch.device("
|
8 |
|
9 |
def find_last_instance_of_separator(lst, element=50258):
|
10 |
reversed_list = lst[::-1]
|
@@ -55,7 +55,7 @@ def reconstruct_tensors(flattened_output):
|
|
55 |
tensor2.append(flattened_output[i+5])
|
56 |
tensor3.append(flattened_output[i+6])
|
57 |
tensor3.append(flattened_output[i+7])
|
58 |
-
codes = [list_to_torch_tensor(tensor1)
|
59 |
|
60 |
if n_tensors == 15:
|
61 |
for i in range(0, len(flattened_output), 16):
|
@@ -74,7 +74,7 @@ def reconstruct_tensors(flattened_output):
|
|
74 |
tensor3.append(flattened_output[i+13])
|
75 |
tensor4.append(flattened_output[i+14])
|
76 |
tensor4.append(flattened_output[i+15])
|
77 |
-
codes = [list_to_torch_tensor(tensor1)
|
78 |
|
79 |
return codes
|
80 |
|
@@ -117,4 +117,4 @@ iface = gr.Interface(
|
|
117 |
)
|
118 |
|
119 |
if __name__ == "__main__":
|
120 |
-
iface.launch()
|
|
|
4 |
from snac import SNAC
|
5 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
6 |
|
7 |
+
device = torch.device("cpu") # Changed to CPU mode
|
8 |
|
9 |
def find_last_instance_of_separator(lst, element=50258):
|
10 |
reversed_list = lst[::-1]
|
|
|
55 |
tensor2.append(flattened_output[i+5])
|
56 |
tensor3.append(flattened_output[i+6])
|
57 |
tensor3.append(flattened_output[i+7])
|
58 |
+
codes = [list_to_torch_tensor(tensor1), list_to_torch_tensor(tensor2), list_to_torch_tensor(tensor3)]
|
59 |
|
60 |
if n_tensors == 15:
|
61 |
for i in range(0, len(flattened_output), 16):
|
|
|
74 |
tensor3.append(flattened_output[i+13])
|
75 |
tensor4.append(flattened_output[i+14])
|
76 |
tensor4.append(flattened_output[i+15])
|
77 |
+
codes = [list_to_torch_tensor(tensor1), list_to_torch_tensor(tensor2), list_to_torch_tensor(tensor3), list_to_torch_tensor(tensor4)]
|
78 |
|
79 |
return codes
|
80 |
|
|
|
117 |
)
|
118 |
|
119 |
if __name__ == "__main__":
|
120 |
+
iface.launch(share=True)
|