Spaces:
Paused
Paused
Optimized for speed
#7
by
KingNish
- opened
- app.py +1 -1
- inference/infer.py +1 -1
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -124,7 +124,7 @@ def infer(genre_txt_content, lyrics_txt_content, num_segments, max_new_tokens):
|
|
| 124 |
"--genre_txt", f"{genre_txt_path}",
|
| 125 |
"--lyrics_txt", f"{lyrics_txt_path}",
|
| 126 |
"--run_n_segments", str(num_segments),
|
| 127 |
-
"--stage2_batch_size", "
|
| 128 |
"--output_dir", f"{output_dir}",
|
| 129 |
"--cuda_idx", "0",
|
| 130 |
"--max_new_tokens", str(max_new_tokens)
|
|
|
|
| 124 |
"--genre_txt", f"{genre_txt_path}",
|
| 125 |
"--lyrics_txt", f"{lyrics_txt_path}",
|
| 126 |
"--run_n_segments", str(num_segments),
|
| 127 |
+
"--stage2_batch_size", "16",
|
| 128 |
"--output_dir", f"{output_dir}",
|
| 129 |
"--cuda_idx", "0",
|
| 130 |
"--max_new_tokens", str(max_new_tokens)
|
inference/infer.py
CHANGED
|
@@ -76,7 +76,7 @@ print(f"Using device: {device}")
|
|
| 76 |
mmtokenizer = _MMSentencePieceTokenizer("./mm_tokenizer_v0.2_hf/tokenizer.model")
|
| 77 |
model = AutoModelForCausalLM.from_pretrained(
|
| 78 |
stage1_model,
|
| 79 |
-
torch_dtype=torch.
|
| 80 |
attn_implementation="flash_attention_2", # To enable flashattn, you have to install flash-attn
|
| 81 |
)
|
| 82 |
model.to(device)
|
|
|
|
| 76 |
mmtokenizer = _MMSentencePieceTokenizer("./mm_tokenizer_v0.2_hf/tokenizer.model")
|
| 77 |
model = AutoModelForCausalLM.from_pretrained(
|
| 78 |
stage1_model,
|
| 79 |
+
torch_dtype=torch.float16,
|
| 80 |
attn_implementation="flash_attention_2", # To enable flashattn, you have to install flash-attn
|
| 81 |
)
|
| 82 |
model.to(device)
|
requirements.txt
CHANGED
|
@@ -3,7 +3,7 @@ torchaudio==2.2.0 --index-url https://download.pytorch.org/whl/cu118
|
|
| 3 |
omegaconf
|
| 4 |
einops
|
| 5 |
numpy<2
|
| 6 |
-
transformers
|
| 7 |
sentencepiece
|
| 8 |
tqdm
|
| 9 |
tensorboard
|
|
|
|
| 3 |
omegaconf
|
| 4 |
einops
|
| 5 |
numpy<2
|
| 6 |
+
git+https://github.com/KingNish24/transformers.git@yue-patch
|
| 7 |
sentencepiece
|
| 8 |
tqdm
|
| 9 |
tensorboard
|