georg-suno reach-vb HF staff commited on
Commit
70a8a7d
β€’
1 Parent(s): a7b2a67

Update README.md (#32)

Browse files

- Update README.md (8f943aced9e2eb6f0d863cc6e8c600c1955ee509)
- Update README.md (e9a0292eee760619bef542411bf421816d153058)
- Update README.md (40e663a136de821ffb01bf0c71caafbc40096f88)
- Update README.md (e7fc53d8bd1776d3705573f8927f93c945c7f6e8)
- Update README.md (59ccf64c288c6c6dde3668c4531040c42563913c)


Co-authored-by: Vaibhav Srivastav <reach-vb@users.noreply.huggingface.co>

Files changed (1) hide show
  1. README.md +21 -9
README.md CHANGED
@@ -69,23 +69,35 @@ Try out Bark yourself!
69
 
70
  ## πŸ€— Transformers Usage
71
 
72
-
73
  You can run Bark locally with the πŸ€— Transformers library from version 4.31.0 onwards.
74
 
75
- 1. First install the πŸ€— [Transformers library](https://github.com/huggingface/transformers) from main:
76
 
77
  ```
78
- pip install git+https://github.com/huggingface/transformers.git
 
79
  ```
80
 
81
- 2. Run the following Python code to generate speech samples:
82
 
83
  ```python
84
- from transformers import AutoProcessor, AutoModel
 
 
 
 
 
85
 
 
 
 
 
 
 
 
86
 
87
- processor = AutoProcessor.from_pretrained("suno/bark-small")
88
- model = AutoModel.from_pretrained("suno/bark-small")
89
 
90
  inputs = processor(
91
  text=["Hello, my name is Suno. And, uh β€” and I like pizza. [laughs] But I also have other interests such as playing tic tac toe."],
@@ -95,7 +107,7 @@ inputs = processor(
95
  speech_values = model.generate(**inputs, do_sample=True)
96
  ```
97
 
98
- 3. Listen to the speech samples either in an ipynb notebook:
99
 
100
  ```python
101
  from IPython.display import Audio
@@ -121,7 +133,7 @@ You can also run Bark locally through the original [Bark library]((https://githu
121
 
122
  1. First install the [`bark` library](https://github.com/suno-ai/bark)
123
 
124
- 3. Run the following Python code:
125
 
126
  ```python
127
  from bark import SAMPLE_RATE, generate_audio, preload_models
 
69
 
70
  ## πŸ€— Transformers Usage
71
 
 
72
  You can run Bark locally with the πŸ€— Transformers library from version 4.31.0 onwards.
73
 
74
+ 1. First install the πŸ€— [Transformers library](https://github.com/huggingface/transformers) and scipy:
75
 
76
  ```
77
+ pip install --upgrade pip
78
+ pip install --upgrade transformers scipy
79
  ```
80
 
81
+ 2. Run inference via the `Text-to-Speech` (TTS) pipeline. You can infer the bark model via the TTS pipeline in just a few lines of code!
82
 
83
  ```python
84
+ from transformers import pipeline
85
+ import scipy
86
+
87
+ synthesiser = pipeline("text-to-speech", "suno/bark")
88
+
89
+ speech = synthesiser("Hello, my dog is cooler than you!", forward_params={"do_sample": True})
90
 
91
+ scipy.io.wavfile.write("bark_out.wav", rate=speech["sampling_rate"], data=speech["audio"])
92
+ ```
93
+
94
+ 3. Run inference via the Transformers modelling code. You can use the processor + generate code to convert text into a mono 24 kHz speech waveform for more fine-grained control.
95
+
96
+ ```python
97
+ from transformers import AutoProcessor, AutoModel
98
 
99
+ processor = AutoProcessor.from_pretrained("suno/bark")
100
+ model = AutoModel.from_pretrained("suno/bark")
101
 
102
  inputs = processor(
103
  text=["Hello, my name is Suno. And, uh β€” and I like pizza. [laughs] But I also have other interests such as playing tic tac toe."],
 
107
  speech_values = model.generate(**inputs, do_sample=True)
108
  ```
109
 
110
+ 4. Listen to the speech samples either in an ipynb notebook:
111
 
112
  ```python
113
  from IPython.display import Audio
 
133
 
134
  1. First install the [`bark` library](https://github.com/suno-ai/bark)
135
 
136
+ 2. Run the following Python code:
137
 
138
  ```python
139
  from bark import SAMPLE_RATE, generate_audio, preload_models