Skip to content

Commit

Permalink
fix: depedency of transformers==4.26.1, and you are able to use newer…
Browse files Browse the repository at this point in the history
… version
  • Loading branch information
syq163 committed Dec 7, 2023
1 parent e2da34f commit 7cad493
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Now open your browser and navigate to http:https://localhost:8501 to start using Emoti
conda create -n EmotiVoice python=3.8 -y
conda activate EmotiVoice
pip install torch torchaudio
pip install numpy numba scipy transformers==4.26.1 soundfile yacs g2p_en jieba pypinyin
pip install numpy numba scipy transformers soundfile yacs g2p_en jieba pypinyin
```

### Prepare model files
Expand Down
2 changes: 1 addition & 1 deletion README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ docker run -dp 127.0.0.1:8501:8501 syq163/emoti-voice:latest
conda create -n EmotiVoice python=3.8 -y
conda activate EmotiVoice
pip install torch torchaudio
pip install numpy numba scipy transformers==4.26.1 soundfile yacs g2p_en jieba pypinyin
pip install numpy numba scipy transformers soundfile yacs g2p_en jieba pypinyin
```

### 准备模型文件
Expand Down
8 changes: 4 additions & 4 deletions data/youdao/text/tokenlist
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,10 @@ err1
rr
ier2
or1
uncased11
uncased12
uncased13
uncased14
ueng2
ir5
iar1
iour1
uncased15
uncased16
uncased17
Expand Down
2 changes: 1 addition & 1 deletion demo_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def get_models():
for key, value in model_CKPT['model'].items():
new_key = key[7:]
model_ckpt[new_key] = value
style_encoder.load_state_dict(model_ckpt)
style_encoder.load_state_dict(model_ckpt, strict=False)
generator = JETSGenerator(conf).to(DEVICE)

model_CKPT = torch.load(am_checkpoint_path, map_location=DEVICE)
Expand Down
2 changes: 1 addition & 1 deletion inference_am_vocoder_joint.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def main(args, config):
for key, value in model_CKPT['model'].items():
new_key = key[7:]
model_ckpt[new_key] = value
style_encoder.load_state_dict(model_ckpt)
style_encoder.load_state_dict(model_ckpt, strict=False)



Expand Down
3 changes: 2 additions & 1 deletion models/hifigan/models.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import torch.nn.functional as F
import torch.nn as nn
from torch.nn import Conv1d, ConvTranspose1d, AvgPool1d, Conv2d
from torch.nn.utils import weight_norm, remove_weight_norm, spectral_norm
from torch.nn.utils.parametrizations import weight_norm
from torch.nn.utils import remove_weight_norm, spectral_norm

LRELU_SLOPE = 0.1

Expand Down
16 changes: 8 additions & 8 deletions models/prompt_tts_modified/jets.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ def __init__(self, config) -> None:

self.generator = HiFiGANGenerator(config.model)

try:
model_CKPT = torch.load(config.pretrained_am, map_location="cpu")
self.am.load_state_dict(model_CKPT['model'])
state_dict_g = torch.load(config.pretrained_vocoder,map_location="cpu")
self.generator.load_state_dict(state_dict_g['generator'])
print("pretrained generator is loaded")
except:
print("pretrained generator is not loaded for training")
# try:
# model_CKPT = torch.load(config.pretrained_am, map_location="cpu")
# self.am.load_state_dict(model_CKPT['model'])
# state_dict_g = torch.load(config.pretrained_vocoder,map_location="cpu")
# self.generator.load_state_dict(state_dict_g['generator'])
# print("pretrained generator is loaded")
# except:
# print("pretrained generator is not loaded for training")
self.config=config


Expand Down
2 changes: 1 addition & 1 deletion openaiapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def get_models():
for key, value in model_CKPT['model'].items():
new_key = key[7:]
model_ckpt[new_key] = value
style_encoder.load_state_dict(model_ckpt)
style_encoder.load_state_dict(model_ckpt, strict=False)
generator = JETSGenerator(conf).to(DEVICE)

model_CKPT = torch.load(am_checkpoint_path, map_location=DEVICE)
Expand Down
2 changes: 1 addition & 1 deletion predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def setup_models(self):
for key, value in model_CKPT['model'].items():
new_key = key[7:]
model_ckpt[new_key] = value
style_encoder.load_state_dict(model_ckpt)
style_encoder.load_state_dict(model_ckpt, strict=False)
generator = JETSGenerator(conf).to(self.device)

model_CKPT = torch.load(am_checkpoint_path, map_location=self.device)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ torchaudio
numpy
numba
scipy
transformers==4.26.1
transformers
soundfile
yacs
g2p_en
Expand Down

0 comments on commit 7cad493

Please sign in to comment.