reach-vb HF staff commited on
Commit
8f943ac
•
1 Parent(s): a7b2a67

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +18 -5
README.md CHANGED
@@ -72,13 +72,26 @@ Try out Bark yourself!
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
@@ -95,7 +108,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 +134,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
 
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) and scipy:
76
 
77
  ```
78
+ pip install 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 = pipe("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
 
108
  speech_values = model.generate(**inputs, do_sample=True)
109
  ```
110
 
111
+ 4. Listen to the speech samples either in an ipynb notebook:
112
 
113
  ```python
114
  from IPython.display import Audio
 
134
 
135
  1. First install the [`bark` library](https://github.com/suno-ai/bark)
136
 
137
+ 2. Run the following Python code:
138
 
139
  ```python
140
  from bark import SAMPLE_RATE, generate_audio, preload_models