knowrohit07 commited on
Commit
3dfd3de
·
verified ·
1 Parent(s): 441f1a6

first commit

Browse files
Files changed (1) hide show
  1. remove_voice_cloning_and_push.py +0 -49
remove_voice_cloning_and_push.py DELETED
@@ -1,49 +0,0 @@
1
- # /// script
2
- # requires-python = ">=3.14"
3
- # dependencies = [
4
- # "safetensors>=0.7.0",
5
- # "torch>=2.9.1",
6
- # "packaging",
7
- # "huggingface_hub",
8
- # "numpy",
9
- # ]
10
- # ///
11
-
12
- import os
13
- import shutil
14
- from pathlib import Path
15
- from safetensors.torch import load_file, save_file
16
- import torch
17
- from huggingface_hub import HfApi
18
- import tempfile
19
-
20
- current_repository = Path(__file__).parent
21
-
22
- with tempfile.TemporaryDirectory() as destination_dir:
23
- destination_dir = Path(destination_dir)
24
- if destination_dir.exists():
25
- shutil.rmtree(destination_dir)
26
-
27
- shutil.copytree(current_repository, destination_dir)
28
-
29
- model_name = "tts_b6369a24.safetensors"
30
-
31
- tensors = load_file(current_repository / model_name)
32
-
33
- new_tensors = {}
34
-
35
- for key, tensor in tensors.items():
36
- if key.startswith("mimi.encoder"):
37
- print("zeroing out", key)
38
- new_tensors[key] = torch.zeros_like(tensor)
39
- else:
40
- new_tensors[key] = tensor
41
-
42
- save_file(new_tensors, destination_dir / model_name)
43
-
44
- api = HfApi()
45
- api.upload_folder(
46
- folder_path=destination_dir,
47
- repo_id="kyutai/pocket-tts-without-voice-cloning",
48
- delete_patterns="*",
49
- )