diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 28a4beab52c17152e1cf5971c1ceef60abe03f23..0000000000000000000000000000000000000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index a6344aac8c09253b3b630fb776ae94478aa0275b..0000000000000000000000000000000000000000 --- a/.gitattributes +++ /dev/null @@ -1,35 +0,0 @@ -*.7z filter=lfs diff=lfs merge=lfs -text -*.arrow filter=lfs diff=lfs merge=lfs -text -*.bin filter=lfs diff=lfs merge=lfs -text -*.bz2 filter=lfs diff=lfs merge=lfs -text -*.ckpt filter=lfs diff=lfs merge=lfs -text -*.ftz filter=lfs diff=lfs merge=lfs -text -*.gz filter=lfs diff=lfs merge=lfs -text -*.h5 filter=lfs diff=lfs merge=lfs -text -*.joblib filter=lfs diff=lfs merge=lfs -text -*.lfs.* filter=lfs diff=lfs merge=lfs -text -*.mlmodel filter=lfs diff=lfs merge=lfs -text -*.model filter=lfs diff=lfs merge=lfs -text -*.msgpack filter=lfs diff=lfs merge=lfs -text -*.npy filter=lfs diff=lfs merge=lfs -text -*.npz filter=lfs diff=lfs merge=lfs -text -*.onnx filter=lfs diff=lfs merge=lfs -text -*.ot filter=lfs diff=lfs merge=lfs -text -*.parquet filter=lfs diff=lfs merge=lfs -text -*.pb filter=lfs diff=lfs merge=lfs -text -*.pickle filter=lfs diff=lfs merge=lfs -text -*.pkl filter=lfs diff=lfs merge=lfs -text -*.pt filter=lfs diff=lfs merge=lfs -text -*.pth filter=lfs diff=lfs merge=lfs -text -*.rar filter=lfs diff=lfs merge=lfs -text -*.safetensors filter=lfs diff=lfs merge=lfs -text -saved_model/**/* filter=lfs diff=lfs merge=lfs -text -*.tar.* filter=lfs diff=lfs merge=lfs -text -*.tar filter=lfs diff=lfs merge=lfs -text -*.tflite filter=lfs diff=lfs merge=lfs -text -*.tgz filter=lfs diff=lfs merge=lfs -text -*.wasm filter=lfs diff=lfs merge=lfs -text -*.xz filter=lfs diff=lfs merge=lfs -text -*.zip filter=lfs diff=lfs merge=lfs -text -*.zst filter=lfs diff=lfs merge=lfs -text -*tfevents* filter=lfs diff=lfs merge=lfs -text diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml deleted file mode 100644 index aec72ad6895d1b6ccfbdd6c5065145940a782b70..0000000000000000000000000000000000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: "Bug Report" -description: | - Please provide as much details to help address the issue, including logs and screenshots. -labels: - - bug -body: - - type: checkboxes - attributes: - label: Checks - description: "To ensure timely help, please confirm the following:" - options: - - label: This template is only for bug reports, usage problems go with 'Help Wanted'. - required: true - - label: I have thoroughly reviewed the project documentation but couldn't find information to solve my problem. - required: true - - label: I have searched for existing issues, including closed ones, and couldn't find a solution. - required: true - - label: I confirm that I am using English to submit this report in order to facilitate communication. - required: true - - type: textarea - attributes: - label: Environment Details - description: "Provide details such as OS, Python version, and any relevant software or dependencies." - placeholder: e.g., CentOS Linux 7, RTX 3090, Python 3.10, torch==2.3.0, cuda 11.8 - validations: - required: true - - type: textarea - attributes: - label: Steps to Reproduce - description: | - Include detailed steps, screenshots, and logs. Use the correct markdown syntax for code blocks. - placeholder: | - 1. Create a new conda environment. - 2. Clone the repository, install as local editable and properly set up. - 3. Run the command: `accelerate launch src/f5_tts/train/train.py`. - 4. Have following error message... (attach logs). - validations: - required: true - - type: textarea - attributes: - label: ✔️ Expected Behavior - placeholder: Describe what you expected to happen. - validations: - required: false - - type: textarea - attributes: - label: ❌ Actual Behavior - placeholder: Describe what actually happened. - validations: - required: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 3ba13e0cec6cbbfd462e9ebf529dd2093148cd69..0000000000000000000000000000000000000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1 +0,0 @@ -blank_issues_enabled: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml deleted file mode 100644 index 5257248abbcc79da4e55ed38b0aafd1481974f3a..0000000000000000000000000000000000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: "Feature Request" -description: | - Some constructive suggestions and new ideas regarding current repo. -labels: - - enhancement -body: - - type: checkboxes - attributes: - label: Checks - description: "To help us grasp quickly, please confirm the following:" - options: - - label: This template is only for feature request. - required: true - - label: I have thoroughly reviewed the project documentation but couldn't find any relevant information that meets my needs. - required: true - - label: I have searched for existing issues, including closed ones, and found not discussion yet. - required: true - - label: I confirm that I am using English to submit this report in order to facilitate communication. - required: true - - type: textarea - attributes: - label: 1. Is this request related to a challenge you're experiencing? Tell us your story. - description: | - Describe the specific problem or scenario you're facing in detail. For example: - *"I was trying to use [feature] for [specific task], but encountered [issue]. This was frustrating because...."* - placeholder: Please describe the situation in as much detail as possible. - validations: - required: true - - - type: textarea - attributes: - label: 2. What is your suggested solution? - description: | - Provide a clear description of the feature or enhancement you'd like to propose. - How would this feature solve your issue or improve the project? - placeholder: Describe your idea or proposed solution here. - validations: - required: true - - - type: textarea - attributes: - label: 3. Additional context or comments - description: | - Any other relevant information, links, documents, or screenshots that provide clarity. - Use this section for anything not covered above. - placeholder: Add any extra details here. - validations: - required: false - - - type: checkboxes - attributes: - label: 4. Can you help us with this feature? - description: | - Let us know if you're interested in contributing. This is not a commitment but a way to express interest in collaboration. - options: - - label: I am interested in contributing to this feature. - required: false - - - type: markdown - attributes: - value: | - **Note:** Please submit only one request per issue to keep discussions focused and manageable. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/help_wanted.yml b/.github/ISSUE_TEMPLATE/help_wanted.yml deleted file mode 100644 index b043fc027a67670f7172a7980934878e8e8a01d4..0000000000000000000000000000000000000000 --- a/.github/ISSUE_TEMPLATE/help_wanted.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: "Help Wanted" -description: | - Please provide as much details to help address the issue, including logs and screenshots. -labels: - - help wanted -body: - - type: checkboxes - attributes: - label: Checks - description: "To ensure timely help, please confirm the following:" - options: - - label: This template is only for usage issues encountered. - required: true - - label: I have thoroughly reviewed the project documentation but couldn't find information to solve my problem. - required: true - - label: I have searched for existing issues, including closed ones, and couldn't find a solution. - required: true - - label: I confirm that I am using English to submit this report in order to facilitate communication. - required: true - - type: textarea - attributes: - label: Environment Details - description: "Provide details such as OS, Python version, and any relevant software or dependencies." - placeholder: e.g., macOS 13.5, Python 3.10, torch==2.3.0, Gradio 4.44.1 - validations: - required: true - - type: textarea - attributes: - label: Steps to Reproduce - description: | - Include detailed steps, screenshots, and logs. Use the correct markdown syntax for code blocks. - placeholder: | - 1. Create a new conda environment. - 2. Clone the repository and install as pip package. - 3. Run the command: `f5-tts_infer-gradio` with no ref_text provided. - 4. Stuck there with the following message... (attach logs and also error msg e.g. after ctrl-c). - validations: - required: true - - type: textarea - attributes: - label: ✔️ Expected Behavior - placeholder: Describe what you expected to happen, e.g. output a generated audio - validations: - required: false - - type: textarea - attributes: - label: ❌ Actual Behavior - placeholder: Describe what actually happened, failure messages, etc. - validations: - required: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml deleted file mode 100644 index d9bc85cf4ae2cf555905530dc9388d9b89d34297..0000000000000000000000000000000000000000 --- a/.github/ISSUE_TEMPLATE/question.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: "Question" -description: | - Pure question or inquiry about the project, usage issue goes with "help wanted". -labels: - - question -body: - - type: checkboxes - attributes: - label: Checks - description: "To help us grasp quickly, please confirm the following:" - options: - - label: This template is only for question, not feature requests or bug reports. - required: true - - label: I have thoroughly reviewed the project documentation and read the related paper(s). - required: true - - label: I have searched for existing issues, including closed ones, no similar questions. - required: true - - label: I confirm that I am using English to submit this report in order to facilitate communication. - required: true - - type: textarea - attributes: - label: Question details - description: | - Question details, clearly stated using proper markdown syntax. - validations: - required: true diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml deleted file mode 100644 index 524f04feb484e7af753366c038bd4925f59af60a..0000000000000000000000000000000000000000 --- a/.github/workflows/pre-commit.yaml +++ /dev/null @@ -1,14 +0,0 @@ -name: pre-commit - -on: - pull_request: - push: - branches: [main] - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 - - uses: pre-commit/action@v3.0.1 diff --git a/.github/workflows/publish-docker-image.yaml b/.github/workflows/publish-docker-image.yaml deleted file mode 100644 index 502c149e90765f57621dd032f801e9aaf311ed9f..0000000000000000000000000000000000000000 --- a/.github/workflows/publish-docker-image.yaml +++ /dev/null @@ -1,60 +0,0 @@ -name: Create and publish a Docker image - -# Configures this workflow to run every time a change is pushed to the branch called `release`. -on: - push: - branches: ['main'] - -# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. -jobs: - build-and-push-image: - runs-on: ubuntu-latest - # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. - permissions: - contents: read - packages: write - # - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Free Up GitHub Actions Ubuntu Runner Disk Space 🔧 - uses: jlumbroso/free-disk-space@main - with: - # This might remove tools that are actually needed, if set to "true" but frees about 6 GB - tool-cache: false - - # All of these default to true, but feel free to set to "false" if necessary for your workflow - android: true - dotnet: true - haskell: true - large-packages: false - swap-storage: false - docker-images: false - # Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here. - - name: Log in to the Container registry - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - # This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels. - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - # This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages. - # It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository. - # It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step. - - name: Build and push Docker image - uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 1f572cc141aefa1e6f11c8fe48bd646e5b4d73f1..0000000000000000000000000000000000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "src/third_party/BigVGAN"] - path = src/third_party/BigVGAN - url = https://github.com/NVIDIA/BigVGAN.git diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index 9ac5ee15dbedc84f6f4aed5a6aff4cf269209077..0000000000000000000000000000000000000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,14 +0,0 @@ -repos: - - repo: https://github.com/astral-sh/ruff-pre-commit - # Ruff version. - rev: v0.7.0 - hooks: - # Run the linter. - - id: ruff - args: [--fix] - # Run the formatter. - - id: ruff-format - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 - hooks: - - id: check-yaml diff --git a/Dockerfile b/Dockerfile index 33943fd5488fa0c658bba478503b55ba25c8a9f3..94b3a5b19dd3cc821d7aa9d12ef084823af646f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,17 +10,15 @@ RUN set -x \ && apt-get update \ && apt-get -y install wget curl man git less openssl libssl-dev unzip unar build-essential aria2 tmux vim \ && apt-get install -y openssh-server sox libsox-fmt-all libsox-fmt-mp3 libsndfile1-dev ffmpeg \ - && apt-get install -y librdmacm1 libibumad3 librdmacm-dev libibverbs1 libibverbs-dev ibverbs-utils ibverbs-providers \ && rm -rf /var/lib/apt/lists/* \ && apt-get clean - + WORKDIR /workspace RUN git clone https://github.com/SWivid/F5-TTS.git \ && cd F5-TTS \ - && git submodule update --init --recursive \ - && sed -i '7iimport sys\nsys.path.append(os.path.dirname(os.path.abspath(__file__)))' src/third_party/BigVGAN/bigvgan.py \ - && pip install -e . --no-cache-dir + && pip install --no-cache-dir -r requirements.txt \ + && pip install --no-cache-dir -r requirements_eval.txt ENV SHELL=/bin/bash diff --git a/README_REPO.md b/README_REPO.md index 3023f268e43287954334128e6ea0b17b3e2db17c..5efbd88f737772378ce8736b2ef4389068d0e798 100644 --- a/README_REPO.md +++ b/README_REPO.md @@ -16,133 +16,176 @@ ### Thanks to all the contributors ! -## News -- **2024/10/08**: F5-TTS & E2 TTS base models on [🤗 Hugging Face](https://huggingface.co/SWivid/F5-TTS), [🤖 Model Scope](https://www.modelscope.cn/models/SWivid/F5-TTS_Emilia-ZH-EN), [🟣 Wisemodel](https://wisemodel.cn/models/SJTU_X-LANCE/F5-TTS_Emilia-ZH-EN). - ## Installation -```bash -# Create a python 3.10 conda env (you could also use virtualenv) -conda create -n f5-tts python=3.10 -conda activate f5-tts +Clone the repository: -# Install pytorch with your CUDA version, e.g. -pip install torch==2.3.0+cu118 torchaudio==2.3.0+cu118 --extra-index-url https://download.pytorch.org/whl/cu118 +```bash +git clone https://github.com/SWivid/F5-TTS.git +cd F5-TTS ``` -Then you can choose from a few options below: - -### 1. As a pip package (if just for inference) +Install torch with your CUDA version, e.g. : ```bash -pip install git+https://github.com/SWivid/F5-TTS.git +pip install torch==2.3.0+cu118 --extra-index-url https://download.pytorch.org/whl/cu118 +pip install torchaudio==2.3.0+cu118 --extra-index-url https://download.pytorch.org/whl/cu118 ``` -### 2. Local editable (if also do training, finetuning) +Install other packages: ```bash -git clone https://github.com/SWivid/F5-TTS.git -cd F5-TTS -# git submodule update --init --recursive # (optional, if need bigvgan) -pip install -e . -``` -If initialize submodule, you should add the following code at the beginning of `src/third_party/BigVGAN/bigvgan.py`. -```python -import os -import sys -sys.path.append(os.path.dirname(os.path.abspath(__file__))) +pip install -r requirements.txt ``` -### 3. Docker usage +## Prepare Dataset + +Example data processing scripts for Emilia and Wenetspeech4TTS, and you may tailor your own one along with a Dataset class in `model/dataset.py`. + ```bash -# Build from Dockerfile -docker build -t f5tts:v1 . +# prepare custom dataset up to your need +# download corresponding dataset first, and fill in the path in scripts + +# Prepare the Emilia dataset +python scripts/prepare_emilia.py -# Or pull from GitHub Container Registry -docker pull ghcr.io/swivid/f5-tts:main +# Prepare the Wenetspeech4TTS dataset +python scripts/prepare_wenetspeech4tts.py ``` +## Training & Finetuning + +Once your datasets are prepared, you can start the training process. + +```bash +# setup accelerate config, e.g. use multi-gpu ddp, fp16 +# will be to: ~/.cache/huggingface/accelerate/default_config.yaml +accelerate config +accelerate launch train.py +``` +An initial guidance on Finetuning [#57](https://github.com/SWivid/F5-TTS/discussions/57). + +Gradio UI finetuning with `finetune_gradio.py` see [#143](https://github.com/SWivid/F5-TTS/discussions/143). ## Inference -### 1. Gradio App +The pretrained model checkpoints can be reached at [🤗 Hugging Face](https://huggingface.co/SWivid/F5-TTS) and [🤖 Model Scope](https://www.modelscope.cn/models/SWivid/F5-TTS_Emilia-ZH-EN), or automatically downloaded with `inference-cli` and `gradio_app`. -Currently supported features: +Currently support 30s for a single generation, which is the **TOTAL** length of prompt audio and the generated. Batch inference with chunks is supported by `inference-cli` and `gradio_app`. +- To avoid possible inference failures, make sure you have seen through the following instructions. +- A longer prompt audio allows shorter generated output. The part longer than 30s cannot be generated properly. Consider using a prompt audio <15s. +- Uppercased letters will be uttered letter by letter, so use lowercased letters for normal words. +- Add some spaces (blank: " ") or punctuations (e.g. "," ".") to explicitly introduce some pauses. If first few words skipped in code-switched generation (cuz different speed with different languages), this might help. + +### CLI Inference -- Basic TTS with Chunk Inference -- Multi-Style / Multi-Speaker Generation -- Voice Chat powered by Qwen2.5-3B-Instruct -- [Custom inference with more language support](src/f5_tts/infer/SHARED.md) +Either you can specify everything in `inference-cli.toml` or override with flags. Leave `--ref_text ""` will have ASR model transcribe the reference audio automatically (use extra GPU memory). If encounter network error, consider use local ckpt, just set `ckpt_path` in `inference-cli.py` ```bash -# Launch a Gradio app (web interface) -f5-tts_infer-gradio +python inference-cli.py \ +--model "F5-TTS" \ +--ref_audio "tests/ref_audio/test_en_1_ref_short.wav" \ +--ref_text "Some call me nature, others call me mother nature." \ +--gen_text "I don't really care what you call me. I've been a silent spectator, watching species evolve, empires rise and fall. But always remember, I am mighty and enduring. Respect me and I'll nurture you; ignore me and you shall face the consequences." + +python inference-cli.py \ +--model "E2-TTS" \ +--ref_audio "tests/ref_audio/test_zh_1_ref_short.wav" \ +--ref_text "对,这就是我,万人敬仰的太乙真人。" \ +--gen_text "突然,身边一阵笑声。我看着他们,意气风发地挺直了胸膛,甩了甩那稍显肉感的双臂,轻笑道,我身上的肉,是为了掩饰我爆棚的魅力,否则,岂不吓坏了你们呢?" + +# Multi voice +python inference-cli.py -c samples/story.toml +``` -# Specify the port/host -f5-tts_infer-gradio --port 7860 --host 0.0.0.0 +### Gradio App +Currently supported features: +- Chunk inference +- Podcast Generation +- Multiple Speech-Type Generation -# Launch a share link -f5-tts_infer-gradio --share +You can launch a Gradio app (web interface) to launch a GUI for inference (will load ckpt from Huggingface, you may set `ckpt_path` to local file in `gradio_app.py`). Currently load ASR model, F5-TTS and E2 TTS all in once, thus use more GPU memory than `inference-cli`. + +```bash +python gradio_app.py ``` -### 2. CLI Inference +You can specify the port/host: ```bash -# Run with flags -# Leave --ref_text "" will have ASR model transcribe (extra GPU memory usage) -f5-tts_infer-cli \ ---model "F5-TTS" \ ---ref_audio "ref_audio.wav" \ ---ref_text "The content, subtitle or transcription of reference audio." \ ---gen_text "Some text you want TTS model generate for you." +python gradio_app.py --port 7860 --host 0.0.0.0 +``` -# Run with default setting. src/f5_tts/infer/examples/basic/basic.toml -f5-tts_infer-cli -# Or with your own .toml file -f5-tts_infer-cli -c custom.toml +Or launch a share link: -# Multi voice. See src/f5_tts/infer/README.md -f5-tts_infer-cli -c src/f5_tts/infer/examples/multi/story.toml +```bash +python gradio_app.py --share ``` -### 3. More instructions +### Speech Editing + +To test speech editing capabilities, use the following command. -- In order to have better generation results, take a moment to read [detailed guidance](src/f5_tts/infer). -- The [Issues](https://github.com/SWivid/F5-TTS/issues?q=is%3Aissue) are very useful, please try to find the solution by properly searching the keywords of problem encountered. If no answer found, then feel free to open an issue. +```bash +python speech_edit.py +``` + +## Evaluation +### Prepare Test Datasets -## Training +1. Seed-TTS test set: Download from [seed-tts-eval](https://github.com/BytedanceSpeech/seed-tts-eval). +2. LibriSpeech test-clean: Download from [OpenSLR](http://www.openslr.org/12/). +3. Unzip the downloaded datasets and place them in the data/ directory. +4. Update the path for the test-clean data in `scripts/eval_infer_batch.py` +5. Our filtered LibriSpeech-PC 4-10s subset is already under data/ in this repo -### 1. Gradio App +### Batch Inference for Test Set -Read [training & finetuning guidance](src/f5_tts/train) for more instructions. +To run batch inference for evaluations, execute the following commands: ```bash -# Quick start with Gradio web interface -f5-tts_finetune-gradio +# batch inference for evaluations +accelerate config # if not set before +bash scripts/eval_infer_batch.sh ``` +### Download Evaluation Model Checkpoints -## [Evaluation](src/f5_tts/eval) +1. Chinese ASR Model: [Paraformer-zh](https://huggingface.co/funasr/paraformer-zh) +2. English ASR Model: [Faster-Whisper](https://huggingface.co/Systran/faster-whisper-large-v3) +3. WavLM Model: Download from [Google Drive](https://drive.google.com/file/d/1-aE1NfzpRCLxA4GUxX9ITI3F9LlbtEGP/view). +### Objective Evaluation -## Development +Install packages for evaluation: -Use pre-commit to ensure code quality (will run linters and formatters automatically) +```bash +pip install -r requirements_eval.txt +``` + +**Some Notes** + +For faster-whisper with CUDA 11: ```bash -pip install pre-commit -pre-commit install +pip install --force-reinstall ctranslate2==3.24.0 ``` -When making a pull request, before each commit, run: +(Recommended) To avoid possible ASR failures, such as abnormal repetitions in output: ```bash -pre-commit run --all-files +pip install faster-whisper==0.10.1 ``` -Note: Some model components have linting exceptions for E722 to accommodate tensor notation +Update the path with your batch-inferenced results, and carry out WER / SIM evaluations: +```bash +# Evaluation for Seed-TTS test set +python scripts/eval_seedtts_testset.py +# Evaluation for LibriSpeech-PC test-clean (cross-sentence) +python scripts/eval_librispeech_test_clean.py +``` ## Acknowledgements @@ -154,8 +197,7 @@ Note: Some model components have linting exceptions for E722 to accommodate tens - [FunASR](https://github.com/modelscope/FunASR), [faster-whisper](https://github.com/SYSTRAN/faster-whisper), [UniSpeech](https://github.com/microsoft/UniSpeech) for evaluation tools - [ctc-forced-aligner](https://github.com/MahmoudAshraf97/ctc-forced-aligner) for speech edit test - [mrfakename](https://x.com/realmrfakename) huggingface space demo ~ -- [f5-tts-mlx](https://github.com/lucasnewman/f5-tts-mlx/tree/main) Implementation with MLX framework by [Lucas Newman](https://github.com/lucasnewman) -- [F5-TTS-ONNX](https://github.com/DakeQQ/F5-TTS-ONNX) ONNX Runtime version by [DakeQQ](https://github.com/DakeQQ) +- [f5-tts-mlx](https://github.com/lucasnewman/f5-tts-mlx/tree/main) Implementation of F5-TTS, with the MLX framework. ## Citation If our work and codebase is useful for you, please cite as: diff --git a/api.py b/api.py deleted file mode 100644 index 1980f85c0964444c550324c7dca2c159ce4a61f9..0000000000000000000000000000000000000000 --- a/api.py +++ /dev/null @@ -1,132 +0,0 @@ -import soundfile as sf -import torch -import tqdm -from cached_path import cached_path - -from model import DiT, UNetT -from model.utils import save_spectrogram - -from model.utils_infer import load_vocoder, load_model, infer_process, remove_silence_for_generated_wav -from model.utils import seed_everything -import random -import sys - - -class F5TTS: - def __init__( - self, - model_type="F5-TTS", - ckpt_file="", - vocab_file="", - ode_method="euler", - use_ema=True, - local_path=None, - device=None, - ): - # Initialize parameters - self.final_wave = None - self.target_sample_rate = 24000 - self.n_mel_channels = 100 - self.hop_length = 256 - self.target_rms = 0.1 - self.seed = -1 - - # Set device - self.device = device or ( - "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu" - ) - - # Load models - self.load_vocoder_model(local_path) - self.load_ema_model(model_type, ckpt_file, vocab_file, ode_method, use_ema) - - def load_vocoder_model(self, local_path): - self.vocos = load_vocoder(local_path is not None, local_path, self.device) - - def load_ema_model(self, model_type, ckpt_file, vocab_file, ode_method, use_ema): - if model_type == "F5-TTS": - if not ckpt_file: - ckpt_file = str(cached_path("hf://SWivid/F5-TTS/F5TTS_Base/model_1200000.safetensors")) - model_cfg = dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4) - model_cls = DiT - elif model_type == "E2-TTS": - if not ckpt_file: - ckpt_file = str(cached_path("hf://SWivid/E2-TTS/E2TTS_Base/model_1200000.safetensors")) - model_cfg = dict(dim=1024, depth=24, heads=16, ff_mult=4) - model_cls = UNetT - else: - raise ValueError(f"Unknown model type: {model_type}") - - self.ema_model = load_model(model_cls, model_cfg, ckpt_file, vocab_file, ode_method, use_ema, self.device) - - def export_wav(self, wav, file_wave, remove_silence=False): - sf.write(file_wave, wav, self.target_sample_rate) - - if remove_silence: - remove_silence_for_generated_wav(file_wave) - - def export_spectrogram(self, spect, file_spect): - save_spectrogram(spect, file_spect) - - def infer( - self, - ref_file, - ref_text, - gen_text, - show_info=print, - progress=tqdm, - target_rms=0.1, - cross_fade_duration=0.15, - sway_sampling_coef=-1, - cfg_strength=2, - nfe_step=32, - speed=1.0, - fix_duration=None, - remove_silence=False, - file_wave=None, - file_spect=None, - seed=-1, - ): - if seed == -1: - seed = random.randint(0, sys.maxsize) - seed_everything(seed) - self.seed = seed - wav, sr, spect = infer_process( - ref_file, - ref_text, - gen_text, - self.ema_model, - show_info=show_info, - progress=progress, - target_rms=target_rms, - cross_fade_duration=cross_fade_duration, - nfe_step=nfe_step, - cfg_strength=cfg_strength, - sway_sampling_coef=sway_sampling_coef, - speed=speed, - fix_duration=fix_duration, - device=self.device, - ) - - if file_wave is not None: - self.export_wav(wav, file_wave, remove_silence) - - if file_spect is not None: - self.export_spectrogram(spect, file_spect) - - return wav, sr, spect - - -if __name__ == "__main__": - f5tts = F5TTS() - - wav, sr, spect = f5tts.infer( - ref_file="tests/ref_audio/test_en_1_ref_short.wav", - ref_text="some call me nature, others call me mother nature.", - gen_text="""I don't really care what you call me. I've been a silent spectator, watching species evolve, empires rise and fall. But always remember, I am mighty and enduring. Respect me and I'll nurture you; ignore me and you shall face the consequences.""", - file_wave="tests/out.wav", - file_spect="tests/out.png", - seed=-1, # random seed = -1 - ) - - print("seed :", f5tts.seed) diff --git a/app.py b/app.py index 869a73611859b6c54ca745c7e32fb4146723f244..a53b9656f0c4bdbb12b38c7ef197bddde54ecba6 100644 --- a/app.py +++ b/app.py @@ -1,169 +1,403 @@ -# ruff: noqa: E402 -# Above allows ruff to ignore E402: module level import not at top of file - import re -import tempfile -from collections import OrderedDict -from importlib.resources import files - -import click +import torch +import torchaudio import gradio as gr import numpy as np -import soundfile as sf -import torchaudio +import tempfile +from einops import rearrange +from vocos import Vocos +from pydub import AudioSegment, silence +from model import CFM, UNetT, DiT, MMDiT from cached_path import cached_path -from transformers import AutoModelForCausalLM, AutoTokenizer +from model.utils import ( + load_checkpoint, + get_tokenizer, + convert_char_to_pinyin, + save_spectrogram, +) +from transformers import pipeline +import click +import soundfile as sf try: import spaces - USING_SPACES = True except ImportError: USING_SPACES = False - def gpu_decorator(func): if USING_SPACES: return spaces.GPU(func) else: return func - -from f5_tts.model import DiT, UNetT -from f5_tts.infer.utils_infer import ( - load_vocoder, - load_model, - preprocess_ref_audio_text, - infer_process, - remove_silence_for_generated_wav, - save_spectrogram, +device = ( + "cuda" + if torch.cuda.is_available() + else "mps" if torch.backends.mps.is_available() else "cpu" ) +print(f"Using {device} device") -DEFAULT_TTS_MODEL = "F5-TTS" -tts_model_choice = DEFAULT_TTS_MODEL +pipe = pipeline( + "automatic-speech-recognition", + model="openai/whisper-large-v3-turbo", + torch_dtype=torch.float16, + device=device, +) +vocos = Vocos.from_pretrained("charactr/vocos-mel-24khz") + +# --------------------- Settings -------------------- # + +target_sample_rate = 24000 +n_mel_channels = 100 +hop_length = 256 +target_rms = 0.1 +nfe_step = 32 # 16, 32 +cfg_strength = 2.0 +ode_method = "euler" +sway_sampling_coef = -1.0 +speed = 1.0 +fix_duration = None + + +def load_model(repo_name, exp_name, model_cls, model_cfg, ckpt_step): + ckpt_path = str(cached_path(f"hf://SWivid/{repo_name}/{exp_name}/model_{ckpt_step}.safetensors")) + # ckpt_path = f"ckpts/{exp_name}/model_{ckpt_step}.pt" # .pt | .safetensors + vocab_char_map, vocab_size = get_tokenizer("Emilia_ZH_EN", "pinyin") + model = CFM( + transformer=model_cls( + **model_cfg, text_num_embeds=vocab_size, mel_dim=n_mel_channels + ), + mel_spec_kwargs=dict( + target_sample_rate=target_sample_rate, + n_mel_channels=n_mel_channels, + hop_length=hop_length, + ), + odeint_kwargs=dict( + method=ode_method, + ), + vocab_char_map=vocab_char_map, + ).to(device) + + model = load_checkpoint(model, ckpt_path, device, use_ema = True) + + return model # load models +F5TTS_model_cfg = dict( + dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4 +) +E2TTS_model_cfg = dict(dim=1024, depth=24, heads=16, ff_mult=4) -vocoder = load_vocoder() - +F5TTS_ema_model = load_model( + "F5-TTS", "F5TTS_Base", DiT, F5TTS_model_cfg, 1200000 +) +E2TTS_ema_model = load_model( + "E2-TTS", "E2TTS_Base", UNetT, E2TTS_model_cfg, 1200000 +) -def load_f5tts(ckpt_path=str(cached_path("hf://SWivid/F5-TTS/F5TTS_Base/model_1200000.safetensors"))): - F5TTS_model_cfg = dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4) - return load_model(DiT, F5TTS_model_cfg, ckpt_path) +def chunk_text(text, max_chars=135): + """ + Splits the input text into chunks, each with a maximum number of characters. + Args: + text (str): The text to be split. + max_chars (int): The maximum number of characters per chunk. -def load_e2tts(ckpt_path=str(cached_path("hf://SWivid/E2-TTS/E2TTS_Base/model_1200000.safetensors"))): - E2TTS_model_cfg = dict(dim=1024, depth=24, heads=16, ff_mult=4) - return load_model(UNetT, E2TTS_model_cfg, ckpt_path) + Returns: + List[str]: A list of text chunks. + """ + chunks = [] + current_chunk = "" + # Split the text into sentences based on punctuation followed by whitespace + sentences = re.split(r'(?<=[;:,.!?])\s+|(?<=[;:,。!?])', text) + + for sentence in sentences: + if len(current_chunk.encode('utf-8')) + len(sentence.encode('utf-8')) <= max_chars: + current_chunk += sentence + " " if sentence and len(sentence[-1].encode('utf-8')) == 1 else sentence + else: + if current_chunk: + chunks.append(current_chunk.strip()) + current_chunk = sentence + " " if sentence and len(sentence[-1].encode('utf-8')) == 1 else sentence + if current_chunk: + chunks.append(current_chunk.strip()) -def load_custom(ckpt_path: str, vocab_path="", model_cfg=None): - ckpt_path, vocab_path = ckpt_path.strip(), vocab_path.strip() - if ckpt_path.startswith("hf://"): - ckpt_path = str(cached_path(ckpt_path)) - if vocab_path.startswith("hf://"): - vocab_path = str(cached_path(vocab_path)) - if model_cfg is None: - model_cfg = dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4) - return load_model(DiT, model_cfg, ckpt_path, vocab_file=vocab_path) + return chunks +@gpu_decorator +def infer_batch(ref_audio, ref_text, gen_text_batches, exp_name, remove_silence, cross_fade_duration=0.15, progress=gr.Progress()): + if exp_name == "F5-TTS": + ema_model = F5TTS_ema_model + elif exp_name == "E2-TTS": + ema_model = E2TTS_ema_model -F5TTS_ema_model = load_f5tts() -E2TTS_ema_model = load_e2tts() if USING_SPACES else None -custom_ema_model, pre_custom_path = None, "" + audio, sr = ref_audio + if audio.shape[0] > 1: + audio = torch.mean(audio, dim=0, keepdim=True) + + rms = torch.sqrt(torch.mean(torch.square(audio))) + if rms < target_rms: + audio = audio * target_rms / rms + if sr != target_sample_rate: + resampler = torchaudio.transforms.Resample(sr, target_sample_rate) + audio = resampler(audio) + audio = audio.to(device) + + generated_waves = [] + spectrograms = [] + + for i, gen_text in enumerate(progress.tqdm(gen_text_batches)): + # Prepare the text + if len(ref_text[-1].encode('utf-8')) == 1: + ref_text = ref_text + " " + text_list = [ref_text + gen_text] + final_text_list = convert_char_to_pinyin(text_list) + + # Calculate duration + ref_audio_len = audio.shape[-1] // hop_length + zh_pause_punc = r"。,、;:?!" + ref_text_len = len(ref_text.encode('utf-8')) + 3 * len(re.findall(zh_pause_punc, ref_text)) + gen_text_len = len(gen_text.encode('utf-8')) + 3 * len(re.findall(zh_pause_punc, gen_text)) + duration = ref_audio_len + int(ref_audio_len / ref_text_len * gen_text_len / speed) + + # inference + with torch.inference_mode(): + generated, _ = ema_model.sample( + cond=audio, + text=final_text_list, + duration=duration, + steps=nfe_step, + cfg_strength=cfg_strength, + sway_sampling_coef=sway_sampling_coef, + ) -chat_model_state = None -chat_tokenizer_state = None + generated = generated[:, ref_audio_len:, :] + generated_mel_spec = rearrange(generated, "1 n d -> 1 d n") + generated_wave = vocos.decode(generated_mel_spec.cpu()) + if rms < target_rms: + generated_wave = generated_wave * rms / target_rms + + # wav -> numpy + generated_wave = generated_wave.squeeze().cpu().numpy() + + generated_waves.append(generated_wave) + spectrograms.append(generated_mel_spec[0].cpu().numpy()) + + # Combine all generated waves with cross-fading + if cross_fade_duration <= 0: + # Simply concatenate + final_wave = np.concatenate(generated_waves) + else: + final_wave = generated_waves[0] + for i in range(1, len(generated_waves)): + prev_wave = final_wave + next_wave = generated_waves[i] + # Calculate cross-fade samples, ensuring it does not exceed wave lengths + cross_fade_samples = int(cross_fade_duration * target_sample_rate) + cross_fade_samples = min(cross_fade_samples, len(prev_wave), len(next_wave)) -@gpu_decorator -def generate_response(messages, model, tokenizer): - """Generate response using Qwen""" - text = tokenizer.apply_chat_template( - messages, - tokenize=False, - add_generation_prompt=True, - ) + if cross_fade_samples <= 0: + # No overlap possible, concatenate + final_wave = np.concatenate([prev_wave, next_wave]) + continue - model_inputs = tokenizer([text], return_tensors="pt").to(model.device) - generated_ids = model.generate( - **model_inputs, - max_new_tokens=512, - temperature=0.7, - top_p=0.95, - ) + # Overlapping parts + prev_overlap = prev_wave[-cross_fade_samples:] + next_overlap = next_wave[:cross_fade_samples] - generated_ids = [ - output_ids[len(input_ids) :] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids) - ] - return tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0] + # Fade out and fade in + fade_out = np.linspace(1, 0, cross_fade_samples) + fade_in = np.linspace(0, 1, cross_fade_samples) + # Cross-faded overlap + cross_faded_overlap = prev_overlap * fade_out + next_overlap * fade_in -@gpu_decorator -def infer( - ref_audio_orig, ref_text, gen_text, model, remove_silence, cross_fade_duration=0.15, speed=1, show_info=gr.Info -): - ref_audio, ref_text = preprocess_ref_audio_text(ref_audio_orig, ref_text, show_info=show_info) + # Combine + new_wave = np.concatenate([ + prev_wave[:-cross_fade_samples], + cross_faded_overlap, + next_wave[cross_fade_samples:] + ]) - if model == "F5-TTS": - ema_model = F5TTS_ema_model - elif model == "E2-TTS": - global E2TTS_ema_model - if E2TTS_ema_model is None: - show_info("Loading E2-TTS model...") - E2TTS_ema_model = load_e2tts() - ema_model = E2TTS_ema_model - elif isinstance(model, list) and model[0] == "Custom": - assert not USING_SPACES, "Only official checkpoints allowed in Spaces." - global custom_ema_model, pre_custom_path - if pre_custom_path != model[1]: - show_info("Loading Custom TTS model...") - custom_ema_model = load_custom(model[1], vocab_path=model[2]) - pre_custom_path = model[1] - ema_model = custom_ema_model - - final_wave, final_sample_rate, combined_spectrogram = infer_process( - ref_audio, - ref_text, - gen_text, - ema_model, - vocoder, - cross_fade_duration=cross_fade_duration, - speed=speed, - show_info=show_info, - progress=gr.Progress(), - ) + final_wave = new_wave # Remove silence if remove_silence: with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f: - sf.write(f.name, final_wave, final_sample_rate) - remove_silence_for_generated_wav(f.name) + sf.write(f.name, final_wave, target_sample_rate) + aseg = AudioSegment.from_file(f.name) + non_silent_segs = silence.split_on_silence(aseg, min_silence_len=1000, silence_thresh=-50, keep_silence=500) + non_silent_wave = AudioSegment.silent(duration=0) + for non_silent_seg in non_silent_segs: + non_silent_wave += non_silent_seg + aseg = non_silent_wave + aseg.export(f.name, format="wav") final_wave, _ = torchaudio.load(f.name) final_wave = final_wave.squeeze().cpu().numpy() - # Save the spectrogram + # Create a combined spectrogram + combined_spectrogram = np.concatenate(spectrograms, axis=1) + with tempfile.NamedTemporaryFile(suffix=".png", delete=False) as tmp_spectrogram: spectrogram_path = tmp_spectrogram.name save_spectrogram(combined_spectrogram, spectrogram_path) - return (final_sample_rate, final_wave), spectrogram_path, ref_text + return (target_sample_rate, final_wave), spectrogram_path + +@gpu_decorator +def infer(ref_audio_orig, ref_text, gen_text, exp_name, remove_silence, cross_fade_duration=0.15): + + print(gen_text) + + gr.Info("Converting audio...") + with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f: + aseg = AudioSegment.from_file(ref_audio_orig) + + non_silent_segs = silence.split_on_silence( + aseg, min_silence_len=1000, silence_thresh=-50, keep_silence=1000 + ) + non_silent_wave = AudioSegment.silent(duration=0) + for non_silent_seg in non_silent_segs: + non_silent_wave += non_silent_seg + aseg = non_silent_wave + + audio_duration = len(aseg) + if audio_duration > 15000: + gr.Warning("Audio is over 15s, clipping to only first 15s.") + aseg = aseg[:15000] + aseg.export(f.name, format="wav") + ref_audio = f.name + + if not ref_text.strip(): + gr.Info("No reference text provided, transcribing reference audio...") + ref_text = pipe( + ref_audio, + chunk_length_s=30, + batch_size=128, + generate_kwargs={"task": "transcribe"}, + return_timestamps=False, + )["text"].strip() + gr.Info("Finished transcription") + else: + gr.Info("Using custom reference text...") + + # Add the functionality to ensure it ends with ". " + if not ref_text.endswith(". "): + if ref_text.endswith("."): + ref_text += " " + else: + ref_text += ". " + + audio, sr = torchaudio.load(ref_audio) + + # Use the new chunk_text function to split gen_text + max_chars = int(len(ref_text.encode('utf-8')) / (audio.shape[-1] / sr) * (25 - audio.shape[-1] / sr)) + gen_text_batches = chunk_text(gen_text, max_chars=max_chars) + print('ref_text', ref_text) + for i, batch_text in enumerate(gen_text_batches): + print(f'gen_text {i}', batch_text) + + gr.Info(f"Generating audio using {exp_name} in {len(gen_text_batches)} batches") + return infer_batch((audio, sr), ref_text, gen_text_batches, exp_name, remove_silence, cross_fade_duration) + + +@gpu_decorator +def generate_podcast(script, speaker1_name, ref_audio1, ref_text1, speaker2_name, ref_audio2, ref_text2, exp_name, remove_silence): + # Split the script into speaker blocks + speaker_pattern = re.compile(f"^({re.escape(speaker1_name)}|{re.escape(speaker2_name)}):", re.MULTILINE) + speaker_blocks = speaker_pattern.split(script)[1:] # Skip the first empty element + + generated_audio_segments = [] + + for i in range(0, len(speaker_blocks), 2): + speaker = speaker_blocks[i] + text = speaker_blocks[i+1].strip() + + # Determine which speaker is talking + if speaker == speaker1_name: + ref_audio = ref_audio1 + ref_text = ref_text1 + elif speaker == speaker2_name: + ref_audio = ref_audio2 + ref_text = ref_text2 + else: + continue # Skip if the speaker is neither speaker1 nor speaker2 + + # Generate audio for this block + audio, _ = infer(ref_audio, ref_text, text, exp_name, remove_silence) + + # Convert the generated audio to a numpy array + sr, audio_data = audio + + # Save the audio data as a WAV file + with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as temp_file: + sf.write(temp_file.name, audio_data, sr) + audio_segment = AudioSegment.from_wav(temp_file.name) + + generated_audio_segments.append(audio_segment) + + # Add a short pause between speakers + pause = AudioSegment.silent(duration=500) # 500ms pause + generated_audio_segments.append(pause) + + # Concatenate all audio segments + final_podcast = sum(generated_audio_segments) + + # Export the final podcast + with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as temp_file: + podcast_path = temp_file.name + final_podcast.export(podcast_path, format="wav") + + return podcast_path + +def parse_speechtypes_text(gen_text): + # Pattern to find (Emotion) + pattern = r'\((.*?)\)' + + # Split the text by the pattern + tokens = re.split(pattern, gen_text) + + segments = [] + current_emotion = 'Regular' + + for i in range(len(tokens)): + if i % 2 == 0: + # This is text + text = tokens[i].strip() + if text: + segments.append({'emotion': current_emotion, 'text': text}) + else: + # This is emotion + emotion = tokens[i].strip() + current_emotion = emotion + + return segments + +def update_speed(new_speed): + global speed + speed = new_speed + return f"Speed set to: {speed}" with gr.Blocks() as app_credits: gr.Markdown(""" # Credits * [mrfakename](https://github.com/fakerybakery) for the original [online demo](https://huggingface.co/spaces/mrfakename/E2-F5-TTS) -* [RootingInLoad](https://github.com/RootingInLoad) for initial chunk generation and podcast app exploration -* [jpgallegoar](https://github.com/jpgallegoar) for multiple speech-type generation & voice chat +* [RootingInLoad](https://github.com/RootingInLoad) for the podcast generation +* [jpgallegoar](https://github.com/jpgallegoar) for multiple speech-type generation """) with gr.Blocks() as app_tts: gr.Markdown("# Batched TTS") ref_audio_input = gr.Audio(label="Reference Audio", type="filepath") gen_text_input = gr.Textbox(label="Text to Generate", lines=10) + model_choice = gr.Radio( + choices=["F5-TTS", "E2-TTS"], label="Choose TTS Model", value="F5-TTS" + ) generate_btn = gr.Button("Synthesize", variant="primary") with gr.Accordion("Advanced Settings", open=False): ref_text_input = gr.Textbox( @@ -180,7 +414,7 @@ with gr.Blocks() as app_tts: label="Speed", minimum=0.3, maximum=2.0, - value=1.0, + value=speed, step=0.1, info="Adjust the speed of the audio.", ) @@ -192,302 +426,301 @@ with gr.Blocks() as app_tts: step=0.01, info="Set the duration of the cross-fade between audio clips.", ) + speed_slider.change(update_speed, inputs=speed_slider) audio_output = gr.Audio(label="Synthesized Audio") spectrogram_output = gr.Image(label="Spectrogram") - @gpu_decorator - def basic_tts( - ref_audio_input, - ref_text_input, - gen_text_input, - remove_silence, - cross_fade_duration_slider, - speed_slider, - ): - audio_out, spectrogram_path, ref_text_out = infer( - ref_audio_input, - ref_text_input, - gen_text_input, - tts_model_choice, - remove_silence, - cross_fade_duration_slider, - speed_slider, - ) - return audio_out, spectrogram_path, gr.update(value=ref_text_out) - generate_btn.click( - basic_tts, + infer, inputs=[ ref_audio_input, ref_text_input, gen_text_input, + model_choice, remove_silence, cross_fade_duration_slider, - speed_slider, ], - outputs=[audio_output, spectrogram_output, ref_text_input], + outputs=[audio_output, spectrogram_output], + ) + +with gr.Blocks() as app_podcast: + gr.Markdown("# Podcast Generation") + speaker1_name = gr.Textbox(label="Speaker 1 Name") + ref_audio_input1 = gr.Audio(label="Reference Audio (Speaker 1)", type="filepath") + ref_text_input1 = gr.Textbox(label="Reference Text (Speaker 1)", lines=2) + + speaker2_name = gr.Textbox(label="Speaker 2 Name") + ref_audio_input2 = gr.Audio(label="Reference Audio (Speaker 2)", type="filepath") + ref_text_input2 = gr.Textbox(label="Reference Text (Speaker 2)", lines=2) + + script_input = gr.Textbox(label="Podcast Script", lines=10, + placeholder="Enter the script with speaker names at the start of each block, e.g.:\nSean: How did you start studying...\n\nMeghan: I came to my interest in technology...\nIt was a long journey...\n\nSean: That's fascinating. Can you elaborate...") + + podcast_model_choice = gr.Radio( + choices=["F5-TTS", "E2-TTS"], label="Choose TTS Model", value="F5-TTS" + ) + podcast_remove_silence = gr.Checkbox( + label="Remove Silences", + value=True, ) + generate_podcast_btn = gr.Button("Generate Podcast", variant="primary") + podcast_output = gr.Audio(label="Generated Podcast") + def podcast_generation(script, speaker1, ref_audio1, ref_text1, speaker2, ref_audio2, ref_text2, model, remove_silence): + return generate_podcast(script, speaker1, ref_audio1, ref_text1, speaker2, ref_audio2, ref_text2, model, remove_silence) -def parse_speechtypes_text(gen_text): - # Pattern to find {speechtype} - pattern = r"\{(.*?)\}" + generate_podcast_btn.click( + podcast_generation, + inputs=[ + script_input, + speaker1_name, + ref_audio_input1, + ref_text_input1, + speaker2_name, + ref_audio_input2, + ref_text_input2, + podcast_model_choice, + podcast_remove_silence, + ], + outputs=podcast_output, + ) + +def parse_emotional_text(gen_text): + # Pattern to find (Emotion) + pattern = r'\((.*?)\)' # Split the text by the pattern tokens = re.split(pattern, gen_text) segments = [] - current_style = "Regular" + current_emotion = 'Regular' for i in range(len(tokens)): if i % 2 == 0: # This is text text = tokens[i].strip() if text: - segments.append({"style": current_style, "text": text}) + segments.append({'emotion': current_emotion, 'text': text}) else: - # This is style - style = tokens[i].strip() - current_style = style + # This is emotion + emotion = tokens[i].strip() + current_emotion = emotion return segments - -with gr.Blocks() as app_multistyle: - # New section for multistyle generation +with gr.Blocks() as app_emotional: + # New section for emotional generation gr.Markdown( """ # Multiple Speech-Type Generation - This section allows you to generate multiple speech types or multiple people's voices. Enter your text in the format shown below, and the system will generate speech using the appropriate type. If unspecified, the model will use the regular speech type. The current speech type will be used until the next speech type is specified. - """ - ) + This section allows you to upload different audio clips for each speech type. 'Regular' emotion is mandatory. You can add additional speech types by clicking the "Add Speech Type" button. Enter your text in the format shown below, and the system will generate speech using the appropriate emotions. If unspecified, the model will use the regular speech type. The current speech type will be used until the next speech type is specified. - with gr.Row(): - gr.Markdown( - """ - **Example Input:** - {Regular} Hello, I'd like to order a sandwich please. - {Surprised} What do you mean you're out of bread? - {Sad} I really wanted a sandwich though... - {Angry} You know what, darn you and your little shop! - {Whisper} I'll just go back home and cry now. - {Shouting} Why me?! - """ - ) + **Example Input:** - gr.Markdown( - """ - **Example Input 2:** - {Speaker1_Happy} Hello, I'd like to order a sandwich please. - {Speaker2_Regular} Sorry, we're out of bread. - {Speaker1_Sad} I really wanted a sandwich though... - {Speaker2_Whisper} I'll give you the last one I was hiding. - """ - ) - - gr.Markdown( - "Upload different audio clips for each speech type. The first speech type is mandatory. You can add additional speech types by clicking the 'Add Speech Type' button." + (Regular) Hello, I'd like to order a sandwich please. (Surprised) What do you mean you're out of bread? (Sad) I really wanted a sandwich though... (Angry) You know what, darn you and your little shop, you suck! (Whisper) I'll just go back home and cry now. (Shouting) Why me?! + """ ) + gr.Markdown("Upload different audio clips for each speech type. 'Regular' emotion is mandatory. You can add additional speech types by clicking the 'Add Speech Type' button.") + # Regular speech type (mandatory) with gr.Row(): - with gr.Column(): - regular_name = gr.Textbox(value="Regular", label="Speech Type Name") - regular_insert = gr.Button("Insert Label", variant="secondary") - regular_audio = gr.Audio(label="Regular Reference Audio", type="filepath") - regular_ref_text = gr.Textbox(label="Reference Text (Regular)", lines=2) + regular_name = gr.Textbox(value='Regular', label='Speech Type Name', interactive=False) + regular_audio = gr.Audio(label='Regular Reference Audio', type='filepath') + regular_ref_text = gr.Textbox(label='Reference Text (Regular)', lines=2) - # Regular speech type (max 100) + # Additional speech types (up to 99 more) max_speech_types = 100 - speech_type_rows = [] # 99 - speech_type_names = [regular_name] # 100 - speech_type_audios = [regular_audio] # 100 - speech_type_ref_texts = [regular_ref_text] # 100 - speech_type_delete_btns = [] # 99 - speech_type_insert_btns = [regular_insert] # 100 - - # Additional speech types (99 more) + speech_type_names = [] + speech_type_audios = [] + speech_type_ref_texts = [] + speech_type_delete_btns = [] + for i in range(max_speech_types - 1): - with gr.Row(visible=False) as row: - with gr.Column(): - name_input = gr.Textbox(label="Speech Type Name") - delete_btn = gr.Button("Delete Type", variant="secondary") - insert_btn = gr.Button("Insert Label", variant="secondary") - audio_input = gr.Audio(label="Reference Audio", type="filepath") - ref_text_input = gr.Textbox(label="Reference Text", lines=2) - speech_type_rows.append(row) + with gr.Row(): + name_input = gr.Textbox(label='Speech Type Name', visible=False) + audio_input = gr.Audio(label='Reference Audio', type='filepath', visible=False) + ref_text_input = gr.Textbox(label='Reference Text', lines=2, visible=False) + delete_btn = gr.Button("Delete", variant="secondary", visible=False) speech_type_names.append(name_input) speech_type_audios.append(audio_input) speech_type_ref_texts.append(ref_text_input) speech_type_delete_btns.append(delete_btn) - speech_type_insert_btns.append(insert_btn) # Button to add speech type add_speech_type_btn = gr.Button("Add Speech Type") # Keep track of current number of speech types - speech_type_count = gr.State(value=1) + speech_type_count = gr.State(value=0) # Function to add a speech type def add_speech_type_fn(speech_type_count): - if speech_type_count < max_speech_types: + if speech_type_count < max_speech_types - 1: speech_type_count += 1 - # Prepare updates for the rows - row_updates = [] - for i in range(1, max_speech_types): + # Prepare updates for the components + name_updates = [] + audio_updates = [] + ref_text_updates = [] + delete_btn_updates = [] + for i in range(max_speech_types - 1): if i < speech_type_count: - row_updates.append(gr.update(visible=True)) + name_updates.append(gr.update(visible=True)) + audio_updates.append(gr.update(visible=True)) + ref_text_updates.append(gr.update(visible=True)) + delete_btn_updates.append(gr.update(visible=True)) else: - row_updates.append(gr.update()) + name_updates.append(gr.update()) + audio_updates.append(gr.update()) + ref_text_updates.append(gr.update()) + delete_btn_updates.append(gr.update()) else: # Optionally, show a warning - row_updates = [gr.update() for _ in range(1, max_speech_types)] - return [speech_type_count] + row_updates + # gr.Warning("Maximum number of speech types reached.") + name_updates = [gr.update() for _ in range(max_speech_types - 1)] + audio_updates = [gr.update() for _ in range(max_speech_types - 1)] + ref_text_updates = [gr.update() for _ in range(max_speech_types - 1)] + delete_btn_updates = [gr.update() for _ in range(max_speech_types - 1)] + return [speech_type_count] + name_updates + audio_updates + ref_text_updates + delete_btn_updates add_speech_type_btn.click( - add_speech_type_fn, inputs=speech_type_count, outputs=[speech_type_count] + speech_type_rows + add_speech_type_fn, + inputs=speech_type_count, + outputs=[speech_type_count] + speech_type_names + speech_type_audios + speech_type_ref_texts + speech_type_delete_btns ) # Function to delete a speech type def make_delete_speech_type_fn(index): def delete_speech_type_fn(speech_type_count): # Prepare updates - row_updates = [] + name_updates = [] + audio_updates = [] + ref_text_updates = [] + delete_btn_updates = [] - for i in range(1, max_speech_types): + for i in range(max_speech_types - 1): if i == index: - row_updates.append(gr.update(visible=False)) + name_updates.append(gr.update(visible=False, value='')) + audio_updates.append(gr.update(visible=False, value=None)) + ref_text_updates.append(gr.update(visible=False, value='')) + delete_btn_updates.append(gr.update(visible=False)) else: - row_updates.append(gr.update()) + name_updates.append(gr.update()) + audio_updates.append(gr.update()) + ref_text_updates.append(gr.update()) + delete_btn_updates.append(gr.update()) - speech_type_count = max(1, speech_type_count) + speech_type_count = max(0, speech_type_count - 1) - return [speech_type_count] + row_updates + return [speech_type_count] + name_updates + audio_updates + ref_text_updates + delete_btn_updates return delete_speech_type_fn - # Update delete button clicks for i, delete_btn in enumerate(speech_type_delete_btns): delete_fn = make_delete_speech_type_fn(i) - delete_btn.click(delete_fn, inputs=speech_type_count, outputs=[speech_type_count] + speech_type_rows) + delete_btn.click( + delete_fn, + inputs=speech_type_count, + outputs=[speech_type_count] + speech_type_names + speech_type_audios + speech_type_ref_texts + speech_type_delete_btns + ) # Text input for the prompt - gen_text_input_multistyle = gr.Textbox( - label="Text to Generate", - lines=10, - placeholder="Enter the script with speaker names (or emotion types) at the start of each block, e.g.:\n\n{Regular} Hello, I'd like to order a sandwich please.\n{Surprised} What do you mean you're out of bread?\n{Sad} I really wanted a sandwich though...\n{Angry} You know what, darn you and your little shop!\n{Whisper} I'll just go back home and cry now.\n{Shouting} Why me?!", - ) + gen_text_input_emotional = gr.Textbox(label="Text to Generate", lines=10) - def make_insert_speech_type_fn(index): - def insert_speech_type_fn(current_text, speech_type_name): - current_text = current_text or "" - speech_type_name = speech_type_name or "None" - updated_text = current_text + f"{{{speech_type_name}}} " - return gr.update(value=updated_text) - - return insert_speech_type_fn - - for i, insert_btn in enumerate(speech_type_insert_btns): - insert_fn = make_insert_speech_type_fn(i) - insert_btn.click( - insert_fn, - inputs=[gen_text_input_multistyle, speech_type_names[i]], - outputs=gen_text_input_multistyle, - ) + # Model choice + model_choice_emotional = gr.Radio( + choices=["F5-TTS", "E2-TTS"], label="Choose TTS Model", value="F5-TTS" + ) with gr.Accordion("Advanced Settings", open=False): - remove_silence_multistyle = gr.Checkbox( + remove_silence_emotional = gr.Checkbox( label="Remove Silences", value=True, ) # Generate button - generate_multistyle_btn = gr.Button("Generate Multi-Style Speech", variant="primary") + generate_emotional_btn = gr.Button("Generate Emotional Speech", variant="primary") # Output audio - audio_output_multistyle = gr.Audio(label="Synthesized Audio") - + audio_output_emotional = gr.Audio(label="Synthesized Audio") @gpu_decorator - def generate_multistyle_speech( + def generate_emotional_speech( + regular_audio, + regular_ref_text, gen_text, *args, ): - speech_type_names_list = args[:max_speech_types] - speech_type_audios_list = args[max_speech_types : 2 * max_speech_types] - speech_type_ref_texts_list = args[2 * max_speech_types : 3 * max_speech_types] - remove_silence = args[3 * max_speech_types] + num_additional_speech_types = max_speech_types - 1 + speech_type_names_list = args[:num_additional_speech_types] + speech_type_audios_list = args[num_additional_speech_types:2 * num_additional_speech_types] + speech_type_ref_texts_list = args[2 * num_additional_speech_types:3 * num_additional_speech_types] + model_choice = args[3 * num_additional_speech_types] + remove_silence = args[3 * num_additional_speech_types + 1] + # Collect the speech types and their audios into a dict - speech_types = OrderedDict() + speech_types = {'Regular': {'audio': regular_audio, 'ref_text': regular_ref_text}} - ref_text_idx = 0 - for name_input, audio_input, ref_text_input in zip( - speech_type_names_list, speech_type_audios_list, speech_type_ref_texts_list - ): + for name_input, audio_input, ref_text_input in zip(speech_type_names_list, speech_type_audios_list, speech_type_ref_texts_list): if name_input and audio_input: - speech_types[name_input] = {"audio": audio_input, "ref_text": ref_text_input} - else: - speech_types[f"@{ref_text_idx}@"] = {"audio": "", "ref_text": ""} - ref_text_idx += 1 + speech_types[name_input] = {'audio': audio_input, 'ref_text': ref_text_input} # Parse the gen_text into segments segments = parse_speechtypes_text(gen_text) # For each segment, generate speech generated_audio_segments = [] - current_style = "Regular" + current_emotion = 'Regular' for segment in segments: - style = segment["style"] - text = segment["text"] + emotion = segment['emotion'] + text = segment['text'] - if style in speech_types: - current_style = style + if emotion in speech_types: + current_emotion = emotion else: - # If style not available, default to Regular - current_style = "Regular" + # If emotion not available, default to Regular + current_emotion = 'Regular' - ref_audio = speech_types[current_style]["audio"] - ref_text = speech_types[current_style].get("ref_text", "") + ref_audio = speech_types[current_emotion]['audio'] + ref_text = speech_types[current_emotion].get('ref_text', '') # Generate speech for this segment - audio_out, _, ref_text_out = infer( - ref_audio, ref_text, text, tts_model_choice, remove_silence, 0, show_info=print - ) # show_info=print no pull to top when generating - sr, audio_data = audio_out + audio, _ = infer(ref_audio, ref_text, text, model_choice, remove_silence, 0) + sr, audio_data = audio generated_audio_segments.append(audio_data) - speech_types[current_style]["ref_text"] = ref_text_out # Concatenate all audio segments if generated_audio_segments: final_audio_data = np.concatenate(generated_audio_segments) - return [(sr, final_audio_data)] + [ - gr.update(value=speech_types[style]["ref_text"]) for style in speech_types - ] + return (sr, final_audio_data) else: gr.Warning("No audio generated.") - return [None] + [gr.update(value=speech_types[style]["ref_text"]) for style in speech_types] + return None - generate_multistyle_btn.click( - generate_multistyle_speech, + generate_emotional_btn.click( + generate_emotional_speech, inputs=[ - gen_text_input_multistyle, - ] - + speech_type_names - + speech_type_audios - + speech_type_ref_texts - + [ - remove_silence_multistyle, + regular_audio, + regular_ref_text, + gen_text_input_emotional, + ] + speech_type_names + speech_type_audios + speech_type_ref_texts + [ + model_choice_emotional, + remove_silence_emotional, ], - outputs=[audio_output_multistyle] + speech_type_ref_texts, + outputs=audio_output_emotional, ) # Validation function to disable Generate button if speech types are missing - def validate_speech_types(gen_text, regular_name, *args): - speech_type_names_list = args[:max_speech_types] + def validate_speech_types( + gen_text, + regular_name, + *args + ): + num_additional_speech_types = max_speech_types - 1 + speech_type_names_list = args[:num_additional_speech_types] # Collect the speech types names speech_types_available = set() @@ -498,8 +731,8 @@ with gr.Blocks() as app_multistyle: speech_types_available.add(name_input) # Parse the gen_text to get the speech types used - segments = parse_speechtypes_text(gen_text) - speech_types_in_text = set(segment["style"] for segment in segments) + segments = parse_emotional_text(gen_text) + speech_types_in_text = set(segment['emotion'] for segment in segments) # Check if all speech types in text are available missing_speech_types = speech_types_in_text - speech_types_available @@ -511,221 +744,11 @@ with gr.Blocks() as app_multistyle: # Enable the generate button return gr.update(interactive=True) - gen_text_input_multistyle.change( + gen_text_input_emotional.change( validate_speech_types, - inputs=[gen_text_input_multistyle, regular_name] + speech_type_names, - outputs=generate_multistyle_btn, + inputs=[gen_text_input_emotional, regular_name] + speech_type_names, + outputs=generate_emotional_btn ) - - -with gr.Blocks() as app_chat: - gr.Markdown( - """ -# Voice Chat -Have a conversation with an AI using your reference voice! -1. Upload a reference audio clip and optionally its transcript. -2. Load the chat model. -3. Record your message through your microphone. -4. The AI will respond using the reference voice. -""" - ) - - if not USING_SPACES: - load_chat_model_btn = gr.Button("Load Chat Model", variant="primary") - - chat_interface_container = gr.Column(visible=False) - - @gpu_decorator - def load_chat_model(): - global chat_model_state, chat_tokenizer_state - if chat_model_state is None: - show_info = gr.Info - show_info("Loading chat model...") - model_name = "Qwen/Qwen2.5-3B-Instruct" - chat_model_state = AutoModelForCausalLM.from_pretrained( - model_name, torch_dtype="auto", device_map="auto" - ) - chat_tokenizer_state = AutoTokenizer.from_pretrained(model_name) - show_info("Chat model loaded.") - - return gr.update(visible=False), gr.update(visible=True) - - load_chat_model_btn.click(load_chat_model, outputs=[load_chat_model_btn, chat_interface_container]) - - else: - chat_interface_container = gr.Column() - - if chat_model_state is None: - model_name = "Qwen/Qwen2.5-3B-Instruct" - chat_model_state = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", device_map="auto") - chat_tokenizer_state = AutoTokenizer.from_pretrained(model_name) - - with chat_interface_container: - with gr.Row(): - with gr.Column(): - ref_audio_chat = gr.Audio(label="Reference Audio", type="filepath") - with gr.Column(): - with gr.Accordion("Advanced Settings", open=False): - remove_silence_chat = gr.Checkbox( - label="Remove Silences", - value=True, - ) - ref_text_chat = gr.Textbox( - label="Reference Text", - info="Optional: Leave blank to auto-transcribe", - lines=2, - ) - system_prompt_chat = gr.Textbox( - label="System Prompt", - value="You are not an AI assistant, you are whoever the user says you are. You must stay in character. Keep your responses concise since they will be spoken out loud.", - lines=2, - ) - - chatbot_interface = gr.Chatbot(label="Conversation") - - with gr.Row(): - with gr.Column(): - audio_input_chat = gr.Microphone( - label="Speak your message", - type="filepath", - ) - audio_output_chat = gr.Audio(autoplay=True) - with gr.Column(): - text_input_chat = gr.Textbox( - label="Type your message", - lines=1, - ) - send_btn_chat = gr.Button("Send Message") - clear_btn_chat = gr.Button("Clear Conversation") - - conversation_state = gr.State( - value=[ - { - "role": "system", - "content": "You are not an AI assistant, you are whoever the user says you are. You must stay in character. Keep your responses concise since they will be spoken out loud.", - } - ] - ) - - # Modify process_audio_input to use model and tokenizer from state - @gpu_decorator - def process_audio_input(audio_path, text, history, conv_state): - """Handle audio or text input from user""" - - if not audio_path and not text.strip(): - return history, conv_state, "" - - if audio_path: - text = preprocess_ref_audio_text(audio_path, text)[1] - - if not text.strip(): - return history, conv_state, "" - - conv_state.append({"role": "user", "content": text}) - history.append((text, None)) - - response = generate_response(conv_state, chat_model_state, chat_tokenizer_state) - - conv_state.append({"role": "assistant", "content": response}) - history[-1] = (text, response) - - return history, conv_state, "" - - @gpu_decorator - def generate_audio_response(history, ref_audio, ref_text, remove_silence): - """Generate TTS audio for AI response""" - if not history or not ref_audio: - return None - - last_user_message, last_ai_response = history[-1] - if not last_ai_response: - return None - - audio_result, _, ref_text_out = infer( - ref_audio, - ref_text, - last_ai_response, - tts_model_choice, - remove_silence, - cross_fade_duration=0.15, - speed=1.0, - show_info=print, # show_info=print no pull to top when generating - ) - return audio_result, gr.update(value=ref_text_out) - - def clear_conversation(): - """Reset the conversation""" - return [], [ - { - "role": "system", - "content": "You are not an AI assistant, you are whoever the user says you are. You must stay in character. Keep your responses concise since they will be spoken out loud.", - } - ] - - def update_system_prompt(new_prompt): - """Update the system prompt and reset the conversation""" - new_conv_state = [{"role": "system", "content": new_prompt}] - return [], new_conv_state - - # Handle audio input - audio_input_chat.stop_recording( - process_audio_input, - inputs=[audio_input_chat, text_input_chat, chatbot_interface, conversation_state], - outputs=[chatbot_interface, conversation_state], - ).then( - generate_audio_response, - inputs=[chatbot_interface, ref_audio_chat, ref_text_chat, remove_silence_chat], - outputs=[audio_output_chat, ref_text_chat], - ).then( - lambda: None, - None, - audio_input_chat, - ) - - # Handle text input - text_input_chat.submit( - process_audio_input, - inputs=[audio_input_chat, text_input_chat, chatbot_interface, conversation_state], - outputs=[chatbot_interface, conversation_state], - ).then( - generate_audio_response, - inputs=[chatbot_interface, ref_audio_chat, ref_text_chat, remove_silence_chat], - outputs=[audio_output_chat, ref_text_chat], - ).then( - lambda: None, - None, - text_input_chat, - ) - - # Handle send button - send_btn_chat.click( - process_audio_input, - inputs=[audio_input_chat, text_input_chat, chatbot_interface, conversation_state], - outputs=[chatbot_interface, conversation_state], - ).then( - generate_audio_response, - inputs=[chatbot_interface, ref_audio_chat, ref_text_chat, remove_silence_chat], - outputs=[audio_output_chat, ref_text_chat], - ).then( - lambda: None, - None, - text_input_chat, - ) - - # Handle clear button - clear_btn_chat.click( - clear_conversation, - outputs=[chatbot_interface, conversation_state], - ) - - # Handle system prompt change and reset conversation - system_prompt_chat.change( - update_system_prompt, - inputs=system_prompt_chat, - outputs=[chatbot_interface, conversation_state], - ) - - with gr.Blocks() as app: gr.Markdown( """ @@ -736,89 +759,14 @@ This is a local web UI for F5 TTS with advanced batch processing support. This a * [F5-TTS](https://arxiv.org/abs/2410.06885) (A Fairytaler that Fakes Fluent and Faithful Speech with Flow Matching) * [E2 TTS](https://arxiv.org/abs/2406.18009) (Embarrassingly Easy Fully Non-Autoregressive Zero-Shot TTS) -The checkpoints currently support English and Chinese. +The checkpoints support English and Chinese. -If you're having issues, try converting your reference audio to WAV or MP3, clipping it to 15s with ✂ in the bottom right corner (otherwise might have non-optimal auto-trimmed result). +If you're having issues, try converting your reference audio to WAV or MP3, clipping it to 15s, and shortening your prompt. **NOTE: Reference text will be automatically transcribed with Whisper if not provided. For best results, keep your reference clips short (<15s). Ensure the audio is fully uploaded before generating.** """ ) - - last_used_custom = files("f5_tts").joinpath("infer/.cache/last_used_custom.txt") - - def load_last_used_custom(): - try: - with open(last_used_custom, "r") as f: - return f.read().split(",") - except FileNotFoundError: - last_used_custom.parent.mkdir(parents=True, exist_ok=True) - return [ - "hf://SWivid/F5-TTS/F5TTS_Base/model_1200000.safetensors", - "hf://SWivid/F5-TTS/F5TTS_Base/vocab.txt", - ] - - def switch_tts_model(new_choice): - global tts_model_choice - if new_choice == "Custom": # override in case webpage is refreshed - custom_ckpt_path, custom_vocab_path = load_last_used_custom() - tts_model_choice = ["Custom", custom_ckpt_path, custom_vocab_path] - return gr.update(visible=True, value=custom_ckpt_path), gr.update(visible=True, value=custom_vocab_path) - else: - tts_model_choice = new_choice - return gr.update(visible=False), gr.update(visible=False) - - def set_custom_model(custom_ckpt_path, custom_vocab_path): - global tts_model_choice - tts_model_choice = ["Custom", custom_ckpt_path, custom_vocab_path] - with open(last_used_custom, "w") as f: - f.write(f"{custom_ckpt_path},{custom_vocab_path}") - - with gr.Row(): - if not USING_SPACES: - choose_tts_model = gr.Radio( - choices=[DEFAULT_TTS_MODEL, "E2-TTS", "Custom"], label="Choose TTS Model", value=DEFAULT_TTS_MODEL - ) - else: - choose_tts_model = gr.Radio( - choices=[DEFAULT_TTS_MODEL, "E2-TTS"], label="Choose TTS Model", value=DEFAULT_TTS_MODEL - ) - custom_ckpt_path = gr.Dropdown( - choices=["hf://SWivid/F5-TTS/F5TTS_Base/model_1200000.safetensors"], - value=load_last_used_custom()[0], - allow_custom_value=True, - label="MODEL CKPT: local_path | hf://user_id/repo_id/model_ckpt", - visible=False, - ) - custom_vocab_path = gr.Dropdown( - choices=["hf://SWivid/F5-TTS/F5TTS_Base/vocab.txt"], - value=load_last_used_custom()[1], - allow_custom_value=True, - label="VOCAB FILE: local_path | hf://user_id/repo_id/vocab_file", - visible=False, - ) - - choose_tts_model.change( - switch_tts_model, - inputs=[choose_tts_model], - outputs=[custom_ckpt_path, custom_vocab_path], - show_progress="hidden", - ) - custom_ckpt_path.change( - set_custom_model, - inputs=[custom_ckpt_path, custom_vocab_path], - show_progress="hidden", - ) - custom_vocab_path.change( - set_custom_model, - inputs=[custom_ckpt_path, custom_vocab_path], - show_progress="hidden", - ) - - gr.TabbedInterface( - [app_tts, app_multistyle, app_chat, app_credits], - ["Basic-TTS", "Multi-Speech", "Voice-Chat", "Credits"], - ) - + gr.TabbedInterface([app_tts, app_podcast, app_emotional, app_credits], ["TTS", "Podcast", "Multi-Style", "Credits"]) @click.command() @click.option("--port", "-p", default=None, type=int, help="Port to run the app on") @@ -831,21 +779,13 @@ If you're having issues, try converting your reference audio to WAV or MP3, clip help="Share the app via Gradio share link", ) @click.option("--api", "-a", default=True, is_flag=True, help="Allow API access") -@click.option( - "--root_path", - "-r", - default=None, - type=str, - help='The root path (or "mount point") of the application, if it\'s not served from the root ("/") of the domain. Often used when the application is behind a reverse proxy that forwards requests to the application, e.g. set "/myapp" or full URL for application served at "https://example.com/myapp".', -) -def main(port, host, share, api, root_path): +def main(port, host, share, api): global app - print("Starting app...") - app.queue(api_open=api).launch(server_name=host, server_port=port, share=share, show_api=api, root_path=root_path) + print(f"Starting app...") + app.queue(api_open=api).launch( + server_name=host, server_port=port, share=share, show_api=api + ) -if __name__ == "__main__": - if not USING_SPACES: - main() - else: - app.queue().launch() + +app.queue().launch() diff --git a/app_local.py b/app_local.py new file mode 100644 index 0000000000000000000000000000000000000000..629b4fc7152b0e8b30e16887af288ffbd63742dc --- /dev/null +++ b/app_local.py @@ -0,0 +1,236 @@ +print("WARNING: You are running this unofficial E2/F5 TTS demo locally, it may not be as up-to-date as the hosted version (https://huggingface.co/spaces/mrfakename/E2-F5-TTS)") + +import os +import re +import torch +import torchaudio +import gradio as gr +import numpy as np +import tempfile +from einops import rearrange +from ema_pytorch import EMA +from vocos import Vocos +from pydub import AudioSegment, silence +from model import CFM, UNetT, DiT, MMDiT +from cached_path import cached_path +from model.utils import ( + get_tokenizer, + convert_char_to_pinyin, + save_spectrogram, +) +from transformers import pipeline +import librosa +import soundfile as sf +from txtsplit import txtsplit + +device = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu" + +pipe = pipeline( + "automatic-speech-recognition", + model="openai/whisper-large-v3-turbo", + torch_dtype=torch.float16, + device=device, +) + +vocos = Vocos.from_pretrained("charactr/vocos-mel-24khz") + +# --------------------- Settings -------------------- # + +target_sample_rate = 24000 +n_mel_channels = 100 +hop_length = 256 +target_rms = 0.1 +nfe_step = 32 # 16, 32 +cfg_strength = 2.0 +ode_method = 'euler' +sway_sampling_coef = -1.0 +speed = 1.0 +# fix_duration = 27 # None or float (duration in seconds) +fix_duration = None + +def load_model(repo_name, exp_name, model_cls, model_cfg, ckpt_step): + checkpoint = torch.load(str(cached_path(f"hf://SWivid/{repo_name}/{exp_name}/model_{ckpt_step}.pt")), map_location=device) + vocab_char_map, vocab_size = get_tokenizer("Emilia_ZH_EN", "pinyin") + model = CFM( + transformer=model_cls( + **model_cfg, + text_num_embeds=vocab_size, + mel_dim=n_mel_channels + ), + mel_spec_kwargs=dict( + target_sample_rate=target_sample_rate, + n_mel_channels=n_mel_channels, + hop_length=hop_length, + ), + odeint_kwargs=dict( + method=ode_method, + ), + vocab_char_map=vocab_char_map, + ).to(device) + + ema_model = EMA(model, include_online_model=False).to(device) + ema_model.load_state_dict(checkpoint['ema_model_state_dict']) + ema_model.copy_params_from_ema_to_model() + + return model + +# load models +F5TTS_model_cfg = dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4) +E2TTS_model_cfg = dict(dim=1024, depth=24, heads=16, ff_mult=4) + +F5TTS_ema_model = load_model("F5-TTS", "F5TTS_Base", DiT, F5TTS_model_cfg, 1200000) +E2TTS_ema_model = load_model("E2-TTS", "E2TTS_Base", UNetT, E2TTS_model_cfg, 1200000) + +def infer(ref_audio_orig, ref_text, gen_text, exp_name, remove_silence, progress = gr.Progress()): + print(gen_text) + gr.Info("Converting audio...") + with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f: + aseg = AudioSegment.from_file(ref_audio_orig) + # remove long silence in reference audio + non_silent_segs = silence.split_on_silence(aseg, min_silence_len=1000, silence_thresh=-50, keep_silence=500) + non_silent_wave = AudioSegment.silent(duration=0) + for non_silent_seg in non_silent_segs: + non_silent_wave += non_silent_seg + aseg = non_silent_wave + # Convert to mono + aseg = aseg.set_channels(1) + audio_duration = len(aseg) + if audio_duration > 15000: + gr.Warning("Audio is over 15s, clipping to only first 15s.") + aseg = aseg[:15000] + aseg.export(f.name, format="wav") + ref_audio = f.name + if exp_name == "F5-TTS": + ema_model = F5TTS_ema_model + elif exp_name == "E2-TTS": + ema_model = E2TTS_ema_model + + if not ref_text.strip(): + gr.Info("No reference text provided, transcribing reference audio...") + ref_text = outputs = pipe( + ref_audio, + chunk_length_s=30, + batch_size=128, + generate_kwargs={"task": "transcribe"}, + return_timestamps=False, + )['text'].strip() + gr.Info("Finished transcription") + else: + gr.Info("Using custom reference text...") + audio, sr = torchaudio.load(ref_audio) + max_chars = int(len(ref_text) / (audio.shape[-1] / sr) * (30 - audio.shape[-1] / sr)) + # Audio + if audio.shape[0] > 1: + audio = torch.mean(audio, dim=0, keepdim=True) + rms = torch.sqrt(torch.mean(torch.square(audio))) + if rms < target_rms: + audio = audio * target_rms / rms + if sr != target_sample_rate: + resampler = torchaudio.transforms.Resample(sr, target_sample_rate) + audio = resampler(audio) + audio = audio.to(device) + # Chunk + chunks = txtsplit(gen_text, 0.7*max_chars, 0.9*max_chars) # 100 chars preferred, 150 max + results = [] + generated_mel_specs = [] + for chunk in progress.tqdm(chunks): + # Prepare the text + text_list = [ref_text + chunk] + final_text_list = convert_char_to_pinyin(text_list) + + # Calculate duration + ref_audio_len = audio.shape[-1] // hop_length + # if fix_duration is not None: + # duration = int(fix_duration * target_sample_rate / hop_length) + # else: + zh_pause_punc = r"。,、;:?!" + ref_text_len = len(ref_text.encode('utf-8')) + 3 * len(re.findall(zh_pause_punc, ref_text)) + chunk = len(chunk.encode('utf-8')) + 3 * len(re.findall(zh_pause_punc, gen_text)) + duration = ref_audio_len + int(ref_audio_len / ref_text_len * chunk / speed) + + # inference + gr.Info(f"Generating audio using {exp_name}") + with torch.inference_mode(): + generated, _ = ema_model.sample( + cond=audio, + text=final_text_list, + duration=duration, + steps=nfe_step, + cfg_strength=cfg_strength, + sway_sampling_coef=sway_sampling_coef, + ) + + generated = generated[:, ref_audio_len:, :] + generated_mel_spec = rearrange(generated, '1 n d -> 1 d n') + gr.Info("Running vocoder") + generated_wave = vocos.decode(generated_mel_spec.cpu()) + if rms < target_rms: + generated_wave = generated_wave * rms / target_rms + + # wav -> numpy + generated_wave = generated_wave.squeeze().cpu().numpy() + results.append(generated_wave) + generated_wave = np.concatenate(results) + if remove_silence: + gr.Info("Removing audio silences... This may take a moment") + # non_silent_intervals = librosa.effects.split(generated_wave, top_db=30) + # non_silent_wave = np.array([]) + # for interval in non_silent_intervals: + # start, end = interval + # non_silent_wave = np.concatenate([non_silent_wave, generated_wave[start:end]]) + # generated_wave = non_silent_wave + with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f: + sf.write(f.name, generated_wave, target_sample_rate) + aseg = AudioSegment.from_file(f.name) + non_silent_segs = silence.split_on_silence(aseg, min_silence_len=1000, silence_thresh=-50, keep_silence=500) + non_silent_wave = AudioSegment.silent(duration=0) + for non_silent_seg in non_silent_segs: + non_silent_wave += non_silent_seg + aseg = non_silent_wave + aseg.export(f.name, format="wav") + generated_wave, _ = torchaudio.load(f.name) + generated_wave = generated_wave.squeeze().cpu().numpy() + + # spectogram + # with tempfile.NamedTemporaryFile(suffix=".png", delete=False) as tmp_spectrogram: + # spectrogram_path = tmp_spectrogram.name + # save_spectrogram(generated_mel_spec[0].cpu().numpy(), spectrogram_path) + + return (target_sample_rate, generated_wave) + +with gr.Blocks() as app: + gr.Markdown(""" +# E2/F5 TTS + +This is an unofficial E2/F5 TTS demo. This demo supports the following TTS models: + +* [E2-TTS](https://arxiv.org/abs/2406.18009) (Embarrassingly Easy Fully Non-Autoregressive Zero-Shot TTS) +* [F5-TTS](https://arxiv.org/abs/2410.06885) (A Fairytaler that Fakes Fluent and Faithful Speech with Flow Matching) + +This demo is based on the [F5-TTS](https://github.com/SWivid/F5-TTS) codebase, which is based on an [unofficial E2-TTS implementation](https://github.com/lucidrains/e2-tts-pytorch). + +The checkpoints support English and Chinese. + +If you're having issues, try converting your reference audio to WAV or MP3, clipping it to 15s, and shortening your prompt. If you're still running into issues, please open a [community Discussion](https://huggingface.co/spaces/mrfakename/E2-F5-TTS/discussions). + +Long-form/batched inference + speech editing is coming soon! + +**NOTE: Reference text will be automatically transcribed with Whisper if not provided. For best results, keep your reference clips short (<15s). Ensure the audio is fully uploaded before generating.** +""") + + ref_audio_input = gr.Audio(label="Reference Audio", type="filepath") + gen_text_input = gr.Textbox(label="Text to Generate (longer text will use chunking)", lines=4) + model_choice = gr.Radio(choices=["F5-TTS", "E2-TTS"], label="Choose TTS Model", value="F5-TTS") + generate_btn = gr.Button("Synthesize", variant="primary") + with gr.Accordion("Advanced Settings", open=False): + ref_text_input = gr.Textbox(label="Reference Text", info="Leave blank to automatically transcribe the reference audio. If you enter text it will override automatic transcription.", lines=2) + remove_silence = gr.Checkbox(label="Remove Silences", info="The model tends to produce silences, especially on longer audio. We can manually remove silences if needed. Note that this is an experimental feature and may produce strange results. This will also increase generation time.", value=True) + + audio_output = gr.Audio(label="Synthesized Audio") + # spectrogram_output = gr.Image(label="Spectrogram") + + generate_btn.click(infer, inputs=[ref_audio_input, ref_text_input, gen_text_input, model_choice, remove_silence], outputs=[audio_output]) + gr.Markdown("Unofficial demo by [mrfakename](https://x.com/realmrfakename)") + + +app.queue().launch() \ No newline at end of file diff --git a/cog.py b/cog.py new file mode 100644 index 0000000000000000000000000000000000000000..792605a73923438777e8630dcb9989ca2bf08ee8 --- /dev/null +++ b/cog.py @@ -0,0 +1,180 @@ +# Prediction interface for Cog ⚙️ +# https://cog.run/python + +from cog import BasePredictor, Input, Path + +import os +import re +import torch +import torchaudio +import numpy as np +import tempfile +from einops import rearrange +from ema_pytorch import EMA +from vocos import Vocos +from pydub import AudioSegment +from model import CFM, UNetT, DiT, MMDiT +from cached_path import cached_path +from model.utils import ( + get_tokenizer, + convert_char_to_pinyin, + save_spectrogram, +) +from transformers import pipeline +import librosa + +device = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu" + +target_sample_rate = 24000 +n_mel_channels = 100 +hop_length = 256 +target_rms = 0.1 +nfe_step = 32 # 16, 32 +cfg_strength = 2.0 +ode_method = 'euler' +sway_sampling_coef = -1.0 +speed = 1.0 +# fix_duration = 27 # None or float (duration in seconds) +fix_duration = None + + +class Predictor(BasePredictor): + def load_model(exp_name, model_cls, model_cfg, ckpt_step): + checkpoint = torch.load(str(cached_path(f"hf://SWivid/F5-TTS/{exp_name}/model_{ckpt_step}.pt")), map_location=device) + vocab_char_map, vocab_size = get_tokenizer("Emilia_ZH_EN", "pinyin") + model = CFM( + transformer=model_cls( + **model_cfg, + text_num_embeds=vocab_size, + mel_dim=n_mel_channels + ), + mel_spec_kwargs=dict( + target_sample_rate=target_sample_rate, + n_mel_channels=n_mel_channels, + hop_length=hop_length, + ), + odeint_kwargs=dict( + method=ode_method, + ), + vocab_char_map=vocab_char_map, + ).to(device) + + ema_model = EMA(model, include_online_model=False).to(device) + ema_model.load_state_dict(checkpoint['ema_model_state_dict']) + ema_model.copy_params_from_ema_to_model() + + return ema_model, model + def setup(self) -> None: + """Load the model into memory to make running multiple predictions efficient""" + # self.model = torch.load("./weights.pth") + print("Loading Whisper model...") + self.pipe = pipeline( + "automatic-speech-recognition", + model="openai/whisper-large-v3-turbo", + torch_dtype=torch.float16, + device=device, + ) + print("Loading F5-TTS model...") + + F5TTS_model_cfg = dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4) + self.F5TTS_ema_model, self.F5TTS_base_model = self.load_model("F5TTS_Base", DiT, F5TTS_model_cfg, 1200000) + + + def predict( + self, + gen_text: str = Input(description="Text to generate"), + ref_audio_orig: Path = Input(description="Reference audio"), + remove_silence: bool = Input(description="Remove silences", default=True), + ) -> Path: + """Run a single prediction on the model""" + model_choice = "F5-TTS" + print(gen_text) + if len(gen_text) > 200: + raise gr.Error("Please keep your text under 200 chars.") + gr.Info("Converting audio...") + with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f: + aseg = AudioSegment.from_file(ref_audio_orig) + audio_duration = len(aseg) + if audio_duration > 15000: + gr.Warning("Audio is over 15s, clipping to only first 15s.") + aseg = aseg[:15000] + aseg.export(f.name, format="wav") + ref_audio = f.name + ema_model = self.F5TTS_ema_model + base_model = self.F5TTS_base_model + + if not ref_text.strip(): + gr.Info("No reference text provided, transcribing reference audio...") + ref_text = outputs = self.pipe( + ref_audio, + chunk_length_s=30, + batch_size=128, + generate_kwargs={"task": "transcribe"}, + return_timestamps=False, + )['text'].strip() + gr.Info("Finished transcription") + else: + gr.Info("Using custom reference text...") + audio, sr = torchaudio.load(ref_audio) + + rms = torch.sqrt(torch.mean(torch.square(audio))) + if rms < target_rms: + audio = audio * target_rms / rms + if sr != target_sample_rate: + resampler = torchaudio.transforms.Resample(sr, target_sample_rate) + audio = resampler(audio) + audio = audio.to(device) + + # Prepare the text + text_list = [ref_text + gen_text] + final_text_list = convert_char_to_pinyin(text_list) + + # Calculate duration + ref_audio_len = audio.shape[-1] // hop_length + # if fix_duration is not None: + # duration = int(fix_duration * target_sample_rate / hop_length) + # else: + zh_pause_punc = r"。,、;:?!" + ref_text_len = len(ref_text) + len(re.findall(zh_pause_punc, ref_text)) + gen_text_len = len(gen_text) + len(re.findall(zh_pause_punc, gen_text)) + duration = ref_audio_len + int(ref_audio_len / ref_text_len * gen_text_len / speed) + + # inference + gr.Info(f"Generating audio using F5-TTS") + with torch.inference_mode(): + generated, _ = base_model.sample( + cond=audio, + text=final_text_list, + duration=duration, + steps=nfe_step, + cfg_strength=cfg_strength, + sway_sampling_coef=sway_sampling_coef, + ) + + generated = generated[:, ref_audio_len:, :] + generated_mel_spec = rearrange(generated, '1 n d -> 1 d n') + gr.Info("Running vocoder") + vocos = Vocos.from_pretrained("charactr/vocos-mel-24khz") + generated_wave = vocos.decode(generated_mel_spec.cpu()) + if rms < target_rms: + generated_wave = generated_wave * rms / target_rms + + # wav -> numpy + generated_wave = generated_wave.squeeze().cpu().numpy() + + if remove_silence: + gr.Info("Removing audio silences... This may take a moment") + non_silent_intervals = librosa.effects.split(generated_wave, top_db=30) + non_silent_wave = np.array([]) + for interval in non_silent_intervals: + start, end = interval + non_silent_wave = np.concatenate([non_silent_wave, generated_wave[start:end]]) + generated_wave = non_silent_wave + + + # spectogram + with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as tmp_wav: + wav_path = tmp_wav.name + torchaudio.save(wav_path, torch.tensor(generated_wave), target_sample_rate) + + return wav_path \ No newline at end of file diff --git a/data/.DS_Store b/data/.DS_Store deleted file mode 100644 index 3383e9e073356ef0c99f2d3d82342ad2c77f384a..0000000000000000000000000000000000000000 Binary files a/data/.DS_Store and /dev/null differ diff --git a/data/Emilia_ZH_EN_pinyin/vocab.txt b/data/Emilia_ZH_EN_pinyin/vocab.txt index cd934390e8f4b3ce98eb319ae618c084d01504b5..a30a90c12e1ab38b95c97770d5c5cd1d03c392e2 100644 --- a/data/Emilia_ZH_EN_pinyin/vocab.txt +++ b/data/Emilia_ZH_EN_pinyin/vocab.txt @@ -1,2545 +1,2545 @@ - -! -" -# -$ -% -& -' -( -) -* -+ -, -- -. -/ -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -: -; -= -> -? -@ -A -B -C -D -E -F -G -H -I -J -K -L -M -N -O -P -Q -R -S -T -U -V -W -X -Y -Z -[ -\ -] -_ -a -a1 -ai1 -ai2 -ai3 -ai4 -an1 -an3 -an4 -ang1 -ang2 -ang4 -ao1 -ao2 -ao3 -ao4 -b -ba -ba1 -ba2 -ba3 -ba4 -bai1 -bai2 -bai3 -bai4 -ban1 -ban2 -ban3 -ban4 -bang1 -bang2 -bang3 -bang4 -bao1 -bao2 -bao3 -bao4 -bei -bei1 -bei2 -bei3 -bei4 -ben1 -ben2 -ben3 -ben4 -beng -beng1 -beng2 -beng3 -beng4 -bi1 -bi2 -bi3 -bi4 -bian1 -bian2 -bian3 -bian4 -biao1 -biao2 -biao3 -bie1 -bie2 -bie3 -bie4 -bin1 -bin4 -bing1 -bing2 -bing3 -bing4 -bo -bo1 -bo2 -bo3 -bo4 -bu2 -bu3 -bu4 -c -ca1 -cai1 -cai2 -cai3 -cai4 -can1 -can2 -can3 -can4 -cang1 -cang2 -cao1 -cao2 -cao3 -ce4 -cen1 -cen2 -ceng1 -ceng2 -ceng4 -cha1 -cha2 -cha3 -cha4 -chai1 -chai2 -chan1 -chan2 -chan3 -chan4 -chang1 -chang2 -chang3 -chang4 -chao1 -chao2 -chao3 -che1 -che2 -che3 -che4 -chen1 -chen2 -chen3 -chen4 -cheng1 -cheng2 -cheng3 -cheng4 -chi1 -chi2 -chi3 -chi4 -chong1 -chong2 -chong3 -chong4 -chou1 -chou2 -chou3 -chou4 -chu1 -chu2 -chu3 -chu4 -chua1 -chuai1 -chuai2 -chuai3 -chuai4 -chuan1 -chuan2 -chuan3 -chuan4 -chuang1 -chuang2 -chuang3 -chuang4 -chui1 -chui2 -chun1 -chun2 -chun3 -chuo1 -chuo4 -ci1 -ci2 -ci3 -ci4 -cong1 -cong2 -cou4 -cu1 -cu4 -cuan1 -cuan2 -cuan4 -cui1 -cui3 -cui4 -cun1 -cun2 -cun4 -cuo1 -cuo2 -cuo4 -d -da -da1 -da2 -da3 -da4 -dai1 -dai2 -dai3 -dai4 -dan1 -dan2 -dan3 -dan4 -dang1 -dang2 -dang3 -dang4 -dao1 -dao2 -dao3 -dao4 -de -de1 -de2 -dei3 -den4 -deng1 -deng2 -deng3 -deng4 -di1 -di2 -di3 -di4 -dia3 -dian1 -dian2 -dian3 -dian4 -diao1 -diao3 -diao4 -die1 -die2 -die4 -ding1 -ding2 -ding3 -ding4 -diu1 -dong1 -dong3 -dong4 -dou1 -dou2 -dou3 -dou4 -du1 -du2 -du3 -du4 -duan1 -duan2 -duan3 -duan4 -dui1 -dui4 -dun1 -dun3 -dun4 -duo1 -duo2 -duo3 -duo4 -e -e1 -e2 -e3 -e4 -ei2 -en1 -en4 -er -er2 -er3 -er4 -f -fa1 -fa2 -fa3 -fa4 -fan1 -fan2 -fan3 -fan4 -fang1 -fang2 -fang3 -fang4 -fei1 -fei2 -fei3 -fei4 -fen1 -fen2 -fen3 -fen4 -feng1 -feng2 -feng3 -feng4 -fo2 -fou2 -fou3 -fu1 -fu2 -fu3 -fu4 -g -ga1 -ga2 -ga3 -ga4 -gai1 -gai2 -gai3 -gai4 -gan1 -gan2 -gan3 -gan4 -gang1 -gang2 -gang3 -gang4 -gao1 -gao2 -gao3 -gao4 -ge1 -ge2 -ge3 -ge4 -gei2 -gei3 -gen1 -gen2 -gen3 -gen4 -geng1 -geng3 -geng4 -gong1 -gong3 -gong4 -gou1 -gou2 -gou3 -gou4 -gu -gu1 -gu2 -gu3 -gu4 -gua1 -gua2 -gua3 -gua4 -guai1 -guai2 -guai3 -guai4 -guan1 -guan2 -guan3 -guan4 -guang1 -guang2 -guang3 -guang4 -gui1 -gui2 -gui3 -gui4 -gun3 -gun4 -guo1 -guo2 -guo3 -guo4 -h -ha1 -ha2 -ha3 -hai1 -hai2 -hai3 -hai4 -han1 -han2 -han3 -han4 -hang1 -hang2 -hang4 -hao1 -hao2 -hao3 -hao4 -he1 -he2 -he4 -hei1 -hen2 -hen3 -hen4 -heng1 -heng2 -heng4 -hong1 -hong2 -hong3 -hong4 -hou1 -hou2 -hou3 -hou4 -hu1 -hu2 -hu3 -hu4 -hua1 -hua2 -hua4 -huai2 -huai4 -huan1 -huan2 -huan3 -huan4 -huang1 -huang2 -huang3 -huang4 -hui1 -hui2 -hui3 -hui4 -hun1 -hun2 -hun4 -huo -huo1 -huo2 -huo3 -huo4 -i -j -ji1 -ji2 -ji3 -ji4 -jia -jia1 -jia2 -jia3 -jia4 -jian1 -jian2 -jian3 -jian4 -jiang1 -jiang2 -jiang3 -jiang4 -jiao1 -jiao2 -jiao3 -jiao4 -jie1 -jie2 -jie3 -jie4 -jin1 -jin2 -jin3 -jin4 -jing1 -jing2 -jing3 -jing4 -jiong3 -jiu1 -jiu2 -jiu3 -jiu4 -ju1 -ju2 -ju3 -ju4 -juan1 -juan2 -juan3 -juan4 -jue1 -jue2 -jue4 -jun1 -jun4 -k -ka1 -ka2 -ka3 -kai1 -kai2 -kai3 -kai4 -kan1 -kan2 -kan3 -kan4 -kang1 -kang2 -kang4 -kao1 -kao2 -kao3 -kao4 -ke1 -ke2 -ke3 -ke4 -ken3 -keng1 -kong1 -kong3 -kong4 -kou1 -kou2 -kou3 -kou4 -ku1 -ku2 -ku3 -ku4 -kua1 -kua3 -kua4 -kuai3 -kuai4 -kuan1 -kuan2 -kuan3 -kuang1 -kuang2 -kuang4 -kui1 -kui2 -kui3 -kui4 -kun1 -kun3 -kun4 -kuo4 -l -la -la1 -la2 -la3 -la4 -lai2 -lai4 -lan2 -lan3 -lan4 -lang1 -lang2 -lang3 -lang4 -lao1 -lao2 -lao3 -lao4 -le -le1 -le4 -lei -lei1 -lei2 -lei3 -lei4 -leng1 -leng2 -leng3 -leng4 -li -li1 -li2 -li3 -li4 -lia3 -lian2 -lian3 -lian4 -liang2 -liang3 -liang4 -liao1 -liao2 -liao3 -liao4 -lie1 -lie2 -lie3 -lie4 -lin1 -lin2 -lin3 -lin4 -ling2 -ling3 -ling4 -liu1 -liu2 -liu3 -liu4 -long1 -long2 -long3 -long4 -lou1 -lou2 -lou3 -lou4 -lu1 -lu2 -lu3 -lu4 -luan2 -luan3 -luan4 -lun1 -lun2 -lun4 -luo1 -luo2 -luo3 -luo4 -lv2 -lv3 -lv4 -lve3 -lve4 -m -ma -ma1 -ma2 -ma3 -ma4 -mai2 -mai3 -mai4 -man1 -man2 -man3 -man4 -mang2 -mang3 -mao1 -mao2 -mao3 -mao4 -me -mei2 -mei3 -mei4 -men -men1 -men2 -men4 -meng -meng1 -meng2 -meng3 -meng4 -mi1 -mi2 -mi3 -mi4 -mian2 -mian3 -mian4 -miao1 -miao2 -miao3 -miao4 -mie1 -mie4 -min2 -min3 -ming2 -ming3 -ming4 -miu4 -mo1 -mo2 -mo3 -mo4 -mou1 -mou2 -mou3 -mu2 -mu3 -mu4 -n -n2 -na1 -na2 -na3 -na4 -nai2 -nai3 -nai4 -nan1 -nan2 -nan3 -nan4 -nang1 -nang2 -nang3 -nao1 -nao2 -nao3 -nao4 -ne -ne2 -ne4 -nei3 -nei4 -nen4 -neng2 -ni1 -ni2 -ni3 -ni4 -nian1 -nian2 -nian3 -nian4 -niang2 -niang4 -niao2 -niao3 -niao4 -nie1 -nie4 -nin2 -ning2 -ning3 -ning4 -niu1 -niu2 -niu3 -niu4 -nong2 -nong4 -nou4 -nu2 -nu3 -nu4 -nuan3 -nuo2 -nuo4 -nv2 -nv3 -nve4 -o -o1 -o2 -ou1 -ou2 -ou3 -ou4 -p -pa1 -pa2 -pa4 -pai1 -pai2 -pai3 -pai4 -pan1 -pan2 -pan4 -pang1 -pang2 -pang4 -pao1 -pao2 -pao3 -pao4 -pei1 -pei2 -pei4 -pen1 -pen2 -pen4 -peng1 -peng2 -peng3 -peng4 -pi1 -pi2 -pi3 -pi4 -pian1 -pian2 -pian4 -piao1 -piao2 -piao3 -piao4 -pie1 -pie2 -pie3 -pin1 -pin2 -pin3 -pin4 -ping1 -ping2 -po1 -po2 -po3 -po4 -pou1 -pu1 -pu2 -pu3 -pu4 -q -qi1 -qi2 -qi3 -qi4 -qia1 -qia3 -qia4 -qian1 -qian2 -qian3 -qian4 -qiang1 -qiang2 -qiang3 -qiang4 -qiao1 -qiao2 -qiao3 -qiao4 -qie1 -qie2 -qie3 -qie4 -qin1 -qin2 -qin3 -qin4 -qing1 -qing2 -qing3 -qing4 -qiong1 -qiong2 -qiu1 -qiu2 -qiu3 -qu1 -qu2 -qu3 -qu4 -quan1 -quan2 -quan3 -quan4 -que1 -que2 -que4 -qun2 -r -ran2 -ran3 -rang1 -rang2 -rang3 -rang4 -rao2 -rao3 -rao4 -re2 -re3 -re4 -ren2 -ren3 -ren4 -reng1 -reng2 -ri4 -rong1 -rong2 -rong3 -rou2 -rou4 -ru2 -ru3 -ru4 -ruan2 -ruan3 -rui3 -rui4 -run4 -ruo4 -s -sa1 -sa2 -sa3 -sa4 -sai1 -sai4 -san1 -san2 -san3 -san4 -sang1 -sang3 -sang4 -sao1 -sao2 -sao3 -sao4 -se4 -sen1 -seng1 -sha1 -sha2 -sha3 -sha4 -shai1 -shai2 -shai3 -shai4 -shan1 -shan3 -shan4 -shang -shang1 -shang3 -shang4 -shao1 -shao2 -shao3 -shao4 -she1 -she2 -she3 -she4 -shei2 -shen1 -shen2 -shen3 -shen4 -sheng1 -sheng2 -sheng3 -sheng4 -shi -shi1 -shi2 -shi3 -shi4 -shou1 -shou2 -shou3 -shou4 -shu1 -shu2 -shu3 -shu4 -shua1 -shua2 -shua3 -shua4 -shuai1 -shuai3 -shuai4 -shuan1 -shuan4 -shuang1 -shuang3 -shui2 -shui3 -shui4 -shun3 -shun4 -shuo1 -shuo4 -si1 -si2 -si3 -si4 -song1 -song3 -song4 -sou1 -sou3 -sou4 -su1 -su2 -su4 -suan1 -suan4 -sui1 -sui2 -sui3 -sui4 -sun1 -sun3 -suo -suo1 -suo2 -suo3 -t -ta1 -ta2 -ta3 -ta4 -tai1 -tai2 -tai4 -tan1 -tan2 -tan3 -tan4 -tang1 -tang2 -tang3 -tang4 -tao1 -tao2 -tao3 -tao4 -te4 -teng2 -ti1 -ti2 -ti3 -ti4 -tian1 -tian2 -tian3 -tiao1 -tiao2 -tiao3 -tiao4 -tie1 -tie2 -tie3 -tie4 -ting1 -ting2 -ting3 -tong1 -tong2 -tong3 -tong4 -tou -tou1 -tou2 -tou4 -tu1 -tu2 -tu3 -tu4 -tuan1 -tuan2 -tui1 -tui2 -tui3 -tui4 -tun1 -tun2 -tun4 -tuo1 -tuo2 -tuo3 -tuo4 -u -v -w -wa -wa1 -wa2 -wa3 -wa4 -wai1 -wai3 -wai4 -wan1 -wan2 -wan3 -wan4 -wang1 -wang2 -wang3 -wang4 -wei1 -wei2 -wei3 -wei4 -wen1 -wen2 -wen3 -wen4 -weng1 -weng4 -wo1 -wo2 -wo3 -wo4 -wu1 -wu2 -wu3 -wu4 -x -xi1 -xi2 -xi3 -xi4 -xia1 -xia2 -xia4 -xian1 -xian2 -xian3 -xian4 -xiang1 -xiang2 -xiang3 -xiang4 -xiao1 -xiao2 -xiao3 -xiao4 -xie1 -xie2 -xie3 -xie4 -xin1 -xin2 -xin4 -xing1 -xing2 -xing3 -xing4 -xiong1 -xiong2 -xiu1 -xiu3 -xiu4 -xu -xu1 -xu2 -xu3 -xu4 -xuan1 -xuan2 -xuan3 -xuan4 -xue1 -xue2 -xue3 -xue4 -xun1 -xun2 -xun4 -y -ya -ya1 -ya2 -ya3 -ya4 -yan1 -yan2 -yan3 -yan4 -yang1 -yang2 -yang3 -yang4 -yao1 -yao2 -yao3 -yao4 -ye1 -ye2 -ye3 -ye4 -yi -yi1 -yi2 -yi3 -yi4 -yin1 -yin2 -yin3 -yin4 -ying1 -ying2 -ying3 -ying4 -yo1 -yong1 -yong2 -yong3 -yong4 -you1 -you2 -you3 -you4 -yu1 -yu2 -yu3 -yu4 -yuan1 -yuan2 -yuan3 -yuan4 -yue1 -yue4 -yun1 -yun2 -yun3 -yun4 -z -za1 -za2 -za3 -zai1 -zai3 -zai4 -zan1 -zan2 -zan3 -zan4 -zang1 -zang4 -zao1 -zao2 -zao3 -zao4 -ze2 -ze4 -zei2 -zen3 -zeng1 -zeng4 -zha1 -zha2 -zha3 -zha4 -zhai1 -zhai2 -zhai3 -zhai4 -zhan1 -zhan2 -zhan3 -zhan4 -zhang1 -zhang2 -zhang3 -zhang4 -zhao1 -zhao2 -zhao3 -zhao4 -zhe -zhe1 -zhe2 -zhe3 -zhe4 -zhen1 -zhen2 -zhen3 -zhen4 -zheng1 -zheng2 -zheng3 -zheng4 -zhi1 -zhi2 -zhi3 -zhi4 -zhong1 -zhong2 -zhong3 -zhong4 -zhou1 -zhou2 -zhou3 -zhou4 -zhu1 -zhu2 -zhu3 -zhu4 -zhua1 -zhua2 -zhua3 -zhuai1 -zhuai3 -zhuai4 -zhuan1 -zhuan2 -zhuan3 -zhuan4 -zhuang1 -zhuang4 -zhui1 -zhui4 -zhun1 -zhun2 -zhun3 -zhuo1 -zhuo2 -zi -zi1 -zi2 -zi3 -zi4 -zong1 -zong2 -zong3 -zong4 -zou1 -zou2 -zou3 -zou4 -zu1 -zu2 -zu3 -zuan1 -zuan3 -zuan4 -zui2 -zui3 -zui4 -zun1 -zuo -zuo1 -zuo2 -zuo3 -zuo4 -{ -~ -¡ -¢ -£ -¥ -§ -¨ -© -« -® -¯ -° -± -² -³ -´ -µ -· -¹ -º -» -¼ -½ -¾ -¿ -À -Á - -à -Ä -Å -Æ -Ç -È -É -Ê -Í -Î -Ñ -Ó -Ö -× -Ø -Ú -Ü -Ý -Þ -ß -à -á -â -ã -ä -å -æ -ç -è -é -ê -ë -ì -í -î -ï -ð -ñ -ò -ó -ô -õ -ö -ø -ù -ú -û -ü -ý -Ā -ā -ă -ą -ć -Č -č -Đ -đ -ē -ė -ę -ě -ĝ -ğ -ħ -ī -į -İ -ı -Ł -ł -ń -ņ -ň -ŋ -Ō -ō -ő -œ -ř -Ś -ś -Ş -ş -Š -š -Ť -ť -ũ -ū -ź -Ż -ż -Ž -ž -ơ -ư -ǎ -ǐ -ǒ -ǔ -ǚ -ș -ț -ɑ -ɔ -ɕ -ə -ɛ -ɜ -ɡ -ɣ -ɪ -ɫ -ɴ -ɹ -ɾ -ʃ -ʊ -ʌ -ʒ -ʔ -ʰ -ʷ -ʻ -ʾ -ʿ -ˈ -ː -˙ -˜ -ˢ -́ -̅ -Α -Β -Δ -Ε -Θ -Κ -Λ -Μ -Ξ -Π -Σ -Τ -Φ -Χ -Ψ -Ω -ά -έ -ή -ί -α -β -γ -δ -ε -ζ -η -θ -ι -κ -λ -μ -ν -ξ -ο -π -ρ -ς -σ -τ -υ -φ -χ -ψ -ω -ϊ -ό -ύ -ώ -ϕ -ϵ -Ё -А -Б -В -Г -Д -Е -Ж -З -И -Й -К -Л -М -Н -О -П -Р -С -Т -У -Ф -Х -Ц -Ч -Ш -Щ -Ы -Ь -Э -Ю -Я -а -б -в -г -д -е -ж -з -и -й -к -л -м -н -о -п -р -с -т -у -ф -х -ц -ч -ш -щ -ъ -ы -ь -э -ю -я -ё -і -ְ -ִ -ֵ -ֶ -ַ -ָ -ֹ -ּ -־ -ׁ -א -ב -ג -ד -ה -ו -ז -ח -ט -י -כ -ל -ם -מ -ן -נ -ס -ע -פ -ק -ר -ש -ת -أ -ب -ة -ت -ج -ح -د -ر -ز -س -ص -ط -ع -ق -ك -ل -م -ن -ه -و -ي -َ -ُ -ِ -ْ -ก -ข -ง -จ -ต -ท -น -ป -ย -ร -ว -ส -ห -อ -ฮ -ั -า -ี -ึ -โ -ใ -ไ -่ -้ -์ -ḍ -Ḥ -ḥ -ṁ -ṃ -ṅ -ṇ -Ṛ -ṛ -Ṣ -ṣ -Ṭ -ṭ -ạ -ả -Ấ -ấ -ầ -ậ -ắ -ằ -ẻ -ẽ -ế -ề -ể -ễ -ệ -ị -ọ -ỏ -ố -ồ -ộ -ớ -ờ -ở -ụ -ủ -ứ -ữ -ἀ -ἁ -Ἀ -ἐ -ἔ -ἰ -ἱ -ὀ -ὁ -ὐ -ὲ -ὸ -ᾶ -᾽ -ῆ -ῇ -ῶ -‎ -‑ -‒ -– -— -― -‖ -† -‡ -• -… -‧ -‬ -′ -″ -⁄ -⁡ -⁰ -⁴ -⁵ -⁶ -⁷ -⁸ -⁹ -₁ -₂ -₃ -€ -₱ -₹ -₽ -℃ -ℏ -ℓ -№ -ℝ -™ -⅓ -⅔ -⅛ -→ -∂ -∈ -∑ -− -∗ -√ -∞ -∫ -≈ -≠ -≡ -≤ -≥ -⋅ -⋯ -█ -♪ -⟨ -⟩ -、 -。 -《 -》 -「 -」 -【 -】 -あ -う -え -お -か -が -き -ぎ -く -ぐ -け -げ -こ -ご -さ -し -じ -す -ず -せ -ぜ -そ -ぞ -た -だ -ち -っ -つ -で -と -ど -な -に -ね -の -は -ば -ひ -ぶ -へ -べ -ま -み -む -め -も -ゃ -や -ゆ -ょ -よ -ら -り -る -れ -ろ -わ -を -ん -ァ -ア -ィ -イ -ウ -ェ -エ -オ -カ -ガ -キ -ク -ケ -ゲ -コ -ゴ -サ -ザ -シ -ジ -ス -ズ -セ -ゾ -タ -ダ -チ -ッ -ツ -テ -デ -ト -ド -ナ -ニ -ネ -ノ -バ -パ -ビ -ピ -フ -プ -ヘ -ベ -ペ -ホ -ボ -ポ -マ -ミ -ム -メ -モ -ャ -ヤ -ュ -ユ -ョ -ヨ -ラ -リ -ル -レ -ロ -ワ -ン -・ -ー -ㄋ -ㄍ -ㄎ -ㄏ -ㄓ -ㄕ -ㄚ -ㄜ -ㄟ -ㄤ -ㄥ -ㄧ -ㄱ -ㄴ -ㄷ -ㄹ -ㅁ -ㅂ -ㅅ -ㅈ -ㅍ -ㅎ -ㅏ -ㅓ -ㅗ -ㅜ -ㅡ -ㅣ -㗎 -가 -각 -간 -갈 -감 -갑 -갓 -갔 -강 -같 -개 -거 -건 -걸 -겁 -것 -겉 -게 -겠 -겨 -결 -겼 -경 -계 -고 -곤 -골 -곱 -공 -과 -관 -광 -교 -구 -국 -굴 -귀 -귄 -그 -근 -글 -금 -기 -긴 -길 -까 -깍 -깔 -깜 -깨 -께 -꼬 -꼭 -꽃 -꾸 -꿔 -끔 -끗 -끝 -끼 -나 -난 -날 -남 -납 -내 -냐 -냥 -너 -넘 -넣 -네 -녁 -년 -녕 -노 -녹 -놀 -누 -눈 -느 -는 -늘 -니 -님 -닙 -다 -닥 -단 -달 -닭 -당 -대 -더 -덕 -던 -덥 -데 -도 -독 -동 -돼 -됐 -되 -된 -될 -두 -둑 -둥 -드 -들 -등 -디 -따 -딱 -딸 -땅 -때 -떤 -떨 -떻 -또 -똑 -뚱 -뛰 -뜻 -띠 -라 -락 -란 -람 -랍 -랑 -래 -랜 -러 -런 -럼 -렇 -레 -려 -력 -렵 -렸 -로 -록 -롬 -루 -르 -른 -를 -름 -릉 -리 -릴 -림 -마 -막 -만 -많 -말 -맑 -맙 -맛 -매 -머 -먹 -멍 -메 -면 -명 -몇 -모 -목 -몸 -못 -무 -문 -물 -뭐 -뭘 -미 -민 -밌 -밑 -바 -박 -밖 -반 -받 -발 -밤 -밥 -방 -배 -백 -밸 -뱀 -버 -번 -벌 -벚 -베 -벼 -벽 -별 -병 -보 -복 -본 -볼 -봐 -봤 -부 -분 -불 -비 -빔 -빛 -빠 -빨 -뼈 -뽀 -뿅 -쁘 -사 -산 -살 -삼 -샀 -상 -새 -색 -생 -서 -선 -설 -섭 -섰 -성 -세 -셔 -션 -셨 -소 -속 -손 -송 -수 -숙 -순 -술 -숫 -숭 -숲 -쉬 -쉽 -스 -슨 -습 -슷 -시 -식 -신 -실 -싫 -심 -십 -싶 -싸 -써 -쓰 -쓴 -씌 -씨 -씩 -씬 -아 -악 -안 -않 -알 -야 -약 -얀 -양 -얘 -어 -언 -얼 -엄 -업 -없 -었 -엉 -에 -여 -역 -연 -염 -엽 -영 -옆 -예 -옛 -오 -온 -올 -옷 -옹 -와 -왔 -왜 -요 -욕 -용 -우 -운 -울 -웃 -워 -원 -월 -웠 -위 -윙 -유 -육 -윤 -으 -은 -을 -음 -응 -의 -이 -익 -인 -일 -읽 -임 -입 -있 -자 -작 -잔 -잖 -잘 -잡 -잤 -장 -재 -저 -전 -점 -정 -제 -져 -졌 -조 -족 -좀 -종 -좋 -죠 -주 -준 -줄 -중 -줘 -즈 -즐 -즘 -지 -진 -집 -짜 -짝 -쩌 -쪼 -쪽 -쫌 -쭈 -쯔 -찌 -찍 -차 -착 -찾 -책 -처 -천 -철 -체 -쳐 -쳤 -초 -촌 -추 -출 -춤 -춥 -춰 -치 -친 -칠 -침 -칩 -칼 -커 -켓 -코 -콩 -쿠 -퀴 -크 -큰 -큽 -키 -킨 -타 -태 -터 -턴 -털 -테 -토 -통 -투 -트 -특 -튼 -틀 -티 -팀 -파 -팔 -패 -페 -펜 -펭 -평 -포 -폭 -표 -품 -풍 -프 -플 -피 -필 -하 -학 -한 -할 -함 -합 -항 -해 -햇 -했 -행 -허 -험 -형 -혜 -호 -혼 -홀 -화 -회 -획 -후 -휴 -흐 -흔 -희 -히 -힘 -ﷺ -ﷻ -! -, -? -� -𠮶 + +! +" +# +$ +% +& +' +( +) +* ++ +, +- +. +/ +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +: +; += +> +? +@ +A +B +C +D +E +F +G +H +I +J +K +L +M +N +O +P +Q +R +S +T +U +V +W +X +Y +Z +[ +\ +] +_ +a +a1 +ai1 +ai2 +ai3 +ai4 +an1 +an3 +an4 +ang1 +ang2 +ang4 +ao1 +ao2 +ao3 +ao4 +b +ba +ba1 +ba2 +ba3 +ba4 +bai1 +bai2 +bai3 +bai4 +ban1 +ban2 +ban3 +ban4 +bang1 +bang2 +bang3 +bang4 +bao1 +bao2 +bao3 +bao4 +bei +bei1 +bei2 +bei3 +bei4 +ben1 +ben2 +ben3 +ben4 +beng +beng1 +beng2 +beng3 +beng4 +bi1 +bi2 +bi3 +bi4 +bian1 +bian2 +bian3 +bian4 +biao1 +biao2 +biao3 +bie1 +bie2 +bie3 +bie4 +bin1 +bin4 +bing1 +bing2 +bing3 +bing4 +bo +bo1 +bo2 +bo3 +bo4 +bu2 +bu3 +bu4 +c +ca1 +cai1 +cai2 +cai3 +cai4 +can1 +can2 +can3 +can4 +cang1 +cang2 +cao1 +cao2 +cao3 +ce4 +cen1 +cen2 +ceng1 +ceng2 +ceng4 +cha1 +cha2 +cha3 +cha4 +chai1 +chai2 +chan1 +chan2 +chan3 +chan4 +chang1 +chang2 +chang3 +chang4 +chao1 +chao2 +chao3 +che1 +che2 +che3 +che4 +chen1 +chen2 +chen3 +chen4 +cheng1 +cheng2 +cheng3 +cheng4 +chi1 +chi2 +chi3 +chi4 +chong1 +chong2 +chong3 +chong4 +chou1 +chou2 +chou3 +chou4 +chu1 +chu2 +chu3 +chu4 +chua1 +chuai1 +chuai2 +chuai3 +chuai4 +chuan1 +chuan2 +chuan3 +chuan4 +chuang1 +chuang2 +chuang3 +chuang4 +chui1 +chui2 +chun1 +chun2 +chun3 +chuo1 +chuo4 +ci1 +ci2 +ci3 +ci4 +cong1 +cong2 +cou4 +cu1 +cu4 +cuan1 +cuan2 +cuan4 +cui1 +cui3 +cui4 +cun1 +cun2 +cun4 +cuo1 +cuo2 +cuo4 +d +da +da1 +da2 +da3 +da4 +dai1 +dai2 +dai3 +dai4 +dan1 +dan2 +dan3 +dan4 +dang1 +dang2 +dang3 +dang4 +dao1 +dao2 +dao3 +dao4 +de +de1 +de2 +dei3 +den4 +deng1 +deng2 +deng3 +deng4 +di1 +di2 +di3 +di4 +dia3 +dian1 +dian2 +dian3 +dian4 +diao1 +diao3 +diao4 +die1 +die2 +die4 +ding1 +ding2 +ding3 +ding4 +diu1 +dong1 +dong3 +dong4 +dou1 +dou2 +dou3 +dou4 +du1 +du2 +du3 +du4 +duan1 +duan2 +duan3 +duan4 +dui1 +dui4 +dun1 +dun3 +dun4 +duo1 +duo2 +duo3 +duo4 +e +e1 +e2 +e3 +e4 +ei2 +en1 +en4 +er +er2 +er3 +er4 +f +fa1 +fa2 +fa3 +fa4 +fan1 +fan2 +fan3 +fan4 +fang1 +fang2 +fang3 +fang4 +fei1 +fei2 +fei3 +fei4 +fen1 +fen2 +fen3 +fen4 +feng1 +feng2 +feng3 +feng4 +fo2 +fou2 +fou3 +fu1 +fu2 +fu3 +fu4 +g +ga1 +ga2 +ga3 +ga4 +gai1 +gai2 +gai3 +gai4 +gan1 +gan2 +gan3 +gan4 +gang1 +gang2 +gang3 +gang4 +gao1 +gao2 +gao3 +gao4 +ge1 +ge2 +ge3 +ge4 +gei2 +gei3 +gen1 +gen2 +gen3 +gen4 +geng1 +geng3 +geng4 +gong1 +gong3 +gong4 +gou1 +gou2 +gou3 +gou4 +gu +gu1 +gu2 +gu3 +gu4 +gua1 +gua2 +gua3 +gua4 +guai1 +guai2 +guai3 +guai4 +guan1 +guan2 +guan3 +guan4 +guang1 +guang2 +guang3 +guang4 +gui1 +gui2 +gui3 +gui4 +gun3 +gun4 +guo1 +guo2 +guo3 +guo4 +h +ha1 +ha2 +ha3 +hai1 +hai2 +hai3 +hai4 +han1 +han2 +han3 +han4 +hang1 +hang2 +hang4 +hao1 +hao2 +hao3 +hao4 +he1 +he2 +he4 +hei1 +hen2 +hen3 +hen4 +heng1 +heng2 +heng4 +hong1 +hong2 +hong3 +hong4 +hou1 +hou2 +hou3 +hou4 +hu1 +hu2 +hu3 +hu4 +hua1 +hua2 +hua4 +huai2 +huai4 +huan1 +huan2 +huan3 +huan4 +huang1 +huang2 +huang3 +huang4 +hui1 +hui2 +hui3 +hui4 +hun1 +hun2 +hun4 +huo +huo1 +huo2 +huo3 +huo4 +i +j +ji1 +ji2 +ji3 +ji4 +jia +jia1 +jia2 +jia3 +jia4 +jian1 +jian2 +jian3 +jian4 +jiang1 +jiang2 +jiang3 +jiang4 +jiao1 +jiao2 +jiao3 +jiao4 +jie1 +jie2 +jie3 +jie4 +jin1 +jin2 +jin3 +jin4 +jing1 +jing2 +jing3 +jing4 +jiong3 +jiu1 +jiu2 +jiu3 +jiu4 +ju1 +ju2 +ju3 +ju4 +juan1 +juan2 +juan3 +juan4 +jue1 +jue2 +jue4 +jun1 +jun4 +k +ka1 +ka2 +ka3 +kai1 +kai2 +kai3 +kai4 +kan1 +kan2 +kan3 +kan4 +kang1 +kang2 +kang4 +kao1 +kao2 +kao3 +kao4 +ke1 +ke2 +ke3 +ke4 +ken3 +keng1 +kong1 +kong3 +kong4 +kou1 +kou2 +kou3 +kou4 +ku1 +ku2 +ku3 +ku4 +kua1 +kua3 +kua4 +kuai3 +kuai4 +kuan1 +kuan2 +kuan3 +kuang1 +kuang2 +kuang4 +kui1 +kui2 +kui3 +kui4 +kun1 +kun3 +kun4 +kuo4 +l +la +la1 +la2 +la3 +la4 +lai2 +lai4 +lan2 +lan3 +lan4 +lang1 +lang2 +lang3 +lang4 +lao1 +lao2 +lao3 +lao4 +le +le1 +le4 +lei +lei1 +lei2 +lei3 +lei4 +leng1 +leng2 +leng3 +leng4 +li +li1 +li2 +li3 +li4 +lia3 +lian2 +lian3 +lian4 +liang2 +liang3 +liang4 +liao1 +liao2 +liao3 +liao4 +lie1 +lie2 +lie3 +lie4 +lin1 +lin2 +lin3 +lin4 +ling2 +ling3 +ling4 +liu1 +liu2 +liu3 +liu4 +long1 +long2 +long3 +long4 +lou1 +lou2 +lou3 +lou4 +lu1 +lu2 +lu3 +lu4 +luan2 +luan3 +luan4 +lun1 +lun2 +lun4 +luo1 +luo2 +luo3 +luo4 +lv2 +lv3 +lv4 +lve3 +lve4 +m +ma +ma1 +ma2 +ma3 +ma4 +mai2 +mai3 +mai4 +man1 +man2 +man3 +man4 +mang2 +mang3 +mao1 +mao2 +mao3 +mao4 +me +mei2 +mei3 +mei4 +men +men1 +men2 +men4 +meng +meng1 +meng2 +meng3 +meng4 +mi1 +mi2 +mi3 +mi4 +mian2 +mian3 +mian4 +miao1 +miao2 +miao3 +miao4 +mie1 +mie4 +min2 +min3 +ming2 +ming3 +ming4 +miu4 +mo1 +mo2 +mo3 +mo4 +mou1 +mou2 +mou3 +mu2 +mu3 +mu4 +n +n2 +na1 +na2 +na3 +na4 +nai2 +nai3 +nai4 +nan1 +nan2 +nan3 +nan4 +nang1 +nang2 +nang3 +nao1 +nao2 +nao3 +nao4 +ne +ne2 +ne4 +nei3 +nei4 +nen4 +neng2 +ni1 +ni2 +ni3 +ni4 +nian1 +nian2 +nian3 +nian4 +niang2 +niang4 +niao2 +niao3 +niao4 +nie1 +nie4 +nin2 +ning2 +ning3 +ning4 +niu1 +niu2 +niu3 +niu4 +nong2 +nong4 +nou4 +nu2 +nu3 +nu4 +nuan3 +nuo2 +nuo4 +nv2 +nv3 +nve4 +o +o1 +o2 +ou1 +ou2 +ou3 +ou4 +p +pa1 +pa2 +pa4 +pai1 +pai2 +pai3 +pai4 +pan1 +pan2 +pan4 +pang1 +pang2 +pang4 +pao1 +pao2 +pao3 +pao4 +pei1 +pei2 +pei4 +pen1 +pen2 +pen4 +peng1 +peng2 +peng3 +peng4 +pi1 +pi2 +pi3 +pi4 +pian1 +pian2 +pian4 +piao1 +piao2 +piao3 +piao4 +pie1 +pie2 +pie3 +pin1 +pin2 +pin3 +pin4 +ping1 +ping2 +po1 +po2 +po3 +po4 +pou1 +pu1 +pu2 +pu3 +pu4 +q +qi1 +qi2 +qi3 +qi4 +qia1 +qia3 +qia4 +qian1 +qian2 +qian3 +qian4 +qiang1 +qiang2 +qiang3 +qiang4 +qiao1 +qiao2 +qiao3 +qiao4 +qie1 +qie2 +qie3 +qie4 +qin1 +qin2 +qin3 +qin4 +qing1 +qing2 +qing3 +qing4 +qiong1 +qiong2 +qiu1 +qiu2 +qiu3 +qu1 +qu2 +qu3 +qu4 +quan1 +quan2 +quan3 +quan4 +que1 +que2 +que4 +qun2 +r +ran2 +ran3 +rang1 +rang2 +rang3 +rang4 +rao2 +rao3 +rao4 +re2 +re3 +re4 +ren2 +ren3 +ren4 +reng1 +reng2 +ri4 +rong1 +rong2 +rong3 +rou2 +rou4 +ru2 +ru3 +ru4 +ruan2 +ruan3 +rui3 +rui4 +run4 +ruo4 +s +sa1 +sa2 +sa3 +sa4 +sai1 +sai4 +san1 +san2 +san3 +san4 +sang1 +sang3 +sang4 +sao1 +sao2 +sao3 +sao4 +se4 +sen1 +seng1 +sha1 +sha2 +sha3 +sha4 +shai1 +shai2 +shai3 +shai4 +shan1 +shan3 +shan4 +shang +shang1 +shang3 +shang4 +shao1 +shao2 +shao3 +shao4 +she1 +she2 +she3 +she4 +shei2 +shen1 +shen2 +shen3 +shen4 +sheng1 +sheng2 +sheng3 +sheng4 +shi +shi1 +shi2 +shi3 +shi4 +shou1 +shou2 +shou3 +shou4 +shu1 +shu2 +shu3 +shu4 +shua1 +shua2 +shua3 +shua4 +shuai1 +shuai3 +shuai4 +shuan1 +shuan4 +shuang1 +shuang3 +shui2 +shui3 +shui4 +shun3 +shun4 +shuo1 +shuo4 +si1 +si2 +si3 +si4 +song1 +song3 +song4 +sou1 +sou3 +sou4 +su1 +su2 +su4 +suan1 +suan4 +sui1 +sui2 +sui3 +sui4 +sun1 +sun3 +suo +suo1 +suo2 +suo3 +t +ta1 +ta2 +ta3 +ta4 +tai1 +tai2 +tai4 +tan1 +tan2 +tan3 +tan4 +tang1 +tang2 +tang3 +tang4 +tao1 +tao2 +tao3 +tao4 +te4 +teng2 +ti1 +ti2 +ti3 +ti4 +tian1 +tian2 +tian3 +tiao1 +tiao2 +tiao3 +tiao4 +tie1 +tie2 +tie3 +tie4 +ting1 +ting2 +ting3 +tong1 +tong2 +tong3 +tong4 +tou +tou1 +tou2 +tou4 +tu1 +tu2 +tu3 +tu4 +tuan1 +tuan2 +tui1 +tui2 +tui3 +tui4 +tun1 +tun2 +tun4 +tuo1 +tuo2 +tuo3 +tuo4 +u +v +w +wa +wa1 +wa2 +wa3 +wa4 +wai1 +wai3 +wai4 +wan1 +wan2 +wan3 +wan4 +wang1 +wang2 +wang3 +wang4 +wei1 +wei2 +wei3 +wei4 +wen1 +wen2 +wen3 +wen4 +weng1 +weng4 +wo1 +wo2 +wo3 +wo4 +wu1 +wu2 +wu3 +wu4 +x +xi1 +xi2 +xi3 +xi4 +xia1 +xia2 +xia4 +xian1 +xian2 +xian3 +xian4 +xiang1 +xiang2 +xiang3 +xiang4 +xiao1 +xiao2 +xiao3 +xiao4 +xie1 +xie2 +xie3 +xie4 +xin1 +xin2 +xin4 +xing1 +xing2 +xing3 +xing4 +xiong1 +xiong2 +xiu1 +xiu3 +xiu4 +xu +xu1 +xu2 +xu3 +xu4 +xuan1 +xuan2 +xuan3 +xuan4 +xue1 +xue2 +xue3 +xue4 +xun1 +xun2 +xun4 +y +ya +ya1 +ya2 +ya3 +ya4 +yan1 +yan2 +yan3 +yan4 +yang1 +yang2 +yang3 +yang4 +yao1 +yao2 +yao3 +yao4 +ye1 +ye2 +ye3 +ye4 +yi +yi1 +yi2 +yi3 +yi4 +yin1 +yin2 +yin3 +yin4 +ying1 +ying2 +ying3 +ying4 +yo1 +yong1 +yong2 +yong3 +yong4 +you1 +you2 +you3 +you4 +yu1 +yu2 +yu3 +yu4 +yuan1 +yuan2 +yuan3 +yuan4 +yue1 +yue4 +yun1 +yun2 +yun3 +yun4 +z +za1 +za2 +za3 +zai1 +zai3 +zai4 +zan1 +zan2 +zan3 +zan4 +zang1 +zang4 +zao1 +zao2 +zao3 +zao4 +ze2 +ze4 +zei2 +zen3 +zeng1 +zeng4 +zha1 +zha2 +zha3 +zha4 +zhai1 +zhai2 +zhai3 +zhai4 +zhan1 +zhan2 +zhan3 +zhan4 +zhang1 +zhang2 +zhang3 +zhang4 +zhao1 +zhao2 +zhao3 +zhao4 +zhe +zhe1 +zhe2 +zhe3 +zhe4 +zhen1 +zhen2 +zhen3 +zhen4 +zheng1 +zheng2 +zheng3 +zheng4 +zhi1 +zhi2 +zhi3 +zhi4 +zhong1 +zhong2 +zhong3 +zhong4 +zhou1 +zhou2 +zhou3 +zhou4 +zhu1 +zhu2 +zhu3 +zhu4 +zhua1 +zhua2 +zhua3 +zhuai1 +zhuai3 +zhuai4 +zhuan1 +zhuan2 +zhuan3 +zhuan4 +zhuang1 +zhuang4 +zhui1 +zhui4 +zhun1 +zhun2 +zhun3 +zhuo1 +zhuo2 +zi +zi1 +zi2 +zi3 +zi4 +zong1 +zong2 +zong3 +zong4 +zou1 +zou2 +zou3 +zou4 +zu1 +zu2 +zu3 +zuan1 +zuan3 +zuan4 +zui2 +zui3 +zui4 +zun1 +zuo +zuo1 +zuo2 +zuo3 +zuo4 +{ +~ +¡ +¢ +£ +¥ +§ +¨ +© +« +® +¯ +° +± +² +³ +´ +µ +· +¹ +º +» +¼ +½ +¾ +¿ +À +Á + +à +Ä +Å +Æ +Ç +È +É +Ê +Í +Î +Ñ +Ó +Ö +× +Ø +Ú +Ü +Ý +Þ +ß +à +á +â +ã +ä +å +æ +ç +è +é +ê +ë +ì +í +î +ï +ð +ñ +ò +ó +ô +õ +ö +ø +ù +ú +û +ü +ý +Ā +ā +ă +ą +ć +Č +č +Đ +đ +ē +ė +ę +ě +ĝ +ğ +ħ +ī +į +İ +ı +Ł +ł +ń +ņ +ň +ŋ +Ō +ō +ő +œ +ř +Ś +ś +Ş +ş +Š +š +Ť +ť +ũ +ū +ź +Ż +ż +Ž +ž +ơ +ư +ǎ +ǐ +ǒ +ǔ +ǚ +ș +ț +ɑ +ɔ +ɕ +ə +ɛ +ɜ +ɡ +ɣ +ɪ +ɫ +ɴ +ɹ +ɾ +ʃ +ʊ +ʌ +ʒ +ʔ +ʰ +ʷ +ʻ +ʾ +ʿ +ˈ +ː +˙ +˜ +ˢ +́ +̅ +Α +Β +Δ +Ε +Θ +Κ +Λ +Μ +Ξ +Π +Σ +Τ +Φ +Χ +Ψ +Ω +ά +έ +ή +ί +α +β +γ +δ +ε +ζ +η +θ +ι +κ +λ +μ +ν +ξ +ο +π +ρ +ς +σ +τ +υ +φ +χ +ψ +ω +ϊ +ό +ύ +ώ +ϕ +ϵ +Ё +А +Б +В +Г +Д +Е +Ж +З +И +Й +К +Л +М +Н +О +П +Р +С +Т +У +Ф +Х +Ц +Ч +Ш +Щ +Ы +Ь +Э +Ю +Я +а +б +в +г +д +е +ж +з +и +й +к +л +м +н +о +п +р +с +т +у +ф +х +ц +ч +ш +щ +ъ +ы +ь +э +ю +я +ё +і +ְ +ִ +ֵ +ֶ +ַ +ָ +ֹ +ּ +־ +ׁ +א +ב +ג +ד +ה +ו +ז +ח +ט +י +כ +ל +ם +מ +ן +נ +ס +ע +פ +ק +ר +ש +ת +أ +ب +ة +ت +ج +ح +د +ر +ز +س +ص +ط +ع +ق +ك +ل +م +ن +ه +و +ي +َ +ُ +ِ +ْ +ก +ข +ง +จ +ต +ท +น +ป +ย +ร +ว +ส +ห +อ +ฮ +ั +า +ี +ึ +โ +ใ +ไ +่ +้ +์ +ḍ +Ḥ +ḥ +ṁ +ṃ +ṅ +ṇ +Ṛ +ṛ +Ṣ +ṣ +Ṭ +ṭ +ạ +ả +Ấ +ấ +ầ +ậ +ắ +ằ +ẻ +ẽ +ế +ề +ể +ễ +ệ +ị +ọ +ỏ +ố +ồ +ộ +ớ +ờ +ở +ụ +ủ +ứ +ữ +ἀ +ἁ +Ἀ +ἐ +ἔ +ἰ +ἱ +ὀ +ὁ +ὐ +ὲ +ὸ +ᾶ +᾽ +ῆ +ῇ +ῶ +‎ +‑ +‒ +– +— +― +‖ +† +‡ +• +… +‧ +‬ +′ +″ +⁄ +⁡ +⁰ +⁴ +⁵ +⁶ +⁷ +⁸ +⁹ +₁ +₂ +₃ +€ +₱ +₹ +₽ +℃ +ℏ +ℓ +№ +ℝ +™ +⅓ +⅔ +⅛ +→ +∂ +∈ +∑ +− +∗ +√ +∞ +∫ +≈ +≠ +≡ +≤ +≥ +⋅ +⋯ +█ +♪ +⟨ +⟩ +、 +。 +《 +》 +「 +」 +【 +】 +あ +う +え +お +か +が +き +ぎ +く +ぐ +け +げ +こ +ご +さ +し +じ +す +ず +せ +ぜ +そ +ぞ +た +だ +ち +っ +つ +で +と +ど +な +に +ね +の +は +ば +ひ +ぶ +へ +べ +ま +み +む +め +も +ゃ +や +ゆ +ょ +よ +ら +り +る +れ +ろ +わ +を +ん +ァ +ア +ィ +イ +ウ +ェ +エ +オ +カ +ガ +キ +ク +ケ +ゲ +コ +ゴ +サ +ザ +シ +ジ +ス +ズ +セ +ゾ +タ +ダ +チ +ッ +ツ +テ +デ +ト +ド +ナ +ニ +ネ +ノ +バ +パ +ビ +ピ +フ +プ +ヘ +ベ +ペ +ホ +ボ +ポ +マ +ミ +ム +メ +モ +ャ +ヤ +ュ +ユ +ョ +ヨ +ラ +リ +ル +レ +ロ +ワ +ン +・ +ー +ㄋ +ㄍ +ㄎ +ㄏ +ㄓ +ㄕ +ㄚ +ㄜ +ㄟ +ㄤ +ㄥ +ㄧ +ㄱ +ㄴ +ㄷ +ㄹ +ㅁ +ㅂ +ㅅ +ㅈ +ㅍ +ㅎ +ㅏ +ㅓ +ㅗ +ㅜ +ㅡ +ㅣ +㗎 +가 +각 +간 +갈 +감 +갑 +갓 +갔 +강 +같 +개 +거 +건 +걸 +겁 +것 +겉 +게 +겠 +겨 +결 +겼 +경 +계 +고 +곤 +골 +곱 +공 +과 +관 +광 +교 +구 +국 +굴 +귀 +귄 +그 +근 +글 +금 +기 +긴 +길 +까 +깍 +깔 +깜 +깨 +께 +꼬 +꼭 +꽃 +꾸 +꿔 +끔 +끗 +끝 +끼 +나 +난 +날 +남 +납 +내 +냐 +냥 +너 +넘 +넣 +네 +녁 +년 +녕 +노 +녹 +놀 +누 +눈 +느 +는 +늘 +니 +님 +닙 +다 +닥 +단 +달 +닭 +당 +대 +더 +덕 +던 +덥 +데 +도 +독 +동 +돼 +됐 +되 +된 +될 +두 +둑 +둥 +드 +들 +등 +디 +따 +딱 +딸 +땅 +때 +떤 +떨 +떻 +또 +똑 +뚱 +뛰 +뜻 +띠 +라 +락 +란 +람 +랍 +랑 +래 +랜 +러 +런 +럼 +렇 +레 +려 +력 +렵 +렸 +로 +록 +롬 +루 +르 +른 +를 +름 +릉 +리 +릴 +림 +마 +막 +만 +많 +말 +맑 +맙 +맛 +매 +머 +먹 +멍 +메 +면 +명 +몇 +모 +목 +몸 +못 +무 +문 +물 +뭐 +뭘 +미 +민 +밌 +밑 +바 +박 +밖 +반 +받 +발 +밤 +밥 +방 +배 +백 +밸 +뱀 +버 +번 +벌 +벚 +베 +벼 +벽 +별 +병 +보 +복 +본 +볼 +봐 +봤 +부 +분 +불 +비 +빔 +빛 +빠 +빨 +뼈 +뽀 +뿅 +쁘 +사 +산 +살 +삼 +샀 +상 +새 +색 +생 +서 +선 +설 +섭 +섰 +성 +세 +셔 +션 +셨 +소 +속 +손 +송 +수 +숙 +순 +술 +숫 +숭 +숲 +쉬 +쉽 +스 +슨 +습 +슷 +시 +식 +신 +실 +싫 +심 +십 +싶 +싸 +써 +쓰 +쓴 +씌 +씨 +씩 +씬 +아 +악 +안 +않 +알 +야 +약 +얀 +양 +얘 +어 +언 +얼 +엄 +업 +없 +었 +엉 +에 +여 +역 +연 +염 +엽 +영 +옆 +예 +옛 +오 +온 +올 +옷 +옹 +와 +왔 +왜 +요 +욕 +용 +우 +운 +울 +웃 +워 +원 +월 +웠 +위 +윙 +유 +육 +윤 +으 +은 +을 +음 +응 +의 +이 +익 +인 +일 +읽 +임 +입 +있 +자 +작 +잔 +잖 +잘 +잡 +잤 +장 +재 +저 +전 +점 +정 +제 +져 +졌 +조 +족 +좀 +종 +좋 +죠 +주 +준 +줄 +중 +줘 +즈 +즐 +즘 +지 +진 +집 +짜 +짝 +쩌 +쪼 +쪽 +쫌 +쭈 +쯔 +찌 +찍 +차 +착 +찾 +책 +처 +천 +철 +체 +쳐 +쳤 +초 +촌 +추 +출 +춤 +춥 +춰 +치 +친 +칠 +침 +칩 +칼 +커 +켓 +코 +콩 +쿠 +퀴 +크 +큰 +큽 +키 +킨 +타 +태 +터 +턴 +털 +테 +토 +통 +투 +트 +특 +튼 +틀 +티 +팀 +파 +팔 +패 +페 +펜 +펭 +평 +포 +폭 +표 +품 +풍 +프 +플 +피 +필 +하 +학 +한 +할 +함 +합 +항 +해 +햇 +했 +행 +허 +험 +형 +혜 +호 +혼 +홀 +화 +회 +획 +후 +휴 +흐 +흔 +희 +히 +힘 +ﷺ +ﷻ +! +, +? +� +𠮶 diff --git a/data/librispeech_pc_test_clean_cross_sentence.lst b/data/librispeech_pc_test_clean_cross_sentence.lst index 347dbfd284689f2c173305e3fb7008613aaa7661..6969a66f3986832ceaefc546bfe5fc0bc043d1b1 100644 --- a/data/librispeech_pc_test_clean_cross_sentence.lst +++ b/data/librispeech_pc_test_clean_cross_sentence.lst @@ -1,1127 +1,1127 @@ -4992-41806-0009 4.355 exclaimed Bill Harmon to his wife as they went through the lighted hall. 4992-23283-0000 6.645 But the more forgetfulness had then prevailed, the more powerful was the force of remembrance when she awoke. -4992-23283-0001 2.71 Miss Milner's health is not good"! 4992-23283-0003 4.645 So there is to me"! added Sandford, with a sarcastic sneer. -4992-23283-0015 3.675 Is she not afraid that I will thwart her inclinations"? 4992-23283-0004 8.06 And yet you must own her behaviour has warranted them has it not been in this particular incoherent and unaccountable"? -4992-23283-0015 3.675 Is she not afraid that I will thwart her inclinations"? 4992-23283-0007 4.045 To ask any more questions of you, I believe, would be unfair. -4992-41797-0012 2.705 She is wild to know how to do things. 4992-23283-0008 4.91 He seemed to wait for her reply; but as she made none, he proceeded- -4992-41797-0016 3.3 They couldn't run nor move; they're just pasteboard". 4992-23283-0009 8.395 Oh! my Lord," cried Miss Woodley, with a most forcible accent, " You are the last person on earth she would pardon me for entrusting". -4992-41797-0005 3.845 Done? He ain't done a thing he'd oughter sence he was born. 4992-23283-0010 5 But in such a case, Miss Milner's election of a husband shall not direct mine. -4992-41797-0012 2.705 She is wild to know how to do things. 4992-23283-0011 4.225 If she does not know how to estimate her own value, I do. -4992-41806-0004 3.7 Burn, fire, burn! Flicker, flicker, flame! 4992-23283-0013 6.63 My Lord, Miss Milner's taste is not a depraved one; it is but too refined". -4992-41797-0012 2.705 She is wild to know how to do things. 4992-23283-0014 4.535 What can you mean by that, Miss Woodley? You talk mysteriously. -4992-41797-0012 2.705 She is wild to know how to do things. 4992-23283-0016 4.495 Again he searched his own thoughts; nor ineffectually as before. -4992-23283-0007 4.045 To ask any more questions of you, I believe, would be unfair. 4992-23283-0018 6.575 To relieve her from both, he laid his hand with force upon his heart, and said, "Do you believe me"? -4992-23283-0016 4.495 Again he searched his own thoughts; nor ineffectually as before. 4992-23283-0019 6.585 I will make no unjust use of what I know," he replied with firmness. "I believe you, my Lord". -672-122797-0005 3.26 Oh, that made him so angry! 672-122797-0000 4.07 Out in the woods stood a nice little Fir Tree. -672-122797-0029 3.05 How it will shine this evening"! 672-122797-0003 4.76 But this was what the Tree could not bear to hear. -672-122797-0000 4.07 Out in the woods stood a nice little Fir Tree. 672-122797-0007 6.42 In autumn the wood cutters always came and felled some of the largest trees. -672-122797-0000 4.07 Out in the woods stood a nice little Fir Tree. 672-122797-0012 7.765 I would fain know if I am destined for so glorious a career," cried the Tree, rejoicing. -672-122797-0029 3.05 How it will shine this evening"! 672-122797-0013 8.705 I am now tall, and my branches spread like the others that were carried off last year! Oh! -672-122797-0032 4 cried the young ladies, and they quickly put out the fire. 672-122797-0015 4.455 Were I in the warm room with all the splendor and magnificence! -672-122797-0044 3.74 And he leaned against the wall lost in reverie. 672-122797-0016 9.215 Yes; then something better, something still grander, will surely follow, or wherefore should they thus ornament me? -672-122797-0041 3.88 In the morning the servant and the housemaid came in. 672-122797-0017 4.82 Something better, something still grander must follow - but what? -672-122797-0000 4.07 Out in the woods stood a nice little Fir Tree. 672-122797-0018 4.93 Rejoice in our presence"! said the Air and the Sunlight. -672-122797-0047 3.325 How kind man is, after all! 672-122797-0019 4.11 Rejoice in thy own fresh youth"! -672-122797-0053 2.955 They were so extremely curious. 672-122797-0020 8.825 But the Tree did not rejoice at all; he grew and grew, and was green both winter and summer. -672-122797-0032 4 cried the young ladies, and they quickly put out the fire. 672-122797-0021 4.15 and towards Christmas he was one of the first that was cut down. -672-122797-0032 4 cried the young ladies, and they quickly put out the fire. 672-122797-0023 9.695063 He well knew that he should never see his dear old comrades, the little bushes and flowers around him, anymore; perhaps not even the birds! -672-122797-0059 3.52 Only that one," answered the Tree. 672-122797-0024 4.13 The departure was not at all agreeable. -672-122797-0000 4.07 Out in the woods stood a nice little Fir Tree. 672-122797-0027 4.79 The servants, as well as the young ladies, decorated it. -672-122797-0015 4.455 Were I in the warm room with all the splendor and magnificence! 672-122797-0030 4.575 Perhaps the other trees from the forest will come to look at me! -672-122797-0015 4.455 Were I in the warm room with all the splendor and magnificence! 672-122797-0032 4 cried the young ladies, and they quickly put out the fire. -672-122797-0015 4.455 Were I in the warm room with all the splendor and magnificence! 672-122797-0034 5.11 A story"! cried the children, drawing a little fat man towards the Tree. -672-122797-0011 2.54 And then? What happens then"? 672-122797-0036 5.365 Humpy Dumpy fell downstairs, and yet he married the princess! -672-122797-0044 3.74 And he leaned against the wall lost in reverie. 672-122797-0038 8.8 thought the Fir Tree, and believed it all, because the man who told the story was so good looking. "Well, well! -672-122797-0043 3.78 What's the meaning of this"? thought the Tree. 672-122797-0039 4.025 I won't tremble tomorrow"! thought the Fir Tree. -672-122797-0000 4.07 Out in the woods stood a nice little Fir Tree. 672-122797-0040 5.125 And the whole night the Tree stood still and in deep thought. -672-122797-0059 3.52 Only that one," answered the Tree. 672-122797-0046 4.715 Tis now winter out of doors"! thought the Tree. -672-122797-0054 4.25 I know no such place," said the Tree. 672-122797-0048 6.555 If it only were not so dark here, and so terribly lonely! -672-122797-0041 3.88 In the morning the servant and the housemaid came in. 672-122797-0050 4.855 They snuffed about the Fir Tree, and rustled among the branches. -672-122797-0054 4.25 I know no such place," said the Tree. 672-122797-0051 4.665 I am by no means old," said the Fir Tree. -672-122797-0011 2.54 And then? What happens then"? 672-122797-0052 4.285 There's many a one considerably older than I am". -672-122797-0031 3.98 It blazed up famously. "Help! Help"! 672-122797-0054 4.25 I know no such place," said the Tree. -672-122797-0032 4 cried the young ladies, and they quickly put out the fire. 672-122797-0055 8.23 And then he told all about his youth; and the little Mice had never heard the like before; and they listened and said, -672-122797-0000 4.07 Out in the woods stood a nice little Fir Tree. 672-122797-0056 5.225 said the Fir Tree, thinking over what he had himself related. -672-122797-0065 3.03 Now that too is over. 672-122797-0057 6.56 Yes, in reality those were happy times". -672-122797-0000 4.07 Out in the woods stood a nice little Fir Tree. 672-122797-0058 4.47 Who is Humpy Dumpy"? asked the Mice. -672-122797-0005 3.26 Oh, that made him so angry! 672-122797-0061 7.59 Don't you know one about bacon and tallow candles? Can't you tell any larder stories"? -672-122797-0021 4.15 and towards Christmas he was one of the first that was cut down. 672-122797-0066 4.815 Why, one morning there came a quantity of people and set to work in the loft. -672-122797-0010 3.815 Rejoice in thy growth"! said the Sunbeams. 672-122797-0068 4.02 but it was not the Fir Tree that they meant. -672-122797-0028 2.61 This evening"! they all said. 672-122797-0069 5.01 It was in a corner that he lay, among weeds and nettles. -672-122797-0032 4 cried the young ladies, and they quickly put out the fire. 672-122797-0070 6.27 The golden star of tinsel was still on the top of the Tree, and glittered in the sunshine. -672-122797-0021 4.15 and towards Christmas he was one of the first that was cut down. 672-122797-0071 8.875 In the court yard some of the merry children were playing who had danced at Christmas round the Fir Tree, and were so glad at the sight of him. -672-122797-0000 4.07 Out in the woods stood a nice little Fir Tree. 672-122797-0072 7.94 And the gardener's boy chopped the Tree into small pieces; there was a whole heap lying there. -672-122797-0053 2.955 They were so extremely curious. 672-122797-0073 8.205 The wood flamed up splendidly under the large brewing copper, and it sighed so deeply! -672-122797-0062 2.675 No," said the Tree. 672-122797-0074 8.73 However, that was over now - the Tree gone, the story at an end. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0001 8.250063 The influence with the Timaeus has exercised upon posterity is due partly to a misunderstanding. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0004 8.22 There is no danger of the modern commentators on the Timaeus falling into the absurdities of the Neo Platonists. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0007 7.64 But they have nothing to do with the interpretation of Plato, and in spirit they are opposed to him. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0012 6.89 Many, if not all the elements of the Pre Socratic philosophy are included in the Timaeus. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0014 8.775 The ideas also remain, but they have become types in nature, forms of men, animals, birds, fishes. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0015 7.83 The style and plan of the Timaeus differ greatly from that of any other of the Platonic dialogues. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0016 7.76 But Plato has not the same mastery over his instrument which he exhibits in the Phaedrus or Symposium. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0017 7.87 Nothing can exceed the beauty or art of the introduction, in which he is using words after his accustomed manner. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0018 8.38 But in the rest of the work the power of language seems to fail him, and the dramatic form is wholly given up. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0020 9.88 And hence we find the same sort of clumsiness in the Timaeus of Plato which characterizes the philosophical poem of Lucretius. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0022 7.425 Plato had not the command of his materials which would have enabled him to produce a perfect work of art. -8224-274384-0003 3.87 or hath he given us any gift? 8224-274381-0011 6.48 His conduct and presence of mind in this emergence appeared conspicuous. -1221-135766-0013 3.645 Pearl was a born outcast of the infantile world. 1221-135767-0005 5.865 It was the scarlet letter in another form: the scarlet letter endowed with life! -1221-135766-0015 2.63 If spoken to, she would not speak again. 1221-135767-0010 8.2 She screamed and shouted, too, with a terrific volume of sound, which, doubtless, caused the hearts of the fugitives to quake within them. -1221-135767-0008 3.095 Come, therefore, and let us fling mud at them"! 1221-135767-0014 7.07 Yea, his honourable worship is within. But he hath a godly minister or two with him, and likewise a leech. -1221-135767-0020 3.345 In truth, she seemed absolutely hidden behind it. 1221-135767-0024 5.85 Pearl, seeing the rose bushes, began to cry for a red rose, and would not be pacified. -7176-88083-0008 3.28 In despair he hurled himself downward too soon. 7176-92135-0001 7.56 In short he becomes a "prominent figure in London Society" - and, if he is not careful, somebody will say so. -7176-92135-0007 3.275 Anyhow it's jolly exciting, and I can do the dialogue all right. 7176-92135-0005 5.47 But suppose you said, "I'm fond of writing; my people always say my letters home are good enough for Punch. -7176-92135-0027 2.835 Lady Larkspur starts suddenly and turns towards him. 7176-92135-0006 7.795 I've got a little idea for a play about a man and a woman and another woman, and - but perhaps I'd better keep the plot a secret for the moment. -7176-88083-0009 4.045 The great hawk followed hurriedly, to retrieve his prey from the ground. 7176-92135-0008 4.43 Lend me your ear for ten minutes, and you shall learn just what stagecraft is". -7176-92135-0004 2.425 Frankly I cannot always say. 7176-92135-0009 4.38 And I should begin with a short homily on Soliloquy. -7176-88083-0016 3.92 Straightway the hawk glided from his perch and darted after him. 7176-92135-0015 6.755 And so on, till you get to the end, when Ophelia might say, "Ah, yes," or something non committal of that sort. -7176-88083-0006 4.295 It might have seemed that a trout of this size was a fairly substantial meal. 7176-92135-0016 7.545 This would be an easy way of doing it, but it would not be the best way, for the reason that it is too easy to call attention to itself. -7176-88083-0016 3.92 Straightway the hawk glided from his perch and darted after him. 7176-92135-0017 7.17 In the old badly made play it was frequently necessary for one of the characters to take the audience into his confidence. -7176-88083-0016 3.92 Straightway the hawk glided from his perch and darted after him. 7176-92135-0018 8.94 In the modern well constructed play he simply rings up an imaginary confederate and tells him what he is going to do. Could anything be more natural? -7176-88083-0008 3.28 In despair he hurled himself downward too soon. 7176-92135-0020 7.165 Double nine two three, Elsinore.... Double- nine, yes.... Hallo, is that you, Horatio? Hamlet speaking. -7176-88083-0016 3.92 Straightway the hawk glided from his perch and darted after him. 7176-92135-0022 8.23 To be or not to be, that is the question; whether 'tis nobler in the mind to suffer the slings and arrows - What? No, Hamlet speaking. -7176-92135-0002 3.415 But even the unsuccessful dramatist has his moments. 7176-92135-0023 6.215 You gave me double- five, I want double- nine.... Hallo, is that you, Horatio? Hamlet speaking. -7176-92135-0026 2.95 Enter Hamlet with his favourite boar hound. 7176-92135-0024 4.1 To be or not to be, that is the question; whether 'tis nobler -7176-88083-0016 3.92 Straightway the hawk glided from his perch and darted after him. 7176-92135-0042 7.27 In novels the hero has often "pushed his meals away untasted," but no stage hero would do anything so unnatural as this. -7176-92135-0007 3.275 Anyhow it's jolly exciting, and I can do the dialogue all right. 7176-92135-0044 5.175 But it is the cigarette which chiefly has brought the modern drama to its present state of perfection. -4077-13754-0001 3.77 But a word further concerning the expedition in general. 4077-13751-0001 8.745 Its origin was small - a germ, an insignificant seed, hardly to be thought of as likely to arouse opposition. -4077-13754-0001 3.77 But a word further concerning the expedition in general. 4077-13751-0002 9.75 Instead of but six regularly affiliated members, and at most two score of adherents, the organization numbers today many hundred thousand souls. -4077-13751-0013 4.315 Their sufferings have never yet been fitly chronicled by human scribe. 4077-13751-0010 6.72 To the fervent Latter day Saint, a temple is not simply a church building, a house for religious assembly. -4077-13751-0019 2.92 Who began the quarrel? Was it the "Mormons"? 4077-13751-0013 4.315 Their sufferings have never yet been fitly chronicled by human scribe. -4077-13754-0001 3.77 But a word further concerning the expedition in general. 4077-13751-0017 5.095 Oh, what a record to read; what a picture to gaze upon; how awful the fact! -6930-81414-0019 3.38 Voltaire picked up something from the ground and looked at it. 6930-76324-0002 5.56 The poor little things"! cried Cynthia. "Think of them having been turned to the wall all these years! -6930-76324-0009 3.405 Do you suppose the miniature was a copy of the same thing"? 6930-76324-0004 6.15 But Joyce had not been listening. All at once she put down her candle on the table and faced her companion. -6930-76324-0009 3.405 Do you suppose the miniature was a copy of the same thing"? 6930-76324-0005 5.035 The twin brother did something she didn't like, and she turned his picture to the wall. -6930-76324-0001 3.2 They were certainly no nearer the solution of their problem. 6930-76324-0006 4.455 Hers happened to be in the same frame too, but she evidently didn't care about that. -6930-76324-0006 4.455 Hers happened to be in the same frame too, but she evidently didn't care about that. 6930-76324-0008 5.185 I thought we were 'stumped' again when I first saw that picture, but it's been of some use, after all. -6930-76324-0026 3.085 Isn't he the greatest for getting into odd corners"! 6930-76324-0011 9.24 They worry me terribly. And, besides, I'd like to see what this lovely furniture looks like without such quantities of dust all over it". "Good scheme, CYN"! -6930-76324-0006 4.455 Hers happened to be in the same frame too, but she evidently didn't care about that. 6930-76324-0012 4.655 We'll come in here this afternoon with old clothes on, and have a regular house cleaning! -6930-76324-0010 2.69 What in the world is that"? queried Joyce. 6930-76324-0013 4.305 It can't hurt anything, I'm sure, for we won't disturb things at all. -6930-76324-0007 2.82 Now what have you to say, Cynthia Sprague"? 6930-76324-0014 4.72 This thought, however, did not enter the heads of the enthusiastic pair. -6930-76324-0019 2.575 Now let's dust the furniture and pictures". 6930-76324-0016 9.205 The lure proved too much for him, and he came sporting after it, as friskily as a young kitten, much to Cynthia's delight when she caught sight of him. -6930-81414-0018 2.93 I remember saying. "Have we been together"? 6930-76324-0017 5.41 Oh, let him come along"! she urged. "I do love to see him about that old house. -6930-76324-0025 4.12 Why, it's Goliath as usual"! they both cried, peering in. 6930-76324-0020 6.315 Yet, little as it was, it had already made a vast difference in the aspect of the room. -6930-76324-0007 2.82 Now what have you to say, Cynthia Sprague"? 6930-76324-0021 7.355 Surface dust at least had been removed, and the fine old furniture gave a hint of its real elegance and polish. -6930-76324-0013 4.305 It can't hurt anything, I'm sure, for we won't disturb things at all. 6930-76324-0023 4.85 And my pocket money is getting low again, and you haven't any left, as usual. -6930-76324-0026 3.085 Isn't he the greatest for getting into odd corners"! 6930-76324-0024 4.05 They say illumination by candle light is the prettiest in the world. -6930-81414-0012 4.43 said another voice, which I recognized as Voltaire's. "Kaffar? 6930-76324-0025 4.12 Why, it's Goliath as usual"! they both cried, peering in. -6930-81414-0019 3.38 Voltaire picked up something from the ground and looked at it. 6930-76324-0027 8.27 Forgetting all their weariness, they seized their candles and scurried through the house, finding an occasional paper tucked away in some odd corner. -6930-81414-0018 2.93 I remember saying. "Have we been together"? 6930-76324-0028 9.875 Well, I'm convinced that the Boarded up House mystery happened not earlier than april sixteenth, eighteen sixty one, and probably not much later. -6930-76324-0007 2.82 Now what have you to say, Cynthia Sprague"? 6930-81414-0004 9.56 The story of its evil influence came back to me, and in my bewildered condition I wondered whether there was not some truth in what had been said. -6930-75918-0000 3.505 Concord returned to its place amidst the tents. 6930-81414-0006 6.8 What then? A human hand, large and shapely, appeared distinctly on the surface of the pond. -6930-75918-0011 3.195 I am convinced of what I say," said the count. 6930-81414-0007 4.365 Nothing more, not even the wrist to which it might be attached. -6930-75918-0013 2.94 In those very terms; I even added more. 6930-81414-0008 6.055 It did not beckon, or indeed move at all; it was as still as the hand of death. -6930-81414-0010 3.835 A sound of voices. A flash of light. 6930-81414-0011 4.7 A feeling of freedom, and I was awake! Where? -6930-76324-0025 4.12 Why, it's Goliath as usual"! they both cried, peering in. 6930-81414-0012 4.43 said another voice, which I recognized as Voltaire's. "Kaffar? -6930-81414-0007 4.365 Nothing more, not even the wrist to which it might be attached. 6930-81414-0013 7.325 I had scarcely known what I had been saying or doing up to this time, but as he spoke I looked at my hand. -6930-75918-0007 3.315 You will be frank with me"? "I always am". 6930-81414-0014 7.41 In the light of the moon I saw a knife red with blood, and my hand, too, was also discoloured. -6930-81414-0025 2.53 My position was too terrible. 6930-81414-0020 5 I say you do know what this means, and you must tell us". -6930-81414-0027 3.85 For some time after that I remembered nothing distinctly. 6930-81414-0022 4.34 I had again been acting under the influence of this man's power. -6930-81414-0021 3.225 A terrible thought flashed into my mind. 6930-81414-0023 4.885 Perchance, too, Kaffar's death might serve him in good stead. -6930-75918-0010 3.035 I can perceive love clearly enough". 6930-81414-0024 5.05 My tongue refused to articulate; my power of speech left me. -1221-135766-0015 2.63 If spoken to, she would not speak again. 1221-135766-0002 4.825 Yet these thoughts affected Hester Prynne less with hope than apprehension. -1221-135766-0015 2.63 If spoken to, she would not speak again. 1221-135766-0004 7.44 This outward mutability indicated, and did not more than fairly express, the various properties of her inner life. -1221-135766-0013 3.645 Pearl was a born outcast of the infantile world. 1221-135766-0007 8.795 Hester Prynne, nevertheless, the loving mother of this one child, ran little risk of erring on the side of undue severity. -1221-135767-0020 3.345 In truth, she seemed absolutely hidden behind it. 1221-135766-0014 4.75 Pearl saw, and gazed intently, but never sought to make acquaintance. -7021-79740-0012 3.26 said she, pointing to the playthings; "see! 7021-79730-0005 8.01 So you will be a good girl, I know, and not make any trouble, but will stay at home contentedly - won't you? -8463-294828-0021 2.735 A route slightly less direct, that's all. 8463-294825-0001 7.805 This reality begins to explain the dark power and otherworldly fascination of Twenty Thousand Leagues Under the Seas. -8463-287645-0014 3.02 of starting. I didn't know the way to come. 8463-294825-0003 9.935 Nemo builds a fabulous futuristic submarine, the Nautilus, then conducts an underwater campaign of vengeance against his imperialist oppressor. -8463-287645-0001 3.545 It is hardly necessary to say more of them here. 8463-294825-0005 7.7 Other subtleties occur inside each episode, the textures sparkling with wit, information, and insight. -8463-287645-0001 3.545 It is hardly necessary to say more of them here. 8463-294825-0010 4.580063 And in this last action he falls into the classic sin of Pride. -8463-287645-0009 3.71 I never knew of but one man who could ever please him. 8463-294825-0012 5.965063 The Nautilus nearly perishes in the Antarctic and Nemo sinks into a growing depression. -1580-141083-0021 3.715 There is no opening except the one pane," said our learned guide. 1580-141083-0000 8.94 I will endeavour, in my statement, to avoid such terms as would serve to limit the events to any particular place, or give a clue as to the people concerned. -1580-141084-0034 4.49 Well, well, don't trouble to answer. Listen, and see that I do you no injustice. 1580-141083-0002 6.135 My friend's temper had not improved since he had been deprived of the congenial surroundings of Baker Street. -1580-141083-0023 3.33 One could hardly hope for any upon so dry a day. 1580-141083-0003 6.55 Without his scrapbooks, his chemicals, and his homely untidiness, he was an uncomfortable man. -1580-141084-0003 4.1 No names, please"! said Holmes, as we knocked at Gilchrist's door. 1580-141083-0004 4.515 I had to read it over carefully, as the text must be absolutely correct. -1580-141084-0045 3.625 Suddenly he heard him at the very door. There was no possible escape. 1580-141083-0007 4.565 The moment I looked at my table, I was aware that someone had rummaged among my papers. -1580-141083-0011 2.825 A broken tip of lead was lying there also. 1580-141083-0008 4.305 The proof was in three long slips. I had left them all together. -1580-141083-0030 3.48 mister Soames was somewhat overwhelmed by this flood of information. 1580-141083-0009 7.04 The alternative was that someone passing had observed the key in the door, had known that I was out, and had entered to look at the papers. -1580-141083-0030 3.48 mister Soames was somewhat overwhelmed by this flood of information. 1580-141083-0010 5.32 I gave him a little brandy and left him collapsed in a chair, while I made a most careful examination of the room. -1580-141083-0050 3.085 I really don't think he knew much about it, mister Holmes. 1580-141083-0012 7.065 Not only this, but on the table I found a small ball of black dough or clay, with specks of something which looks like sawdust in it. -1580-141083-0019 2.705 Above were three students, one on each story. 1580-141083-0013 4.32 Above all things, I desire to settle the matter quietly and discreetly". -1580-141083-0048 2.785 How came you to leave the key in the door"? 1580-141083-0015 4.985 Did anyone know that these proofs would be there"? "No one save the printer". -1580-141084-0021 4.01 On the palm were three little pyramids of black, doughy clay. 1580-141083-0016 4.255 I was in such a hurry to come to you". "You left your door open"? -1580-141083-0036 3.98 Holmes held it out on his open palm in the glare of the electric light. 1580-141083-0020 5.135 Then he approached it, and, standing on tiptoe with his neck craned, he looked into the room. -1580-141084-0050 2.78 If mister Soames saw them, the game was up. 1580-141083-0024 4.48 You left him in a chair, you say. Which chair"? "By the window there". -1580-141084-0037 2.965 When I approached your room, I examined the window. 1580-141083-0026 4.775 As a matter of fact, he could not," said Soames, "for I entered by the side door". -1580-141083-0030 3.48 mister Soames was somewhat overwhelmed by this flood of information. 1580-141083-0027 5.225 How long would it take him to do that, using every possible contraction? A quarter of an hour, not less. -1580-141084-0050 2.78 If mister Soames saw them, the game was up. 1580-141083-0031 6.25 Holmes held out a small chip with the letters NN and a space of clear wood after them. "You see"? -1580-141084-0036 2.475 The Indian I also thought nothing of. 1580-141083-0032 4.135 Watson, I have always done you an injustice. There are others. -1580-141084-0045 3.625 Suddenly he heard him at the very door. There was no possible escape. 1580-141083-0033 7.45 I was hoping that if the paper on which he wrote was thin, some trace of it might come through upon this polished surface. No, I see nothing. -1580-141083-0025 3.905 The man entered and took the papers, sheet by sheet, from the central table. 1580-141083-0034 6.99 As Holmes drew the curtain I was aware, from some little rigidity and alertness of his attitude, that he was prepared for an emergency. -1580-141084-0050 2.78 If mister Soames saw them, the game was up. 1580-141083-0035 4.98 Holmes turned away, and stooped suddenly to the floor. "Hello! What's this"? -1580-141083-0030 3.48 mister Soames was somewhat overwhelmed by this flood of information. 1580-141083-0037 5.73 What could he do? He caught up everything which would betray him, and he rushed into your bedroom to conceal himself". -1580-141083-0036 3.98 Holmes held it out on his open palm in the glare of the electric light. 1580-141083-0038 7.535 I understand you to say that there are three students who use this stair, and are in the habit of passing your door"? "Yes, there are". -1580-141083-0024 4.48 You left him in a chair, you say. Which chair"? "By the window there". 1580-141083-0042 5.865 My scholar has been left very poor, but he is hard working and industrious. He will do well. -1580-141084-0014 3.97 Why, Bannister, the servant. What's his game in the matter"? 1580-141083-0044 5.505 I dare not go so far as that. But, of the three, he is perhaps the least unlikely". -1580-141083-0025 3.905 The man entered and took the papers, sheet by sheet, from the central table. 1580-141083-0045 4.36 He was still suffering from this sudden disturbance of the quiet routine of his life. -1580-141083-0052 3.45 Oh, I would not venture to say, sir. 1580-141083-0053 4.015 You haven't seen any of them"? "No, sir". -4992-41797-0003 2.835 mister Popham laid down his brush. 4992-41797-0000 5.485 Yes, dead these four years, an' a good job for her, too. -4992-41797-0003 2.835 mister Popham laid down his brush. 4992-41797-0002 5.625 Grandfather was Alexander Carey, L L. D., - Doctor of Laws, that is". -4992-23283-0016 4.495 Again he searched his own thoughts; nor ineffectually as before. 4992-41797-0004 7.315 I swan to man"! he ejaculated. "If you don't work hard you can't keep up with the times! Doctor of Laws! -4992-23283-0015 3.675 Is she not afraid that I will thwart her inclinations"? 4992-41797-0006 4.55 He keeps the thou shalt not commandments first rate, Hen Lord does! -4992-23283-0015 3.675 Is she not afraid that I will thwart her inclinations"? 4992-41797-0007 6.905 He give up his position and shut the family up in that tomb of a house so 't he could study his books. -4992-41797-0012 2.705 She is wild to know how to do things. 4992-41797-0008 8.965 mister Popham exaggerated nothing, but on the contrary left much unsaid in his narrative of the family at the House of Lords. -4992-41797-0003 2.835 mister Popham laid down his brush. 4992-41797-0010 6.82 Always irritable, cold, indifferent, he had grown rapidly more so as years went on. -4992-41797-0016 3.3 They couldn't run nor move; they're just pasteboard". 4992-41797-0011 5.445 Whatever appealed to her sense of beauty was straightway transferred to paper or canvas. -4992-41806-0009 4.355 exclaimed Bill Harmon to his wife as they went through the lighted hall. 4992-41797-0013 9.8 She makes effort after effort, trembling with eagerness, and when she fails to reproduce what she sees, she works herself into a frenzy of grief and disappointment". -4992-41806-0009 4.355 exclaimed Bill Harmon to his wife as they went through the lighted hall. 4992-41797-0014 7.215 When she could not make a rabbit or a bird look "real" on paper, she searched in her father's books for pictures of its bones. -4992-41806-0009 4.355 exclaimed Bill Harmon to his wife as they went through the lighted hall. 4992-41797-0015 8.65 Cyril, there must be some better way of doing; I just draw the outline of an animal and then I put hairs or feathers on it. They have no bodies. -4992-23283-0011 4.225 If she does not know how to estimate her own value, I do. 4992-41797-0017 8.69 He wouldn't search, so don't worry," replied Cyril quietly, and the two looked at each other and knew that it was so. -4992-23283-0016 4.495 Again he searched his own thoughts; nor ineffectually as before. 4992-41797-0018 9.155 There, in the cedar hollow, then, lived Olive Lord, an angry, resentful, little creature weighed down by a fierce sense of injury. -4992-23283-0001 2.71 Miss Milner's health is not good"! 4992-41797-0019 4.755 Olive's mournful black eyes met Nancy's sparkling brown ones. -4992-41797-0012 2.705 She is wild to know how to do things. 4992-41797-0020 7.49 Nancy's curly chestnut crop shone in the sun, and Olive's thick black plaits looked blacker by contrast. -4992-23283-0007 4.045 To ask any more questions of you, I believe, would be unfair. 4992-41797-0021 8.23 She's wonderful! More wonderful than anybody we've ever seen anywhere, and she draws better than the teacher in Charlestown! -4992-23283-0001 2.71 Miss Milner's health is not good"! 4992-41797-0022 6.45 She's older than I am, but so tiny and sad and shy that she seems like a child. -2830-3980-0001 3.945 They said to the Galatians: "You have no right to think highly of Paul. 2830-3979-0000 6.12 We want you to help us publish some leading work of Luther's for the general American market. Will you do it"? -2830-3980-0020 3.46 This is no sinful pride. It is holy pride. 2830-3979-0002 4.315 Let us begin with that: his Commentary on Galatians..". -2830-3980-0046 2.84 Was it not enough to say, "from God the Father"? 2830-3979-0003 8.085 The undertaking, which seemed so attractive when viewed as a literary task, proved a most difficult one, and at times became oppressive. -2830-3980-0012 3.42 The most they could claim is that they were sent by others. 2830-3979-0006 4.55 A word should now be said about the origin of Luther's Commentary on Galatians. -2830-3980-0013 4.145 He mentions the apostles first because they were appointed directly by God. 2830-3979-0008 9.44 In other words, these three men took down the lectures which Luther addressed to his students in the course of Galatians, and Roerer prepared the manuscript for the printer. -2830-3980-0013 4.145 He mentions the apostles first because they were appointed directly by God. 2830-3979-0009 8.35 It presents like no other of Luther's writings the central thought of Christianity, the justification of the sinner for the sake of Christ's merits alone. -2830-3980-0020 3.46 This is no sinful pride. It is holy pride. 2830-3979-0011 9.45 The Lord who has given us power to teach and to hear, let Him also give us the power to serve and to do". LUKE two -2094-142345-0025 3.595 Cold, is it, my darling? Bless your sweet face"! 2094-142345-0001 8.03 But the windows are patched with wooden panes, and the door, I think, is like the gate it is never opened. -2094-142345-0025 3.595 Cold, is it, my darling? Bless your sweet face"! 2094-142345-0005 9.09 Several clothes horses, a pillion, a spinning wheel, and an old box wide open and stuffed full of coloured rags. -2094-142345-0060 2.71 Oh, I've no doubt it's in capital order. 2094-142345-0021 5.335 That's the way with you that's the road you'd all like to go, headlongs to ruin. -2094-142345-0018 3.155 Who taught you to scrub a floor, I should like to know? 2094-142345-0034 7.99 And there's linen in the house as I could well spare you, for I've got lots o' sheeting and table clothing, and towelling, as isn't made up. -2094-142345-0026 2.825 She's going to put the ironing things away". 2094-142345-0036 6.915 Nay, dear aunt, you never heard me say that all people are called to forsake their work and their families. -2094-142345-0020 2.435 That's what you'd like to be doing, is it? 2094-142345-0039 6.28 I've strong assurance that no evil will happen to you and my uncle and the children from anything I've done. -2094-142345-0020 2.435 That's what you'd like to be doing, is it? 2094-142345-0043 7.35 By this time the two gentlemen had reached the palings and had got down from their horses: it was plain they meant to come in. -2094-142345-0032 3.24 I often heard her talk of you in the same sort of way. 2094-142345-0048 6.39 said Captain Donnithorne, seating himself where he could see along the short passage to the open dairy door. -2094-142345-0004 2.64 And what through the left hand window? 2094-142345-0049 6.125 No, sir, he isn't; he's gone to Rosseter to see mister West, the factor, about the wool. -2094-142345-0018 3.155 Who taught you to scrub a floor, I should like to know? 2094-142345-0051 5.31 No, thank you; I'll just look at the whelps and leave a message about them with your shepherd. -2094-142345-0060 2.71 Oh, I've no doubt it's in capital order. 2094-142345-0052 6.53 I must come another day and see your husband; I want to have a consultation with him about horses. -1995-1837-0009 3.76 The lagoon had been level with the dykes a week ago; and now? 1995-1836-0001 6 At last the Cotton Combine was to all appearances an assured fact and he was slated for the Senate. -1995-1837-0015 4.485 The squares of cotton, sharp edged, heavy, were just about to burst to bolls! 1995-1836-0003 7.965 She was not herself a notably intelligent woman; she greatly admired intelligence or whatever looked to her like intelligence in others. -1995-1837-0015 4.485 The squares of cotton, sharp edged, heavy, were just about to burst to bolls! 1995-1836-0006 7.715 She was therefore most agreeably surprised to hear mister Cresswell express himself so cordially as approving of Negro education. -1995-1837-0005 2.635 She was so strange and human a creature. 1995-1836-0008 6.985 I believe in the training of people to their highest capacity". The Englishman here heartily seconded him. -1995-1837-0000 3.865 He knew the Silver Fleece - his and Zora's - must be ruined. 1995-1836-0009 6.71 But," Cresswell added significantly, "capacity differs enormously between races". -1995-1826-0004 3.035 Might learn something useful down there". 1995-1836-0011 4.705 Positively heroic," added Cresswell, avoiding his sister's eyes. -1995-1837-0022 3.415 Up in the sick room Zora lay on the little white bed. 1995-1836-0014 9.045 Fortunately," said mister Vanderpool, "Northerners and Southerners are arriving at a better mutual understanding on most of these matters". -237-126133-0021 4.365 she asked impulsively, "I didn't believe you could persuade her, father". 237-126133-0003 6.56 Somehow, of all the days when the home feeling was the strongest, this day it seemed as if she could bear it no longer. -237-126133-0025 3.755 At last he came out of them, and wiped his face vigorously. 237-126133-0005 6.51 Oh, she's always at the piano," said Van. "She must be there now, somewhere," and then somebody laughed. -237-126133-0016 4.25 Oh no, Jasper; I must go by my very own self". 237-126133-0006 6.15 At this, the bundle opened suddenly, and - out popped Phronsie! -237-126133-0021 4.365 she asked impulsively, "I didn't believe you could persuade her, father". 237-126133-0007 8.68 But Polly couldn't speak; and if Jasper hadn't caught her just in time, she would have tumbled over backward from the stool, Phronsie and all! -237-126133-0025 3.755 At last he came out of them, and wiped his face vigorously. 237-126133-0010 6.24 Oh, you are the dearest and best mister King I ever saw! but how did you make mammy let her come"? -237-126133-0009 3.97 Now you'll stay," cried Van; "say, Polly, won't you". 237-126133-0011 6.71 Isn't he splendid"! cried Jasper in intense pride, swelling up. "Father knew how to do it". -237-126133-0018 4.095 Don't mind it, Polly," whispered Jasper; "twasn't her fault". 237-126133-0012 4.45 There, there," he said soothingly, patting her brown, fuzzy head. -237-126133-0016 4.25 Oh no, Jasper; I must go by my very own self". 237-126133-0013 6.815 I know," gasped Polly, controlling her sobs; "I won't - only - I can't thank you"! -237-126133-0025 3.755 At last he came out of them, and wiped his face vigorously. 237-126133-0014 6.79 asked Phronsie in intense interest slipping down out of Polly's arms, and crowding up close to Jasper's side. -237-126133-0025 3.755 At last he came out of them, and wiped his face vigorously. 237-126133-0015 9.34 Yes, all alone by himself," asserted Jasper, vehemently, and winking furiously to the others to stop their laughing; "he did now, truly, Phronsie". -237-126133-0009 3.97 Now you'll stay," cried Van; "say, Polly, won't you". 237-126133-0016 4.25 Oh no, Jasper; I must go by my very own self". -237-126133-0021 4.365 she asked impulsively, "I didn't believe you could persuade her, father". 237-126133-0017 6.21 There Jap, you've caught it," laughed Percy; while the others screamed at the sight of Jasper's face. -237-126133-0008 3.865 asked Phronsie, with her little face close to Polly's own. 237-126133-0018 4.095 Don't mind it, Polly," whispered Jasper; "twasn't her fault". -237-126133-0025 3.755 At last he came out of them, and wiped his face vigorously. 237-126133-0019 7.12 Dear me"! ejaculated the old gentleman, in the utmost amazement; "and such a time as I've had to get her here too"! -237-126133-0025 3.755 At last he came out of them, and wiped his face vigorously. 237-126133-0021 4.365 she asked impulsively, "I didn't believe you could persuade her, father". -237-126133-0021 4.365 she asked impulsively, "I didn't believe you could persuade her, father". 237-126133-0022 5.04 I didn't have any fears, if I worked it rightly," said the old gentleman complacently. -237-126133-0021 4.365 she asked impulsively, "I didn't believe you could persuade her, father". 237-126133-0023 6.675 he cried in high dudgeon; just as if he owned the whole of the Peppers, and could dispose of them all to suit his fancy! -237-126133-0021 4.365 she asked impulsively, "I didn't believe you could persuade her, father". 237-126133-0024 9.665 And the old gentleman was so delighted with his success, that he had to burst out into a series of short, happy bits of laughter, that occupied quite a space of time. -4507-16021-0040 3.925 One thinks one hears hydras talking. 4507-16021-0003 4.895 She has a son, theft, and a daughter, hunger. -4507-16021-0012 2.735 Why should one halt on the way? 4507-16021-0005 4.21 We have never understood this sort of objections. -4507-16021-0015 3.86 Since when has malady banished medicine? 4507-16021-0011 5.615 Why should one not explore everything, and study everything? -4507-16021-0000 2.59 Chapter one Origin. 4507-16021-0014 6.115 Now, when has horror ever excluded study? -4507-16021-0007 2.63 Slang makes one shudder"! 4507-16021-0024 5.14 Algebra, medicine, botany, have each their slang. -4507-16021-0041 2.975 It is unintelligible in the dark. 4507-16021-0025 9.215 To meet the needs of this conflict, wretchedness has invented a language of combat, which is slang. -4507-16021-0050 3.895 And you belong to that small class who are happy! 4507-16021-0033 5.545 Do we really know the mountain well when we are not acquainted with the cavern? -4507-16021-0058 3.11 The flame is the enemy of the wing. 4507-16021-0035 7.535 True history being a mixture of all things, the true historian mingles in everything. -4507-16021-0028 3.265 Even dialect, let that pass! 4507-16021-0036 5.435 Facts form one of these, and ideas the other. -4507-16021-0015 3.86 Since when has malady banished medicine? 4507-16021-0037 5.35 There it clothes itself in word masks, in metaphor rags. -4507-16021-0050 3.895 And you belong to that small class who are happy! 4507-16021-0045 4.89 It is so made, that everywhere we feel the sense of punishment. -4507-16021-0012 2.735 Why should one halt on the way? 4507-16021-0046 4.59 Each day has its own great grief or its little care. -4507-16021-0050 3.895 And you belong to that small class who are happy! 4507-16021-0048 5.215 This without reckoning in the pains of the heart. And so it goes on. -4507-16021-0050 3.895 And you belong to that small class who are happy! 4507-16021-0049 5.91 There is hardly one day out of a hundred which is wholly joyous and sunny. -4507-16021-0019 2.93 It is the language of wretchedness. 4507-16021-0051 6.17 In this world, evidently the vestibule of another, there are no fortunate. -4507-16021-0007 2.63 Slang makes one shudder"! 4507-16021-0052 6.275 The real human division is this: the luminous and the shady. -4507-16021-0005 4.21 We have never understood this sort of objections. 4507-16021-0053 8.095 To diminish the number of the shady, to augment the number of the luminous,-that is the object. -4507-16021-0029 3.87 To this we reply in one word, only. 4507-16021-0054 4.315 That is why we cry: Education! science! -4507-16021-0041 2.975 It is unintelligible in the dark. 4507-16021-0055 7.225 To teach reading, means to light the fire; every syllable spelled out sparkles. -4507-16021-0040 3.925 One thinks one hears hydras talking. 4507-16021-0056 6.345 However, he who says light does not, necessarily, say joy. -4507-16021-0038 3.885 In this guise it becomes horrible. 4507-16021-0057 4.61 People suffer in the light; excess burns. -4507-16021-0015 3.86 Since when has malady banished medicine? 4507-16021-0059 6.205 To burn without ceasing to fly, therein lies the marvel of genius. -8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284447-0000 9.605 Then he rushed down stairs into the courtyard, shouting loudly for his soldiers and threatening to patch everybody in his dominions if the sailorman was not recaptured. -8555-284447-0003 4.415 But Captain Bill made no such attempt, knowing it would be useless. 8555-284447-0001 8.61 Hold him fast, my men, and as soon as I've had my coffee and oatmeal I'll take him to the Room of the Great Knife and patch him". -8555-284447-0022 3.56 I had a notion it was you, mate, as saved me from the knife. 8555-284447-0002 8.025 I wouldn't mind a cup of coffee myself," said Captain Bill. "I've had considerable exercise this morning and I'm all ready for breakfast". -8555-284447-0009 3.275 Mornin', girls; hope ye feel as well as ye look". 8555-284447-0003 4.415 But Captain Bill made no such attempt, knowing it would be useless. -8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284447-0004 5.485 As soon as they entered the Room of the Great Knife the Boolooroo gave a yell of disappointment. -8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284447-0005 6.83 The Room of the Great Knife was high and big, and around it ran rows of benches for the spectators to sit upon. -8555-284449-0005 2.555 When he finished she said cheerfully: 8555-284447-0007 6.365 Therefore her Majesty paid no attention to anyone and no one paid any attention to her. -8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284447-0008 8.39 Rich jewels of blue stones glittered upon their persons and the royal ladies were fully as gorgeous as they were haughty and overbearing. -8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284447-0013 9.04 Why, you said to fetch the first living creature we met, and that was this billygoat," replied the Captain, panting hard as he held fast to one of the goat's horns. -8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284447-0014 8.47 The idea of patching Captain Bill to a goat was vastly amusing to him, and the more he thought of it the more he roared with laughter. -8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284447-0018 5.46 At once the goat gave a leap, escaped from the soldiers and with bowed head rushed upon the Boolooroo. -8555-284447-0003 4.415 But Captain Bill made no such attempt, knowing it would be useless. 8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. -8555-284447-0022 3.56 I had a notion it was you, mate, as saved me from the knife. 8555-284447-0023 7.155 I couldn't shiver much, bein' bound so tight, but when I'm loose I mean to have jus' one good shiver to relieve my feelin's". -8555-292519-0013 4.185 That was but rustling of dripping plants in the dark. 8555-284447-0024 4.635 Come and get the Boolooroo," she said, going toward the benches. -8230-279154-0003 3.195 And what sort of evidence is logically possible? 8230-279154-0000 8.805 The analysis of knowledge will occupy us until the end of the thirteenth lecture, and is the most difficult part of our whole enterprise. -8230-279154-0032 3.88 It is this that is of interest to theory of knowledge. 8230-279154-0005 7.72 All that I am doing is to use its logical tenability as a help in the analysis of what occurs when we remember. -8230-279154-0003 3.195 And what sort of evidence is logically possible? 8230-279154-0006 7.51 The behaviourist, who attempts to make psychology a record of behaviour, has to trust his memory in making the record. -8230-279154-0008 3.62 But I do not think such an inference is warranted. 8230-279154-0011 6.25 Some images, like some sensations, feel very familiar, while others feel strange. -8230-279154-0003 3.195 And what sort of evidence is logically possible? 8230-279154-0014 7.94 I come now to the other characteristic which memory images must have in order to account for our knowledge of the past. -8230-279154-0003 3.195 And what sort of evidence is logically possible? 8230-279154-0015 8.05 They must have some characteristic which makes us regard them as referring to more or less remote portions of the past. -8230-279154-0003 3.195 And what sort of evidence is logically possible? 8230-279154-0017 7.93 There may be a specific feeling which could be called the feeling of "pastness," especially where immediate memory is concerned. -8230-279154-0003 3.195 And what sort of evidence is logically possible? 8230-279154-0020 7.835 If we had retained the "subject" or "act" in knowledge, the whole problem of memory would have been comparatively simple. -8230-279154-0003 3.195 And what sort of evidence is logically possible? 8230-279154-0021 6.56 Remembering has to be a present occurrence in some way resembling, or related to, what is remembered. -8230-279154-0012 3.64 Familiarity is a feeling capable of degrees. 8230-279154-0022 6.44 Some points may be taken as fixed, and such as any theory of memory must arrive at. -8230-279154-0032 3.88 It is this that is of interest to theory of knowledge. 8230-279154-0023 6.265 In this case, as in most others, what may be taken as certain in advance is rather vague. -8230-279154-0008 3.62 But I do not think such an inference is warranted. 8230-279154-0024 6.34 The first of our vague but indubitable data is that there is knowledge of the past. -8230-279154-0032 3.88 It is this that is of interest to theory of knowledge. 8230-279154-0026 9.3 This distinction is vital to the understanding of memory. But it is not so easy to carry out in practice as it is to draw in theory. -8230-279154-0003 3.195 And what sort of evidence is logically possible? 8230-279154-0029 8.54 The fact that a man can recite a poem does not show that he remembers any previous occasion on which he has recited or read it. -8230-279154-0008 3.62 But I do not think such an inference is warranted. 8230-279154-0030 7.28 Semon's two books, mentioned in an earlier lecture, do not touch knowledge memory at all closely. -8230-279154-0012 3.64 Familiarity is a feeling capable of degrees. 8230-279154-0035 7.555 Thus no knowledge as to the past is to be derived from the feeling of familiarity alone. -8230-279154-0003 3.195 And what sort of evidence is logically possible? 8230-279154-0039 4.59 This knowledge is memory in one sense, though in another it is not. -7021-85628-0000 3.02 But Anders cared nothing about that. 7021-79740-0001 5.995 Della had a young sister named Maria, and a cousin whose name was Jane. -7021-85628-0019 3.255 With one jump Anders got out of his chair. 7021-79740-0002 9.225 Now Delia contrived to obtain a great influence and ascendency over the minds of the children by means of these dolls. -7021-79740-0009 3.635 They were now playing with their dolls in the parlor. 7021-79740-0003 4.985 To give an idea of these conversations I will report one of them in full. -7021-79740-0012 3.26 said she, pointing to the playthings; "see! 7021-79740-0004 6.465 You have come, Andella (Andella was the name of Jane's doll), to make Rosalie a visit. -7021-85628-0019 3.255 With one jump Anders got out of his chair. 7021-79740-0006 5.965 I expect you have been a very good girl, Andella, since you were here last". -7021-79740-0012 3.26 said she, pointing to the playthings; "see! 7021-79740-0007 6.99 Then, turning to Jane, she asked, in a somewhat altered tone, "Has she been a good girl, Jane"? -7021-79740-0009 3.635 They were now playing with their dolls in the parlor. 7021-79740-0013 7.365 Put these playthings all away quick, and carefully, and we will not let them know any thing about your leaving them out". -61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. 61-70968-0000 4.905 He began a confused complaint against the wizard, who had vanished behind the curtain on the left. -61-70968-0012 2.61 Cries of: "A Nottingham! A Nottingham"! 61-70968-0003 4.315 He was like unto my father, in a way, and yet was not my father. -61-70970-0009 3.405 Tis late; and I go myself within a short space. 61-70968-0005 5.07 This was so sweet a lady, sir, and in some manner I do think she died. -61-70968-0018 2.405 So I did push this fellow". 61-70968-0009 4.51 Like as not, young master, though I am an old man". -61-70970-0033 3.42 Truly such a horse should be worth much in Nottingham Fair! 61-70968-0010 8.295 Forthwith all ran to the opening of the tent to see what might be amiss; but Master Will, who peeped out first, needed no more than one glance. -61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. 61-70968-0011 6.375 He gave way to the others very readily and retreated unperceived by the Squire and Mistress Fitzooth to the rear of the tent. -61-70970-0019 3.78 At last all was quiet and black in the courtyard of Gamewell. 61-70968-0013 4.45 Before them fled the stroller and his three sons, capless and terrified. -61-70968-0006 2.935 But then the picture was gone as quickly as it came". 61-70968-0014 7.485 What is the tumult and rioting"? cried out the Squire, authoritatively, and he blew twice on a silver whistle which hung at his belt. -61-70968-0036 2.934938 George Montfichet will never forget this day. 61-70968-0015 5.375 Nay, we refused their request most politely, most noble," said the little stroller. -61-70970-0007 4.485 He was in deep converse with the clerk, and entered the hall holding him by the arm. 61-70968-0017 5.11 I could not see my boy injured, excellence, for but doing his duty as one of Cumberland's sons. -61-70970-0023 3.705 Be not so foolish, friend," said Fitzooth, crossly. 61-70968-0019 5.475 It is enough," said George Gamewell, sharply, and he turned upon the crowd. -61-70968-0025 4.41 Come to me, men, here, here"! He raised his voice still louder. 61-70968-0020 5.105 Shame on you, citizens," cried he; "I blush for my fellows of Nottingham. -61-70968-0048 3.02 And Henry might return to England at any moment. 61-70968-0022 4.67 Tis fine for you to talk, old man," answered the lean, sullen apprentice. -61-70970-0033 3.42 Truly such a horse should be worth much in Nottingham Fair! 61-70968-0023 5.025 But I wrestled with this fellow and do know that he played unfairly in the second bout. -61-70970-0032 3.135 enquired Robin, with his suspicions still upon him. 61-70968-0024 6.025 spoke the Squire, losing all patience; "and it was to you that I gave another purse in consolation! -61-70970-0003 3.835 If, for a whim, you beggar yourself, I cannot stay you. 61-70968-0025 4.41 Come to me, men, here, here"! He raised his voice still louder. -61-70970-0040 4.165 They regained their apartment, apparently without disturbing the household of Gamewell. 61-70968-0026 4.92 The strollers took their part in it with hearty zest now that they had some chance of beating off their foes. -61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. 61-70968-0027 6.87 Robin and the little tumbler between them tried to force the Squire to stand back, and very valiantly did these two comport themselves. -61-70968-0046 3.55 Nottingham Castle was reached, and admittance was demanded. 61-70968-0030 5.685 Now, be silent, on your lives," he began; but the captured apprentice set up an instant shout. -61-70968-0029 3.495 The Squire helped to thrust them all in and entered swiftly himself. 61-70968-0032 4.28 He felt for and found the wizard's black cloth. The Squire was quite out of breath. -61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. 61-70968-0033 5.685 Thrusting open the proper entrance of the tent, Robin suddenly rushed forth with his burden, with a great shout. -61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. 61-70968-0035 7.95 Taking advantage of this, the Squire's few men redoubled their efforts, and, encouraged by Robin's and the little stroller's cries, fought their way to him. -61-70968-0036 2.934938 George Montfichet will never forget this day. 61-70968-0037 4.315 What is your name, lording"? asked the little stroller, presently. -61-70970-0022 3.97 Robin entered the hut, dragging the unwilling esquire after him. 61-70968-0041 6.825 I like you, Will; you are the second Will that I have met and liked within two days; is there a sign in that"? -61-70968-0003 4.315 He was like unto my father, in a way, and yet was not my father. 61-70968-0043 6.735 Friends," said Montfichet, faintly, to the wrestlers, "bear us escort so far as the Sheriff's house. -61-70970-0013 4.35 There was no chance to alter his sleeping room to one nearer to Gamewell's chamber. 61-70968-0047 4.775 Master Monceux, the Sheriff of Nottingham, was mightily put about when told of the rioting. -61-70968-0048 3.02 And Henry might return to England at any moment. 61-70968-0049 8.25 Have your will, child, if the boy also wills it," Montfichet answered, feeling too ill to oppose anything very strongly just then. -61-70968-0042 2.785 Montfichet called out for Robin to give him an arm. 61-70968-0050 5.58 He made an effort to hide his condition from them all, and Robin felt his fingers tighten upon his arm. -61-70970-0030 3.24 Save me, masters, but you startled me rarely"! 61-70968-0053 4.22 He is my esquire, excellency," returned Robin, with dignity. -61-70970-0040 4.165 They regained their apartment, apparently without disturbing the household of Gamewell. 61-70968-0054 7.86 Mistress Fitzooth had been carried off by the Sheriff's daughter and her maids as soon as they had entered the house, so that Robin alone had the care of Montfichet. -61-70968-0012 2.61 Cries of: "A Nottingham! A Nottingham"! 61-70968-0057 5.065 These escapades are not for old Gamewell, lad; his day has come to twilight. -61-70968-0048 3.02 And Henry might return to England at any moment. 61-70968-0061 5.53 You are a worthy leech, Will," presently whispered Robin. "The wine has worked a marvel. -8224-274384-0003 3.87 or hath he given us any gift? 8224-274384-0002 9.815 They informed the English parliament of this unexpected incident, and assured them that they had entered into no private treaty with the king. -8224-274384-0003 3.87 or hath he given us any gift? 8224-274384-0005 8.745 Another preacher, after reproaching him to his face with his misgovernment, ordered this psalm to be sung: -8224-274384-0003 3.87 or hath he given us any gift? 8224-274384-0006 6.81 The king stood up, and called for that psalm which begins with these words, -8224-274384-0003 3.87 or hath he given us any gift? 8224-274384-0007 6.23 Have mercy, Lord, on me, I pray; For men would me devour". -8224-274384-0003 3.87 or hath he given us any gift? 8224-274384-0009 4.805 The parliament and the Scots laid their proposals before the king. -8224-274384-0003 3.87 or hath he given us any gift? 8224-274384-0013 5.44 His death, in this conjuncture, was a public misfortune. -6829-68771-0035 4.39 Will you leave me alone in my own room, or must I go away to escape you"? 6829-68769-0001 9.315 It was a serious crime indeed, mister Watson told them, and Tom Gates bade fair to serve a lengthy term in state's prison as a consequence of his rash act. -6829-68769-0046 2.57 You're foolish. Why should you do all this"? 6829-68769-0003 4.215 It was a deliberate theft from his employers to protect a girl he loved. -6829-68769-0007 3.865 But under the circumstances I doubt if such an arrangement could be made". 6829-68769-0004 7.145 But they could not have proven a case against Lucy, if she was innocent, and all their threats of arresting her were probably mere bluff. -6829-68769-0044 3.225 It has cost me twice sixty dollars in annoyance". 6829-68769-0005 6.72 He was soft hearted and impetuous," said Beth; "and, being in love, he didn't stop to count the cost". -6829-68769-0022 4.115 We have heard something of your story," said Kenneth, "and are interested in it. 6829-68769-0006 7.195 If the prosecution were withdrawn and the case settled with the victim of the forged check, then the young man would be allowed his freedom. -6829-68769-0022 4.115 We have heard something of your story," said Kenneth, "and are interested in it. 6829-68769-0009 4.22 They were received in the little office by a man named Markham, who was the jailer. -6829-68769-0003 4.215 It was a deliberate theft from his employers to protect a girl he loved. 6829-68769-0011 4.685 I'm running for Representative on the Republican ticket," said Kenneth, quietly. -6829-68769-0039 4.045 He looked up rather ungraciously, but motioned them to be seated. 6829-68769-0012 4.295 Oh, say! that's different," observed Markham, altering his demeanor. -6829-68769-0003 4.215 It was a deliberate theft from his employers to protect a girl he loved. 6829-68769-0015 6.525 Sometimes I'm that yearning for a smoke I'm nearly crazy, an' I don't know which is worst, dying one way or another. -6829-68769-0037 2.53 I've seen lots of that kind in my day. 6829-68769-0016 4.12 He unlocked the door, and called: "Here's visitors, Tom". -6829-68771-0028 3.555 She even seemed mildly amused at the attention she attracted. 6829-68769-0020 5.125 Sit down, please," said Gates, in a cheerful and pleasant voice. "There's a bench here". -6829-68769-0002 3.075 I can't see it in that light," said the old lawyer. 6829-68769-0021 7.895 A fresh, wholesome looking boy, was Tom Gates, with steady gray eyes, an intelligent forehead, but a sensitive, rather weak mouth. -6829-68769-0009 4.22 They were received in the little office by a man named Markham, who was the jailer. 6829-68769-0022 4.115 We have heard something of your story," said Kenneth, "and are interested in it. -6829-68771-0028 3.555 She even seemed mildly amused at the attention she attracted. 6829-68769-0023 4.89 I didn't stop to think whether it was foolish or not. I did it; and I'm glad I did". -6829-68769-0007 3.865 But under the circumstances I doubt if such an arrangement could be made". 6829-68769-0025 5.735 Then Rogers wouldn't do anything but lead her around, and wait upon her, and the place went to rack and ruin". -6829-68769-0051 3.545 There was a grim smile of amusement on his shrewd face. 6829-68769-0026 4.64 He spoke simply, but paced up and down the narrow cell in front of them. -6829-68769-0012 4.295 Oh, say! that's different," observed Markham, altering his demeanor. 6829-68769-0030 4.91 I was bookkeeper, so it was easy to get a blank check and forge the signature. -6829-68769-0037 2.53 I've seen lots of that kind in my day. 6829-68769-0031 5.555 As regards my robbing the company, I'll say that I saved them a heavy loss one day. -6829-68769-0007 3.865 But under the circumstances I doubt if such an arrangement could be made". 6829-68769-0032 5.72 I discovered and put out a fire that would have destroyed the whole plant. But Marshall never even thanked me. -6829-68769-0019 2.665 Sorry we haven't any reception room in the jail. 6829-68769-0033 4.02 It was better for him to think the girl unfeeling than to know the truth. -6829-68769-0019 2.665 Sorry we haven't any reception room in the jail. 6829-68769-0034 6.055 I'm going to see mister Marshall," said Kenneth, "and discover what I can do to assist you". "Thank you, sir. -6829-68771-0035 4.39 Will you leave me alone in my own room, or must I go away to escape you"? 6829-68769-0036 5.555 They left him then, for the jailer arrived to unlock the door, and escort them to the office. -6829-68769-0017 3.545 Worse, Tom; worse 'n ever," replied the jailer, gloomily. 6829-68769-0039 4.045 He looked up rather ungraciously, but motioned them to be seated. -6829-68771-0028 3.555 She even seemed mildly amused at the attention she attracted. 6829-68769-0040 4.77 Some girl has been here twice to interview my men and I have refused to admit her. -6829-68769-0012 4.295 Oh, say! that's different," observed Markham, altering his demeanor. 6829-68769-0049 7.4 He detested the grasping disposition that would endeavor to take advantage of his evident desire to help young Gates. -6829-68769-0010 3.14 We wish to talk with him," answered Kenneth. "Talk! 6829-68769-0052 4.6 He might have had that forged check for the face of it, if he'd been sharp. -6829-68769-0051 3.545 There was a grim smile of amusement on his shrewd face. 6829-68769-0053 6.36 And to think we can save all that misery and despair by the payment of a hundred and fifty dollars! -5142-33396-0015 4.31 As our boat flashed down the rollers into the water I made this song and sang it: 5142-36586-0003 5.055 But this subject will be more properly discussed when we treat of the different races of mankind. -3570-5694-0019 3.755 But the general distinction is not on that account to be overlooked. 3570-5696-0002 7.51 Other circumstances permitting, that instinct disposes men to look with favor upon productive efficiency and on whatever is of human use. -3570-5694-0012 3.205 There is a more or less elaborate system of rank and grades. 3570-5696-0004 4.7 The salient features of this development of domestic service have already been indicated. -3570-5694-0012 3.205 There is a more or less elaborate system of rank and grades. 3570-5696-0006 4.16 As used in the speech of everyday life the word carries an undertone of deprecation. -3570-5694-0019 3.755 But the general distinction is not on that account to be overlooked. 3570-5696-0007 9.5 The use of the word "waste" as a technical term, therefore, implies no deprecation of the motives or of the ends sought by the consumer under this canon of conspicuous waste. -3570-5696-0006 4.16 As used in the speech of everyday life the word carries an undertone of deprecation. 3570-5696-0008 7.26 But it is, on other grounds, worth noting that the term "waste" in the language of everyday life implies deprecation of what is characterized as wasteful. -3570-5694-0012 3.205 There is a more or less elaborate system of rank and grades. 3570-5696-0009 8.86 In strict accuracy nothing should be included under the head of conspicuous waste but such expenditure as is incurred on the ground of an invidious pecuniary comparison. -3570-5694-0012 3.205 There is a more or less elaborate system of rank and grades. 3570-5696-0010 7.57 An article may be useful and wasteful both, and its utility to the consumer may be made up of use and waste in the most varying proportions. -2830-3980-0042 3.02 The world brands this a pernicious doctrine. 2830-3980-0005 6.45 Do you suppose that God for the sake of a few Lutheran heretics would disown His entire Church? -2830-3980-0071 3.96 We think that by some little work or merit we can dismiss sin. 2830-3980-0006 6.41 Against these boasting, false apostles, Paul boldly defends his apostolic authority and ministry. -2830-3980-0046 2.84 Was it not enough to say, "from God the Father"? 2830-3980-0008 4.84 Paul takes pride in his ministry, not to his own praise but to the praise of God. -2830-3980-0028 3.54 This should go far in shutting the mouths of the false apostles. 2830-3980-0010 6.525 Either He calls ministers through the agency of men, or He calls them directly as He called the prophets and apostles. -2830-3980-0071 3.96 We think that by some little work or merit we can dismiss sin. 2830-3980-0011 5.525 Paul declares that the false apostles were called or sent neither by men, nor by man. -2830-3980-0028 3.54 This should go far in shutting the mouths of the false apostles. 2830-3980-0013 4.145 He mentions the apostles first because they were appointed directly by God. -2830-3980-0017 3.665 When I was a young man I thought Paul was making too much of his call. 2830-3980-0019 7.015 I knew nothing of the doctrine of faith because we were taught sophistry instead of certainty, and nobody understood spiritual boasting. -2830-3980-0021 2.91 and God the Father, who raised him from the dead. 2830-3980-0023 6.16 These perverters of the righteousness of Christ resist the Father and the Son, and the works of them both. -2830-3980-0020 3.46 This is no sinful pride. It is holy pride. 2830-3980-0025 8.795 By His resurrection Christ won the victory over law, sin, flesh, world, devil, death, hell, and every evil. -2830-3980-0042 3.02 The world brands this a pernicious doctrine. 2830-3980-0029 9.075 Although the brethren with me are not apostles like myself, yet they are all of one mind with me, think, write, and teach as I do". -2830-3980-0000 3.73 In every way they sought to undermine the authority of Saint Paul. 2830-3980-0030 5.25 They do not go where the enemies of the Gospel predominate. They go where the Christians are. -2830-3980-0000 3.73 In every way they sought to undermine the authority of Saint Paul. 2830-3980-0031 8.485 Why do they not invade the Catholic provinces and preach their doctrine to godless princes, bishops, and doctors, as we have done by the help of God? -2830-3980-0042 3.02 The world brands this a pernicious doctrine. 2830-3980-0032 7.22 We look for that reward which "eye hath not seen, nor ear heard, neither hath entered into the heart of man". -2830-3980-0000 3.73 In every way they sought to undermine the authority of Saint Paul. 2830-3980-0036 5.765 Wherever the means of grace are found, there is the Holy Church, even though Antichrist reigns there. -2830-3980-0058 2.69 Mohammed also speaks highly of Christ. 2830-3980-0037 6.42 So much for the title of the epistle. Now follows the greeting of the apostle. VERSE three. -2830-3980-0042 3.02 The world brands this a pernicious doctrine. 2830-3980-0038 5.54 Grace be to you, and peace, from God the Father, and from our Lord Jesus Christ. -2830-3980-0000 3.73 In every way they sought to undermine the authority of Saint Paul. 2830-3980-0039 5.195 The terms of grace and peace are common terms with Paul and are now pretty well understood. -2830-3980-0064 2.88 How may we obtain remission of our sins? 2830-3980-0041 4.89 Grace involves the remission of sins, peace, and a happy conscience. -2830-3980-0024 3.935 In this whole epistle Paul treats of the resurrection of Christ. 2830-3980-0047 7.865 To do so is to lose God altogether because God becomes intolerable when we seek to measure and to comprehend His infinite majesty. -2830-3980-0071 3.96 We think that by some little work or merit we can dismiss sin. 2830-3980-0050 7.475 Did not Christ Himself say: "I am the way, and the truth, and the life: no man cometh unto the Father, but by me"? -2830-3980-0001 3.945 They said to the Galatians: "You have no right to think highly of Paul. 2830-3980-0051 6.44 When you argue about the nature of God apart from the question of justification, you may be as profound as you like. -2830-3980-0046 2.84 Was it not enough to say, "from God the Father"? 2830-3980-0052 4.88 We are to hear Christ, who has been appointed by the Father as our divine Teacher. -2830-3980-0003 2.48 Paul came later and is beneath us. 2830-3980-0053 5.015 At the same time, Paul confirms our creed, "that Christ is very God". -2830-3980-0071 3.96 We think that by some little work or merit we can dismiss sin. 2830-3980-0055 7.335 To bestow peace and grace lies in the province of God, who alone can create these blessings. The angels cannot. -2830-3980-0060 2.675 He never loses sight of the purpose of his epistle. 2830-3980-0056 5.35 Otherwise Paul should have written: "Grace from God the Father, and peace from our Lord Jesus Christ". -2830-3980-0040 2.62 The greeting of the Apostle is refreshing. 2830-3980-0057 8.07 The Arians took Christ for a noble and perfect creature, superior even to the angels, because by Him God created heaven and earth. -2830-3979-0012 3.625 The Word of our God shall stand forever. 2830-3980-0061 7.12 Not gold, or silver, or paschal lambs, or an angel, but Himself. What for? -2830-3980-0034 2.97 These means cannot be contaminated. 2830-3980-0062 5.44 Not for a crown, or a kingdom, or our goodness, but for our sins. -2830-3980-0045 3.51 Men Should Not Speculate About the Nature of God 2830-3980-0063 5.415 Underscore these words, for they are full of comfort for sore consciences. -2830-3980-0042 3.02 The world brands this a pernicious doctrine. 2830-3980-0065 6.515 Paul answers: "The man who is named Jesus Christ and the Son of God gave himself for our sins". -2830-3980-0021 2.91 and God the Father, who raised him from the dead. 2830-3980-0066 6.085 Since Christ was given for our sins it stands to reason that they cannot be put away by our own efforts. -2830-3980-0071 3.96 We think that by some little work or merit we can dismiss sin. 2830-3980-0067 8.13 This sentence also defines our sins as great, so great, in fact, that the whole world could not make amends for a single sin. -2830-3980-0045 3.51 Men Should Not Speculate About the Nature of God 2830-3980-0068 5 The greatness of the ransom, Christ, the Son of God, indicates this. -2830-3980-0040 2.62 The greeting of the Apostle is refreshing. 2830-3980-0069 5.555063 The vicious character of sin is brought out by the words "who gave himself for our sins". -2830-3980-0042 3.02 The world brands this a pernicious doctrine. 2830-3980-0072 4.855 This passage, then, bears out the fact that all men are sold under sin. -2830-3980-0060 2.675 He never loses sight of the purpose of his epistle. 2830-3980-0074 5.7 This attitude is universal and particularly developed in those who consider themselves better than others. -2830-3980-0042 3.02 The world brands this a pernicious doctrine. 2830-3980-0075 5.79 But the real significance and comfort of the words "for our sins" is lost upon them. -2830-3980-0046 2.84 Was it not enough to say, "from God the Father"? 2830-3980-0076 4.81 On the other hand, we are not to regard them as so terrible that we must despair. -5105-28241-0014 2.995 Another circumstance was most remarkable. 5105-28233-0000 4.51 Length of service: Fourteen years, three months, and five days. -5105-28240-0018 2.885 You will take me on board, count, will you not"? 5105-28233-0001 4.49 He seemed born to please without being conscious of the power he possessed. -5105-28240-0018 2.885 You will take me on board, count, will you not"? 5105-28233-0002 8.285 It must be owned, and no one was more ready to confess it than himself, that his literary attainments were by no means of a high order. -5105-28233-0001 4.49 He seemed born to please without being conscious of the power he possessed. 5105-28233-0004 4.735 Once, in action, he was leading a detachment of infantry through an intrenchment. -5105-28241-0003 3.98 Steam up and canvas spread, the schooner started eastwards. 5105-28233-0006 5.505 No cathedral - not even Burgos itself - could vie with the church at Montmartre. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0000 4.665 Socrates begins the Timaeus with a summary of the Republic. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0001 9.185 And now he desires to see the ideal State set in motion; he would like to know how she behaved in some great struggle. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0003 4.73 I will, if Timaeus approves'. 'I approve. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0006 4.6 And what was the subject of the poem'? said the person who made the remark. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0007 8.505 The subject was a very noble one; he described the most famous action in which the Athenian people were ever engaged. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0008 7.155 But the memory of their exploits has passed away owing to the lapse of time and the extinction of the actors. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0009 5.705 Tell us,' said the other, 'the whole story, and where Solon heard the story. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0010 7.83 But in Egypt the traditions of our own and other lands are by us registered for ever in our temples. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0011 7.815 The genealogies which you have recited to us out of your own annals, Solon, are a mere children's story. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0013 5.12 Solon marvelled, and desired to be informed of the particulars. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0014 9.565 Nine thousand years have elapsed since she founded yours, and eight thousand since she founded ours, as our annals record. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0015 6.815 Many laws exist among us which are the counterpart of yours as they were in the olden time. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0016 7.815 I will briefly describe them to you, and you shall read the account of them at your leisure in the sacred registers. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0017 9.73 Observe again, what care the law took in the pursuit of wisdom, searching out the deep things of the world, and applying them to the use of man. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0018 5.29 The most famous of them all was the overthrow of the island of Atlantis. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0020 6.125 This is the explanation of the shallows which are found in that part of the Atlantic ocean. -2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0021 4.94 But I would not speak at the time, because I wanted to refresh my memory. -1995-1837-0015 4.485 The squares of cotton, sharp edged, heavy, were just about to burst to bolls! 1995-1837-0001 8.73 It was the first great sorrow of his life; it was not so much the loss of the cotton itself - but the fantasy, the hopes, the dreams built around it. -1995-1837-0015 4.485 The squares of cotton, sharp edged, heavy, were just about to burst to bolls! 1995-1837-0003 7.36 The revelation of his love lighted and brightened slowly till it flamed like a sunrise over him and left him in burning wonder. -1995-1826-0008 2.895 Some others, too; big cotton county". 1995-1837-0004 6.36 He panted to know if she, too, knew, or knew and cared not, or cared and knew not. -1995-1837-0005 2.635 She was so strange and human a creature. 1995-1837-0007 8.8 Then of a sudden, at midday, the sun shot out, hot and still; no breath of air stirred; the sky was like blue steel; the earth steamed. -1995-1837-0009 3.76 The lagoon had been level with the dykes a week ago; and now? 1995-1837-0012 8.245 He splashed and stamped along, farther and farther onward until he neared the rampart of the clearing, and put foot upon the tree bridge. -1995-1826-0003 3.09 Better go," he had counselled, sententiously. 1995-1837-0016 7.19 For one long moment he paused, stupid, agape with utter amazement, then leaned dizzily against a tree. -1995-1837-0013 3.195 Then he looked down. The lagoon was dry. 1995-1837-0019 5.38 He sat down weak, bewildered, and one thought was uppermost - Zora! -1995-1836-0007 3.435 But you believe in some education"? asked Mary Taylor. 1995-1837-0024 5.385 For a while she lay in her chair, in happy, dreamy pleasure at sun and bird and tree. -1995-1836-0007 3.435 But you believe in some education"? asked Mary Taylor. 1995-1837-0025 9.505062 She rose with a fleeting glance, gathered the shawl round her, then gliding forward, wavering, tremulous, slipped across the road and into the swamp. -1995-1837-0021 3.09 The hope and dream of harvest was upon the land. 1995-1837-0026 8.095 She had been born within its borders; within its borders she had lived and grown, and within its borders she had met her love. -1995-1826-0003 3.09 Better go," he had counselled, sententiously. 1995-1837-0027 6.705 On she hurried until, sweeping down to the lagoon and the island, lo! the cotton lay before her! -1995-1826-0025 3.295 Some time you'll tell me, please, won't you"? 1995-1837-0029 5.58 He darted through the trees and paused, a tall man strongly but slimly made. -5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". 5639-40744-0002 8.91 Rodolfo and his companions, with their faces muffled in their cloaks, stared rudely and insolently at the mother, the daughter, and the servant maid. -5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". 5639-40744-0005 5.645 Finally, the one party went off exulting, and the other was left in desolation and woe. -5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". 5639-40744-0006 8.045 Rodolfo arrived at his own house without any impediment, and Leocadia's parents reached theirs heart broken and despairing. -5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". 5639-40744-0007 5.825 Meanwhile Rodolfo had Leocadia safe in his custody, and in his own apartment. -5639-40744-0011 2.665 She found the door, but it was locked outside. 5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". -5639-40744-0011 2.665 She found the door, but it was locked outside. 5639-40744-0012 8.595 She succeeded in opening the window; and the moonlight shone in so brightly, that she could distinguish the colour of some damask hangings in the room. -5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". 5639-40744-0013 6.865 She saw that the bed was gilded, and so rich, that it seemed that of a prince rather than of a private gentleman. -5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". 5639-40744-0014 7.72 Among other things on which she cast her eyes was a small crucifix of solid silver, standing on a cabinet near the window. -5639-40744-0011 2.665 She found the door, but it was locked outside. 5639-40744-0016 9.49 On the contrary, he resolved to tell them, that repenting of his violence, and moved by her tears, he had only carried her half way towards his house, and then let her go. -5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". 5639-40744-0017 5.88 Choking with emotion, Leocadi made a sign to her parents that she wished to be alone with them. -5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". 5639-40744-0020 9.82 Thus did this humane and right minded father comfort his unhappy daughter; and her mother embracing her again did all she could to soothe her feelings. -5639-40744-0011 2.665 She found the door, but it was locked outside. 5639-40744-0024 8.845 One day, when the boy was sent by his grandfather with a message to a relation, he passed along a street in which there was a great concourse of horsemen. -5639-40744-0011 2.665 She found the door, but it was locked outside. 5639-40744-0025 8.785 The bed she too well remembered was there; and, above all, the cabinet, on which had stood the image she had taken away, was still on the same spot. -5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". 5639-40744-0029 7.305 This truth which I have learned from her lips is confirmed by his face, in which we have both beheld that of our son". -5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". 5639-40744-0033 9.15 Her bearing was graceful and animated; she led her son by the hand, and before her walked two maids with wax lights and silver candlesticks. -260-123440-0003 3.585 Oh! won't she be savage if I've kept her waiting"! 260-123440-0010 8.315 How cheerfully he seems to grin, How neatly spread his claws, And welcome little fishes in With gently smiling jaws"! -260-123440-0003 3.585 Oh! won't she be savage if I've kept her waiting"! 260-123440-0011 4.87 No, I've made up my mind about it; if I'm Mabel, I'll stay down here! -260-123288-0019 2.955 At noon the violence of the storm redoubles. 260-123440-0012 5.245 It'll be no use their putting their heads down and saying 'Come up again, dear! -260-123286-0022 3.235 Two hours afterwards a terrible shock awoke me. 260-123440-0015 6.2 I wish I hadn't cried so much"! said Alice, as she swam about, trying to find her way out. -260-123286-0024 3.04 There's a whale, a whale"! cried the Professor. 260-123440-0016 4.895 I shall be punished for it now, I suppose, by being drowned in my own tears! -260-123288-0009 3.435 Those clouds seem as if they were going to crush the sea". 260-123440-0019 6.63 cried Alice again, for this time the Mouse was bristling all over, and she felt certain it must be really offended. -260-123440-0018 3.64 I am very tired of swimming about here, O Mouse"! 260-123440-0020 4.995 We won't talk about her any more if you'd rather not". "We indeed"! -2300-131720-0006 4.12 There seems no good reason for believing that it will change. 2300-131720-0000 5.08 The Paris plant, like that at the Crystal Palace, was a temporary exhibit. -2300-131720-0014 3.75 mister Edison was a leader far ahead of the time. 2300-131720-0005 6.9 Why, if we erect a station at the falls, it is a great economy to get it up to the city. -2300-131720-0041 3.75 We had meters in which there were two bottles of liquid. 2300-131720-0006 4.12 There seems no good reason for believing that it will change. -2300-131720-0014 3.75 mister Edison was a leader far ahead of the time. 2300-131720-0008 9.125 Everything he has done has been aimed at the conservation of energy, the contraction of space, the intensification of culture. -2300-131720-0041 3.75 We had meters in which there were two bottles of liquid. 2300-131720-0009 9.605 For some years it was not found feasible to operate motors on alternating current circuits, and that reason was often urged against it seriously. -2300-131720-0006 4.12 There seems no good reason for believing that it will change. 2300-131720-0015 8.875 He obtained the desired speed and load with a friction brake; also regulator of speed; but waited for an indicator to verify it. -2300-131720-0041 3.75 We had meters in which there were two bottles of liquid. 2300-131720-0024 4.77 But the plant ran, and it was the first three wire station in this country". -2300-131720-0014 3.75 mister Edison was a leader far ahead of the time. 2300-131720-0027 8.62 Edison held that the electricity sold must be measured just like gas or water, and he proceeded to develop a meter. -2300-131720-0014 3.75 mister Edison was a leader far ahead of the time. 2300-131720-0029 6.425 Hence the Edison electrolytic meter is no longer used, despite its excellent qualities. -2300-131720-0006 4.12 There seems no good reason for believing that it will change. 2300-131720-0030 9.98 The principle employed in the Edison electrolytic meter is that which exemplifies the power of electricity to decompose a chemical substance. -2300-131720-0041 3.75 We had meters in which there were two bottles of liquid. 2300-131720-0034 8.605 the others having been in operation too short a time to show definite results, although they also went quickly to a dividend basis. -2300-131720-0014 3.75 mister Edison was a leader far ahead of the time. 2300-131720-0037 7.965 He weighed and reweighed the meter plates, and pursued every line of investigation imaginable, but all in vain. -2300-131720-0041 3.75 We had meters in which there were two bottles of liquid. 2300-131720-0038 5.61 He felt he was up against it, and that perhaps another kind of a job would suit him better. -2300-131720-0041 3.75 We had meters in which there were two bottles of liquid. 2300-131720-0040 5.455 We were more interested in the technical condition of the station than in the commercial part. -908-157963-0002 2.755 why fades the lotus of the water? 908-31957-0002 4.79 I did not wrong myself so, but I placed A wrong on thee. -908-157963-0018 4.255 And fearest thou because I vanish and am seen no more. 908-31957-0003 6.565 When called before, I told how hastily I dropped my flowers or brake off from a game. -908-157963-0001 2.885 O life of this our spring! 908-31957-0005 4.49 Alas, I have grieved so I am hard to love. -908-31957-0018 3.915 But thou art not such A lover, my Beloved! 908-31957-0006 5.89 Open thy heart wide, And fold within, the wet wings of thy dove. -908-157963-0002 2.755 why fades the lotus of the water? 908-31957-0007 5.8 Could it mean To last, a love set pendulous between Sorrow and sorrow? -908-157963-0029 3.63 Why a Tongue impressed with honey from every wind? 908-31957-0009 7.705 And, though I have grown serene And strong since then, I think that God has willed A still renewable fear... -908-31957-0005 4.49 Alas, I have grieved so I am hard to love. 908-31957-0012 7.615 if he, to keep one oath, Must lose one joy, by his life's star foretold. -908-157963-0002 2.755 why fades the lotus of the water? 908-31957-0013 6.18 Slow to world greetings, quick with its "O, list," When the angels speak. -908-157963-0024 3.44 image of weakness, art thou but a Worm? 908-31957-0014 7.56 A ring of amethyst I could not wear here, plainer to my sight, Than that first kiss. -908-31957-0005 4.49 Alas, I have grieved so I am hard to love. 908-31957-0016 6.48 Dearest, teach me so To pour out gratitude, as thou dost, good! -908-31957-0018 3.915 But thou art not such A lover, my Beloved! 908-31957-0017 7.795 Mussulmans and Giaours Throw kerchiefs at a smile, and have no ruth For any weeping. -908-157963-0002 2.755 why fades the lotus of the water? 908-31957-0019 9.54 thou canst wait Through sorrow and sickness, to bring souls to touch, And think it soon when others cry "Too late". -908-157963-0013 4.315 And why it scatters its bright beauty thro the humid air. 908-31957-0020 5.895 I thank all who have loved me in their hearts, With thanks and love from mine. -908-31957-0018 3.915 But thou art not such A lover, my Beloved! 908-31957-0023 8.515 I love thee freely, as men strive for Right; I love thee purely, as they turn from Praise. -908-157963-0002 2.755 why fades the lotus of the water? 908-31957-0024 7.54 I love thee with the passion put to use In my old griefs, and with my childhood's faith. -4992-41797-0016 3.3 They couldn't run nor move; they're just pasteboard". 4992-41806-0001 8.31 To night there was no need of extra heat, and there were great ceremonies to be observed in lighting the fires on the hearthstones. -4992-41797-0016 3.3 They couldn't run nor move; they're just pasteboard". 4992-41806-0003 9.24 Kathleen waved the torch to and fro as she recited some beautiful lines written for some such purpose as that which called them together to night. -4992-41797-0016 3.3 They couldn't run nor move; they're just pasteboard". 4992-41806-0009 4.355 exclaimed Bill Harmon to his wife as they went through the lighted hall. -4992-23283-0007 4.045 To ask any more questions of you, I believe, would be unfair. 4992-41806-0011 7.84 Mother Carey poured coffee, Nancy chocolate, and the others helped serve the sandwiches and cake, doughnuts and tarts. -4992-23283-0016 4.495 Again he searched his own thoughts; nor ineffectually as before. 4992-41806-0012 6.73 At that moment the gentleman entered, bearing a huge object concealed by a piece of green felt. -4992-41797-0016 3.3 They couldn't run nor move; they're just pasteboard". 4992-41806-0013 6.02 Approaching the dining table, he carefully placed the article in the centre and removed the cloth. -7021-85628-0004 2.805 Yes, why not"? thought Anders. 7021-85628-0002 6.455 He was such a big boy that he wore high boots and carried a jack knife. -7021-85628-0006 3.58 I am going to the court ball," answered Anders. 7021-85628-0005 5.015 Seeing that I am so fine, I may as well go and visit the King". -7021-85628-0025 2.775 But his mother hugged him close. 7021-85628-0008 7.125 For, like as not, they must have thought him a prince when they saw his fine cap. -7021-79759-0001 2.48 That is comparatively nothing. 7021-85628-0009 8.54 At the farther end of the largest hall a table was set with golden cups and golden plates in long rows. -7021-85628-0019 3.255 With one jump Anders got out of his chair. 7021-85628-0010 8.015 On huge silver platters were pyramids of tarts and cakes, and red wine sparkled in glittering decanters. -7021-79740-0012 3.26 said she, pointing to the playthings; "see! 7021-85628-0011 8.995 The Princess sat down under a blue canopy with bouquets of roses; and she let Anders sit in a golden chair by her side. -7021-79740-0009 3.635 They were now playing with their dolls in the parlor. 7021-85628-0012 5.33 But you must not eat with your cap on your head," she said, and was going to take it off. -7021-85628-0026 2.74 No, my little son," she said. 7021-85628-0016 4.28 That is a very fine cap you have," he said. -7021-79740-0012 3.26 said she, pointing to the playthings; "see! 7021-85628-0018 8.22 And it is made of mother's best yarn, and she knitted it herself, and everybody wants to get it away from me". -7021-79740-0012 3.26 said she, pointing to the playthings; "see! 7021-85628-0020 6.45 He darted like an arrow through all the halls, down all the stairs, and across the yard. -7021-79740-0009 3.635 They were now playing with their dolls in the parlor. 7021-85628-0021 5.365 He still held on to it with both hands as he rushed into his mother's cottage. -7021-79740-0009 3.635 They were now playing with their dolls in the parlor. 7021-85628-0022 5.145 And all his brothers and sisters stood round and listened with their mouths open. -7021-79740-0009 3.635 They were now playing with their dolls in the parlor. 7021-85628-0023 9.03 But when his big brother heard that he had refused to give his cap for a King's golden crown, he said that Anders was a stupid. -7021-85628-0019 3.255 With one jump Anders got out of his chair. 7021-85628-0027 8.5 If you dressed in silk and gold from top to toe, you could not look any nicer than in your little red cap". -1284-1181-0007 4.04 She poured into the dish a quantity from each of these bottles. 1284-134647-0000 8.53 The grateful applause of the clergy has consecrated the memory of a prince who indulged their passions and promoted their interest. -4970-29095-0011 3.355 Does thee think thee could stand it six months? 4970-29095-0002 5.48 Well, mother," said the young student, looking up, with a shade of impatience. -4970-29095-0006 4.47 Is thy father willing thee should go away to a school of the world's people"? 4970-29095-0004 9.61 I heard father tell cousin Abner that he was whipped so often for whistling when he was a boy that he was determined to have what compensation he could get now". -4970-29095-0014 3.26 Where thee and thy family are known"? 4970-29095-0005 4.65 Thy ways greatly try me, Ruth, and all thy relations. -4970-29093-0015 3.325 You can begin by carrying a rod, and putting down the figures. 4970-29095-0006 4.47 Is thy father willing thee should go away to a school of the world's people"? -4970-29095-0014 3.26 Where thee and thy family are known"? 4970-29095-0009 5.6 Margaret Bolton almost lost for a moment her habitual placidity. -4970-29095-0000 2.865 She was tired of other things. 4970-29095-0012 4.68 And, besides, suppose thee does learn medicine"? -4970-29095-0014 3.26 Where thee and thy family are known"? 4970-29095-0016 6.945 Ruth sat quite still for a time, with face intent and flushed. It was out now. -4970-29095-0011 3.355 Does thee think thee could stand it six months? 4970-29095-0022 4.765 Is thee going to the Yearly Meeting, Ruth"? asked one of the girls. -4970-29093-0000 3.03 You'll never dig it out of the Astor Library". 4970-29095-0024 6.04 It has occupied mother a long time, to find at the shops the exact shade for her new bonnet. -4970-29093-0017 2.865 I've been ready to go anywhere for six months. 4970-29095-0027 9.795 It's such a crush at the Yearly Meeting at Arch Street, and then there's the row of sleek looking young men who line the curbstone and stare at us as we come out. -4970-29093-0008 3.58 He wanted to begin at the top of the ladder. 4970-29095-0030 4.67 Father, thee's unjust to Philip. He's going into business". -4970-29095-0017 3.93 The sight seers returned in high spirits from the city. 4970-29095-0032 6.61 But Philip is honest, and he has talent enough, if he will stop scribbling, to make his way. -4970-29093-0008 3.58 He wanted to begin at the top of the ladder. 4970-29095-0034 5.81 Why should I rust, and be stupid, and sit in inaction because I am a girl? -4970-29095-0011 3.355 Does thee think thee could stand it six months? 4970-29095-0035 4.75 And if I had a fortune, would thee want me to lead a useless life"? -4970-29093-0017 2.865 I've been ready to go anywhere for six months. 4970-29095-0036 5.25 Has thee consulted thy mother about a career, I suppose it is a career thee wants"? -4970-29093-0000 3.03 You'll never dig it out of the Astor Library". 4970-29095-0037 6.885 But that wise and placid woman understood the sweet rebel a great deal better than Ruth understood herself. -4970-29093-0000 3.03 You'll never dig it out of the Astor Library". 4970-29095-0038 8.74 Ruth was glad to hear that Philip had made a push into the world, and she was sure that his talent and courage would make a way for him. -121-127105-0032 3.17 Yes, but that's just the beauty of her passion". 121-127105-0000 9.875 It was this observation that drew from Douglas not immediately, but later in the evening a reply that had the interesting consequence to which I call attention. -121-127105-0018 2.77 cried the ladies whose departure had been fixed. 121-127105-0001 5.025 Someone else told a story not particularly effective, which I saw he was not following. -121-127105-0032 3.17 Yes, but that's just the beauty of her passion". 121-127105-0002 7.495 cried one of the women. He took no notice of her; he looked at me, but as if, instead of me, he saw what he spoke of. -121-127105-0036 4.15 But was that all her reward"? one of the ladies asked. 121-127105-0003 7.725 There was a unanimous groan at this, and much reproach; after which, in his preoccupied way, he explained. -121-127105-0032 3.17 Yes, but that's just the beauty of her passion". 121-127105-0005 5.82 I could write to my man and enclose the key; he could send down the packet as he finds it". -121-127105-0018 2.77 cried the ladies whose departure had been fixed. 121-127105-0006 4.725 The others resented postponement, but it was just his scruples that charmed me. -121-127105-0036 4.15 But was that all her reward"? one of the ladies asked. 121-127105-0007 5.79 To this his answer was prompt. "Oh, thank God, no"! "And is the record yours? -121-127105-0010 2.85 She sent me the pages in question before she died". 121-127105-0011 5.78 She was the most agreeable woman I've ever known in her position; she would have been worthy of any whatever. -121-127105-0010 2.85 She sent me the pages in question before she died". 121-127105-0012 4.83 It wasn't simply that she said so, but that I knew she hadn't. I was sure; I could see. -121-127105-0010 2.85 She sent me the pages in question before she died". 121-127105-0013 5.895 You'll easily judge why when you hear". "Because the thing had been such a scare"? He continued to fix me. -121-127105-0036 4.15 But was that all her reward"? one of the ladies asked. 121-127105-0022 5.075 Well, if I don't know who she was in love with, I know who he was". -121-127105-0018 2.77 cried the ladies whose departure had been fixed. 121-127105-0026 7.53 The first of these touches conveyed that the written statement took up the tale at a point after it had, in a manner, begun. -121-127105-0018 2.77 cried the ladies whose departure had been fixed. 121-127105-0028 6.75 The awkward thing was that they had practically no other relations and that his own affairs took up all his time. -121-127105-0015 2.96 He quitted the fire and dropped back into his chair. 121-127105-0029 7.31 There were plenty of people to help, but of course the young lady who should go down as governess would be in supreme authority. -121-127105-0036 4.15 But was that all her reward"? one of the ladies asked. 121-127105-0034 7.41 It sounded dull it sounded strange; and all the more so because of his main condition". "Which was-"? -121-127105-0008 2.76 He hung fire again. "A woman's. 121-127105-0036 4.15 But was that all her reward"? one of the ladies asked. -260-123288-0012 3.545 That will be safest". "No, no! Never"! 260-123286-0000 7.04 Saturday, august fifteenth. - The sea unbroken all round. No land in sight. -260-123286-0012 2.43 But there seemed no reason to fear. 260-123286-0002 9.985 All my danger and sufferings were needed to strike a spark of human feeling out of him; but now that I am well his nature has resumed its sway. -260-123440-0005 3.105 And yesterday things went on just as usual. 260-123286-0003 7.37 You seem anxious, my uncle," I said, seeing him continually with his glass to his eye. "Anxious! -260-123286-0024 3.04 There's a whale, a whale"! cried the Professor. 260-123286-0005 4.81 I am not complaining that the rate is slow, but that the sea is so wide". -260-123288-0019 2.955 At noon the violence of the storm redoubles. 260-123286-0006 7.405 We are losing time, and the fact is, I have not come all this way to take a little sail upon a pond on a raft". -260-123288-0019 2.955 At noon the violence of the storm redoubles. 260-123286-0007 4.55 He called this sea a pond, and our long voyage, taking a little sail! -260-123286-0022 3.235 Two hours afterwards a terrible shock awoke me. 260-123286-0009 5.795 I take this as my answer, and I leave the Professor to bite his lips with impatience. -260-123286-0001 3.07 The horizon seems extremely distant. 260-123286-0011 4.255 Nothing new. Weather unchanged. The wind freshens. -260-123286-0024 3.04 There's a whale, a whale"! cried the Professor. 260-123286-0013 4.73 The shadow of the raft was clearly outlined upon the surface of the waves. -260-123440-0018 3.64 I am very tired of swimming about here, O Mouse"! 260-123286-0015 5.21 It must be as wide as the Mediterranean or the Atlantic - and why not? -260-123288-0019 2.955 At noon the violence of the storm redoubles. 260-123286-0016 7 These thoughts agitated me all day, and my imagination scarcely calmed down after several hours' sleep. -260-123440-0006 2.715 I wonder if I've been changed in the night? 260-123286-0018 5.67 I saw at the Hamburg museum the skeleton of one of these creatures thirty feet in length. -260-123288-0009 3.435 Those clouds seem as if they were going to crush the sea". 260-123286-0023 5.875 The raft was heaved up on a watery mountain and pitched down again, at a distance of twenty fathoms. -260-123286-0024 3.04 There's a whale, a whale"! cried the Professor. 260-123286-0025 9.205 Flight was out of the question now. The reptiles rose; they wheeled around our little raft with a rapidity greater than that of express trains. -260-123288-0020 2.9 Each of us is lashed to some part of the raft. 260-123286-0026 6.94 Two monsters only were creating all this commotion; and before my eyes are two reptiles of the primitive world. -260-123286-0022 3.235 Two hours afterwards a terrible shock awoke me. 260-123286-0027 7.17 I can distinguish the eye of the ichthyosaurus glowing like a red hot coal, and as large as a man's head. -260-123286-0024 3.04 There's a whale, a whale"! cried the Professor. 260-123286-0029 4.545 Those huge creatures attacked each other with the greatest animosity. -260-123440-0005 3.105 And yesterday things went on just as usual. 260-123286-0030 7.53 Suddenly the ichthyosaurus and the plesiosaurus disappear below, leaving a whirlpool eddying in the water. -260-123288-0022 3.705 They seem to be 'We are lost'; but I am not sure. 260-123286-0031 5.06 As for the ichthyosaurus - has he returned to his submarine cavern? -3575-170457-0031 4 On august twenty seventh, eighteen thirty seven, she writes: 3575-170457-0000 8.23 And often has my mother said, While on her lap I laid my head, She feared for time I was not made, But for Eternity. -3575-170457-0032 3.03 Come, come. I am getting really tired of your absence. 3575-170457-0003 7.595 Surely, it must be because we are in danger of loving each other too well - of losing sight of the Creator in idolatry of the creature. -3575-170457-0049 2.715 This decision was communicated to the girls. 3575-170457-0005 7.34 She, a Tory and clergyman's daughter, was always in a minority of one in our house of violent Dissent and Radicalism. -3575-170457-0052 3 She had another weight on her mind this Christmas. 3575-170457-0006 8.3 Her feeble health gave her her yielding manner, for she could never oppose any one without gathering up all her strength for the struggle. -3575-170457-0031 4 On august twenty seventh, eighteen thirty seven, she writes: 3575-170457-0007 7.775 He spoke French perfectly, I have been told, when need was; but delighted usually in talking the broadest Yorkshire. -3575-170457-0031 4 On august twenty seventh, eighteen thirty seven, she writes: 3575-170457-0010 4.79 I am not depreciating it when I say that in these times it is not rare. -3575-170457-0049 2.715 This decision was communicated to the girls. 3575-170457-0011 7.015 But it is not with a view to distinction that you should cultivate this talent, if you consult your own happiness. -3575-170457-0049 2.715 This decision was communicated to the girls. 3575-170457-0012 5.850062 You will say that a woman has no need of such a caution; there can be no peril in it for her. -3575-170457-0031 4 On august twenty seventh, eighteen thirty seven, she writes: 3575-170457-0013 9.175 The more she is engaged in her proper duties, the less leisure will she have for it, even as an accomplishment and a recreation. -3575-170457-0031 4 On august twenty seventh, eighteen thirty seven, she writes: 3575-170457-0014 6.68 To those duties you have not yet been called, and when you are you will be less eager for celebrity. -3575-170457-0004 3.105 We used to dispute about politics and religion. 3575-170457-0019 6.155 I had not ventured to hope for such a reply; so considerate in its tone, so noble in its spirit. -3575-170457-0056 3.370062 I doubt whether Branwell was maintaining himself at this time. 3575-170457-0020 8.645 I know the first letter I wrote to you was all senseless trash from beginning to end; but I am not altogether the idle dreaming being it would seem to denote. -3575-170457-0032 3.03 Come, come. I am getting really tired of your absence. 3575-170457-0021 4.18 I thought it therefore my duty, when I left school, to become a governess. -3575-170457-0004 3.105 We used to dispute about politics and religion. 3575-170457-0022 5.825 In the evenings, I confess, I do think, but I never trouble any one else with my thoughts. -3575-170457-0049 2.715 This decision was communicated to the girls. 3575-170457-0023 9.095 I carefully avoid any appearance of preoccupation and eccentricity, which might lead those I live amongst to suspect the nature of my pursuits. -3575-170457-0034 3.495 in this monotonous life of mine, that was a pleasant event. 3575-170457-0025 9.205 Again I thank you. This incident, I suppose, will be renewed no more; if I live to be an old woman, I shall remember it thirty years hence as a bright dream. -3575-170457-0031 4 On august twenty seventh, eighteen thirty seven, she writes: 3575-170457-0027 4.58 I cannot deny myself the gratification of inserting Southey's reply: -3575-170457-0049 2.715 This decision was communicated to the girls. 3575-170457-0029 6.055 Your letter has given me great pleasure, and I should not forgive myself if I did not tell you so. -3575-170457-0049 2.715 This decision was communicated to the girls. 3575-170457-0030 8.945063 Of this second letter, also, she spoke, and told me that it contained an invitation for her to go and see the poet if ever she visited the Lakes. -3575-170457-0021 4.18 I thought it therefore my duty, when I left school, to become a governess. 3575-170457-0033 8.5 Saturday after Saturday comes round, and I can have no hope of hearing your knock at the door, and then being told that 'Miss E. is come'. Oh, dear! -3575-170457-0049 2.715 This decision was communicated to the girls. 3575-170457-0035 9.37 I wish it would recur again; but it will take two or three interviews before the stiffness - the estrangement of this long separation - will wear away". -3575-170457-0034 3.495 in this monotonous life of mine, that was a pleasant event. 3575-170457-0040 6.905 Indeed, there were only one or two strangers who could be admitted among the sisters without producing the same result. -3575-170457-0049 2.715 This decision was communicated to the girls. 3575-170457-0044 9.72 After this disappointment, I never dare reckon with certainty on the enjoyment of a pleasure again; it seems as if some fatality stood between you and me. -3575-170457-0001 2.99 Why are we to be denied each other's society? 3575-170457-0045 6.52 I am not good enough for you, and you must be kept from the contamination of too intimate society. -3575-170457-0049 2.715 This decision was communicated to the girls. 3575-170457-0047 6.525 Tabby had lived with them for ten or twelve years, and was, as Charlotte expressed it, "one of the family". -3575-170457-0052 3 She had another weight on her mind this Christmas. 3575-170457-0048 5.555 He refused at first to listen to the careful advice; it was repugnant to his liberal nature. -3575-170457-0049 2.715 This decision was communicated to the girls. 3575-170457-0050 6.405 Tabby had tended them in their childhood; they, and none other, should tend her in her infirmity and age. -3575-170457-0056 3.370062 I doubt whether Branwell was maintaining himself at this time. 3575-170457-0051 4.915 At tea time, they were sad and silent, and the meal went away untouched by any of the three. -3575-170457-0031 4 On august twenty seventh, eighteen thirty seven, she writes: 3575-170457-0054 8.005 Stung by anxiety for this little sister, she upbraided Miss W -- for her fancied indifference to Anne's state of health. -4970-29093-0008 3.58 He wanted to begin at the top of the ladder. 4970-29093-0007 6.995 It is such a noble ambition, that it is a pity it has usually such a shallow foundation. -4970-29095-0011 3.355 Does thee think thee could stand it six months? 4970-29093-0009 9.12 Philip therefore read diligently in the Astor library, planned literary works that should compel attention, and nursed his genius. -4970-29093-0017 2.865 I've been ready to go anywhere for six months. 4970-29093-0012 8.71 But Philip did afford it, and he wrote, thanking his friends, and declining because he said the political scheme would fail, and ought to fail. -4970-29093-0017 2.865 I've been ready to go anywhere for six months. 4970-29093-0013 8.01 And he went back to his books and to his waiting for an opening large enough for his dignified entrance into the literary world. -4970-29095-0008 3.04 Mother, I'm going to study medicine"? 4970-29093-0014 4.275 Well, I'm going as an engineer. You can go as one". -4970-29093-0017 2.865 I've been ready to go anywhere for six months. 4970-29093-0018 9.715 The two young men who were by this time full of the adventure, went down to the Wall street office of Henry's uncle and had a talk with that wily operator. -4970-29093-0015 3.325 You can begin by carrying a rod, and putting down the figures. 4970-29093-0019 7.47 The night was spent in packing up and writing letters, for Philip would not take such an important step without informing his friends. -4970-29093-0004 3.75 He was unable to decide exactly what it should be. 4970-29093-0020 5.58 Why, it's in Missouri somewhere, on the frontier I think. We'll get a map". -4970-29093-0017 2.865 I've been ready to go anywhere for six months. 4970-29093-0022 6.22 He knew his uncle would be glad to hear that he had at last turned his thoughts to a practical matter. -4970-29095-0011 3.355 Does thee think thee could stand it six months? 4970-29093-0023 8.07 He well knew the perils of the frontier, the savage state of society, the lurking Indians and the dangers of fever. -1284-1181-0019 3.2 I now use them as ornamental statuary in my garden. 1284-1180-0000 8.12 He wore blue silk stockings, blue knee pants with gold buckles, a blue ruffled waist and a jacket of bright blue braided with gold. -1284-1181-0007 4.04 She poured into the dish a quantity from each of these bottles. 1284-1180-0001 7.755 His hat had a peaked crown and a flat brim, and around the brim was a row of tiny golden bells that tinkled when he moved. -1284-1181-0021 2.7 asked the voice, in scornful accents. 1284-1180-0002 7.68 Instead of shoes, the old man wore boots with turnover tops and his blue coat had wide cuffs of gold braid. -1284-1180-0004 4.285 When they were outside, Unc simply latched the door and started up the path. 1284-1180-0003 4.835 For a long time he had wished to explore the beautiful Land of Oz in which they lived. -1284-1180-0014 3.665 Ojo had never eaten such a fine meal in all his life. 1284-1180-0004 4.285 When they were outside, Unc simply latched the door and started up the path. -1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1180-0005 6.55 No one would disturb their little house, even if anyone came so far into the thick forest while they were gone. -1284-1180-0004 4.285 When they were outside, Unc simply latched the door and started up the path. 1284-1180-0006 6.865 At the foot of the mountain that separated the Country of the Munchkins from the Country of the Gillikins, the path divided. -1284-1180-0004 4.285 When they were outside, Unc simply latched the door and started up the path. 1284-1180-0007 6.265 He knew it would take them to the house of the Crooked Magician, whom he had never seen but who was their nearest neighbor. -1284-1180-0014 3.665 Ojo had never eaten such a fine meal in all his life. 1284-1180-0009 6.285 Then they started on again and two hours later came in sight of the house of doctor Pipt. -1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1180-0010 8.635 Unc knocked at the door of the house and a chubby, pleasant faced woman, dressed all in blue, opened it and greeted the visitors with a smile. -1284-1180-0014 3.665 Ojo had never eaten such a fine meal in all his life. 1284-1180-0011 4.275 I am, my dear, and all strangers are welcome to my home". -1284-1180-0011 4.275 I am, my dear, and all strangers are welcome to my home". 1284-1180-0012 4.88 We have come from a far lonelier place than this". "A lonelier place! -1284-1180-0022 2.885 I'm afraid I don't know much about the Land of Oz. 1284-1180-0015 5.835 We are traveling," replied Ojo, "and we stopped at your house just to rest and refresh ourselves. -1284-1180-0004 4.285 When they were outside, Unc simply latched the door and started up the path. 1284-1180-0020 5.87 The first lot we tested on our Glass Cat, which not only began to live but has lived ever since. -1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1180-0021 9.84 I think the next Glass Cat the Magician makes will have neither brains nor heart, for then it will not object to catching mice and may prove of some use to us". -1284-1180-0022 2.885 I'm afraid I don't know much about the Land of Oz. 1284-1180-0023 5.61 You see, I've lived all my life with Unc Nunkie, the Silent One, and there was no one to tell me anything". -1284-1181-0007 4.04 She poured into the dish a quantity from each of these bottles. 1284-1180-0024 5.26 That is one reason you are Ojo the Unlucky," said the woman, in a sympathetic tone. -1284-1181-0007 4.04 She poured into the dish a quantity from each of these bottles. 1284-1180-0025 8.705 I think I must show you my Patchwork Girl," said Margolotte, laughing at the boy's astonishment, "for she is rather difficult to explain. -1284-1180-0004 4.285 When they were outside, Unc simply latched the door and started up the path. 1284-1180-0026 8.29 But first I will tell you that for many years I have longed for a servant to help me with the housework and to cook the meals and wash the dishes. -1284-1181-0007 4.04 She poured into the dish a quantity from each of these bottles. 1284-1180-0028 6.045 A bed quilt made of patches of different kinds and colors of cloth, all neatly sewed together. -1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1180-0029 5.335 Sometimes it is called a 'crazy quilt,' because the patches and colors are so mixed up. -1284-1180-0004 4.285 When they were outside, Unc simply latched the door and started up the path. 1284-1180-0031 4.825 At the Emerald City, where our Princess Ozma lives, green is the popular color. -1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1180-0032 5.78 I will show you what a good job I did," and she went to a tall cupboard and threw open the doors. -3570-5694-0022 4.295 The livery becomes obnoxious to nearly all who are required to wear it. 3570-5694-0001 5.675 The utility of consumption as an evidence of wealth is to be classed as a derivative growth. -3570-5694-0022 4.295 The livery becomes obnoxious to nearly all who are required to wear it. 3570-5694-0004 5.33 In the nature of things, luxuries and the comforts of life belong to the leisure class. -3570-5694-0022 4.295 The livery becomes obnoxious to nearly all who are required to wear it. 3570-5694-0005 8.405 Under the tabu, certain victuals, and more particularly certain beverages, are strictly reserved for the use of the superior class. -3570-5694-0022 4.295 The livery becomes obnoxious to nearly all who are required to wear it. 3570-5694-0008 9.495 The consumption of luxuries, in the true sense, is a consumption directed to the comfort of the consumer himself, and is, therefore, a mark of the master. -3570-5694-0012 3.205 There is a more or less elaborate system of rank and grades. 3570-5694-0013 5.61 This differentiation is furthered by the inheritance of wealth and the consequent inheritance of gentility. -3570-5694-0022 4.295 The livery becomes obnoxious to nearly all who are required to wear it. 3570-5694-0015 8.435 So many of them, however, as make up the retainer and hangers on of the patron may be classed as vicarious consumer without qualification. -3570-5694-0019 3.755 But the general distinction is not on that account to be overlooked. 3570-5694-0017 8.335 The wearing of uniforms or liveries implies a considerable degree of dependence, and may even be said to be a mark of servitude, real or ostensible. -3570-5694-0022 4.295 The livery becomes obnoxious to nearly all who are required to wear it. 3570-5694-0018 7.815 The wearers of uniforms and liveries may be roughly divided into two classes the free and the servile, or the noble and the ignoble. -3570-5694-0019 3.755 But the general distinction is not on that account to be overlooked. 3570-5694-0022 4.295 The livery becomes obnoxious to nearly all who are required to wear it. -8463-287645-0010 4.325 He worked me very hard; he wanted to be beating me all the time". 8463-294828-0001 9.19 THREE SECONDS before the arrival of JB Hobson's letter, I no more dreamed of chasing the unicorn than of trying for the Northwest Passage. -8463-287645-0014 3.02 of starting. I didn't know the way to come. 8463-294828-0002 6.19 Even so, I had just returned from an arduous journey, exhausted and badly needing a rest. -8463-294828-0021 2.735 A route slightly less direct, that's all. 8463-294828-0003 9.34 I wanted nothing more than to see my country again, my friends, my modest quarters by the Botanical Gardens, my dearly beloved collections! -8463-294828-0026 2.745 We have a commander who's game for anything"! 8463-294828-0006 7.32 From rubbing shoulders with scientists in our little universe by the Botanical Gardens, the boy had come to know a thing or two. -8463-294828-0026 2.745 We have a commander who's game for anything"! 8463-294828-0009 4.17 Not once did he comment on the length or the hardships of a journey. -8463-287645-0009 3.71 I never knew of but one man who could ever please him. 8463-294828-0010 8.34 Never did he object to buckling up his suitcase for any country whatever, China or the Congo, no matter how far off it was. -8463-294828-0011 3.91 He went here, there, and everywhere in perfect contentment. 8463-294828-0012 4.905 Please forgive me for this underhanded way of admitting I had turned forty. -8463-287645-0008 3.325 As usual nothing was done in the way of punishment". 8463-294828-0013 7.2 He was a fanatic on formality, and he only addressed me in the third person to the point where it got tiresome. -8463-287645-0009 3.71 I never knew of but one man who could ever please him. 8463-294828-0014 5.725 There was good reason to stop and think, even for the world's most emotionless man. -8463-294828-0005 2.44 Conseil was my manservant. 8463-294828-0015 4.88 Conseil"! I called a third time. Conseil appeared. -8463-287645-0008 3.325 As usual nothing was done in the way of punishment". 8463-294828-0017 9.3 Pack as much into my trunk as you can, my traveling kit, my suits, shirts, and socks, don't bother counting, just squeeze it all in and hurry"! -8463-294825-0008 3.98 But much of the novel's brooding power comes from Captain Nemo. 8463-294828-0019 4.53 Anyhow, we'll leave instructions to ship the whole menagerie to France". -8463-287645-0001 3.545 It is hardly necessary to say more of them here. 8463-294828-0020 5.915 Yes, we are... certainly...," I replied evasively, "but after we make a detour". -8463-287645-0008 3.325 As usual nothing was done in the way of punishment". 8463-294828-0023 4.745 You see, my friend, it's an issue of the monster, the notorious narwhale. -8463-294828-0026 2.745 We have a commander who's game for anything"! 8463-294828-0027 5.98 I left instructions for shipping my containers of stuffed animals and dried plants to Paris, France. -8463-294828-0034 3.505 We'll be quite comfortable here," I told Conseil. 8463-294828-0028 7.915 I opened a line of credit sufficient to cover the babirusa and, Conseil at my heels, I jumped into a carriage. -8463-294828-0011 3.91 He went here, there, and everywhere in perfect contentment. 8463-294828-0029 5.285 Our baggage was immediately carried to the deck of the frigate. I rushed aboard. -8463-294828-0026 2.745 We have a commander who's game for anything"! 8463-294828-0031 7.765 One of the sailors led me to the afterdeck, where I stood in the presence of a smart looking officer who extended his hand to me. -8463-287645-0008 3.325 As usual nothing was done in the way of punishment". 8463-294828-0032 4.395 In person. Welcome aboard, professor. Your cabin is waiting for you". -8463-294825-0008 3.98 But much of the novel's brooding power comes from Captain Nemo. 8463-294828-0033 6.365 I was well satisfied with my cabin, which was located in the stern and opened into the officers' mess. -8463-294828-0009 4.17 Not once did he comment on the length or the hardships of a journey. 8463-294828-0036 6.985 The wharves of Brooklyn, and every part of New York bordering the East River, were crowded with curiosity seekers. -7127-75947-0008 4.155 The arrow pierced his heart and wounded him mortally. 7127-75947-0001 6.64 Upon this Madame deigned to turn her eyes languishingly towards the comte, observing. -7127-75947-0002 3.235 Do you think so"? she replied with indifference. 7127-75947-0003 5.98 Yes; the character which your royal highness assumed is in perfect harmony with your own". -7127-75946-0025 3.96 The ballet began; the effect was more than beautiful. 7127-75947-0007 5.46 She then rose, humming the air to which she was presently going to dance. -7127-75946-0005 2.67 What do you mean"? inquired Louis, 7127-75947-0008 4.155 The arrow pierced his heart and wounded him mortally. -7127-75947-0002 3.235 Do you think so"? she replied with indifference. 7127-75947-0010 8.865 When she perceived the young man, she rose, like a woman surprised in the midst of ideas she was desirous of concealing from herself. -7127-75946-0005 2.67 What do you mean"? inquired Louis, 7127-75947-0013 5.045 I remember now, and I congratulate myself. Do you love any one"? -7127-75947-0018 4.04 I have been here this quarter of an hour," replied La Valliere. 7127-75947-0015 6.26 There cannot be a doubt he received you kindly, for, in fact, you returned without his permission". -7127-75946-0010 3.6 Your majesty's plan, then, in this affair, is 7127-75947-0016 7.48 Oh! mademoiselle, why have I not a devoted sister, or a true friend, such as yourself"? -7127-75947-0018 4.04 I have been here this quarter of an hour," replied La Valliere. 7127-75947-0024 7.33 Look yonder, do you not see the moon slowly rising, silvering the topmost branches of the chestnuts and the oaks. -7127-75947-0018 4.04 I have been here this quarter of an hour," replied La Valliere. 7127-75947-0025 5.57 exquisite soft turf of the woods, the happiness which your friendship confers upon me! -7127-75946-0025 3.96 The ballet began; the effect was more than beautiful. 7127-75947-0028 7.46 Quick, quick, then, among the high reed grass," said Montalais; "stoop, Athenais, you are so tall". -7127-75946-0025 3.96 The ballet began; the effect was more than beautiful. 7127-75947-0029 5.285 The young girls had, indeed, made themselves small - indeed invisible. -7127-75947-0019 3.875 Did not the dancing amuse you"? "No". 7127-75947-0032 4.745 Yes; but perhaps I frightened her". "In what way"? -7127-75947-0018 4.04 I have been here this quarter of an hour," replied La Valliere. 7127-75947-0035 4.415 Good gracious! has the king any right to interfere in matters of that kind? -7127-75947-0018 4.04 I have been here this quarter of an hour," replied La Valliere. 7127-75947-0037 8.824938 Oh! I am speaking seriously," replied Montalais, "and my opinion in this case is quite as good as the king's, I suppose; is it not, Louise"? -121-121726-0011 4.035 HUSBAND The next thing to a wife. 121-123859-0004 9.505 So I return rebuked to my content, And gain by ill thrice more than I have spent. -908-31957-0005 4.49 Alas, I have grieved so I am hard to love. 908-157963-0005 7.035 Like the doves voice, like transient day, like music in the air: Ah! -908-157963-0009 4.06 Why should the mistress of the vales of Har, utter a sigh. 908-157963-0006 8.11 And gentle sleep the sleep of death, and gently hear the voice Of him that walketh in the garden in the evening time. -908-157963-0029 3.63 Why a Tongue impressed with honey from every wind? 908-157963-0009 4.06 Why should the mistress of the vales of Har, utter a sigh. -908-31957-0018 3.915 But thou art not such A lover, my Beloved! 908-157963-0010 6.28 She ceasd and smiled in tears, then sat down in her silver shrine. -908-157963-0018 4.255 And fearest thou because I vanish and am seen no more. 908-157963-0013 4.315 And why it scatters its bright beauty thro the humid air. -908-157963-0018 4.255 And fearest thou because I vanish and am seen no more. 908-157963-0014 4.52 Descend O little cloud and hover before the eyes of Thel. -908-31957-0018 3.915 But thou art not such A lover, my Beloved! 908-157963-0016 5.105 I pass away, yet I complain, and no one hears my voice. -908-157963-0013 4.315 And why it scatters its bright beauty thro the humid air. 908-157963-0017 4.95 The Cloud then shewd his golden head and his bright form emerged. -908-157963-0003 3.08 Why fade these children of the spring? 908-157963-0018 4.255 And fearest thou because I vanish and am seen no more. -908-157963-0024 3.44 image of weakness, art thou but a Worm? 908-157963-0020 9.8 Till we arise linked in a golden band and never part: But walk united bearing food to all our tender flowers. -908-157963-0013 4.315 And why it scatters its bright beauty thro the humid air. 908-157963-0022 4.61 Come forth worm and the silent valley, to thy pensive queen. -908-157963-0002 2.755 why fades the lotus of the water? 908-157963-0023 9.625 The helpless worm arose and sat upon the Lillys leaf, And the bright Cloud saild on, to find his partner in the vale. -908-157963-0024 3.44 image of weakness, art thou but a Worm? 908-157963-0025 9.265 I see they lay helpless and naked: weeping And none to answer, none to cherish thee with mothers smiles. -908-157963-0029 3.63 Why a Tongue impressed with honey from every wind? 908-157963-0026 8.1 And says; Thou mother of my children, I have loved thee And I have given thee a crown that none can take away. -908-157963-0024 3.44 image of weakness, art thou but a Worm? 908-157963-0027 5.225 And lay me down in thy cold bed, and leave my shining lot. -908-157963-0003 3.08 Why fade these children of the spring? 908-157963-0028 4.955 Or an Eye of gifts and graces showring fruits and coined gold! -908-157963-0024 3.44 image of weakness, art thou but a Worm? 908-157963-0030 4.52 Why an Ear, a whirlpool fierce to draw creations in? -4446-2271-0003 3.7 It's been on only two weeks, and I've been half a dozen times already. 4446-2271-0001 6.35 He had preconceived ideas about everything, and his idea about Americans was that they should be engineers or mechanics. -4446-2275-0005 4.445 I felt it in my bones when I woke this morning that something splendid was going to turn up. 4446-2271-0008 5.495 Irene Burgoyne, one of her family, told me in confidence that there was a romance somewhere back in the beginning. -4446-2271-0005 3.395 She saves her hand, too. She's at her best in the second act. 4446-2271-0009 7.82 Mainhall vouched for her constancy with a loftiness that made Alexander smile, even while a kind of rapid excitement was tingling through him. -4446-2273-0009 4.015 It's not particularly rare," she said, "but some of it was my mother's. 4446-2271-0013 4.4 Do you know, I thought the dance a bit conscious to night, for the first time. -4446-2273-0002 3.295 Lamb wouldn't care a great deal about many of them, I fancy". 4446-2271-0014 5.34 Westmere and I were back after the first act, and we thought she seemed quite uncertain of herself. -4446-2273-0033 3.3 For a long time neither Hilda nor Bartley spoke. 4446-2271-0018 5.715 She considered a moment and then said "No, I think not, though I am glad you ask me. -4446-2275-0045 2.635 We've tortured each other enough for tonight. 4446-2271-0020 7.55 Of course," he reflected, "she always had that combination of something homely and sensible, and something utterly wild and daft. -4446-2271-0005 3.395 She saves her hand, too. She's at her best in the second act. 4446-2273-0000 8.995 Hilda was very nice to him, and he sat on the edge of his chair, flushed with his conversational efforts and moving his chin about nervously over his high collar. -4446-2273-0002 3.295 Lamb wouldn't care a great deal about many of them, I fancy". 4446-2273-0001 4.66 They asked him to come to see them in Chelsea, and they spoke very tenderly of Hilda. -4446-2273-0002 3.295 Lamb wouldn't care a great deal about many of them, I fancy". 4446-2273-0003 7.835 When Bartley arrived at Bedford Square on Sunday evening, Marie, the pretty little French girl, met him at the door and conducted him upstairs. -4446-2275-0022 3.28 But why didn't you tell me when you were here in the summer"? 4446-2273-0004 5.435 I should never have asked you if Molly had been here, for I remember you don't like English cookery". -4446-2273-0034 3.59 He felt a tremor run through the slender yellow figure in front of him. 4446-2273-0005 4.125 I haven't had a chance yet to tell you what a jolly little place I think this is. -4446-2273-0002 3.295 Lamb wouldn't care a great deal about many of them, I fancy". 4446-2273-0008 7.715 I've managed to save something every year, and that with helping my three sisters now and then, and tiding poor Cousin Mike over bad seasons. -4446-2271-0013 4.4 Do you know, I thought the dance a bit conscious to night, for the first time. 4446-2273-0009 4.015 It's not particularly rare," she said, "but some of it was my mother's. -4446-2271-0000 3.495 Mainhall liked Alexander because he was an engineer. 4446-2273-0015 4.505 Don't I, though! I'm so sorry to hear it. How did her son turn out? -4446-2271-0005 3.395 She saves her hand, too. She's at her best in the second act. 4446-2273-0016 9.645 Her hair is still like flax, and her blue eyes are just like a baby's, and she has the same three freckles on her little nose, and talks about going back to her bains de mer". -4446-2275-0015 2.98 He pulled up a window as if the air were heavy. 4446-2273-0021 5.255 What she wanted from us was neither our flowers nor our francs, but just our youth. -4446-2271-0013 4.4 Do you know, I thought the dance a bit conscious to night, for the first time. 4446-2273-0022 5.865 They were both remembering what the woman had said when she took the money: "God give you a happy love"! -4446-2273-0012 2.98 Thank you. But I don't like it so well as this". 4446-2273-0023 6.1 The strange woman, and her passionate sentence that rang out so sharply, had frightened them both. -4446-2271-0024 3.16 I shouldn't wonder if she could laugh about it with me now. 4446-2273-0024 4.825 Bartley started when Hilda rang the little bell beside her. "Dear me, why did you do that? -4446-2271-0011 3.945 Sir Harry Towne, mister Bartley Alexander, the American engineer". 4446-2273-0025 4.83 It was very jolly," he murmured lazily, as Marie came in to take away the coffee. -4446-2271-0013 4.4 Do you know, I thought the dance a bit conscious to night, for the first time. 4446-2273-0028 5.405 Nonsense. Of course I can't really sing, except the way my mother and grandmother did before me. -4446-2273-0011 2.79 There is nothing else that looks so jolly". 4446-2273-0032 7.835 He stood a little behind her, and tried to steady himself as he said: "It's soft and misty. See how white the stars are". -4446-2271-0012 3.78 I say, Sir Harry, the little girl's going famously to night, isn't she"? 4446-2273-0035 6.15 Bartley leaned over her shoulder, without touching her, and whispered in her ear: "You are giving me a chance"? "Yes. -1188-133604-0013 3.02 It must, remember, be one or the other. 1188-133604-0001 9.04 They unite every quality; and sometimes you will find me referring to them as colorists, sometimes as chiaroscurists. -1188-133604-0031 4.25 There's one, and there's another - the "Dudley" and the "Flint". 1188-133604-0005 8.56 It is the head of a parrot with a little flower in his beak from a picture of Carpaccio's, one of his series of the Life of Saint George. -1188-133604-0031 4.25 There's one, and there's another - the "Dudley" and the "Flint". 1188-133604-0010 6.095 But in this vignette, copied from Turner, you have the two principles brought out perfectly. -1188-133604-0040 3.23 The crampness and the poverty are all intended. 1188-133604-0014 4.39 Do not, therefore, think that the Gothic school is an easy one. -1188-133604-0031 4.25 There's one, and there's another - the "Dudley" and the "Flint". 1188-133604-0017 4.615 That a style is restrained or severe does not mean that it is also erroneous. -1188-133604-0014 4.39 Do not, therefore, think that the Gothic school is an easy one. 1188-133604-0022 9.63 You must look at him in the face - fight him - conquer him with what scathe you may: you need not think to keep out of the way of him. -1188-133604-0031 4.25 There's one, and there's another - the "Dudley" and the "Flint". 1188-133604-0025 7.45 You know I have just been telling you how this school of materialism and clay involved itself at last in cloud and fire. -1188-133604-0040 3.23 The crampness and the poverty are all intended. 1188-133604-0031 4.25 There's one, and there's another - the "Dudley" and the "Flint". -1188-133604-0006 2.4 Then he comes to the beak of it. 1188-133604-0033 6.625 Every plant in the grass is set formally, grows perfectly, and may be realized completely. -1188-133604-0014 4.39 Do not, therefore, think that the Gothic school is an easy one. 1188-133604-0036 7.97 In both these high mythical subjects the surrounding nature, though suffering, is still dignified and beautiful. -1188-133604-0031 4.25 There's one, and there's another - the "Dudley" and the "Flint". 1188-133604-0038 5.365 But now here is a subject of which you will wonder at first why Turner drew it at all. -1188-133604-0031 4.25 There's one, and there's another - the "Dudley" and the "Flint". 1188-133604-0039 6.625 It has no beauty whatsoever, no specialty of picturesqueness; and all its lines are cramped and poor. -1188-133604-0031 4.25 There's one, and there's another - the "Dudley" and the "Flint". 1188-133604-0043 4.885 See that your lives be in nothing worse than a boy's climbing for his entangled kite. -7729-102255-0000 3.285 The bogus Legislature numbered thirty six members. 7729-102255-0002 8.3 That summer's emigration, however, being mainly from the free States, greatly changed the relative strength of the two parties. -7729-102255-0034 2.71 To their sorrow they were soon undeceived. 7729-102255-0005 5.18 This was a formidable array of advantages; slavery was playing with loaded dice. -7729-102255-0013 2.675 It was, in fact, the best weapon of its day. 7729-102255-0010 8.54 Of the lynchings, the mobs, and the murders, it would be impossible, except in a very extended work, to note the frequent and atrocious details. -7729-102255-0034 2.71 To their sorrow they were soon undeceived. 7729-102255-0012 4.075 Several hundred free State men promptly responded to the summons. -7729-102255-0034 2.71 To their sorrow they were soon undeceived. 7729-102255-0014 5.295 The leaders of the conspiracy became distrustful of their power to crush the town. -7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0021 7.93 But the affair was magnified as a crowning proof that the free State men were insurrectionists and outlaws. -7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0023 5.5 Their distinctive characters, however, display one broad and unfailing difference. -7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0025 5.485 Their assumed character changed with their changing opportunities or necessities. -7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0028 9.6 Private persons who had leased the Free State Hotel vainly besought the various authorities to prevent the destruction of their property. -7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0029 7.06 Ten days were consumed in these negotiations; but the spirit of vengeance refused to yield. -7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0030 7.25 He summoned half a dozen citizens to join his posse, who followed, obeyed, and assisted him. -7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0031 6.75 He continued his pretended search and, to give color to his errand, made two arrests. -7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0033 6.775 As he had promised to protect the hotel, the reassured citizens began to laugh at their own fears. -7729-102255-0034 2.71 To their sorrow they were soon undeceived. 7729-102255-0035 5.625 The military force, partly rabble, partly organized, had meanwhile moved into the town. -7729-102255-0012 4.075 Several hundred free State men promptly responded to the summons. 7729-102255-0036 7.705 He planted a company before the hotel, and demanded a surrender of the arms belonging to the free- State military companies. -7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0038 7.92 Atchison, who had been haranguing the mob, planted his two guns before the building and trained them upon it. -7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0039 6.815 The inmates being removed, at the appointed hour a few cannon balls were fired through the stone walls. -7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0045 6.805 Captain Martin said: 'I shall give you a pistol to help protect yourself if worse comes to worst! -3570-5694-0022 4.295 The livery becomes obnoxious to nearly all who are required to wear it. 3570-5695-0000 4.83 In a general way, though not wholly nor consistently, these two groups coincide. -3570-5694-0012 3.205 There is a more or less elaborate system of rank and grades. 3570-5695-0002 7.805 But as we descend the social scale, the point is presently reached where the duties of vicarious leisure and consumption devolve upon the wife alone. -3570-5694-0012 3.205 There is a more or less elaborate system of rank and grades. 3570-5695-0003 5.355 In the communities of the Western culture, this point is at present found among the lower middle class. -3570-5694-0019 3.755 But the general distinction is not on that account to be overlooked. 3570-5695-0006 7.47 Very much of squalor and discomfort will be endured before the last trinket or the last pretense of pecuniary decency is put away. -3570-5694-0019 3.755 But the general distinction is not on that account to be overlooked. 3570-5695-0007 9.755 There is no class and no country that has yielded so abjectly before the pressure of physical want as to deny themselves all gratification of this higher or spiritual need. -3570-5694-0019 3.755 But the general distinction is not on that account to be overlooked. 3570-5695-0008 6.845 The question is, which of the two methods will most effectively reach the persons whose convictions it is desired to affect. -3570-5694-0019 3.755 But the general distinction is not on that account to be overlooked. 3570-5695-0009 5.025 Each will therefore serve about equally well during the earlier stages of social growth. -3570-5694-0019 3.755 But the general distinction is not on that account to be overlooked. 3570-5695-0010 4.665 The modern organization of industry works in the same direction also by another line. -3570-5696-0006 4.16 As used in the speech of everyday life the word carries an undertone of deprecation. 3570-5695-0011 8.26 It is evident, therefore, that the present trend of the development is in the direction of heightening the utility of conspicuous consumption as compared with leisure. -3570-5696-0006 4.16 As used in the speech of everyday life the word carries an undertone of deprecation. 3570-5695-0013 4.64 Consumption becomes a larger element in the standard of living in the city than in the country. -3570-5694-0012 3.205 There is a more or less elaborate system of rank and grades. 3570-5695-0015 7.95 The result is a great mobility of the labor employed in printing; perhaps greater than in any other equally well defined and considerable body of workmen. -260-123440-0008 3.745 I'll try if I know all the things I used to know. 260-123288-0001 5.08 The weather - if we may use that term - will change before long. -260-123288-0020 2.9 Each of us is lashed to some part of the raft. 260-123288-0002 7.25 The atmosphere is charged with vapours, pervaded with the electricity generated by the evaporation of saline waters. -260-123288-0009 3.435 Those clouds seem as if they were going to crush the sea". 260-123288-0003 8.905 The electric light can scarcely penetrate through the dense curtain which has dropped over the theatre on which the battle of the elements is about to be waged. -260-123286-0020 3.06 Tuesday, august eighteenth. 260-123288-0004 4.31 The air is heavy; the sea is calm. -260-123440-0005 3.105 And yesterday things went on just as usual. 260-123288-0006 4.88 The atmosphere is evidently charged and surcharged with electricity. -260-123440-0008 3.745 I'll try if I know all the things I used to know. 260-123288-0008 5.515 There's a heavy storm coming on," I cried, pointing towards the horizon. -260-123440-0006 2.715 I wonder if I've been changed in the night? 260-123288-0011 8.98 But if we have now ceased to advance why do we yet leave that sail loose, which at the first shock of the tempest may capsize us in a moment? -260-123288-0019 2.955 At noon the violence of the storm redoubles. 260-123288-0016 4.865 I refer to the thermometer; it indicates... (the figure is obliterated). -260-123440-0006 2.715 I wonder if I've been changed in the night? 260-123288-0017 5.225 Is the atmospheric condition, having once reached this density, to become final? -260-123440-0005 3.105 And yesterday things went on just as usual. 260-123288-0027 6.305 A suffocating smell of nitrogen fills the air, it enters the throat, it fills the lungs. -8455-210777-0062 3.05 When do you intend that the John Bright shall start"? 8455-210777-0000 8.745 I remained there alone for many hours, but I must acknowledge that before I left the chambers I had gradually brought myself to look at the matter in another light. -8455-210777-0026 3 And the death of which I dreamt could not, alas! 8455-210777-0002 6.24 On arriving at home at my own residence, I found that our salon was filled with a brilliant company. -8455-210777-0026 3 And the death of which I dreamt could not, alas! 8455-210777-0005 5.685 We have our little struggles here as elsewhere, and all things cannot be done by rose water. -8455-210777-0047 2.54 You propose to kidnap me," I said. 8455-210777-0006 4.52 We are quite satisfied now, Captain Battleax," said my wife. -8455-210777-0049 4.11 Lieutenant Crosstrees is a very gallant officer. 8455-210777-0009 4.58 No doubt, in process of time the ladies will follow -8455-210777-0025 3.63 What could I do now but just lay myself down and die? 8455-210777-0011 6.63 I did not mean," said Captain Battleax, "to touch upon public subjects at such a moment as this. -8455-210777-0050 3.945 One of us always remains on board while the other is on shore. 8455-210777-0013 7.41 Jack had been standing in the far corner of the room talking to Eva, and was now reduced to silence by his praises. -8455-210777-0066 2.76 They, of course, must all be altered". 8455-210777-0014 4.12 Sir Kennington Oval is a very fine player," said my wife. -8455-210777-0014 4.12 Sir Kennington Oval is a very fine player," said my wife. 8455-210777-0015 8.615 I and my wife and son, and the two Craswellers, and three or four others, agreed to dine on board the ship on the next. -8455-210777-0026 3 And the death of which I dreamt could not, alas! 8455-210777-0017 5.330063 My wife, on the spur of the moment, managed to give the gentlemen a very good dinner. -8455-210777-0025 3.63 What could I do now but just lay myself down and die? 8455-210777-0018 5.925 This, she said, was true hospitality; and I am not sure that I did not agree with her. -8455-210777-0062 3.05 When do you intend that the John Bright shall start"? 8455-210777-0019 8.105 Then there were three or four leading men of the community, with their wives, who were for the most part the fathers and mothers of the young ladies. -8455-210777-0026 3 And the death of which I dreamt could not, alas! 8455-210777-0023 4.73 We sat with the officers some little time after dinner, and then went ashore. -8455-210777-0043 3.145 But what is the delicate mission"? I asked. 8455-210777-0024 7.56 How much of evil, - of real accomplished evil, - had there not occurred to me during the last few days! -8455-210777-0068 2.59 Your power is sufficient," I said. 8455-210777-0028 7.735 Jack would become Eva's happy husband, and would remain amidst the hurried duties of the eager world. -8455-210777-0025 3.63 What could I do now but just lay myself down and die? 8455-210777-0031 7.67 You have received us with all that courtesy and hospitality for which your character in England stands so high. -8455-210777-0026 3 And the death of which I dreamt could not, alas! 8455-210777-0033 7.51 But your power is so superior to any that I can advance, as to make us here feel that there is no disgrace in yielding to it. -8455-210777-0050 3.945 One of us always remains on board while the other is on shore. 8455-210777-0034 7.7 Not a doubt but had your force been only double or treble our own, I should have found it my duty to struggle with you. -8455-210777-0068 2.59 Your power is sufficient," I said. 8455-210777-0037 4.735 You have come to us threatening us with absolute destruction. -8455-210777-0026 3 And the death of which I dreamt could not, alas! 8455-210777-0039 5.59 I can assure you he has not even allowed me to see the trigger since I have been on board. -8455-210777-0025 3.63 What could I do now but just lay myself down and die? 8455-210777-0040 6.195 Then," said Sir Ferdinando, "there is nothing for it but that he must take you with him". -8455-210777-0026 3 And the death of which I dreamt could not, alas! 8455-210777-0041 6.37 There came upon me a sudden shock when I heard these words, which exceeded anything which I had yet felt. -8455-210777-0050 3.945 One of us always remains on board while the other is on shore. 8455-210777-0044 7.17 I was to be taken away and carried to England or elsewhere, - or drowned upon the voyage, it mattered not which. -8455-210777-0062 3.05 When do you intend that the John Bright shall start"? 8455-210777-0046 9.33 You may be quite sure it's there," said Captain Battleax, "and that I can so use it as to half obliterate your town within two minutes of my return on board". -8455-210777-0020 3.155 Oh yes," said Jack, "and I'm nowhere. 8455-210777-0049 4.11 Lieutenant Crosstrees is a very gallant officer. -8455-210777-0048 3.43 What would become of your gun were I to kidnap you"? 8455-210777-0052 4.94 You will allow me to suggest," said he, "that that is a matter of opinion. -8455-210777-0062 3.05 When do you intend that the John Bright shall start"? 8455-210777-0053 6.955 Were I to comply with your orders without expressing my own opinion, I should seem to have done so willingly hereafter. -8455-210777-0025 3.63 What could I do now but just lay myself down and die? 8455-210777-0055 9.555 SIR, - I have it in command to inform your Excellency that you have been appointed Governor of the Crown colony which is called Britannula. -8455-210777-0025 3.63 What could I do now but just lay myself down and die? 8455-210777-0056 5.545 The peculiar circumstances of the colony are within your Excellency's knowledge. -8455-210777-0050 3.945 One of us always remains on board while the other is on shore. 8455-210777-0058 7.16 It is founded on the acknowledged weakness of those who survive that period of life at which men cease to work. -8455-210777-0064 3.835 And I have no one ready to whom I can give up the archives of the Government". 8455-210777-0059 5.535 But it is surmised that you will find difficulties in the way of your entering at once upon your government. -8455-210777-0062 3.05 When do you intend that the John Bright shall start"? 8455-210777-0060 7.075 The John Bright is armed with a weapon of great power, against which it is impossible that the people of Britannula should prevail. -8455-210777-0064 3.835 And I have no one ready to whom I can give up the archives of the Government". 8455-210777-0069 8.915 If you will give us your promise to meet Captain Battleaxe here at this time tomorrow, we will stretch a point and delay the departure of the John Bright for twenty four hours". -8455-210777-0026 3 And the death of which I dreamt could not, alas! 8455-210777-0070 5.945 And this plan was adopted, too, in order to extract from me a promise that I would depart in peace. -6829-68769-0043 2.59 And he deserves a term in state's prison". 6829-68771-0002 8.94 The "weak kneed" contingency must be strengthened and fortified, and a couple of hundred votes in one way or another secured from the opposition. -6829-68769-0016 4.12 He unlocked the door, and called: "Here's visitors, Tom". 6829-68771-0003 4.015 The Democratic Committee figured out a way to do this. -6829-68769-0014 3.655 They followed the jailer along a succession of passages. 6829-68771-0004 8.44 Under ordinary conditions Reynolds was sure to be elected, but the Committee proposed to sacrifice him in order to elect Hopkins. -6829-68769-0037 2.53 I've seen lots of that kind in my day. 6829-68771-0005 6.165 The only thing necessary was to "fix" Seth Reynolds, and this Hopkins arranged personally. -6829-68769-0012 4.295 Oh, say! that's different," observed Markham, altering his demeanor. 6829-68771-0006 5.92 And this was why Kenneth and Beth discovered him conversing with the young woman in the buggy. -6829-68769-0039 4.045 He looked up rather ungraciously, but motioned them to be seated. 6829-68771-0008 7.18 These women were flattered by the attention of the young lady and had promised to assist in electing mister Forbes. -6829-68769-0051 3.545 There was a grim smile of amusement on his shrewd face. 6829-68771-0010 9.82 The Fairview band was engaged to discourse as much harmony as it could produce, and the resources of the great house were taxed to entertain the guests. -6829-68769-0037 2.53 I've seen lots of that kind in my day. 6829-68771-0011 5.625 Tables were spread on the lawn and a dainty but substantial repast was to be served. -6829-68769-0028 3.29 He is supposed to sign all the checks of the concern. 6829-68771-0014 4.77 We ought to have more attendants, Beth," said Louise, approaching her cousin. -6829-68769-0033 4.02 It was better for him to think the girl unfeeling than to know the truth. 6829-68771-0015 4.525 Won't you run into the house and see if Martha can't spare one or two more maids"? -6829-68769-0035 2.755 It won't be much, but I'm grateful to find a friend. 6829-68771-0016 6.99 She was very fond of the young ladies, whom she had known when Aunt Jane was the mistress here, and Beth was her especial favorite. -6829-68771-0021 2.61 But it can't be," protested the girl. 6829-68771-0018 8.445 For a moment Beth stood staring, while the new maid regarded her with composure and a slight smile upon her beautiful face. -6829-68771-0031 2.515 Her eyes wandered to the maid's hands. 6829-68771-0019 7.42 She was dressed in the regulation costume of the maids at Elmhurst, a plain black gown with white apron and cap. -6829-68771-0022 3.8 I attend to the household mending, you know, and care for the linen. 6829-68771-0020 4.615 Then she gave a little laugh, and replied: "No, Miss Beth. I'm Elizabeth Parsons". -6829-68769-0012 4.295 Oh, say! that's different," observed Markham, altering his demeanor. 6829-68771-0023 5.425 You speak like an educated person," said Beth, wonderingly. "Where is your home"? -6829-68771-0035 4.39 Will you leave me alone in my own room, or must I go away to escape you"? 6829-68771-0024 6.245 For the first time the maid seemed a little confused, and her gaze wandered from the face of her visitor. -6829-68769-0051 3.545 There was a grim smile of amusement on his shrewd face. 6829-68771-0025 7.83 She sat down in a rocking chair, and clasping her hands in her lap, rocked slowly back and forth. "I'm sorry," said Beth. -6829-68769-0051 3.545 There was a grim smile of amusement on his shrewd face. 6829-68771-0027 5.32 They - they excite me, in some way, and I - I can't bear them. You must excuse me". -6829-68771-0035 4.39 Will you leave me alone in my own room, or must I go away to escape you"? 6829-68771-0029 8.945 Beth was a beautiful girl - the handsomest of the three cousins, by far; yet Eliza surpassed her in natural charm, and seemed well aware of the fact. -6829-68769-0003 4.215 It was a deliberate theft from his employers to protect a girl he loved. 6829-68771-0030 6.225 Her manner was neither independent nor assertive, but rather one of well bred composure and calm reliance. -6829-68769-0002 3.075 I can't see it in that light," said the old lawyer. 6829-68771-0032 6.555 However her features and form might repress any evidence of nervousness, these hands told a different story. -6829-68771-0034 2.475 I wish I knew myself," she cried, fiercely. 6829-68771-0033 5.45 She rose quickly to her feet, with an impetuous gesture that made her visitor catch her breath. -6829-68769-0002 3.075 I can't see it in that light," said the old lawyer. 6829-68771-0035 4.39 Will you leave me alone in my own room, or must I go away to escape you"? -6829-68769-0028 3.29 He is supposed to sign all the checks of the concern. 6829-68771-0036 5.2 Eliza closed the door behind her with a decided slam, and a key clicked in the lock. -8463-287645-0008 3.325 As usual nothing was done in the way of punishment". 8463-287645-0000 4.73 This was what did the mischief so far as the "running away" was concerned. -8463-294828-0008 2.65 And yet, what a fine, gallant lad! 8463-287645-0003 7.905 Of this party, Edward, a boy of seventeen, called forth much sympathy; he too was claimed by Hollan. -8463-294828-0026 2.745 We have a commander who's game for anything"! 8463-287645-0006 7.71 The doctor who attended the injured creature in this case was simply told that she slipped and fell down stairs as she was coming down. -8463-294828-0021 2.735 A route slightly less direct, that's all. 8463-287645-0010 4.325 He worked me very hard; he wanted to be beating me all the time". -8463-287645-0008 3.325 As usual nothing was done in the way of punishment". 8463-287645-0011 6.38 She was a large, homely woman; they were common white people, with no reputation in the community". -8463-294828-0011 3.91 He went here, there, and everywhere in perfect contentment. 8463-287645-0012 5.425 Substantially this was Jacob's unvarnished description of his master and mistress. -8463-294828-0032 4.395 In person. Welcome aboard, professor. Your cabin is waiting for you". 8463-287645-0013 6.665 As to his age, and also the name of his master, Jacob's statement varied somewhat from the advertisement. -3729-6852-0016 4.195 Madame Quinson, besides, can answer your enquiries. 3729-6852-0011 7.37 I had a name, I believe, in my young days, but I have forgotten it since I have been in service. -3729-6852-0010 2.755 I never had any family. 3729-6852-0014 5.71 Here, go and get me change for a Louis". "I have it, sir". -3729-6852-0025 3 Is there not a meridian everywhere"? 3729-6852-0016 4.195 Madame Quinson, besides, can answer your enquiries. -3729-6852-0016 4.195 Madame Quinson, besides, can answer your enquiries. 3729-6852-0018 6.21 I sit down at a small table: a waiter comes immediately to enquire my wishes. -3729-6852-0019 3.305 I tell him to give me some coffee, if it is good. 3729-6852-0022 8.315 I address him in Italian, and he answers very wittily, but his way of speaking makes me smile, and I tell him why. -3729-6852-0019 3.305 I tell him to give me some coffee, if it is good. 3729-6852-0023 8.185 My remark pleases him, but I soon prove to him that it is not the right way to speak, however perfect may have been the language of that ancient writer. -3729-6852-0019 3.305 I tell him to give me some coffee, if it is good. 3729-6852-0024 5.515 I see a crowd in one corner of the garden, everybody standing still and looking up. -3729-6852-0016 4.195 Madame Quinson, besides, can answer your enquiries. 3729-6852-0026 4.69 Yes, but the meridian of the Palais Royal is the most exact". -3729-6852-0019 3.305 I tell him to give me some coffee, if it is good. 3729-6852-0028 5.265 All these honest persons are waiting their turn to get their snuff boxes filled". -3729-6852-0010 2.755 I never had any family. 3729-6852-0029 8.605 It is sold everywhere, but for the last three weeks nobody will use any snuff but that sold at the 'Civet Cat. -3729-6852-0025 3 Is there not a meridian everywhere"? 3729-6852-0031 4.4 But how did she manage to render it so fashionable"? -3729-6852-0019 3.305 I tell him to give me some coffee, if it is good. 3729-6852-0037 5.89 She introduced me to all her guests, and gave me some particulars respecting every one of them. -3729-6852-0021 2.96 I thank him and take my leave. 3729-6852-0038 5.77 What, sir"! I said to him, "am I fortunate enough to see you? -3729-6852-0019 3.305 I tell him to give me some coffee, if it is good. 3729-6852-0039 8.825 He himself recited the same passage in French, and politely pointed out the parts in which he thought that I had improved on the original. -3729-6852-0019 3.305 I tell him to give me some coffee, if it is good. 3729-6852-0044 6.98 I will make you translate them into French, and you need not be afraid of my finding you insatiable". -7176-92135-0026 2.95 Enter Hamlet with his favourite boar hound. 7176-88083-0000 5.695 All about him was a tumult of bright and broken color, scattered in broad splashes. -7176-92135-0039 3.125 Tea, please, Matthews. Butler (impassively). 7176-88083-0002 7.51 His feet were red, his long narrow beak, with its saw toothed edges and sharp hooked tip, was bright red. -7176-92135-0024 4.1 To be or not to be, that is the question; whether 'tis nobler 7176-88083-0003 7.6 But here he was at a terrible disadvantage as compared with the owls, hawks, and eagles. He had no rending claws. -7176-88083-0016 3.92 Straightway the hawk glided from his perch and darted after him. 7176-88083-0004 7.5 But suddenly, straight and swift as a diving cormorant, he shot down into the torrent and disappeared beneath the surface. -7176-88083-0016 3.92 Straightway the hawk glided from his perch and darted after him. 7176-88083-0005 4.7 Once fairly a wing, however, he wheeled and made back hurriedly for his perch. -7176-92135-0008 4.43 Lend me your ear for ten minutes, and you shall learn just what stagecraft is". 7176-88083-0006 4.295 It might have seemed that a trout of this size was a fairly substantial meal. -7176-92135-0008 4.43 Lend me your ear for ten minutes, and you shall learn just what stagecraft is". 7176-88083-0009 4.045 The great hawk followed hurriedly, to retrieve his prey from the ground. -7176-88083-0008 3.28 In despair he hurled himself downward too soon. 7176-88083-0010 6.74 The cat growled softly, picked up the prize in her jaws and trotted into the bushes to devour it. -7176-88083-0016 3.92 Straightway the hawk glided from his perch and darted after him. 7176-88083-0012 5.045 The hawk alighted on the dead branch, and sat upright, motionless, as if surprised. -7176-88083-0009 4.045 The great hawk followed hurriedly, to retrieve his prey from the ground. 7176-88083-0014 4.67 The hawk sat upon the branch and watched his quarry swimming beneath the surface. -7176-88083-0016 3.92 Straightway the hawk glided from his perch and darted after him. 7176-88083-0019 5.81 As he flew, his down reaching, clutching talons were not half a yard above the fugitive's head. -7176-88083-0009 4.045 The great hawk followed hurriedly, to retrieve his prey from the ground. 7176-88083-0020 5.415 Where the waves for an instant sank, they came closer, - but not quite within grasping reach. -7176-92135-0024 4.1 To be or not to be, that is the question; whether 'tis nobler 7176-88083-0022 9.485 The hawk, embittered by the loss of his first quarry, had become as dogged in pursuit as a weasel, not to be shaken off or evaded or deceived. -7176-88083-0016 3.92 Straightway the hawk glided from his perch and darted after him. 7176-88083-0023 9.645 He had a lot of line out, and the place was none too free for a long cast; but he was impatient to drop his flies again on the spot where the big fish was feeding. -7176-92135-0024 4.1 To be or not to be, that is the question; whether 'tis nobler 7176-88083-0024 8.195 The last drop fly, as luck would have it, caught just in the corner of the hawk's angrily open beak, hooking itself firmly. -7176-88083-0006 4.295 It might have seemed that a trout of this size was a fairly substantial meal. 7176-88083-0025 7.38 At the sudden sharp sting of it, the great bird turned his head and noticed, for the first time, the fisherman standing on the bank. -7176-88083-0009 4.045 The great hawk followed hurriedly, to retrieve his prey from the ground. 7176-88083-0026 5.53 The drag upon his beak and the light check upon his wings were inexplicable to him, and appalling. -7127-75947-0008 4.155 The arrow pierced his heart and wounded him mortally. 7127-75946-0004 4.49 Certainly, sire; but I must have money to do that". "What! -7127-75947-0035 4.415 Good gracious! has the king any right to interfere in matters of that kind? 7127-75946-0006 7.98 He has given them with too much grace not to have others still to give, if they are required, which is the case at the present moment. -7127-75947-0017 2.665 What, already here"! they said to her. 7127-75946-0007 4.755 It is necessary, therefore, that he should comply". The king frowned. -7127-75947-0030 2.76 She was here just now," said the count. 7127-75946-0008 4.46 Does your majesty then no longer believe the disloyal attempt"? -7127-75946-0005 2.67 What do you mean"? inquired Louis, 7127-75946-0009 4.72 Not at all; you are, on the contrary, most agreeable to me". -7127-75947-0011 3.62 Remain, I implore you: the evening is most lovely. 7127-75946-0012 9.87 The news circulated with the rapidity of lightning; during its progress it kindled every variety of coquetry, desire, and wild ambition. -7127-75947-0002 3.235 Do you think so"? she replied with indifference. 7127-75946-0013 8.58 The king had completed his toilette by nine o'clock; he appeared in an open carriage decorated with branches of trees and flowers. -7127-75947-0018 4.04 I have been here this quarter of an hour," replied La Valliere. 7127-75946-0015 7.515 Suddenly, for the purpose of restoring peace and order, Spring, accompanied by his whole court, made his appearance. -7127-75947-0018 4.04 I have been here this quarter of an hour," replied La Valliere. 7127-75946-0018 9.14 There was something in his carriage which resembled the buoyant movements of an immortal, and he did not dance so much as seem to soar along. -7127-75947-0018 4.04 I have been here this quarter of an hour," replied La Valliere. 7127-75946-0020 6.52 Far from it, sire; your majesty having given no directions about it, the musicians have retained it". -7127-75947-0002 3.235 Do you think so"? she replied with indifference. 7127-75946-0024 5.09 Monsieur was the only one who did not understand anything about the matter. -7127-75947-0018 4.04 I have been here this quarter of an hour," replied La Valliere. 7127-75946-0027 9.675 Disdainful of a success of which Madame showed no acknowledgement, he thought of nothing but boldly regaining the marked preference of the princess. -7127-75946-0023 3.745 The king seemed only pleased with every one present. 7127-75946-0029 9.285 The king, who had from this moment become in reality the principal dancer in the quadrille, cast a look upon his vanquished rival. -5105-28240-0018 2.885 You will take me on board, count, will you not"? 5105-28241-0000 6.455 Her sea going qualities were excellent, and would have amply sufficed for a circumnavigation of the globe. -5105-28240-0016 4.17 To all these inquiries, the count responded in the affirmative. 5105-28241-0005 8.415 For a few miles she followed the line hitherto presumably occupied by the coast of Algeria; but no land appeared to the south. -5105-28233-0001 4.49 He seemed born to please without being conscious of the power he possessed. 5105-28241-0006 7.55 The log and the compass, therefore, were able to be called upon to do the work of the sextant, which had become utterly useless. -5105-28240-0002 4.01 exclaimed Servadac, keeping his eye unmoved at his telescope. 5105-28241-0008 8.54 The earth has undoubtedly entered upon a new orbit, but she is not incurring any probable risk of being precipitated onto the sun". -5105-28240-0013 2.96 Nothing more than you know yourself". 5105-28241-0009 7.01 And what demonstration do you offer," asked Servadac eagerly, "that it will not happen"? -5105-28240-0010 2.935 Captain Servadac hastened towards him. 5105-28241-0012 6.775 Is it not impossible," he murmured aloud, "that any city should disappear so completely? -5105-28241-0014 2.995 Another circumstance was most remarkable. 5105-28241-0013 4.82 Would not the loftiest eminences of the city at least be visible? -5105-28240-0018 2.885 You will take me on board, count, will you not"? 5105-28241-0016 6.285 You must see, lieutenant, I should think, that we are not so near the coast of Algeria as you imagined". -5105-28240-0018 2.885 You will take me on board, count, will you not"? 5105-28241-0019 5.29 Nothing was to be done but to put about, and return in disappointment towards the north. -7021-85628-0004 2.805 Yes, why not"? thought Anders. 7021-79759-0000 4.775 Nature of the Effect produced by Early Impressions. -7021-79740-0009 3.635 They were now playing with their dolls in the parlor. 7021-79759-0002 5.25 They are chiefly formed from combinations of the impressions made in childhood. -7021-79759-0001 2.48 That is comparatively nothing. 7021-79759-0003 4.62 Vast Importance and Influence of this mental Furnishing, -1320-122617-0041 4.15 Uncas cast his skin, and stepped forth in his own beautiful proportions. 1320-122612-0001 9.52 The dews were suffered to exhale, and the sun had dispersed the mists, and was shedding a strong and clear light in the forest, when the travelers resumed their journey. -1320-122612-0014 3.515 The examination, however, resulted in no discovery. 1320-122612-0002 7.46 After proceeding a few miles, the progress of Hawkeye, who led the advance, became more deliberate and watchful. -1320-122617-0005 4.4 The bear shook his shaggy sides, and then a well known voice replied: 1320-122612-0003 9.865 He often stopped to examine the trees; nor did he cross a rivulet without attentively considering the quantity, the velocity, and the color of its waters. -1320-122617-0005 4.4 The bear shook his shaggy sides, and then a well known voice replied: 1320-122612-0004 6.425 Distrusting his own judgment, his appeals to the opinion of Chingachgook were frequent and earnest. -1320-122612-0009 3.88 It would have been more wonderful had he spoken without a bidding. 1320-122612-0005 5.915 Yet here are we, within a short range of the Scaroons, and not a sign of a trail have we crossed! -1320-122617-0030 3.98 So choose for yourself to make a rush or tarry here". 1320-122612-0006 4.845 Let us retrace our steps, and examine as we go, with keener eyes. -1320-122612-0014 3.515 The examination, however, resulted in no discovery. 1320-122612-0007 5.54 Chingachgook had caught the look, and motioning with his hand, he bade him speak. -1320-122612-0009 3.88 It would have been more wonderful had he spoken without a bidding. 1320-122612-0008 7.875 The eyes of the whole party followed the unexpected movement, and read their success in the air of triumph that the youth assumed. -1320-122612-0009 3.88 It would have been more wonderful had he spoken without a bidding. 1320-122612-0013 6.55 A circle of a few hundred feet in circumference was drawn, and each of the party took a segment for his portion. -1320-122617-0041 4.15 Uncas cast his skin, and stepped forth in his own beautiful proportions. 1320-122612-0015 6.385 The whole party crowded to the spot where Uncas pointed out the impression of a moccasin in the moist alluvion. -5142-33396-0028 3.755 On a bench in a far corner were a dozen people huddled together. 5142-33396-0001 5.02 What is your country, Olaf? Have you always been a thrall"? The thrall's eyes flashed. -5142-33396-0010 3.455 In the stern I curved the tail up almost as high as the head. 5142-33396-0006 6.23 I made her for only twenty oars because I thought few men would follow me; for I was young, fifteen years old. -5142-33396-0003 3.47 The rest of you, off a viking'! "He had three ships. 5142-33396-0007 4.975 At the prow I carved the head with open mouth and forked tongue thrust out. -5142-33396-0050 2.885 May you drink heart's ease from it for many years. 5142-33396-0012 4.59 Then I will get me a farm and will winter in that land. Now who will follow me? -5142-33396-0021 3.505 Up and down the water we went to get much wealth and much frolic. 5142-33396-0015 4.31 As our boat flashed down the rollers into the water I made this song and sang it: -5142-33396-0014 3.245 Thirty men, one after another, raised their horns and said: 5142-33396-0019 4.985 Oh! it is better to live on the sea and let other men raise your crops and cook your meals. -5142-33396-0036 4.26 So I will give out this law: that my men shall never leave you alone. 5142-33396-0022 4.77 What of the farm, Olaf'? "'Not yet,' I answered. 'Viking is better for summer. -5142-33396-0047 2.535 My men pounded the table with their fists. 5142-33396-0024 5.345 I stood with my back to the wall; for I wanted no sword reaching out of the dark for me. -5142-33396-0037 3.575 Hakon there shall be your constant companion, friend farmer. 5142-33396-0031 7.845 They set up a crane over the fire and hung the pot upon it, and we sat and watched it boil while we joked. At last the supper began. -5142-33396-0010 3.455 In the stern I curved the tail up almost as high as the head. 5142-33396-0032 9.785 The farmer sat gloomily on the bench and would not eat, and you cannot wonder; for he saw us putting potfuls of his good beef and basket loads of bread into our big mouths. -5142-33396-0050 2.885 May you drink heart's ease from it for many years. 5142-33396-0033 5.28 You would not eat with us. You cannot say no to half of my ale. I drink this to your health. -5142-33396-0009 3.37 There, stand so'! I said, 'and glare and hiss at my foes. 5142-33396-0034 6.615 Then I drank half of the hornful and sent the rest across the fire to the farmer. He took it and smiled, saying: -5142-36586-0000 3.65 It is manifest that man is now subject to much variability. 5142-33396-0036 4.26 So I will give out this law: that my men shall never leave you alone. -5142-33396-0060 2.615 Take him out, Thorkel, and let him taste your sword. 5142-33396-0038 4.18 He shall not leave you day or night, whether you are working or playing or sleeping. -5142-33396-0030 2.765 The thralls were bringing in a great pot of meat. 5142-33396-0042 6.095 So no tales got out to the neighbors. Besides, it was a lonely place, and by good luck no one came that way. -5142-33396-0030 2.765 The thralls were bringing in a great pot of meat. 5142-33396-0044 4.855 I am stiff with long sitting,' he said. 'I itch for a fight'. "I turned to the farmer. -5142-33396-0014 3.245 Thirty men, one after another, raised their horns and said: 5142-33396-0051 5.57 And with it I leave you a name, Sif the Friendly. I shall hope to drink with you sometime in Valhalla. -5142-33396-0060 2.615 Take him out, Thorkel, and let him taste your sword. 5142-33396-0052 5.88 Here is a ring for Sif the Friendly'. "'And here is a bracelet'. "'A sword would not be ashamed to hang at your side. -5142-33396-0049 3.305 Here, friend, take it,' and he thrust it into the farmer's hand. 5142-33396-0054 5.745 That is the best way to decide, for the spear will always point somewhere, and one thing is as good as another. -5142-33396-0050 2.885 May you drink heart's ease from it for many years. 5142-33396-0059 5.47 Yes. And with all your fingers it took you a year to catch me'. "The king frowned more angrily. -5142-33396-0025 3.32 Come, come'! I called, when no one obeyed. 'A fire! 5142-33396-0065 5.195 Soft heart'! he said gently to her; then to Thorkel, 'Well, let him go, Thorkel! -5142-33396-0049 3.305 Here, friend, take it,' and he thrust it into the farmer's hand. 5142-33396-0067 5.565 But, young sharp tongue, now that we have caught you we will put you into a trap that you cannot get out of. -5683-32866-0000 2.645 Miss Lake declined the carriage to night. 5683-32879-0000 8.92 It was not very much past eleven that morning when the pony carriage from Brandon drew up before the little garden wicket of Redman's Farm. -5683-32879-0022 4.175 I like you still, Rachel; I'm sure I'll always like you. 5683-32879-0003 9.345 Women can hide their pain better than we men, and bear it better, too, except when shame drops fire into the dreadful chalice. -5683-32866-0001 3.47 And he added something still less complimentary. 5683-32879-0005 6.11 This transient spring and lighting up are beautiful - a glamour beguiling our senses. -5683-32865-0001 2.58 said Lord Chelford, addressing me. 5683-32879-0007 6.795 Rachel's pale and sharpened features and dilated eye struck her with a painful surprise. -5683-32879-0008 2.95 You have been so ill, my poor Rachel. 5683-32879-0009 5.135 Ill and troubled, dear - troubled in mind, and miserably nervous. -5683-32866-0006 4.215 Yes, so they said; but that would, I think, have been worse. 5683-32879-0010 7.75 Poor Rachel! her nature recoiled from deceit, and she told, at all events, as much of the truth as she dared. -5683-32865-0014 2.615 He's not a man for country quarters! 5683-32879-0011 9.21 She spoke with a sudden energy, which partook of fear and passion, and flushed her thin cheek, and made her languid eyes flash. -5683-32865-0015 4.145 I had a horrid dream about him last night.' That? 5683-32879-0012 4.38 Thank you, Rachel, my Cousin Rachel, my only friend. -5683-32879-0001 3.66 Well, she was better, though she had had a bad night. 5683-32879-0014 8.405 Yes, something - everything,' said Rachel, hurriedly, looking frowningly at a flower which she was twirling in her fingers. -5683-32866-0023 2.745 All the furniture belonged to other times. 5683-32879-0018 7.44 It is an antipathy - an antipathy I cannot get over, dear Dorcas; you may think it a madness, but don't blame me. -5683-32866-0007 4.12 If a fellow's been a little bit wild, he's Beelzebub at once. 5683-32879-0019 6.35 I have very few to love me now, and I thought you might love me, as I have begun to love you. -5683-32865-0014 2.615 He's not a man for country quarters! 5683-32879-0020 6.545 And she threw her arms round her cousin's neck, and brave Rachel at last burst into tears. -5683-32865-0006 3.35 At dinner Lake was easy and amusing. 5683-32879-0021 4.09 Dorcas, in her strange way, was moved. -5683-32865-0003 3.51 They are cousins, you know; we are all cousins. 5683-32879-0022 4.175 I like you still, Rachel; I'm sure I'll always like you. -5683-32866-0001 3.47 And he added something still less complimentary. 5683-32879-0023 4.975 You resemble me, Rachel: you are fearless and inflexible and generous. -1580-141084-0003 4.1 No names, please"! said Holmes, as we knocked at Gilchrist's door. 1580-141084-0000 4.615 It was the Indian, whose dark silhouette appeared suddenly upon his blind. -1580-141084-0034 4.49 Well, well, don't trouble to answer. Listen, and see that I do you no injustice. 1580-141084-0002 5.905 This set of rooms is quite the oldest in the college, and it is not unusual for visitors to go over them. -1580-141083-0041 3.575 Let us hear the suspicions. I will look after the proofs". 1580-141084-0003 4.1 No names, please"! said Holmes, as we knocked at Gilchrist's door. -1580-141083-0050 3.085 I really don't think he knew much about it, mister Holmes. 1580-141084-0004 9.005 Of course, he did not realize that it was I who was knocking, but none the less his conduct was very uncourteous, and, indeed, under the circumstances rather suspicious". -1580-141083-0046 3.53 But I have occasionally done the same thing at other times". 1580-141084-0008 6.795 I cannot allow the examination to be held if one of the papers has been tampered with. The situation must be faced". -1580-141083-0021 3.715 There is no opening except the one pane," said our learned guide. 1580-141084-0009 4.685 It is possible that I may be in a position then to indicate some course of action. -1580-141084-0037 2.965 When I approached your room, I examined the window. 1580-141084-0011 5 When we were out in the darkness of the quadrangle, we again looked up at the windows. -1580-141084-0045 3.625 Suddenly he heard him at the very door. There was no possible escape. 1580-141084-0016 5.96 My friend did not appear to be depressed by his failure, but shrugged his shoulders in half humorous resignation. -1580-141083-0016 4.255 I was in such a hurry to come to you". "You left your door open"? 1580-141084-0021 4.01 On the palm were three little pyramids of black, doughy clay. -1580-141083-0030 3.48 mister Soames was somewhat overwhelmed by this flood of information. 1580-141084-0023 8.735 In a few hours the examination would commence, and he was still in the dilemma between making the facts public and allowing the culprit to compete for the valuable scholarship. -1580-141083-0046 3.53 But I have occasionally done the same thing at other times". 1580-141084-0024 9.185 He could hardly stand still so great was his mental agitation, and he ran towards Holmes with two eager hands outstretched. "Thank heaven that you have come! -1580-141083-0025 3.905 The man entered and took the papers, sheet by sheet, from the central table. 1580-141084-0026 6.995 If this matter is not to become public, we must give ourselves certain powers and resolve ourselves into a small private court martial. -1580-141083-0046 3.53 But I have occasionally done the same thing at other times". 1580-141084-0029 8.075 His troubled blue eyes glanced at each of us, and finally rested with an expression of blank dismay upon Bannister in the farther corner. -1580-141083-0050 3.085 I really don't think he knew much about it, mister Holmes. 1580-141084-0031 6.47 We want to know, mister Gilchrist, how you, an honourable man, ever came to commit such an action as that of yesterday"? -1580-141083-0028 2.585 Then he tossed it down and seized the next. 1580-141084-0032 4.995 For a moment Gilchrist, with upraised hand, tried to control his writhing features. -1580-141083-0040 3.75 One hardly likes to throw suspicion where there are no proofs". 1580-141084-0033 7 Come, come," said Holmes, kindly, "it is human to err, and at least no one can accuse you of being a callous criminal. -1580-141083-0036 3.98 Holmes held it out on his open palm in the glare of the electric light. 1580-141084-0034 4.49 Well, well, don't trouble to answer. Listen, and see that I do you no injustice. -1580-141084-0035 2.63 He could examine the papers in his own office. 1580-141084-0039 4.885 I entered, and I took you into my confidence as to the suggestions of the side table. -1580-141084-0035 2.63 He could examine the papers in his own office. 1580-141084-0040 5.985 He returned carrying his jumping shoes, which are provided, as you are aware, with several sharp spikes. -1580-141084-0045 3.625 Suddenly he heard him at the very door. There was no possible escape. 1580-141084-0041 7.99 No harm would have been done had it not been that, as he passed your door, he perceived the key which had been left by the carelessness of your servant. -1580-141083-0024 4.48 You left him in a chair, you say. Which chair"? "By the window there". 1580-141084-0042 5.06 A sudden impulse came over him to enter, and see if they were indeed the proofs. -1580-141083-0030 3.48 mister Soames was somewhat overwhelmed by this flood of information. 1580-141084-0047 5.25 I have a letter here, mister Soames, which I wrote to you early this morning in the middle of a restless night. -1580-141084-0045 3.625 Suddenly he heard him at the very door. There was no possible escape. 1580-141084-0048 9.265 It will be clear to you, from what I have said, that only you could have let this young man out, since you were left in the room, and must have locked the door when you went out. -1580-141083-0024 4.48 You left him in a chair, you say. Which chair"? "By the window there". 1580-141084-0049 7.575 It was simple enough, sir, if you only had known, but, with all your cleverness, it was impossible that you could know. -6930-76324-0010 2.69 What in the world is that"? queried Joyce. 6930-75918-0002 5.025 Congratulations were poured in upon the princess everywhere during her journey. -6930-76324-0013 4.305 It can't hurt anything, I'm sure, for we won't disturb things at all. 6930-75918-0006 5.85 This has indeed been a harassing day," continued the young man, his eyes fixed upon his friend. -6930-75918-0000 3.505 Concord returned to its place amidst the tents. 6930-75918-0008 4.785 Can you imagine why Buckingham has been so violent"? "I suspect". -6930-76324-0019 2.575 Now let's dust the furniture and pictures". 6930-75918-0009 7.28 It is you who are mistaken, Raoul; I have read his distress in his eyes, in his every gesture and action the whole day". -6930-75918-0000 3.505 Concord returned to its place amidst the tents. 6930-75918-0015 6.38 Thus it is that the honor of three is saved: our country's, our master's, and our own. -6930-76324-0013 4.305 It can't hurt anything, I'm sure, for we won't disturb things at all. 6930-75918-0017 6.16 But in this friendly pressure Raoul could detect the nervous agitation of a great internal conflict. -4077-13751-0019 2.92 Who began the quarrel? Was it the "Mormons"? 4077-13754-0000 4.78 The army found the people in poverty, and left them in comparative wealth. -4077-13751-0013 4.315 Their sufferings have never yet been fitly chronicled by human scribe. 4077-13754-0003 5.68 Moreover, had the people been inclined to rebellion what greater opportunity could they have wished? -4077-13754-0001 3.77 But a word further concerning the expedition in general. 4077-13754-0004 4.985 Already a North and a South were talked of - why not set up also a West? -4077-13751-0013 4.315 Their sufferings have never yet been fitly chronicled by human scribe. 4077-13754-0009 7.65 At the inception of plural marriage among the Latter day Saints, there was no law, national or state, against its practise. -1995-1837-0015 4.485 The squares of cotton, sharp edged, heavy, were just about to burst to bolls! 1995-1826-0000 9.485 In the debate between the senior societies her defence of the Fifteenth Amendment had been not only a notable bit of reasoning, but delivered with real enthusiasm. -1995-1837-0015 4.485 The squares of cotton, sharp edged, heavy, were just about to burst to bolls! 1995-1826-0002 4.605 John Taylor, who had supported her through college, was interested in cotton. -1995-1837-0000 3.865 He knew the Silver Fleece - his and Zora's - must be ruined. 1995-1826-0005 5.125 But, John, there's no society - just elementary work -1995-1837-0013 3.195 Then he looked down. The lagoon was dry. 1995-1826-0009 7.57 You ought to know, John, if I teach Negroes I'll scarcely see much of people in my own class". -1995-1837-0020 3.21 The years of the days of her dying were ten. 1995-1826-0011 8.94 Here she was teaching dirty children, and the smell of confused odors and bodily perspiration was to her at times unbearable. -1995-1836-0007 3.435 But you believe in some education"? asked Mary Taylor. 1995-1826-0012 6.18 She wanted a glance of the new books and periodicals and talk of great philanthropies and reforms. -1995-1837-0009 3.76 The lagoon had been level with the dykes a week ago; and now? 1995-1826-0013 8.77 So for the hundredth time she was thinking today, as she walked alone up the lane back of the barn, and then slowly down through the bottoms. -1995-1826-0015 3.55 She had almost forgotten that it was here within touch and sight. 1995-1826-0016 5.9 The glimmering sea of delicate leaves whispered and murmured before her, stretching away to the Northward. -1995-1837-0022 3.415 Up in the sick room Zora lay on the little white bed. 1995-1826-0017 6.145 There might be a bit of poetry here and there, but most of this place was such desperate prose. -1995-1837-0015 4.485 The squares of cotton, sharp edged, heavy, were just about to burst to bolls! 1995-1826-0018 5.01 Her regard shifted to the green stalks and leaves again, and she started to move away. -1995-1826-0004 3.035 Might learn something useful down there". 1995-1826-0019 5.25 Cotton is a wonderful thing, is it not, boys"? she said rather primly. -1995-1837-0011 3.375 He started at the thought. He hurried forth sadly. 1995-1826-0020 6.12 Miss Taylor did not know much about cotton, but at least one more remark seemed called for. -1995-1826-0003 3.09 Better go," he had counselled, sententiously. 1995-1826-0022 4.745 I suppose, though, it's too early for them". Then came the explosion. -1995-1837-0002 2.79 Ah! the swamp, the cruel swamp! 1995-1826-0024 5.095 The Golden Fleece - it's the Silver Fleece"! He harkened. -5683-32866-0001 3.47 And he added something still less complimentary. 5683-32865-0004 7.365 Whatever Lord Chelford said, Miss Brandon received it very graciously, and even with a momentary smile. -5683-32865-0002 2.78 He had his hand upon Lake's shoulder. 5683-32865-0007 6.065 I'm glad you like it,' says Wylder, chuckling benignantly on it, over his shoulder. -5683-32866-0001 3.47 And he added something still less complimentary. 5683-32865-0008 6.12 I believe I have a little taste that way; those are all real, you know, those jewels. -5683-32866-0000 2.645 Miss Lake declined the carriage to night. 5683-32865-0009 9.89 And he placed it in that gentleman's fingers, who now took his turn at the lamp, and contemplated the little parallelogram with a gleam of sly amusement. -5683-32866-0006 4.215 Yes, so they said; but that would, I think, have been worse. 5683-32865-0010 6.335 I was thinking it's very like the ace of hearts,' answered the captain softly, smiling on. -5683-32865-0003 3.51 They are cousins, you know; we are all cousins. 5683-32865-0011 6.355 Whereupon Lake laughed quietly, still looking on the ace of hearts with his sly eyes. -5683-32865-0015 4.145 I had a horrid dream about him last night.' That? 5683-32865-0013 7.095 Do you know?' 'Lake? Oh! I really can't tell; but he'll soon tire of country life. -5683-32879-0012 4.38 Thank you, Rachel, my Cousin Rachel, my only friend. 5683-32865-0015 4.145 I had a horrid dream about him last night.' That? -5683-32866-0006 4.215 Yes, so they said; but that would, I think, have been worse. 5683-32865-0017 5.455 All the time he was talking to me his angry little eyes were following Lake. -1320-122617-0005 4.4 The bear shook his shaggy sides, and then a well known voice replied: 1320-122617-0000 7.835 Notwithstanding the high resolution of Hawkeye he fully comprehended all the difficulties and danger he was about to incur. -1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0003 6.285 There was something in his air and manner that betrayed to the scout the utter confusion of the state of his mind. -1320-122617-0008 4.185 The young man is in bondage, and much I fear his death is decreed. 1320-122617-0005 4.4 The bear shook his shaggy sides, and then a well known voice replied: -1320-122612-0016 3.49 Run back, Uncas, and bring me the size of the singer's foot. 1320-122617-0006 5.655 Can these things be"? returned David, breathing more freely, as the truth began to dawn upon him. -1320-122617-0005 4.4 The bear shook his shaggy sides, and then a well known voice replied: 1320-122617-0008 4.185 The young man is in bondage, and much I fear his death is decreed. -1320-122612-0009 3.88 It would have been more wonderful had he spoken without a bidding. 1320-122617-0009 7.705 I greatly mourn that one so well disposed should die in his ignorance, and I have sought a goodly hymn-" "Can you lead me to him"? -1320-122617-0005 4.4 The bear shook his shaggy sides, and then a well known voice replied: 1320-122617-0010 10 The task will not be difficult," returned David, hesitating; "though I greatly fear your presence would rather increase than mitigate his unhappy fortunes". -1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0011 9.76 The lodge in which Uncas was confined was in the very center of the village, and in a situation, perhaps, more difficult than any other to approach, or leave, without observation. -1320-122617-0041 4.15 Uncas cast his skin, and stepped forth in his own beautiful proportions. 1320-122617-0012 7.59 Four or five of the latter only lingered about the door of the prison of Uncas, wary but close observers of the manner of their captive. -1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0014 4.9 They drew back a little from the entrance and motioned to the supposed conjurer to enter. -1320-122617-0005 4.4 The bear shook his shaggy sides, and then a well known voice replied: 1320-122617-0015 5.125 But the bear, instead of obeying, maintained the seat it had taken, and growled: -1320-122612-0016 3.49 Run back, Uncas, and bring me the size of the singer's foot. 1320-122617-0017 5.655 Then, as if satisfied of their safety, the scout left his position, and slowly entered the place. -1320-122617-0008 4.185 The young man is in bondage, and much I fear his death is decreed. 1320-122617-0018 9.695 It was silent and gloomy, being tenanted solely by the captive, and lighted by the dying embers of a fire, which had been used for the purposed of cookery. -1320-122617-0005 4.4 The bear shook his shaggy sides, and then a well known voice replied: 1320-122617-0019 8.23 Uncas occupied a distant corner, in a reclining attitude, being rigidly bound, both hands and feet, by strong and painful withes. -1320-122617-0041 4.15 Uncas cast his skin, and stepped forth in his own beautiful proportions. 1320-122617-0020 8.895 The scout, who had left David at the door, to ascertain they were not observed, thought it prudent to preserve his disguise until assured of their privacy. -1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0021 5.335 What shall we do with the Mingoes at the door? They count six, and this singer is as good as nothing". -1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0023 7.815 Uncas, who had already approached the door, in readiness to lead the way, now recoiled, and placed himself, once more, in the bottom of the lodge. -1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0024 7.555 But Hawkeye, who was too much occupied with his own thoughts to note the movement, continued speaking more to himself than to his companion. -1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0025 6.36 So, Uncas, you had better take the lead, while I will put on the skin again, and trust to cunning for want of speed". -1320-122617-0005 4.4 The bear shook his shaggy sides, and then a well known voice replied: 1320-122617-0026 5.225 Well, what can't be done by main courage, in war, must be done by circumvention. -1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0027 5.689938 As soon as these dispositions were made, the scout turned to David, and gave him his parting instructions. -1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0029 7.875 If you are not then knocked on the head, your being a non composser will protect you; and you'll then have a good reason to expect to die in your bed. -1320-122617-0008 4.185 The young man is in bondage, and much I fear his death is decreed. 1320-122617-0031 6.285 Bravely and generously has he battled in my behalf, and this, and more, will I dare in his service". -1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0034 9.485 Hold"! said David, perceiving that with this assurance they were about to leave him; "I am an unworthy and humble follower of one who taught not the damnable principle of revenge. -1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0037 7.18 The Delaware dog"! he said, leaning forward, and peering through the dim light to catch the expression of the other's features; "is he afraid? -1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0039 7.055 The Mohican started on his feet, and shook his shaggy covering, as though the animal he counterfeited was about to make some desperate effort. -1320-122617-0041 4.15 Uncas cast his skin, and stepped forth in his own beautiful proportions. 1320-122617-0040 7.975 He had no occasion to delay, for at the next instant a burst of cries filled the outer air, and ran along the whole extent of the village. -1320-122612-0016 3.49 Run back, Uncas, and bring me the size of the singer's foot. 1320-122617-0041 4.15 Uncas cast his skin, and stepped forth in his own beautiful proportions. -121-127105-0036 4.15 But was that all her reward"? one of the ladies asked. 121-121726-0000 8.46 Also, a popular contrivance whereby love making may be suspended but not stopped during the picnic season. -121-121726-0004 4.02 Heaven, a good place to be raised to. 121-121726-0001 5.925 Harangue The tiresome product of a tireless tongue. -121-121726-0013 2.49 Tied to a woman. 121-121726-0002 4.41 angor, pain. Painful to hear. -121-127105-0008 2.76 He hung fire again. "A woman's. 121-121726-0003 6.755 Hay fever, a heart trouble caused by falling in love with a grass widow. -121-121726-0006 3.895 Heredity, the cause of all our faults. 121-121726-0004 4.02 Heaven, a good place to be raised to. -121-127105-0008 2.76 He hung fire again. "A woman's. 121-121726-0007 6.73 Horse sense, a degree of wisdom that keeps one from betting on the races. -121-121726-0014 3.165 Hypocrite, a horse dealer. 121-121726-0008 4.99 Hose Man's excuse for wetting the walk. -121-121726-0006 3.895 Heredity, the cause of all our faults. 121-121726-0009 7.26 Hotel, a place where a guest often gives up good dollars for poor quarters. -121-127105-0008 2.76 He hung fire again. "A woman's. 121-121726-0010 9.81 Housecleaning, a domestic upheaval that makes it easy for the government to enlist all the soldiers it needs. -121-121726-0014 3.165 Hypocrite, a horse dealer. 121-121726-0011 4.035 Husband, the next thing to a wife. -121-121726-0002 4.41 angor, pain. Painful to hear. 121-121726-0012 4.045 hussy, woman, and bond, tie. -61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. 61-70970-0000 6.075 Young Fitzooth had been commanded to his mother's chamber so soon as he had come out from his converse with the Squire. -61-70970-0012 3.135 Yet he will teach you a few tricks when morning is come. 61-70970-0001 6.155 There befell an anxious interview, Mistress Fitzooth arguing for and against the Squire's project in a breath. -61-70968-0045 3.475 Pray follow us, with mine and my lord Sheriff's men". 61-70970-0002 4.165 Most of all Robin thought of his father. What would he counsel? -61-70968-0056 3.565 The wine did certainly bring back the color to the Squire's cheeks. 61-70970-0007 4.485 He was in deep converse with the clerk, and entered the hall holding him by the arm. -61-70968-0039 3.805 And mine is Will Stuteley. Shall we be comrades"? 61-70970-0011 6.075 As any in England, I would say," said Gamewell, proudly. "That is, in his day. -61-70968-0016 3.72 And then they became vexed, and would have snatched your purse from us. 61-70970-0013 4.35 There was no chance to alter his sleeping room to one nearer to Gamewell's chamber. -61-70968-0046 3.55 Nottingham Castle was reached, and admittance was demanded. 61-70970-0015 8.415 Will," cried he, softly; and Stuteley, who had chosen his couch across the door of his young master's chamber, sprang up at once in answer. -61-70968-0029 3.495 The Squire helped to thrust them all in and entered swiftly himself. 61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. -61-70968-0046 3.55 Nottingham Castle was reached, and admittance was demanded. 61-70970-0018 4.6 The hours passed wearily by, and movement could yet be heard about the hall. -61-70970-0009 3.405 Tis late; and I go myself within a short space. 61-70970-0020 5.025 Will," whispered Robin, opening his door as he spoke, "are you ready"? -61-70970-0013 4.35 There was no chance to alter his sleeping room to one nearer to Gamewell's chamber. 61-70970-0021 5.405 They then renewed their journey, and, under the better light, made a safe crossing of the stable roofs. -61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. 61-70970-0024 7.235 They moved thereafter cautiously about the hut, groping before and about them to find something to show that Warrenton had fulfilled his mission. -61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. 61-70970-0025 7.435 They were upon the verge of an open trap, in the far corner of the hut; and Stuteley had tripped over the edge of the reversed flap mouth of this pit. -61-70970-0033 3.42 Truly such a horse should be worth much in Nottingham Fair! 61-70970-0026 5.475 Fitzooth's hand rested at last upon the top rung of a ladder, and slowly the truth came to him. -61-70970-0032 3.135 enquired Robin, with his suspicions still upon him. 61-70970-0027 5.08 Robin carefully descended the ladder and found himself soon upon firm rocky ground. -61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. 61-70970-0028 6.55 Stuteley was by his side in a flash: and then they both began feeling about them to ascertain the shape and character of this vault. -61-70968-0055 3.965 Robin was glad when, at length, they were left to their own devices. 61-70970-0029 4.03 From the blackness behind the light they heard a voice - Warrenton's! -61-70970-0007 4.485 He was in deep converse with the clerk, and entered the hall holding him by the arm. 61-70970-0031 5.135 cried he, waving the lanthorn before him to make sure that these were no ghosts in front of him. -61-70968-0039 3.805 And mine is Will Stuteley. Shall we be comrades"? 61-70970-0034 4.485 Nay, nay, lording," answered Warrenton, with a half laugh. -61-70968-0006 2.935 But then the picture was gone as quickly as it came". 61-70970-0035 7.405 Warrenton spoke thus with significance, to show Robin that he was not to think Geoffrey's claims to the estate would be passed by. -61-70970-0033 3.42 Truly such a horse should be worth much in Nottingham Fair! 61-70970-0036 6.785 Robin Fitzooth saw that his doubts of Warrenton had been unfair: and he became ashamed of himself for harboring them. -61-70968-0052 2.65 But who is this fellow plucking at your sleeve? 61-70970-0037 5.98 His tones rang pleasantly on Warrenton's ears, and forthwith a good fellowship was heralded between them. -61-70968-0046 3.55 Nottingham Castle was reached, and admittance was demanded. 61-70970-0039 6.665 He implores us to be discreet as the grave in this matter, for in sooth his life is in the hollow of our hands". -61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. 61-70970-0040 4.165 They regained their apartment, apparently without disturbing the household of Gamewell. -5105-28240-0002 4.01 exclaimed Servadac, keeping his eye unmoved at his telescope. 5105-28240-0000 5.455 Fast as his legs could carry him, Servadac had made his way to the top of the cliff. -5105-28240-0016 4.17 To all these inquiries, the count responded in the affirmative. 5105-28240-0002 4.01 exclaimed Servadac, keeping his eye unmoved at his telescope. -5105-28240-0013 2.96 Nothing more than you know yourself". 5105-28240-0003 5.515 She is under sail; but she is Count Timascheff's yacht". He was right. -5105-28240-0014 3.07 Are you certain that this is the Mediterranean"? 5105-28240-0004 6.015 If the count were on board, a strange fatality was bringing him to the presence of his rival. -5105-28240-0014 3.07 Are you certain that this is the Mediterranean"? 5105-28240-0005 7.4 He reckoned, therefore, not only upon ascertaining the extent of the late catastrophe, but upon learning its cause. -5105-28240-0014 3.07 Are you certain that this is the Mediterranean"? 5105-28240-0007 4.625 Servadac took it for granted that the Dobryna was endeavoring to put in. -5105-28241-0014 2.995 Another circumstance was most remarkable. 5105-28240-0011 6.02 I left you on a continent, and here I have the honor of finding you on an island". -5105-28240-0014 3.07 Are you certain that this is the Mediterranean"? 5105-28240-0015 8.525 For some moments he seemed perfectly stupefied; then, recovering himself, he began to overwhelm the count with a torrent of questions. -5105-28240-0002 4.01 exclaimed Servadac, keeping his eye unmoved at his telescope. 5105-28240-0016 4.17 To all these inquiries, the count responded in the affirmative. -5105-28241-0014 2.995 Another circumstance was most remarkable. 5105-28240-0017 5.665 Some mysterious force seemed to have brought about a convulsion of the elements. -5105-28241-0003 3.98 Steam up and canvas spread, the schooner started eastwards. 5105-28240-0019 6.240062 My yacht is at your service, sir, even should you require to make a tour round the world". -5105-28233-0001 4.49 He seemed born to please without being conscious of the power he possessed. 5105-28240-0022 4.725 It was on the last day of January that the repairs of the schooner were completed. -5105-28241-0003 3.98 Steam up and canvas spread, the schooner started eastwards. 5105-28240-0024 8.2 Doubts now arose, and some discussion followed, whether or not it was desirable for Ben Zoof to accompany his master. -1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1181-0003 4.505 The hair was of brown yarn and hung down on her neck in several neat braids. -1284-1180-0027 3.27 Yet that task was not so easy as you may suppose. 1284-1181-0004 7.15 Gold is the most common metal in the Land of Oz and is used for many purposes because it is soft and pliable. -1284-1180-0027 3.27 Yet that task was not so easy as you may suppose. 1284-1181-0007 4.04 She poured into the dish a quantity from each of these bottles. -1284-1180-0027 3.27 Yet that task was not so easy as you may suppose. 1284-1181-0008 6.08 I think that will do," she continued, "for the other qualities are not needed in a servant". -1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1181-0009 5.245 She ran to her husband's side at once and helped him lift the four kettles from the fire. -1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1181-0010 6.435 Their contents had all boiled away, leaving in the bottom of each kettle a few grains of fine white powder. -1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1181-0011 7.75 Very carefully the Magician removed this powder, placing it all together in a golden dish, where he mixed it with a golden spoon. -1284-1180-0004 4.285 When they were outside, Unc simply latched the door and started up the path. 1284-1181-0012 8.51 No one saw him do this, for all were looking at the Powder of Life; but soon the woman remembered what she had been doing, and came back to the cupboard. -1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1181-0014 7.92 He selected a small gold bottle with a pepper box top, so that the powder might be sprinkled on any object through the small holes. -1284-1181-0007 4.04 She poured into the dish a quantity from each of these bottles. 1284-1181-0015 5.115 Most people talk too much, so it is a relief to find one who talks too little". -1284-1181-0007 4.04 She poured into the dish a quantity from each of these bottles. 1284-1181-0016 9.515 I am not allowed to perform magic, except for my own amusement," he told his visitors, as he lighted a pipe with a crooked stem and began to smoke. -1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1181-0020 6.73 Dear me; what a chatterbox you're getting to be, Unc," remarked the Magician, who was pleased with the compliment. -4446-2271-0012 3.78 I say, Sir Harry, the little girl's going famously to night, isn't she"? 4446-2275-0000 6.34 The stop at Queenstown, the tedious passage up the Mersey, were things that he noted dimly through his growing impatience. -4446-2273-0002 3.295 Lamb wouldn't care a great deal about many of them, I fancy". 4446-2275-0001 4.66 She blushed and smiled and fumbled his card in her confusion before she ran upstairs. -4446-2271-0005 3.395 She saves her hand, too. She's at her best in the second act. 4446-2275-0002 7.675 Alexander paced up and down the hallway, buttoning and unbuttoning his overcoat, until she returned and took him up to Hilda's living room. -4446-2271-0006 2.905 He's been wanting to marry Hilda these three years and more. 4446-2275-0005 4.445 I felt it in my bones when I woke this morning that something splendid was going to turn up. -4446-2273-0005 4.125 I haven't had a chance yet to tell you what a jolly little place I think this is. 4446-2275-0007 8.975 She pushed him toward the big chair by the fire, and sat down on a stool at the opposite side of the hearth, her knees drawn up to her chin, laughing like a happy little girl. -4446-2271-0003 3.7 It's been on only two weeks, and I've been half a dozen times already. 4446-2275-0008 4.13 When did you come, Bartley, and how did it happen? You haven't spoken a word". -4446-2275-0035 4.075 Alexander rose and shook himself angrily. "Yes, I know I'm cowardly. 4446-2275-0012 6.025 She looked at his heavy shoulders and big, determined head, thrust forward like a catapult in leash. -4446-2273-0036 3.12 Alexander unclenched the two hands at his sides. 4446-2275-0016 7.3 Hilda watched him from her corner, trembling and scarcely breathing, dark shadows growing about her eyes. "It... -4446-2275-0015 2.98 He pulled up a window as if the air were heavy. 4446-2275-0019 4.93 The world is all there, just as it used to be, but I can't get at it any more. -4446-2273-0033 3.3 For a long time neither Hilda nor Bartley spoke. 4446-2275-0021 5.05 Hilda's face quivered, but she whispered: "Yes, I think it must have been. -4446-2273-0030 2.885 Alexander went over and opened the window for her. 4446-2275-0026 5.495 She closed her eyes and took a deep breath, as if to draw in again the fragrance of those days. -4446-2275-0035 4.075 Alexander rose and shook himself angrily. "Yes, I know I'm cowardly. 4446-2275-0029 6.28 Please tell me one thing, Bartley. At least, tell me that you believe I thought I was making you happy". -4446-2275-0010 3.735 Alexander leaned forward and warmed his hands before the blaze. 4446-2275-0033 7.06 What I mean is that I want you to promise never to see me again, no matter how often I come, no matter how hard I beg". -4446-2271-0011 3.945 Sir Harry Towne, mister Bartley Alexander, the American engineer". 4446-2275-0035 4.075 Alexander rose and shook himself angrily. "Yes, I know I'm cowardly. -4446-2273-0017 2.74 How jolly it was being young, Hilda! 4446-2275-0038 4.53 I will ask the least imaginable, but I must have something! -4446-2271-0005 3.395 She saves her hand, too. She's at her best in the second act. 4446-2275-0040 6.965 The sight of you, Bartley, to see you living and happy and successful can I never make you understand what that means to me"? -4446-2271-0005 3.395 She saves her hand, too. She's at her best in the second act. 4446-2275-0041 4.755 You see, loving some one as I love you makes the whole world different. -4446-2275-0011 2.435 Bartley bent lower over the fire. 4446-2275-0042 5.4 And then you came back, not caring very much, but it made no difference". -4446-2273-0033 3.3 For a long time neither Hilda nor Bartley spoke. 4446-2275-0043 5.88 Bartley bent over and took her in his arms, kissing her mouth and her wet, tired eyes. -5142-33396-0015 4.31 As our boat flashed down the rollers into the water I made this song and sang it: 5142-36377-0001 5.39 In five minutes I was in a new world, and my melancholy room was full of the liveliest French company. -5142-33396-0062 2.9 Now she put her hand on his arm and smiled and said: 5142-36377-0002 5.62 The sound of an imperative and uncompromising bell recalled me in due time to the regions of reality. -5142-33396-0050 2.885 May you drink heart's ease from it for many years. 5142-36377-0004 5.485 She signed to me, with a ghostly solemnity, to take the vacant place on the left of her father. -5142-33396-0023 3.48 It was so dark that I could see nothing but a few sparks on the hearth. 5142-36377-0005 7.085 The door opened again while I was still studying the two brothers, without, I honestly confess, being very favorably impressed by either of them. -5142-33396-0049 3.305 Here, friend, take it,' and he thrust it into the farmer's hand. 5142-36377-0006 4.635 A new member of the family circle, who instantly attracted my attention, entered the room. -5142-33396-0053 3.93 I took five great bracelets of gold from our treasure chest and gave them to him. 5142-36377-0007 6.18 A little cracked" - that in the popular phrase was my impression of the stranger who now made his appearance in the supper room. -5142-36586-0000 3.65 It is manifest that man is now subject to much variability. 5142-36377-0010 4.294937 He is not well; he has come over the ocean for rest, and change of scene. -5142-33396-0023 3.48 It was so dark that I could see nothing but a few sparks on the hearth. 5142-36377-0013 6.585 They pointedly drew back from John Jago as he approached the empty chair next to me and moved round to the opposite side of the table. -5142-33396-0049 3.305 Here, friend, take it,' and he thrust it into the farmer's hand. 5142-36377-0015 4.34 Our first impressions of people are, in nine cases out of ten, the right impressions. -5142-33396-0049 3.305 Here, friend, take it,' and he thrust it into the farmer's hand. 5142-36377-0017 4.685 The only cheerful conversation was the conversation across the table between Naomi and me. -5142-33396-0002 3.67 Two hundred warriors feasted in his hall and followed him to battle. 5142-36377-0018 4.97 He looked up at Naomi doubtingly from his plate, and looked down again slowly with a frown. -5142-33396-0011 3.52 There she sat on the rollers, as fair a ship as I ever saw. 5142-36377-0020 4.53 A more dreary and more disunited family party I never sat at the table with. -5142-36586-0000 3.65 It is manifest that man is now subject to much variability. 5142-36377-0023 5.79 You were quite right to say 'No,'" Ambrose began. "Never smoke with John Jago. His cigars will poison you". -5142-33396-0040 2.81 And these shall follow your thralls in the same way. 5142-36377-0024 5.78 Naomi shook her forefinger reproachfully at them, as if the two sturdy young farmers had been two children. -8555-292519-0015 2.85 He had broken into her courtyard. 8555-292519-0005 9.575 While the old gold and the marble stays, Forever gleaming its soft strong blaze, Calm in the early evening glow. -8555-292519-0013 4.185 That was but rustling of dripping plants in the dark. 8555-292519-0007 8.405 It is my heart hung in the sky; And no clouds ever float between The grave flowers and my heart on high. -8555-292519-0015 2.85 He had broken into her courtyard. 8555-292519-0008 6.025 Over the track lined city street The young men, the grinning men, pass. -8555-284449-0009 3.27 You are, mate," replied the sailor. 8555-292519-0010 5.77 Old dances are simplified of their yearning, bleached by Time. -8555-292519-0015 2.85 He had broken into her courtyard. 8555-292519-0012 5.17 Through the black night rain, he sang to her window bars: -8555-292519-0015 2.85 He had broken into her courtyard. 8555-292519-0013 4.185 That was but rustling of dripping plants in the dark. -5683-32865-0001 2.58 said Lord Chelford, addressing me. 5683-32866-0002 5.125 But don't these very wise things sometimes turn out very foolishly? -5683-32865-0001 2.58 said Lord Chelford, addressing me. 5683-32866-0004 9.225 By this time Lord Chelford and Wylder returned; and, disgusted rather with myself, I ruminated on my want of general ship. -5683-32866-0014 3.97 Don't insult me, Stanley, by talking again as you did this morning. 5683-32866-0005 4.59 and he made a little dip of his cane towards Brandon Hall, over his shoulder. -5683-32866-0008 3.3 Bracton's a very good fellow, I can assure you. 5683-32866-0006 4.215 Yes, so they said; but that would, I think, have been worse. -5683-32879-0001 3.66 Well, she was better, though she had had a bad night. 5683-32866-0007 4.12 If a fellow's been a little bit wild, he's Beelzebub at once. -5683-32866-0015 2.83 What I say is altogether on your own account. 5683-32866-0011 7.37 Their walk continued silent for the greater part, neither was quite satisfied with the other. But Rachel at last said -5683-32866-0015 2.83 What I say is altogether on your own account. 5683-32866-0012 8.26 Now that's impossible, Radie; for I really don't think I once thought of him all this evening - except just while we were talking. -5683-32866-0014 3.97 Don't insult me, Stanley, by talking again as you did this morning. 5683-32866-0013 9.93 There was a bright moonlight, broken by the shadows of overhanging boughs and withered leaves; and the mottled lights and shadows glided oddly across his pale features. -5683-32866-0006 4.215 Yes, so they said; but that would, I think, have been worse. 5683-32866-0016 4.88 Mark my words, you'll find him too strong for you; aye, and too deep. -5683-32865-0001 2.58 said Lord Chelford, addressing me. 5683-32866-0017 4.585 I am very uneasy about it, whatever it is. I can't help it. -5683-32879-0001 3.66 Well, she was better, though she had had a bad night. 5683-32866-0018 5.455 To my mind there has always been something inexpressibly awful in family feuds. -5683-32866-0001 3.47 And he added something still less complimentary. 5683-32866-0021 7.9 My bed was unexceptionably comfortable, but, in my then mood, I could have wished it a great deal more modern. -5683-32866-0014 3.97 Don't insult me, Stanley, by talking again as you did this morning. 5683-32866-0024 9.855 I shan't trouble you about my train of thoughts or fancies; but I began to feel very like a gentleman in a ghost story, watching experimentally in a haunted chamber. -5683-32866-0008 3.3 Bracton's a very good fellow, I can assure you. 5683-32866-0027 4.755 A cold, bright moon was shining with clear sharp lights and shadows. -5683-32879-0012 4.38 Thank you, Rachel, my Cousin Rachel, my only friend. 5683-32866-0028 5.62 The sombre old trees, like gigantic hearse plumes, black and awful. -5683-32866-0003 2.865 In the meantime I had formed a new idea of her. 5683-32866-0030 4.845 A little bit of plaster tumbled down the chimney, and startled me confoundedly. -8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284449-0001 8.63 Then they all marched out a little way into the fields and found that the Army of Pinkies had already formed and was advancing steadily toward them. -8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284449-0003 8.875 When the Blueskins saw Ghip Ghisizzle they raised another great shout, for he was the favorite of the soldiers and very popular with all the people. -8555-284447-0003 4.415 But Captain Bill made no such attempt, knowing it would be useless. 8555-284449-0007 9.31 Now, then, let's enter the City and enjoy the grand feast that's being cooked. I'm nearly starved, myself, for this conquering kingdoms is hard work". -8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284449-0008 6.135 Then she gave Rosalie back her magic ring, thanking the kind Witch for all she had done for them. -8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284449-0012 9.87 I'll gladly do that," promised the new Boolooroo; "and I'll feed the honorable goat all the shavings and leather and tin cans he can eat, besides the grass. -8555-284447-0003 4.415 But Captain Bill made no such attempt, knowing it would be useless. 8555-284449-0013 5.775 Scuse me," said Trot; "I neglected to tell you that you're not the Boolooroo any more. -8555-292519-0013 4.185 That was but rustling of dripping plants in the dark. 8555-284449-0015 5.12 I'll not be wicked any more," sighed the old Boolooroo; "I'll reform. -8555-284447-0022 3.56 I had a notion it was you, mate, as saved me from the knife. 8555-284449-0016 5.895 As a private citizen I shall be a model of deportment, because it would be dangerous to be otherwise". -8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284449-0018 7.03 So Ghip Ghisizzle ordered the Captain to take a file of soldiers and escort the raving beauties to their new home. -8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284449-0019 7.61 That evening Trot gave a grand ball in the palace, to which the most important of the Pinkies and the Blueskins were invited. -8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284449-0020 5.095 The combined bands of both the countries played the music and a fine supper was served. +4992-41806-0009 4.355 exclaimed Bill Harmon to his wife as they went through the lighted hall. 4992-23283-0000 6.645 But the more forgetfulness had then prevailed, the more powerful was the force of remembrance when she awoke. +4992-23283-0001 2.71 Miss Milner's health is not good"! 4992-23283-0003 4.645 So there is to me"! added Sandford, with a sarcastic sneer. +4992-23283-0015 3.675 Is she not afraid that I will thwart her inclinations"? 4992-23283-0004 8.06 And yet you must own her behaviour has warranted them has it not been in this particular incoherent and unaccountable"? +4992-23283-0015 3.675 Is she not afraid that I will thwart her inclinations"? 4992-23283-0007 4.045 To ask any more questions of you, I believe, would be unfair. +4992-41797-0012 2.705 She is wild to know how to do things. 4992-23283-0008 4.91 He seemed to wait for her reply; but as she made none, he proceeded- +4992-41797-0016 3.3 They couldn't run nor move; they're just pasteboard". 4992-23283-0009 8.395 Oh! my Lord," cried Miss Woodley, with a most forcible accent, " You are the last person on earth she would pardon me for entrusting". +4992-41797-0005 3.845 Done? He ain't done a thing he'd oughter sence he was born. 4992-23283-0010 5 But in such a case, Miss Milner's election of a husband shall not direct mine. +4992-41797-0012 2.705 She is wild to know how to do things. 4992-23283-0011 4.225 If she does not know how to estimate her own value, I do. +4992-41806-0004 3.7 Burn, fire, burn! Flicker, flicker, flame! 4992-23283-0013 6.63 My Lord, Miss Milner's taste is not a depraved one; it is but too refined". +4992-41797-0012 2.705 She is wild to know how to do things. 4992-23283-0014 4.535 What can you mean by that, Miss Woodley? You talk mysteriously. +4992-41797-0012 2.705 She is wild to know how to do things. 4992-23283-0016 4.495 Again he searched his own thoughts; nor ineffectually as before. +4992-23283-0007 4.045 To ask any more questions of you, I believe, would be unfair. 4992-23283-0018 6.575 To relieve her from both, he laid his hand with force upon his heart, and said, "Do you believe me"? +4992-23283-0016 4.495 Again he searched his own thoughts; nor ineffectually as before. 4992-23283-0019 6.585 I will make no unjust use of what I know," he replied with firmness. "I believe you, my Lord". +672-122797-0005 3.26 Oh, that made him so angry! 672-122797-0000 4.07 Out in the woods stood a nice little Fir Tree. +672-122797-0029 3.05 How it will shine this evening"! 672-122797-0003 4.76 But this was what the Tree could not bear to hear. +672-122797-0000 4.07 Out in the woods stood a nice little Fir Tree. 672-122797-0007 6.42 In autumn the wood cutters always came and felled some of the largest trees. +672-122797-0000 4.07 Out in the woods stood a nice little Fir Tree. 672-122797-0012 7.765 I would fain know if I am destined for so glorious a career," cried the Tree, rejoicing. +672-122797-0029 3.05 How it will shine this evening"! 672-122797-0013 8.705 I am now tall, and my branches spread like the others that were carried off last year! Oh! +672-122797-0032 4 cried the young ladies, and they quickly put out the fire. 672-122797-0015 4.455 Were I in the warm room with all the splendor and magnificence! +672-122797-0044 3.74 And he leaned against the wall lost in reverie. 672-122797-0016 9.215 Yes; then something better, something still grander, will surely follow, or wherefore should they thus ornament me? +672-122797-0041 3.88 In the morning the servant and the housemaid came in. 672-122797-0017 4.82 Something better, something still grander must follow - but what? +672-122797-0000 4.07 Out in the woods stood a nice little Fir Tree. 672-122797-0018 4.93 Rejoice in our presence"! said the Air and the Sunlight. +672-122797-0047 3.325 How kind man is, after all! 672-122797-0019 4.11 Rejoice in thy own fresh youth"! +672-122797-0053 2.955 They were so extremely curious. 672-122797-0020 8.825 But the Tree did not rejoice at all; he grew and grew, and was green both winter and summer. +672-122797-0032 4 cried the young ladies, and they quickly put out the fire. 672-122797-0021 4.15 and towards Christmas he was one of the first that was cut down. +672-122797-0032 4 cried the young ladies, and they quickly put out the fire. 672-122797-0023 9.695063 He well knew that he should never see his dear old comrades, the little bushes and flowers around him, anymore; perhaps not even the birds! +672-122797-0059 3.52 Only that one," answered the Tree. 672-122797-0024 4.13 The departure was not at all agreeable. +672-122797-0000 4.07 Out in the woods stood a nice little Fir Tree. 672-122797-0027 4.79 The servants, as well as the young ladies, decorated it. +672-122797-0015 4.455 Were I in the warm room with all the splendor and magnificence! 672-122797-0030 4.575 Perhaps the other trees from the forest will come to look at me! +672-122797-0015 4.455 Were I in the warm room with all the splendor and magnificence! 672-122797-0032 4 cried the young ladies, and they quickly put out the fire. +672-122797-0015 4.455 Were I in the warm room with all the splendor and magnificence! 672-122797-0034 5.11 A story"! cried the children, drawing a little fat man towards the Tree. +672-122797-0011 2.54 And then? What happens then"? 672-122797-0036 5.365 Humpy Dumpy fell downstairs, and yet he married the princess! +672-122797-0044 3.74 And he leaned against the wall lost in reverie. 672-122797-0038 8.8 thought the Fir Tree, and believed it all, because the man who told the story was so good looking. "Well, well! +672-122797-0043 3.78 What's the meaning of this"? thought the Tree. 672-122797-0039 4.025 I won't tremble tomorrow"! thought the Fir Tree. +672-122797-0000 4.07 Out in the woods stood a nice little Fir Tree. 672-122797-0040 5.125 And the whole night the Tree stood still and in deep thought. +672-122797-0059 3.52 Only that one," answered the Tree. 672-122797-0046 4.715 Tis now winter out of doors"! thought the Tree. +672-122797-0054 4.25 I know no such place," said the Tree. 672-122797-0048 6.555 If it only were not so dark here, and so terribly lonely! +672-122797-0041 3.88 In the morning the servant and the housemaid came in. 672-122797-0050 4.855 They snuffed about the Fir Tree, and rustled among the branches. +672-122797-0054 4.25 I know no such place," said the Tree. 672-122797-0051 4.665 I am by no means old," said the Fir Tree. +672-122797-0011 2.54 And then? What happens then"? 672-122797-0052 4.285 There's many a one considerably older than I am". +672-122797-0031 3.98 It blazed up famously. "Help! Help"! 672-122797-0054 4.25 I know no such place," said the Tree. +672-122797-0032 4 cried the young ladies, and they quickly put out the fire. 672-122797-0055 8.23 And then he told all about his youth; and the little Mice had never heard the like before; and they listened and said, +672-122797-0000 4.07 Out in the woods stood a nice little Fir Tree. 672-122797-0056 5.225 said the Fir Tree, thinking over what he had himself related. +672-122797-0065 3.03 Now that too is over. 672-122797-0057 6.56 Yes, in reality those were happy times". +672-122797-0000 4.07 Out in the woods stood a nice little Fir Tree. 672-122797-0058 4.47 Who is Humpy Dumpy"? asked the Mice. +672-122797-0005 3.26 Oh, that made him so angry! 672-122797-0061 7.59 Don't you know one about bacon and tallow candles? Can't you tell any larder stories"? +672-122797-0021 4.15 and towards Christmas he was one of the first that was cut down. 672-122797-0066 4.815 Why, one morning there came a quantity of people and set to work in the loft. +672-122797-0010 3.815 Rejoice in thy growth"! said the Sunbeams. 672-122797-0068 4.02 but it was not the Fir Tree that they meant. +672-122797-0028 2.61 This evening"! they all said. 672-122797-0069 5.01 It was in a corner that he lay, among weeds and nettles. +672-122797-0032 4 cried the young ladies, and they quickly put out the fire. 672-122797-0070 6.27 The golden star of tinsel was still on the top of the Tree, and glittered in the sunshine. +672-122797-0021 4.15 and towards Christmas he was one of the first that was cut down. 672-122797-0071 8.875 In the court yard some of the merry children were playing who had danced at Christmas round the Fir Tree, and were so glad at the sight of him. +672-122797-0000 4.07 Out in the woods stood a nice little Fir Tree. 672-122797-0072 7.94 And the gardener's boy chopped the Tree into small pieces; there was a whole heap lying there. +672-122797-0053 2.955 They were so extremely curious. 672-122797-0073 8.205 The wood flamed up splendidly under the large brewing copper, and it sighed so deeply! +672-122797-0062 2.675 No," said the Tree. 672-122797-0074 8.73 However, that was over now - the Tree gone, the story at an end. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0001 8.250063 The influence with the Timaeus has exercised upon posterity is due partly to a misunderstanding. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0004 8.22 There is no danger of the modern commentators on the Timaeus falling into the absurdities of the Neo Platonists. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0007 7.64 But they have nothing to do with the interpretation of Plato, and in spirit they are opposed to him. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0012 6.89 Many, if not all the elements of the Pre Socratic philosophy are included in the Timaeus. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0014 8.775 The ideas also remain, but they have become types in nature, forms of men, animals, birds, fishes. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0015 7.83 The style and plan of the Timaeus differ greatly from that of any other of the Platonic dialogues. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0016 7.76 But Plato has not the same mastery over his instrument which he exhibits in the Phaedrus or Symposium. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0017 7.87 Nothing can exceed the beauty or art of the introduction, in which he is using words after his accustomed manner. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0018 8.38 But in the rest of the work the power of language seems to fail him, and the dramatic form is wholly given up. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0020 9.88 And hence we find the same sort of clumsiness in the Timaeus of Plato which characterizes the philosophical poem of Lucretius. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-960-0022 7.425 Plato had not the command of his materials which would have enabled him to produce a perfect work of art. +8224-274384-0003 3.87 or hath he given us any gift? 8224-274381-0011 6.48 His conduct and presence of mind in this emergence appeared conspicuous. +1221-135766-0013 3.645 Pearl was a born outcast of the infantile world. 1221-135767-0005 5.865 It was the scarlet letter in another form: the scarlet letter endowed with life! +1221-135766-0015 2.63 If spoken to, she would not speak again. 1221-135767-0010 8.2 She screamed and shouted, too, with a terrific volume of sound, which, doubtless, caused the hearts of the fugitives to quake within them. +1221-135767-0008 3.095 Come, therefore, and let us fling mud at them"! 1221-135767-0014 7.07 Yea, his honourable worship is within. But he hath a godly minister or two with him, and likewise a leech. +1221-135767-0020 3.345 In truth, she seemed absolutely hidden behind it. 1221-135767-0024 5.85 Pearl, seeing the rose bushes, began to cry for a red rose, and would not be pacified. +7176-88083-0008 3.28 In despair he hurled himself downward too soon. 7176-92135-0001 7.56 In short he becomes a "prominent figure in London Society" - and, if he is not careful, somebody will say so. +7176-92135-0007 3.275 Anyhow it's jolly exciting, and I can do the dialogue all right. 7176-92135-0005 5.47 But suppose you said, "I'm fond of writing; my people always say my letters home are good enough for Punch. +7176-92135-0027 2.835 Lady Larkspur starts suddenly and turns towards him. 7176-92135-0006 7.795 I've got a little idea for a play about a man and a woman and another woman, and - but perhaps I'd better keep the plot a secret for the moment. +7176-88083-0009 4.045 The great hawk followed hurriedly, to retrieve his prey from the ground. 7176-92135-0008 4.43 Lend me your ear for ten minutes, and you shall learn just what stagecraft is". +7176-92135-0004 2.425 Frankly I cannot always say. 7176-92135-0009 4.38 And I should begin with a short homily on Soliloquy. +7176-88083-0016 3.92 Straightway the hawk glided from his perch and darted after him. 7176-92135-0015 6.755 And so on, till you get to the end, when Ophelia might say, "Ah, yes," or something non committal of that sort. +7176-88083-0006 4.295 It might have seemed that a trout of this size was a fairly substantial meal. 7176-92135-0016 7.545 This would be an easy way of doing it, but it would not be the best way, for the reason that it is too easy to call attention to itself. +7176-88083-0016 3.92 Straightway the hawk glided from his perch and darted after him. 7176-92135-0017 7.17 In the old badly made play it was frequently necessary for one of the characters to take the audience into his confidence. +7176-88083-0016 3.92 Straightway the hawk glided from his perch and darted after him. 7176-92135-0018 8.94 In the modern well constructed play he simply rings up an imaginary confederate and tells him what he is going to do. Could anything be more natural? +7176-88083-0008 3.28 In despair he hurled himself downward too soon. 7176-92135-0020 7.165 Double nine two three, Elsinore.... Double- nine, yes.... Hallo, is that you, Horatio? Hamlet speaking. +7176-88083-0016 3.92 Straightway the hawk glided from his perch and darted after him. 7176-92135-0022 8.23 To be or not to be, that is the question; whether 'tis nobler in the mind to suffer the slings and arrows - What? No, Hamlet speaking. +7176-92135-0002 3.415 But even the unsuccessful dramatist has his moments. 7176-92135-0023 6.215 You gave me double- five, I want double- nine.... Hallo, is that you, Horatio? Hamlet speaking. +7176-92135-0026 2.95 Enter Hamlet with his favourite boar hound. 7176-92135-0024 4.1 To be or not to be, that is the question; whether 'tis nobler +7176-88083-0016 3.92 Straightway the hawk glided from his perch and darted after him. 7176-92135-0042 7.27 In novels the hero has often "pushed his meals away untasted," but no stage hero would do anything so unnatural as this. +7176-92135-0007 3.275 Anyhow it's jolly exciting, and I can do the dialogue all right. 7176-92135-0044 5.175 But it is the cigarette which chiefly has brought the modern drama to its present state of perfection. +4077-13754-0001 3.77 But a word further concerning the expedition in general. 4077-13751-0001 8.745 Its origin was small - a germ, an insignificant seed, hardly to be thought of as likely to arouse opposition. +4077-13754-0001 3.77 But a word further concerning the expedition in general. 4077-13751-0002 9.75 Instead of but six regularly affiliated members, and at most two score of adherents, the organization numbers today many hundred thousand souls. +4077-13751-0013 4.315 Their sufferings have never yet been fitly chronicled by human scribe. 4077-13751-0010 6.72 To the fervent Latter day Saint, a temple is not simply a church building, a house for religious assembly. +4077-13751-0019 2.92 Who began the quarrel? Was it the "Mormons"? 4077-13751-0013 4.315 Their sufferings have never yet been fitly chronicled by human scribe. +4077-13754-0001 3.77 But a word further concerning the expedition in general. 4077-13751-0017 5.095 Oh, what a record to read; what a picture to gaze upon; how awful the fact! +6930-81414-0019 3.38 Voltaire picked up something from the ground and looked at it. 6930-76324-0002 5.56 The poor little things"! cried Cynthia. "Think of them having been turned to the wall all these years! +6930-76324-0009 3.405 Do you suppose the miniature was a copy of the same thing"? 6930-76324-0004 6.15 But Joyce had not been listening. All at once she put down her candle on the table and faced her companion. +6930-76324-0009 3.405 Do you suppose the miniature was a copy of the same thing"? 6930-76324-0005 5.035 The twin brother did something she didn't like, and she turned his picture to the wall. +6930-76324-0001 3.2 They were certainly no nearer the solution of their problem. 6930-76324-0006 4.455 Hers happened to be in the same frame too, but she evidently didn't care about that. +6930-76324-0006 4.455 Hers happened to be in the same frame too, but she evidently didn't care about that. 6930-76324-0008 5.185 I thought we were 'stumped' again when I first saw that picture, but it's been of some use, after all. +6930-76324-0026 3.085 Isn't he the greatest for getting into odd corners"! 6930-76324-0011 9.24 They worry me terribly. And, besides, I'd like to see what this lovely furniture looks like without such quantities of dust all over it". "Good scheme, CYN"! +6930-76324-0006 4.455 Hers happened to be in the same frame too, but she evidently didn't care about that. 6930-76324-0012 4.655 We'll come in here this afternoon with old clothes on, and have a regular house cleaning! +6930-76324-0010 2.69 What in the world is that"? queried Joyce. 6930-76324-0013 4.305 It can't hurt anything, I'm sure, for we won't disturb things at all. +6930-76324-0007 2.82 Now what have you to say, Cynthia Sprague"? 6930-76324-0014 4.72 This thought, however, did not enter the heads of the enthusiastic pair. +6930-76324-0019 2.575 Now let's dust the furniture and pictures". 6930-76324-0016 9.205 The lure proved too much for him, and he came sporting after it, as friskily as a young kitten, much to Cynthia's delight when she caught sight of him. +6930-81414-0018 2.93 I remember saying. "Have we been together"? 6930-76324-0017 5.41 Oh, let him come along"! she urged. "I do love to see him about that old house. +6930-76324-0025 4.12 Why, it's Goliath as usual"! they both cried, peering in. 6930-76324-0020 6.315 Yet, little as it was, it had already made a vast difference in the aspect of the room. +6930-76324-0007 2.82 Now what have you to say, Cynthia Sprague"? 6930-76324-0021 7.355 Surface dust at least had been removed, and the fine old furniture gave a hint of its real elegance and polish. +6930-76324-0013 4.305 It can't hurt anything, I'm sure, for we won't disturb things at all. 6930-76324-0023 4.85 And my pocket money is getting low again, and you haven't any left, as usual. +6930-76324-0026 3.085 Isn't he the greatest for getting into odd corners"! 6930-76324-0024 4.05 They say illumination by candle light is the prettiest in the world. +6930-81414-0012 4.43 said another voice, which I recognized as Voltaire's. "Kaffar? 6930-76324-0025 4.12 Why, it's Goliath as usual"! they both cried, peering in. +6930-81414-0019 3.38 Voltaire picked up something from the ground and looked at it. 6930-76324-0027 8.27 Forgetting all their weariness, they seized their candles and scurried through the house, finding an occasional paper tucked away in some odd corner. +6930-81414-0018 2.93 I remember saying. "Have we been together"? 6930-76324-0028 9.875 Well, I'm convinced that the Boarded up House mystery happened not earlier than april sixteenth, eighteen sixty one, and probably not much later. +6930-76324-0007 2.82 Now what have you to say, Cynthia Sprague"? 6930-81414-0004 9.56 The story of its evil influence came back to me, and in my bewildered condition I wondered whether there was not some truth in what had been said. +6930-75918-0000 3.505 Concord returned to its place amidst the tents. 6930-81414-0006 6.8 What then? A human hand, large and shapely, appeared distinctly on the surface of the pond. +6930-75918-0011 3.195 I am convinced of what I say," said the count. 6930-81414-0007 4.365 Nothing more, not even the wrist to which it might be attached. +6930-75918-0013 2.94 In those very terms; I even added more. 6930-81414-0008 6.055 It did not beckon, or indeed move at all; it was as still as the hand of death. +6930-81414-0010 3.835 A sound of voices. A flash of light. 6930-81414-0011 4.7 A feeling of freedom, and I was awake! Where? +6930-76324-0025 4.12 Why, it's Goliath as usual"! they both cried, peering in. 6930-81414-0012 4.43 said another voice, which I recognized as Voltaire's. "Kaffar? +6930-81414-0007 4.365 Nothing more, not even the wrist to which it might be attached. 6930-81414-0013 7.325 I had scarcely known what I had been saying or doing up to this time, but as he spoke I looked at my hand. +6930-75918-0007 3.315 You will be frank with me"? "I always am". 6930-81414-0014 7.41 In the light of the moon I saw a knife red with blood, and my hand, too, was also discoloured. +6930-81414-0025 2.53 My position was too terrible. 6930-81414-0020 5 I say you do know what this means, and you must tell us". +6930-81414-0027 3.85 For some time after that I remembered nothing distinctly. 6930-81414-0022 4.34 I had again been acting under the influence of this man's power. +6930-81414-0021 3.225 A terrible thought flashed into my mind. 6930-81414-0023 4.885 Perchance, too, Kaffar's death might serve him in good stead. +6930-75918-0010 3.035 I can perceive love clearly enough". 6930-81414-0024 5.05 My tongue refused to articulate; my power of speech left me. +1221-135766-0015 2.63 If spoken to, she would not speak again. 1221-135766-0002 4.825 Yet these thoughts affected Hester Prynne less with hope than apprehension. +1221-135766-0015 2.63 If spoken to, she would not speak again. 1221-135766-0004 7.44 This outward mutability indicated, and did not more than fairly express, the various properties of her inner life. +1221-135766-0013 3.645 Pearl was a born outcast of the infantile world. 1221-135766-0007 8.795 Hester Prynne, nevertheless, the loving mother of this one child, ran little risk of erring on the side of undue severity. +1221-135767-0020 3.345 In truth, she seemed absolutely hidden behind it. 1221-135766-0014 4.75 Pearl saw, and gazed intently, but never sought to make acquaintance. +7021-79740-0012 3.26 said she, pointing to the playthings; "see! 7021-79730-0005 8.01 So you will be a good girl, I know, and not make any trouble, but will stay at home contentedly - won't you? +8463-294828-0021 2.735 A route slightly less direct, that's all. 8463-294825-0001 7.805 This reality begins to explain the dark power and otherworldly fascination of Twenty Thousand Leagues Under the Seas. +8463-287645-0014 3.02 of starting. I didn't know the way to come. 8463-294825-0003 9.935 Nemo builds a fabulous futuristic submarine, the Nautilus, then conducts an underwater campaign of vengeance against his imperialist oppressor. +8463-287645-0001 3.545 It is hardly necessary to say more of them here. 8463-294825-0005 7.7 Other subtleties occur inside each episode, the textures sparkling with wit, information, and insight. +8463-287645-0001 3.545 It is hardly necessary to say more of them here. 8463-294825-0010 4.580063 And in this last action he falls into the classic sin of Pride. +8463-287645-0009 3.71 I never knew of but one man who could ever please him. 8463-294825-0012 5.965063 The Nautilus nearly perishes in the Antarctic and Nemo sinks into a growing depression. +1580-141083-0021 3.715 There is no opening except the one pane," said our learned guide. 1580-141083-0000 8.94 I will endeavour, in my statement, to avoid such terms as would serve to limit the events to any particular place, or give a clue as to the people concerned. +1580-141084-0034 4.49 Well, well, don't trouble to answer. Listen, and see that I do you no injustice. 1580-141083-0002 6.135 My friend's temper had not improved since he had been deprived of the congenial surroundings of Baker Street. +1580-141083-0023 3.33 One could hardly hope for any upon so dry a day. 1580-141083-0003 6.55 Without his scrapbooks, his chemicals, and his homely untidiness, he was an uncomfortable man. +1580-141084-0003 4.1 No names, please"! said Holmes, as we knocked at Gilchrist's door. 1580-141083-0004 4.515 I had to read it over carefully, as the text must be absolutely correct. +1580-141084-0045 3.625 Suddenly he heard him at the very door. There was no possible escape. 1580-141083-0007 4.565 The moment I looked at my table, I was aware that someone had rummaged among my papers. +1580-141083-0011 2.825 A broken tip of lead was lying there also. 1580-141083-0008 4.305 The proof was in three long slips. I had left them all together. +1580-141083-0030 3.48 mister Soames was somewhat overwhelmed by this flood of information. 1580-141083-0009 7.04 The alternative was that someone passing had observed the key in the door, had known that I was out, and had entered to look at the papers. +1580-141083-0030 3.48 mister Soames was somewhat overwhelmed by this flood of information. 1580-141083-0010 5.32 I gave him a little brandy and left him collapsed in a chair, while I made a most careful examination of the room. +1580-141083-0050 3.085 I really don't think he knew much about it, mister Holmes. 1580-141083-0012 7.065 Not only this, but on the table I found a small ball of black dough or clay, with specks of something which looks like sawdust in it. +1580-141083-0019 2.705 Above were three students, one on each story. 1580-141083-0013 4.32 Above all things, I desire to settle the matter quietly and discreetly". +1580-141083-0048 2.785 How came you to leave the key in the door"? 1580-141083-0015 4.985 Did anyone know that these proofs would be there"? "No one save the printer". +1580-141084-0021 4.01 On the palm were three little pyramids of black, doughy clay. 1580-141083-0016 4.255 I was in such a hurry to come to you". "You left your door open"? +1580-141083-0036 3.98 Holmes held it out on his open palm in the glare of the electric light. 1580-141083-0020 5.135 Then he approached it, and, standing on tiptoe with his neck craned, he looked into the room. +1580-141084-0050 2.78 If mister Soames saw them, the game was up. 1580-141083-0024 4.48 You left him in a chair, you say. Which chair"? "By the window there". +1580-141084-0037 2.965 When I approached your room, I examined the window. 1580-141083-0026 4.775 As a matter of fact, he could not," said Soames, "for I entered by the side door". +1580-141083-0030 3.48 mister Soames was somewhat overwhelmed by this flood of information. 1580-141083-0027 5.225 How long would it take him to do that, using every possible contraction? A quarter of an hour, not less. +1580-141084-0050 2.78 If mister Soames saw them, the game was up. 1580-141083-0031 6.25 Holmes held out a small chip with the letters NN and a space of clear wood after them. "You see"? +1580-141084-0036 2.475 The Indian I also thought nothing of. 1580-141083-0032 4.135 Watson, I have always done you an injustice. There are others. +1580-141084-0045 3.625 Suddenly he heard him at the very door. There was no possible escape. 1580-141083-0033 7.45 I was hoping that if the paper on which he wrote was thin, some trace of it might come through upon this polished surface. No, I see nothing. +1580-141083-0025 3.905 The man entered and took the papers, sheet by sheet, from the central table. 1580-141083-0034 6.99 As Holmes drew the curtain I was aware, from some little rigidity and alertness of his attitude, that he was prepared for an emergency. +1580-141084-0050 2.78 If mister Soames saw them, the game was up. 1580-141083-0035 4.98 Holmes turned away, and stooped suddenly to the floor. "Hello! What's this"? +1580-141083-0030 3.48 mister Soames was somewhat overwhelmed by this flood of information. 1580-141083-0037 5.73 What could he do? He caught up everything which would betray him, and he rushed into your bedroom to conceal himself". +1580-141083-0036 3.98 Holmes held it out on his open palm in the glare of the electric light. 1580-141083-0038 7.535 I understand you to say that there are three students who use this stair, and are in the habit of passing your door"? "Yes, there are". +1580-141083-0024 4.48 You left him in a chair, you say. Which chair"? "By the window there". 1580-141083-0042 5.865 My scholar has been left very poor, but he is hard working and industrious. He will do well. +1580-141084-0014 3.97 Why, Bannister, the servant. What's his game in the matter"? 1580-141083-0044 5.505 I dare not go so far as that. But, of the three, he is perhaps the least unlikely". +1580-141083-0025 3.905 The man entered and took the papers, sheet by sheet, from the central table. 1580-141083-0045 4.36 He was still suffering from this sudden disturbance of the quiet routine of his life. +1580-141083-0052 3.45 Oh, I would not venture to say, sir. 1580-141083-0053 4.015 You haven't seen any of them"? "No, sir". +4992-41797-0003 2.835 mister Popham laid down his brush. 4992-41797-0000 5.485 Yes, dead these four years, an' a good job for her, too. +4992-41797-0003 2.835 mister Popham laid down his brush. 4992-41797-0002 5.625 Grandfather was Alexander Carey, L L. D., - Doctor of Laws, that is". +4992-23283-0016 4.495 Again he searched his own thoughts; nor ineffectually as before. 4992-41797-0004 7.315 I swan to man"! he ejaculated. "If you don't work hard you can't keep up with the times! Doctor of Laws! +4992-23283-0015 3.675 Is she not afraid that I will thwart her inclinations"? 4992-41797-0006 4.55 He keeps the thou shalt not commandments first rate, Hen Lord does! +4992-23283-0015 3.675 Is she not afraid that I will thwart her inclinations"? 4992-41797-0007 6.905 He give up his position and shut the family up in that tomb of a house so 't he could study his books. +4992-41797-0012 2.705 She is wild to know how to do things. 4992-41797-0008 8.965 mister Popham exaggerated nothing, but on the contrary left much unsaid in his narrative of the family at the House of Lords. +4992-41797-0003 2.835 mister Popham laid down his brush. 4992-41797-0010 6.82 Always irritable, cold, indifferent, he had grown rapidly more so as years went on. +4992-41797-0016 3.3 They couldn't run nor move; they're just pasteboard". 4992-41797-0011 5.445 Whatever appealed to her sense of beauty was straightway transferred to paper or canvas. +4992-41806-0009 4.355 exclaimed Bill Harmon to his wife as they went through the lighted hall. 4992-41797-0013 9.8 She makes effort after effort, trembling with eagerness, and when she fails to reproduce what she sees, she works herself into a frenzy of grief and disappointment". +4992-41806-0009 4.355 exclaimed Bill Harmon to his wife as they went through the lighted hall. 4992-41797-0014 7.215 When she could not make a rabbit or a bird look "real" on paper, she searched in her father's books for pictures of its bones. +4992-41806-0009 4.355 exclaimed Bill Harmon to his wife as they went through the lighted hall. 4992-41797-0015 8.65 Cyril, there must be some better way of doing; I just draw the outline of an animal and then I put hairs or feathers on it. They have no bodies. +4992-23283-0011 4.225 If she does not know how to estimate her own value, I do. 4992-41797-0017 8.69 He wouldn't search, so don't worry," replied Cyril quietly, and the two looked at each other and knew that it was so. +4992-23283-0016 4.495 Again he searched his own thoughts; nor ineffectually as before. 4992-41797-0018 9.155 There, in the cedar hollow, then, lived Olive Lord, an angry, resentful, little creature weighed down by a fierce sense of injury. +4992-23283-0001 2.71 Miss Milner's health is not good"! 4992-41797-0019 4.755 Olive's mournful black eyes met Nancy's sparkling brown ones. +4992-41797-0012 2.705 She is wild to know how to do things. 4992-41797-0020 7.49 Nancy's curly chestnut crop shone in the sun, and Olive's thick black plaits looked blacker by contrast. +4992-23283-0007 4.045 To ask any more questions of you, I believe, would be unfair. 4992-41797-0021 8.23 She's wonderful! More wonderful than anybody we've ever seen anywhere, and she draws better than the teacher in Charlestown! +4992-23283-0001 2.71 Miss Milner's health is not good"! 4992-41797-0022 6.45 She's older than I am, but so tiny and sad and shy that she seems like a child. +2830-3980-0001 3.945 They said to the Galatians: "You have no right to think highly of Paul. 2830-3979-0000 6.12 We want you to help us publish some leading work of Luther's for the general American market. Will you do it"? +2830-3980-0020 3.46 This is no sinful pride. It is holy pride. 2830-3979-0002 4.315 Let us begin with that: his Commentary on Galatians..". +2830-3980-0046 2.84 Was it not enough to say, "from God the Father"? 2830-3979-0003 8.085 The undertaking, which seemed so attractive when viewed as a literary task, proved a most difficult one, and at times became oppressive. +2830-3980-0012 3.42 The most they could claim is that they were sent by others. 2830-3979-0006 4.55 A word should now be said about the origin of Luther's Commentary on Galatians. +2830-3980-0013 4.145 He mentions the apostles first because they were appointed directly by God. 2830-3979-0008 9.44 In other words, these three men took down the lectures which Luther addressed to his students in the course of Galatians, and Roerer prepared the manuscript for the printer. +2830-3980-0013 4.145 He mentions the apostles first because they were appointed directly by God. 2830-3979-0009 8.35 It presents like no other of Luther's writings the central thought of Christianity, the justification of the sinner for the sake of Christ's merits alone. +2830-3980-0020 3.46 This is no sinful pride. It is holy pride. 2830-3979-0011 9.45 The Lord who has given us power to teach and to hear, let Him also give us the power to serve and to do". LUKE two +2094-142345-0025 3.595 Cold, is it, my darling? Bless your sweet face"! 2094-142345-0001 8.03 But the windows are patched with wooden panes, and the door, I think, is like the gate it is never opened. +2094-142345-0025 3.595 Cold, is it, my darling? Bless your sweet face"! 2094-142345-0005 9.09 Several clothes horses, a pillion, a spinning wheel, and an old box wide open and stuffed full of coloured rags. +2094-142345-0060 2.71 Oh, I've no doubt it's in capital order. 2094-142345-0021 5.335 That's the way with you that's the road you'd all like to go, headlongs to ruin. +2094-142345-0018 3.155 Who taught you to scrub a floor, I should like to know? 2094-142345-0034 7.99 And there's linen in the house as I could well spare you, for I've got lots o' sheeting and table clothing, and towelling, as isn't made up. +2094-142345-0026 2.825 She's going to put the ironing things away". 2094-142345-0036 6.915 Nay, dear aunt, you never heard me say that all people are called to forsake their work and their families. +2094-142345-0020 2.435 That's what you'd like to be doing, is it? 2094-142345-0039 6.28 I've strong assurance that no evil will happen to you and my uncle and the children from anything I've done. +2094-142345-0020 2.435 That's what you'd like to be doing, is it? 2094-142345-0043 7.35 By this time the two gentlemen had reached the palings and had got down from their horses: it was plain they meant to come in. +2094-142345-0032 3.24 I often heard her talk of you in the same sort of way. 2094-142345-0048 6.39 said Captain Donnithorne, seating himself where he could see along the short passage to the open dairy door. +2094-142345-0004 2.64 And what through the left hand window? 2094-142345-0049 6.125 No, sir, he isn't; he's gone to Rosseter to see mister West, the factor, about the wool. +2094-142345-0018 3.155 Who taught you to scrub a floor, I should like to know? 2094-142345-0051 5.31 No, thank you; I'll just look at the whelps and leave a message about them with your shepherd. +2094-142345-0060 2.71 Oh, I've no doubt it's in capital order. 2094-142345-0052 6.53 I must come another day and see your husband; I want to have a consultation with him about horses. +1995-1837-0009 3.76 The lagoon had been level with the dykes a week ago; and now? 1995-1836-0001 6 At last the Cotton Combine was to all appearances an assured fact and he was slated for the Senate. +1995-1837-0015 4.485 The squares of cotton, sharp edged, heavy, were just about to burst to bolls! 1995-1836-0003 7.965 She was not herself a notably intelligent woman; she greatly admired intelligence or whatever looked to her like intelligence in others. +1995-1837-0015 4.485 The squares of cotton, sharp edged, heavy, were just about to burst to bolls! 1995-1836-0006 7.715 She was therefore most agreeably surprised to hear mister Cresswell express himself so cordially as approving of Negro education. +1995-1837-0005 2.635 She was so strange and human a creature. 1995-1836-0008 6.985 I believe in the training of people to their highest capacity". The Englishman here heartily seconded him. +1995-1837-0000 3.865 He knew the Silver Fleece - his and Zora's - must be ruined. 1995-1836-0009 6.71 But," Cresswell added significantly, "capacity differs enormously between races". +1995-1826-0004 3.035 Might learn something useful down there". 1995-1836-0011 4.705 Positively heroic," added Cresswell, avoiding his sister's eyes. +1995-1837-0022 3.415 Up in the sick room Zora lay on the little white bed. 1995-1836-0014 9.045 Fortunately," said mister Vanderpool, "Northerners and Southerners are arriving at a better mutual understanding on most of these matters". +237-126133-0021 4.365 she asked impulsively, "I didn't believe you could persuade her, father". 237-126133-0003 6.56 Somehow, of all the days when the home feeling was the strongest, this day it seemed as if she could bear it no longer. +237-126133-0025 3.755 At last he came out of them, and wiped his face vigorously. 237-126133-0005 6.51 Oh, she's always at the piano," said Van. "She must be there now, somewhere," and then somebody laughed. +237-126133-0016 4.25 Oh no, Jasper; I must go by my very own self". 237-126133-0006 6.15 At this, the bundle opened suddenly, and - out popped Phronsie! +237-126133-0021 4.365 she asked impulsively, "I didn't believe you could persuade her, father". 237-126133-0007 8.68 But Polly couldn't speak; and if Jasper hadn't caught her just in time, she would have tumbled over backward from the stool, Phronsie and all! +237-126133-0025 3.755 At last he came out of them, and wiped his face vigorously. 237-126133-0010 6.24 Oh, you are the dearest and best mister King I ever saw! but how did you make mammy let her come"? +237-126133-0009 3.97 Now you'll stay," cried Van; "say, Polly, won't you". 237-126133-0011 6.71 Isn't he splendid"! cried Jasper in intense pride, swelling up. "Father knew how to do it". +237-126133-0018 4.095 Don't mind it, Polly," whispered Jasper; "twasn't her fault". 237-126133-0012 4.45 There, there," he said soothingly, patting her brown, fuzzy head. +237-126133-0016 4.25 Oh no, Jasper; I must go by my very own self". 237-126133-0013 6.815 I know," gasped Polly, controlling her sobs; "I won't - only - I can't thank you"! +237-126133-0025 3.755 At last he came out of them, and wiped his face vigorously. 237-126133-0014 6.79 asked Phronsie in intense interest slipping down out of Polly's arms, and crowding up close to Jasper's side. +237-126133-0025 3.755 At last he came out of them, and wiped his face vigorously. 237-126133-0015 9.34 Yes, all alone by himself," asserted Jasper, vehemently, and winking furiously to the others to stop their laughing; "he did now, truly, Phronsie". +237-126133-0009 3.97 Now you'll stay," cried Van; "say, Polly, won't you". 237-126133-0016 4.25 Oh no, Jasper; I must go by my very own self". +237-126133-0021 4.365 she asked impulsively, "I didn't believe you could persuade her, father". 237-126133-0017 6.21 There Jap, you've caught it," laughed Percy; while the others screamed at the sight of Jasper's face. +237-126133-0008 3.865 asked Phronsie, with her little face close to Polly's own. 237-126133-0018 4.095 Don't mind it, Polly," whispered Jasper; "twasn't her fault". +237-126133-0025 3.755 At last he came out of them, and wiped his face vigorously. 237-126133-0019 7.12 Dear me"! ejaculated the old gentleman, in the utmost amazement; "and such a time as I've had to get her here too"! +237-126133-0025 3.755 At last he came out of them, and wiped his face vigorously. 237-126133-0021 4.365 she asked impulsively, "I didn't believe you could persuade her, father". +237-126133-0021 4.365 she asked impulsively, "I didn't believe you could persuade her, father". 237-126133-0022 5.04 I didn't have any fears, if I worked it rightly," said the old gentleman complacently. +237-126133-0021 4.365 she asked impulsively, "I didn't believe you could persuade her, father". 237-126133-0023 6.675 he cried in high dudgeon; just as if he owned the whole of the Peppers, and could dispose of them all to suit his fancy! +237-126133-0021 4.365 she asked impulsively, "I didn't believe you could persuade her, father". 237-126133-0024 9.665 And the old gentleman was so delighted with his success, that he had to burst out into a series of short, happy bits of laughter, that occupied quite a space of time. +4507-16021-0040 3.925 One thinks one hears hydras talking. 4507-16021-0003 4.895 She has a son, theft, and a daughter, hunger. +4507-16021-0012 2.735 Why should one halt on the way? 4507-16021-0005 4.21 We have never understood this sort of objections. +4507-16021-0015 3.86 Since when has malady banished medicine? 4507-16021-0011 5.615 Why should one not explore everything, and study everything? +4507-16021-0000 2.59 Chapter one Origin. 4507-16021-0014 6.115 Now, when has horror ever excluded study? +4507-16021-0007 2.63 Slang makes one shudder"! 4507-16021-0024 5.14 Algebra, medicine, botany, have each their slang. +4507-16021-0041 2.975 It is unintelligible in the dark. 4507-16021-0025 9.215 To meet the needs of this conflict, wretchedness has invented a language of combat, which is slang. +4507-16021-0050 3.895 And you belong to that small class who are happy! 4507-16021-0033 5.545 Do we really know the mountain well when we are not acquainted with the cavern? +4507-16021-0058 3.11 The flame is the enemy of the wing. 4507-16021-0035 7.535 True history being a mixture of all things, the true historian mingles in everything. +4507-16021-0028 3.265 Even dialect, let that pass! 4507-16021-0036 5.435 Facts form one of these, and ideas the other. +4507-16021-0015 3.86 Since when has malady banished medicine? 4507-16021-0037 5.35 There it clothes itself in word masks, in metaphor rags. +4507-16021-0050 3.895 And you belong to that small class who are happy! 4507-16021-0045 4.89 It is so made, that everywhere we feel the sense of punishment. +4507-16021-0012 2.735 Why should one halt on the way? 4507-16021-0046 4.59 Each day has its own great grief or its little care. +4507-16021-0050 3.895 And you belong to that small class who are happy! 4507-16021-0048 5.215 This without reckoning in the pains of the heart. And so it goes on. +4507-16021-0050 3.895 And you belong to that small class who are happy! 4507-16021-0049 5.91 There is hardly one day out of a hundred which is wholly joyous and sunny. +4507-16021-0019 2.93 It is the language of wretchedness. 4507-16021-0051 6.17 In this world, evidently the vestibule of another, there are no fortunate. +4507-16021-0007 2.63 Slang makes one shudder"! 4507-16021-0052 6.275 The real human division is this: the luminous and the shady. +4507-16021-0005 4.21 We have never understood this sort of objections. 4507-16021-0053 8.095 To diminish the number of the shady, to augment the number of the luminous,-that is the object. +4507-16021-0029 3.87 To this we reply in one word, only. 4507-16021-0054 4.315 That is why we cry: Education! science! +4507-16021-0041 2.975 It is unintelligible in the dark. 4507-16021-0055 7.225 To teach reading, means to light the fire; every syllable spelled out sparkles. +4507-16021-0040 3.925 One thinks one hears hydras talking. 4507-16021-0056 6.345 However, he who says light does not, necessarily, say joy. +4507-16021-0038 3.885 In this guise it becomes horrible. 4507-16021-0057 4.61 People suffer in the light; excess burns. +4507-16021-0015 3.86 Since when has malady banished medicine? 4507-16021-0059 6.205 To burn without ceasing to fly, therein lies the marvel of genius. +8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284447-0000 9.605 Then he rushed down stairs into the courtyard, shouting loudly for his soldiers and threatening to patch everybody in his dominions if the sailorman was not recaptured. +8555-284447-0003 4.415 But Captain Bill made no such attempt, knowing it would be useless. 8555-284447-0001 8.61 Hold him fast, my men, and as soon as I've had my coffee and oatmeal I'll take him to the Room of the Great Knife and patch him". +8555-284447-0022 3.56 I had a notion it was you, mate, as saved me from the knife. 8555-284447-0002 8.025 I wouldn't mind a cup of coffee myself," said Captain Bill. "I've had considerable exercise this morning and I'm all ready for breakfast". +8555-284447-0009 3.275 Mornin', girls; hope ye feel as well as ye look". 8555-284447-0003 4.415 But Captain Bill made no such attempt, knowing it would be useless. +8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284447-0004 5.485 As soon as they entered the Room of the Great Knife the Boolooroo gave a yell of disappointment. +8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284447-0005 6.83 The Room of the Great Knife was high and big, and around it ran rows of benches for the spectators to sit upon. +8555-284449-0005 2.555 When he finished she said cheerfully: 8555-284447-0007 6.365 Therefore her Majesty paid no attention to anyone and no one paid any attention to her. +8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284447-0008 8.39 Rich jewels of blue stones glittered upon their persons and the royal ladies were fully as gorgeous as they were haughty and overbearing. +8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284447-0013 9.04 Why, you said to fetch the first living creature we met, and that was this billygoat," replied the Captain, panting hard as he held fast to one of the goat's horns. +8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284447-0014 8.47 The idea of patching Captain Bill to a goat was vastly amusing to him, and the more he thought of it the more he roared with laughter. +8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284447-0018 5.46 At once the goat gave a leap, escaped from the soldiers and with bowed head rushed upon the Boolooroo. +8555-284447-0003 4.415 But Captain Bill made no such attempt, knowing it would be useless. 8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. +8555-284447-0022 3.56 I had a notion it was you, mate, as saved me from the knife. 8555-284447-0023 7.155 I couldn't shiver much, bein' bound so tight, but when I'm loose I mean to have jus' one good shiver to relieve my feelin's". +8555-292519-0013 4.185 That was but rustling of dripping plants in the dark. 8555-284447-0024 4.635 Come and get the Boolooroo," she said, going toward the benches. +8230-279154-0003 3.195 And what sort of evidence is logically possible? 8230-279154-0000 8.805 The analysis of knowledge will occupy us until the end of the thirteenth lecture, and is the most difficult part of our whole enterprise. +8230-279154-0032 3.88 It is this that is of interest to theory of knowledge. 8230-279154-0005 7.72 All that I am doing is to use its logical tenability as a help in the analysis of what occurs when we remember. +8230-279154-0003 3.195 And what sort of evidence is logically possible? 8230-279154-0006 7.51 The behaviourist, who attempts to make psychology a record of behaviour, has to trust his memory in making the record. +8230-279154-0008 3.62 But I do not think such an inference is warranted. 8230-279154-0011 6.25 Some images, like some sensations, feel very familiar, while others feel strange. +8230-279154-0003 3.195 And what sort of evidence is logically possible? 8230-279154-0014 7.94 I come now to the other characteristic which memory images must have in order to account for our knowledge of the past. +8230-279154-0003 3.195 And what sort of evidence is logically possible? 8230-279154-0015 8.05 They must have some characteristic which makes us regard them as referring to more or less remote portions of the past. +8230-279154-0003 3.195 And what sort of evidence is logically possible? 8230-279154-0017 7.93 There may be a specific feeling which could be called the feeling of "pastness," especially where immediate memory is concerned. +8230-279154-0003 3.195 And what sort of evidence is logically possible? 8230-279154-0020 7.835 If we had retained the "subject" or "act" in knowledge, the whole problem of memory would have been comparatively simple. +8230-279154-0003 3.195 And what sort of evidence is logically possible? 8230-279154-0021 6.56 Remembering has to be a present occurrence in some way resembling, or related to, what is remembered. +8230-279154-0012 3.64 Familiarity is a feeling capable of degrees. 8230-279154-0022 6.44 Some points may be taken as fixed, and such as any theory of memory must arrive at. +8230-279154-0032 3.88 It is this that is of interest to theory of knowledge. 8230-279154-0023 6.265 In this case, as in most others, what may be taken as certain in advance is rather vague. +8230-279154-0008 3.62 But I do not think such an inference is warranted. 8230-279154-0024 6.34 The first of our vague but indubitable data is that there is knowledge of the past. +8230-279154-0032 3.88 It is this that is of interest to theory of knowledge. 8230-279154-0026 9.3 This distinction is vital to the understanding of memory. But it is not so easy to carry out in practice as it is to draw in theory. +8230-279154-0003 3.195 And what sort of evidence is logically possible? 8230-279154-0029 8.54 The fact that a man can recite a poem does not show that he remembers any previous occasion on which he has recited or read it. +8230-279154-0008 3.62 But I do not think such an inference is warranted. 8230-279154-0030 7.28 Semon's two books, mentioned in an earlier lecture, do not touch knowledge memory at all closely. +8230-279154-0012 3.64 Familiarity is a feeling capable of degrees. 8230-279154-0035 7.555 Thus no knowledge as to the past is to be derived from the feeling of familiarity alone. +8230-279154-0003 3.195 And what sort of evidence is logically possible? 8230-279154-0039 4.59 This knowledge is memory in one sense, though in another it is not. +7021-85628-0000 3.02 But Anders cared nothing about that. 7021-79740-0001 5.995 Della had a young sister named Maria, and a cousin whose name was Jane. +7021-85628-0019 3.255 With one jump Anders got out of his chair. 7021-79740-0002 9.225 Now Delia contrived to obtain a great influence and ascendency over the minds of the children by means of these dolls. +7021-79740-0009 3.635 They were now playing with their dolls in the parlor. 7021-79740-0003 4.985 To give an idea of these conversations I will report one of them in full. +7021-79740-0012 3.26 said she, pointing to the playthings; "see! 7021-79740-0004 6.465 You have come, Andella (Andella was the name of Jane's doll), to make Rosalie a visit. +7021-85628-0019 3.255 With one jump Anders got out of his chair. 7021-79740-0006 5.965 I expect you have been a very good girl, Andella, since you were here last". +7021-79740-0012 3.26 said she, pointing to the playthings; "see! 7021-79740-0007 6.99 Then, turning to Jane, she asked, in a somewhat altered tone, "Has she been a good girl, Jane"? +7021-79740-0009 3.635 They were now playing with their dolls in the parlor. 7021-79740-0013 7.365 Put these playthings all away quick, and carefully, and we will not let them know any thing about your leaving them out". +61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. 61-70968-0000 4.905 He began a confused complaint against the wizard, who had vanished behind the curtain on the left. +61-70968-0012 2.61 Cries of: "A Nottingham! A Nottingham"! 61-70968-0003 4.315 He was like unto my father, in a way, and yet was not my father. +61-70970-0009 3.405 Tis late; and I go myself within a short space. 61-70968-0005 5.07 This was so sweet a lady, sir, and in some manner I do think she died. +61-70968-0018 2.405 So I did push this fellow". 61-70968-0009 4.51 Like as not, young master, though I am an old man". +61-70970-0033 3.42 Truly such a horse should be worth much in Nottingham Fair! 61-70968-0010 8.295 Forthwith all ran to the opening of the tent to see what might be amiss; but Master Will, who peeped out first, needed no more than one glance. +61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. 61-70968-0011 6.375 He gave way to the others very readily and retreated unperceived by the Squire and Mistress Fitzooth to the rear of the tent. +61-70970-0019 3.78 At last all was quiet and black in the courtyard of Gamewell. 61-70968-0013 4.45 Before them fled the stroller and his three sons, capless and terrified. +61-70968-0006 2.935 But then the picture was gone as quickly as it came". 61-70968-0014 7.485 What is the tumult and rioting"? cried out the Squire, authoritatively, and he blew twice on a silver whistle which hung at his belt. +61-70968-0036 2.934938 George Montfichet will never forget this day. 61-70968-0015 5.375 Nay, we refused their request most politely, most noble," said the little stroller. +61-70970-0007 4.485 He was in deep converse with the clerk, and entered the hall holding him by the arm. 61-70968-0017 5.11 I could not see my boy injured, excellence, for but doing his duty as one of Cumberland's sons. +61-70970-0023 3.705 Be not so foolish, friend," said Fitzooth, crossly. 61-70968-0019 5.475 It is enough," said George Gamewell, sharply, and he turned upon the crowd. +61-70968-0025 4.41 Come to me, men, here, here"! He raised his voice still louder. 61-70968-0020 5.105 Shame on you, citizens," cried he; "I blush for my fellows of Nottingham. +61-70968-0048 3.02 And Henry might return to England at any moment. 61-70968-0022 4.67 Tis fine for you to talk, old man," answered the lean, sullen apprentice. +61-70970-0033 3.42 Truly such a horse should be worth much in Nottingham Fair! 61-70968-0023 5.025 But I wrestled with this fellow and do know that he played unfairly in the second bout. +61-70970-0032 3.135 enquired Robin, with his suspicions still upon him. 61-70968-0024 6.025 spoke the Squire, losing all patience; "and it was to you that I gave another purse in consolation! +61-70970-0003 3.835 If, for a whim, you beggar yourself, I cannot stay you. 61-70968-0025 4.41 Come to me, men, here, here"! He raised his voice still louder. +61-70970-0040 4.165 They regained their apartment, apparently without disturbing the household of Gamewell. 61-70968-0026 4.92 The strollers took their part in it with hearty zest now that they had some chance of beating off their foes. +61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. 61-70968-0027 6.87 Robin and the little tumbler between them tried to force the Squire to stand back, and very valiantly did these two comport themselves. +61-70968-0046 3.55 Nottingham Castle was reached, and admittance was demanded. 61-70968-0030 5.685 Now, be silent, on your lives," he began; but the captured apprentice set up an instant shout. +61-70968-0029 3.495 The Squire helped to thrust them all in and entered swiftly himself. 61-70968-0032 4.28 He felt for and found the wizard's black cloth. The Squire was quite out of breath. +61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. 61-70968-0033 5.685 Thrusting open the proper entrance of the tent, Robin suddenly rushed forth with his burden, with a great shout. +61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. 61-70968-0035 7.95 Taking advantage of this, the Squire's few men redoubled their efforts, and, encouraged by Robin's and the little stroller's cries, fought their way to him. +61-70968-0036 2.934938 George Montfichet will never forget this day. 61-70968-0037 4.315 What is your name, lording"? asked the little stroller, presently. +61-70970-0022 3.97 Robin entered the hut, dragging the unwilling esquire after him. 61-70968-0041 6.825 I like you, Will; you are the second Will that I have met and liked within two days; is there a sign in that"? +61-70968-0003 4.315 He was like unto my father, in a way, and yet was not my father. 61-70968-0043 6.735 Friends," said Montfichet, faintly, to the wrestlers, "bear us escort so far as the Sheriff's house. +61-70970-0013 4.35 There was no chance to alter his sleeping room to one nearer to Gamewell's chamber. 61-70968-0047 4.775 Master Monceux, the Sheriff of Nottingham, was mightily put about when told of the rioting. +61-70968-0048 3.02 And Henry might return to England at any moment. 61-70968-0049 8.25 Have your will, child, if the boy also wills it," Montfichet answered, feeling too ill to oppose anything very strongly just then. +61-70968-0042 2.785 Montfichet called out for Robin to give him an arm. 61-70968-0050 5.58 He made an effort to hide his condition from them all, and Robin felt his fingers tighten upon his arm. +61-70970-0030 3.24 Save me, masters, but you startled me rarely"! 61-70968-0053 4.22 He is my esquire, excellency," returned Robin, with dignity. +61-70970-0040 4.165 They regained their apartment, apparently without disturbing the household of Gamewell. 61-70968-0054 7.86 Mistress Fitzooth had been carried off by the Sheriff's daughter and her maids as soon as they had entered the house, so that Robin alone had the care of Montfichet. +61-70968-0012 2.61 Cries of: "A Nottingham! A Nottingham"! 61-70968-0057 5.065 These escapades are not for old Gamewell, lad; his day has come to twilight. +61-70968-0048 3.02 And Henry might return to England at any moment. 61-70968-0061 5.53 You are a worthy leech, Will," presently whispered Robin. "The wine has worked a marvel. +8224-274384-0003 3.87 or hath he given us any gift? 8224-274384-0002 9.815 They informed the English parliament of this unexpected incident, and assured them that they had entered into no private treaty with the king. +8224-274384-0003 3.87 or hath he given us any gift? 8224-274384-0005 8.745 Another preacher, after reproaching him to his face with his misgovernment, ordered this psalm to be sung: +8224-274384-0003 3.87 or hath he given us any gift? 8224-274384-0006 6.81 The king stood up, and called for that psalm which begins with these words, +8224-274384-0003 3.87 or hath he given us any gift? 8224-274384-0007 6.23 Have mercy, Lord, on me, I pray; For men would me devour". +8224-274384-0003 3.87 or hath he given us any gift? 8224-274384-0009 4.805 The parliament and the Scots laid their proposals before the king. +8224-274384-0003 3.87 or hath he given us any gift? 8224-274384-0013 5.44 His death, in this conjuncture, was a public misfortune. +6829-68771-0035 4.39 Will you leave me alone in my own room, or must I go away to escape you"? 6829-68769-0001 9.315 It was a serious crime indeed, mister Watson told them, and Tom Gates bade fair to serve a lengthy term in state's prison as a consequence of his rash act. +6829-68769-0046 2.57 You're foolish. Why should you do all this"? 6829-68769-0003 4.215 It was a deliberate theft from his employers to protect a girl he loved. +6829-68769-0007 3.865 But under the circumstances I doubt if such an arrangement could be made". 6829-68769-0004 7.145 But they could not have proven a case against Lucy, if she was innocent, and all their threats of arresting her were probably mere bluff. +6829-68769-0044 3.225 It has cost me twice sixty dollars in annoyance". 6829-68769-0005 6.72 He was soft hearted and impetuous," said Beth; "and, being in love, he didn't stop to count the cost". +6829-68769-0022 4.115 We have heard something of your story," said Kenneth, "and are interested in it. 6829-68769-0006 7.195 If the prosecution were withdrawn and the case settled with the victim of the forged check, then the young man would be allowed his freedom. +6829-68769-0022 4.115 We have heard something of your story," said Kenneth, "and are interested in it. 6829-68769-0009 4.22 They were received in the little office by a man named Markham, who was the jailer. +6829-68769-0003 4.215 It was a deliberate theft from his employers to protect a girl he loved. 6829-68769-0011 4.685 I'm running for Representative on the Republican ticket," said Kenneth, quietly. +6829-68769-0039 4.045 He looked up rather ungraciously, but motioned them to be seated. 6829-68769-0012 4.295 Oh, say! that's different," observed Markham, altering his demeanor. +6829-68769-0003 4.215 It was a deliberate theft from his employers to protect a girl he loved. 6829-68769-0015 6.525 Sometimes I'm that yearning for a smoke I'm nearly crazy, an' I don't know which is worst, dying one way or another. +6829-68769-0037 2.53 I've seen lots of that kind in my day. 6829-68769-0016 4.12 He unlocked the door, and called: "Here's visitors, Tom". +6829-68771-0028 3.555 She even seemed mildly amused at the attention she attracted. 6829-68769-0020 5.125 Sit down, please," said Gates, in a cheerful and pleasant voice. "There's a bench here". +6829-68769-0002 3.075 I can't see it in that light," said the old lawyer. 6829-68769-0021 7.895 A fresh, wholesome looking boy, was Tom Gates, with steady gray eyes, an intelligent forehead, but a sensitive, rather weak mouth. +6829-68769-0009 4.22 They were received in the little office by a man named Markham, who was the jailer. 6829-68769-0022 4.115 We have heard something of your story," said Kenneth, "and are interested in it. +6829-68771-0028 3.555 She even seemed mildly amused at the attention she attracted. 6829-68769-0023 4.89 I didn't stop to think whether it was foolish or not. I did it; and I'm glad I did". +6829-68769-0007 3.865 But under the circumstances I doubt if such an arrangement could be made". 6829-68769-0025 5.735 Then Rogers wouldn't do anything but lead her around, and wait upon her, and the place went to rack and ruin". +6829-68769-0051 3.545 There was a grim smile of amusement on his shrewd face. 6829-68769-0026 4.64 He spoke simply, but paced up and down the narrow cell in front of them. +6829-68769-0012 4.295 Oh, say! that's different," observed Markham, altering his demeanor. 6829-68769-0030 4.91 I was bookkeeper, so it was easy to get a blank check and forge the signature. +6829-68769-0037 2.53 I've seen lots of that kind in my day. 6829-68769-0031 5.555 As regards my robbing the company, I'll say that I saved them a heavy loss one day. +6829-68769-0007 3.865 But under the circumstances I doubt if such an arrangement could be made". 6829-68769-0032 5.72 I discovered and put out a fire that would have destroyed the whole plant. But Marshall never even thanked me. +6829-68769-0019 2.665 Sorry we haven't any reception room in the jail. 6829-68769-0033 4.02 It was better for him to think the girl unfeeling than to know the truth. +6829-68769-0019 2.665 Sorry we haven't any reception room in the jail. 6829-68769-0034 6.055 I'm going to see mister Marshall," said Kenneth, "and discover what I can do to assist you". "Thank you, sir. +6829-68771-0035 4.39 Will you leave me alone in my own room, or must I go away to escape you"? 6829-68769-0036 5.555 They left him then, for the jailer arrived to unlock the door, and escort them to the office. +6829-68769-0017 3.545 Worse, Tom; worse 'n ever," replied the jailer, gloomily. 6829-68769-0039 4.045 He looked up rather ungraciously, but motioned them to be seated. +6829-68771-0028 3.555 She even seemed mildly amused at the attention she attracted. 6829-68769-0040 4.77 Some girl has been here twice to interview my men and I have refused to admit her. +6829-68769-0012 4.295 Oh, say! that's different," observed Markham, altering his demeanor. 6829-68769-0049 7.4 He detested the grasping disposition that would endeavor to take advantage of his evident desire to help young Gates. +6829-68769-0010 3.14 We wish to talk with him," answered Kenneth. "Talk! 6829-68769-0052 4.6 He might have had that forged check for the face of it, if he'd been sharp. +6829-68769-0051 3.545 There was a grim smile of amusement on his shrewd face. 6829-68769-0053 6.36 And to think we can save all that misery and despair by the payment of a hundred and fifty dollars! +5142-33396-0015 4.31 As our boat flashed down the rollers into the water I made this song and sang it: 5142-36586-0003 5.055 But this subject will be more properly discussed when we treat of the different races of mankind. +3570-5694-0019 3.755 But the general distinction is not on that account to be overlooked. 3570-5696-0002 7.51 Other circumstances permitting, that instinct disposes men to look with favor upon productive efficiency and on whatever is of human use. +3570-5694-0012 3.205 There is a more or less elaborate system of rank and grades. 3570-5696-0004 4.7 The salient features of this development of domestic service have already been indicated. +3570-5694-0012 3.205 There is a more or less elaborate system of rank and grades. 3570-5696-0006 4.16 As used in the speech of everyday life the word carries an undertone of deprecation. +3570-5694-0019 3.755 But the general distinction is not on that account to be overlooked. 3570-5696-0007 9.5 The use of the word "waste" as a technical term, therefore, implies no deprecation of the motives or of the ends sought by the consumer under this canon of conspicuous waste. +3570-5696-0006 4.16 As used in the speech of everyday life the word carries an undertone of deprecation. 3570-5696-0008 7.26 But it is, on other grounds, worth noting that the term "waste" in the language of everyday life implies deprecation of what is characterized as wasteful. +3570-5694-0012 3.205 There is a more or less elaborate system of rank and grades. 3570-5696-0009 8.86 In strict accuracy nothing should be included under the head of conspicuous waste but such expenditure as is incurred on the ground of an invidious pecuniary comparison. +3570-5694-0012 3.205 There is a more or less elaborate system of rank and grades. 3570-5696-0010 7.57 An article may be useful and wasteful both, and its utility to the consumer may be made up of use and waste in the most varying proportions. +2830-3980-0042 3.02 The world brands this a pernicious doctrine. 2830-3980-0005 6.45 Do you suppose that God for the sake of a few Lutheran heretics would disown His entire Church? +2830-3980-0071 3.96 We think that by some little work or merit we can dismiss sin. 2830-3980-0006 6.41 Against these boasting, false apostles, Paul boldly defends his apostolic authority and ministry. +2830-3980-0046 2.84 Was it not enough to say, "from God the Father"? 2830-3980-0008 4.84 Paul takes pride in his ministry, not to his own praise but to the praise of God. +2830-3980-0028 3.54 This should go far in shutting the mouths of the false apostles. 2830-3980-0010 6.525 Either He calls ministers through the agency of men, or He calls them directly as He called the prophets and apostles. +2830-3980-0071 3.96 We think that by some little work or merit we can dismiss sin. 2830-3980-0011 5.525 Paul declares that the false apostles were called or sent neither by men, nor by man. +2830-3980-0028 3.54 This should go far in shutting the mouths of the false apostles. 2830-3980-0013 4.145 He mentions the apostles first because they were appointed directly by God. +2830-3980-0017 3.665 When I was a young man I thought Paul was making too much of his call. 2830-3980-0019 7.015 I knew nothing of the doctrine of faith because we were taught sophistry instead of certainty, and nobody understood spiritual boasting. +2830-3980-0021 2.91 and God the Father, who raised him from the dead. 2830-3980-0023 6.16 These perverters of the righteousness of Christ resist the Father and the Son, and the works of them both. +2830-3980-0020 3.46 This is no sinful pride. It is holy pride. 2830-3980-0025 8.795 By His resurrection Christ won the victory over law, sin, flesh, world, devil, death, hell, and every evil. +2830-3980-0042 3.02 The world brands this a pernicious doctrine. 2830-3980-0029 9.075 Although the brethren with me are not apostles like myself, yet they are all of one mind with me, think, write, and teach as I do". +2830-3980-0000 3.73 In every way they sought to undermine the authority of Saint Paul. 2830-3980-0030 5.25 They do not go where the enemies of the Gospel predominate. They go where the Christians are. +2830-3980-0000 3.73 In every way they sought to undermine the authority of Saint Paul. 2830-3980-0031 8.485 Why do they not invade the Catholic provinces and preach their doctrine to godless princes, bishops, and doctors, as we have done by the help of God? +2830-3980-0042 3.02 The world brands this a pernicious doctrine. 2830-3980-0032 7.22 We look for that reward which "eye hath not seen, nor ear heard, neither hath entered into the heart of man". +2830-3980-0000 3.73 In every way they sought to undermine the authority of Saint Paul. 2830-3980-0036 5.765 Wherever the means of grace are found, there is the Holy Church, even though Antichrist reigns there. +2830-3980-0058 2.69 Mohammed also speaks highly of Christ. 2830-3980-0037 6.42 So much for the title of the epistle. Now follows the greeting of the apostle. VERSE three. +2830-3980-0042 3.02 The world brands this a pernicious doctrine. 2830-3980-0038 5.54 Grace be to you, and peace, from God the Father, and from our Lord Jesus Christ. +2830-3980-0000 3.73 In every way they sought to undermine the authority of Saint Paul. 2830-3980-0039 5.195 The terms of grace and peace are common terms with Paul and are now pretty well understood. +2830-3980-0064 2.88 How may we obtain remission of our sins? 2830-3980-0041 4.89 Grace involves the remission of sins, peace, and a happy conscience. +2830-3980-0024 3.935 In this whole epistle Paul treats of the resurrection of Christ. 2830-3980-0047 7.865 To do so is to lose God altogether because God becomes intolerable when we seek to measure and to comprehend His infinite majesty. +2830-3980-0071 3.96 We think that by some little work or merit we can dismiss sin. 2830-3980-0050 7.475 Did not Christ Himself say: "I am the way, and the truth, and the life: no man cometh unto the Father, but by me"? +2830-3980-0001 3.945 They said to the Galatians: "You have no right to think highly of Paul. 2830-3980-0051 6.44 When you argue about the nature of God apart from the question of justification, you may be as profound as you like. +2830-3980-0046 2.84 Was it not enough to say, "from God the Father"? 2830-3980-0052 4.88 We are to hear Christ, who has been appointed by the Father as our divine Teacher. +2830-3980-0003 2.48 Paul came later and is beneath us. 2830-3980-0053 5.015 At the same time, Paul confirms our creed, "that Christ is very God". +2830-3980-0071 3.96 We think that by some little work or merit we can dismiss sin. 2830-3980-0055 7.335 To bestow peace and grace lies in the province of God, who alone can create these blessings. The angels cannot. +2830-3980-0060 2.675 He never loses sight of the purpose of his epistle. 2830-3980-0056 5.35 Otherwise Paul should have written: "Grace from God the Father, and peace from our Lord Jesus Christ". +2830-3980-0040 2.62 The greeting of the Apostle is refreshing. 2830-3980-0057 8.07 The Arians took Christ for a noble and perfect creature, superior even to the angels, because by Him God created heaven and earth. +2830-3979-0012 3.625 The Word of our God shall stand forever. 2830-3980-0061 7.12 Not gold, or silver, or paschal lambs, or an angel, but Himself. What for? +2830-3980-0034 2.97 These means cannot be contaminated. 2830-3980-0062 5.44 Not for a crown, or a kingdom, or our goodness, but for our sins. +2830-3980-0045 3.51 Men Should Not Speculate About the Nature of God 2830-3980-0063 5.415 Underscore these words, for they are full of comfort for sore consciences. +2830-3980-0042 3.02 The world brands this a pernicious doctrine. 2830-3980-0065 6.515 Paul answers: "The man who is named Jesus Christ and the Son of God gave himself for our sins". +2830-3980-0021 2.91 and God the Father, who raised him from the dead. 2830-3980-0066 6.085 Since Christ was given for our sins it stands to reason that they cannot be put away by our own efforts. +2830-3980-0071 3.96 We think that by some little work or merit we can dismiss sin. 2830-3980-0067 8.13 This sentence also defines our sins as great, so great, in fact, that the whole world could not make amends for a single sin. +2830-3980-0045 3.51 Men Should Not Speculate About the Nature of God 2830-3980-0068 5 The greatness of the ransom, Christ, the Son of God, indicates this. +2830-3980-0040 2.62 The greeting of the Apostle is refreshing. 2830-3980-0069 5.555063 The vicious character of sin is brought out by the words "who gave himself for our sins". +2830-3980-0042 3.02 The world brands this a pernicious doctrine. 2830-3980-0072 4.855 This passage, then, bears out the fact that all men are sold under sin. +2830-3980-0060 2.675 He never loses sight of the purpose of his epistle. 2830-3980-0074 5.7 This attitude is universal and particularly developed in those who consider themselves better than others. +2830-3980-0042 3.02 The world brands this a pernicious doctrine. 2830-3980-0075 5.79 But the real significance and comfort of the words "for our sins" is lost upon them. +2830-3980-0046 2.84 Was it not enough to say, "from God the Father"? 2830-3980-0076 4.81 On the other hand, we are not to regard them as so terrible that we must despair. +5105-28241-0014 2.995 Another circumstance was most remarkable. 5105-28233-0000 4.51 Length of service: Fourteen years, three months, and five days. +5105-28240-0018 2.885 You will take me on board, count, will you not"? 5105-28233-0001 4.49 He seemed born to please without being conscious of the power he possessed. +5105-28240-0018 2.885 You will take me on board, count, will you not"? 5105-28233-0002 8.285 It must be owned, and no one was more ready to confess it than himself, that his literary attainments were by no means of a high order. +5105-28233-0001 4.49 He seemed born to please without being conscious of the power he possessed. 5105-28233-0004 4.735 Once, in action, he was leading a detachment of infantry through an intrenchment. +5105-28241-0003 3.98 Steam up and canvas spread, the schooner started eastwards. 5105-28233-0006 5.505 No cathedral - not even Burgos itself - could vie with the church at Montmartre. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0000 4.665 Socrates begins the Timaeus with a summary of the Republic. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0001 9.185 And now he desires to see the ideal State set in motion; he would like to know how she behaved in some great struggle. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0003 4.73 I will, if Timaeus approves'. 'I approve. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0006 4.6 And what was the subject of the poem'? said the person who made the remark. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0007 8.505 The subject was a very noble one; he described the most famous action in which the Athenian people were ever engaged. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0008 7.155 But the memory of their exploits has passed away owing to the lapse of time and the extinction of the actors. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0009 5.705 Tell us,' said the other, 'the whole story, and where Solon heard the story. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0010 7.83 But in Egypt the traditions of our own and other lands are by us registered for ever in our temples. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0011 7.815 The genealogies which you have recited to us out of your own annals, Solon, are a mere children's story. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0013 5.12 Solon marvelled, and desired to be informed of the particulars. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0014 9.565 Nine thousand years have elapsed since she founded yours, and eight thousand since she founded ours, as our annals record. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0015 6.815 Many laws exist among us which are the counterpart of yours as they were in the olden time. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0016 7.815 I will briefly describe them to you, and you shall read the account of them at your leisure in the sacred registers. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0017 9.73 Observe again, what care the law took in the pursuit of wisdom, searching out the deep things of the world, and applying them to the use of man. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0018 5.29 The most famous of them all was the overthrow of the island of Atlantis. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0020 6.125 This is the explanation of the shallows which are found in that part of the Atlantic ocean. +2961-961-0005 3.775 Some poems of Solon were recited by the boys. 2961-961-0021 4.94 But I would not speak at the time, because I wanted to refresh my memory. +1995-1837-0015 4.485 The squares of cotton, sharp edged, heavy, were just about to burst to bolls! 1995-1837-0001 8.73 It was the first great sorrow of his life; it was not so much the loss of the cotton itself - but the fantasy, the hopes, the dreams built around it. +1995-1837-0015 4.485 The squares of cotton, sharp edged, heavy, were just about to burst to bolls! 1995-1837-0003 7.36 The revelation of his love lighted and brightened slowly till it flamed like a sunrise over him and left him in burning wonder. +1995-1826-0008 2.895 Some others, too; big cotton county". 1995-1837-0004 6.36 He panted to know if she, too, knew, or knew and cared not, or cared and knew not. +1995-1837-0005 2.635 She was so strange and human a creature. 1995-1837-0007 8.8 Then of a sudden, at midday, the sun shot out, hot and still; no breath of air stirred; the sky was like blue steel; the earth steamed. +1995-1837-0009 3.76 The lagoon had been level with the dykes a week ago; and now? 1995-1837-0012 8.245 He splashed and stamped along, farther and farther onward until he neared the rampart of the clearing, and put foot upon the tree bridge. +1995-1826-0003 3.09 Better go," he had counselled, sententiously. 1995-1837-0016 7.19 For one long moment he paused, stupid, agape with utter amazement, then leaned dizzily against a tree. +1995-1837-0013 3.195 Then he looked down. The lagoon was dry. 1995-1837-0019 5.38 He sat down weak, bewildered, and one thought was uppermost - Zora! +1995-1836-0007 3.435 But you believe in some education"? asked Mary Taylor. 1995-1837-0024 5.385 For a while she lay in her chair, in happy, dreamy pleasure at sun and bird and tree. +1995-1836-0007 3.435 But you believe in some education"? asked Mary Taylor. 1995-1837-0025 9.505062 She rose with a fleeting glance, gathered the shawl round her, then gliding forward, wavering, tremulous, slipped across the road and into the swamp. +1995-1837-0021 3.09 The hope and dream of harvest was upon the land. 1995-1837-0026 8.095 She had been born within its borders; within its borders she had lived and grown, and within its borders she had met her love. +1995-1826-0003 3.09 Better go," he had counselled, sententiously. 1995-1837-0027 6.705 On she hurried until, sweeping down to the lagoon and the island, lo! the cotton lay before her! +1995-1826-0025 3.295 Some time you'll tell me, please, won't you"? 1995-1837-0029 5.58 He darted through the trees and paused, a tall man strongly but slimly made. +5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". 5639-40744-0002 8.91 Rodolfo and his companions, with their faces muffled in their cloaks, stared rudely and insolently at the mother, the daughter, and the servant maid. +5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". 5639-40744-0005 5.645 Finally, the one party went off exulting, and the other was left in desolation and woe. +5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". 5639-40744-0006 8.045 Rodolfo arrived at his own house without any impediment, and Leocadia's parents reached theirs heart broken and despairing. +5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". 5639-40744-0007 5.825 Meanwhile Rodolfo had Leocadia safe in his custody, and in his own apartment. +5639-40744-0011 2.665 She found the door, but it was locked outside. 5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". +5639-40744-0011 2.665 She found the door, but it was locked outside. 5639-40744-0012 8.595 She succeeded in opening the window; and the moonlight shone in so brightly, that she could distinguish the colour of some damask hangings in the room. +5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". 5639-40744-0013 6.865 She saw that the bed was gilded, and so rich, that it seemed that of a prince rather than of a private gentleman. +5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". 5639-40744-0014 7.72 Among other things on which she cast her eyes was a small crucifix of solid silver, standing on a cabinet near the window. +5639-40744-0011 2.665 She found the door, but it was locked outside. 5639-40744-0016 9.49 On the contrary, he resolved to tell them, that repenting of his violence, and moved by her tears, he had only carried her half way towards his house, and then let her go. +5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". 5639-40744-0017 5.88 Choking with emotion, Leocadi made a sign to her parents that she wished to be alone with them. +5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". 5639-40744-0020 9.82 Thus did this humane and right minded father comfort his unhappy daughter; and her mother embracing her again did all she could to soothe her feelings. +5639-40744-0011 2.665 She found the door, but it was locked outside. 5639-40744-0024 8.845 One day, when the boy was sent by his grandfather with a message to a relation, he passed along a street in which there was a great concourse of horsemen. +5639-40744-0011 2.665 She found the door, but it was locked outside. 5639-40744-0025 8.785 The bed she too well remembered was there; and, above all, the cabinet, on which had stood the image she had taken away, was still on the same spot. +5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". 5639-40744-0029 7.305 This truth which I have learned from her lips is confirmed by his face, in which we have both beheld that of our son". +5639-40744-0010 4.12 It is the only amends I ask of you for the wrong you have done me". 5639-40744-0033 9.15 Her bearing was graceful and animated; she led her son by the hand, and before her walked two maids with wax lights and silver candlesticks. +260-123440-0003 3.585 Oh! won't she be savage if I've kept her waiting"! 260-123440-0010 8.315 How cheerfully he seems to grin, How neatly spread his claws, And welcome little fishes in With gently smiling jaws"! +260-123440-0003 3.585 Oh! won't she be savage if I've kept her waiting"! 260-123440-0011 4.87 No, I've made up my mind about it; if I'm Mabel, I'll stay down here! +260-123288-0019 2.955 At noon the violence of the storm redoubles. 260-123440-0012 5.245 It'll be no use their putting their heads down and saying 'Come up again, dear! +260-123286-0022 3.235 Two hours afterwards a terrible shock awoke me. 260-123440-0015 6.2 I wish I hadn't cried so much"! said Alice, as she swam about, trying to find her way out. +260-123286-0024 3.04 There's a whale, a whale"! cried the Professor. 260-123440-0016 4.895 I shall be punished for it now, I suppose, by being drowned in my own tears! +260-123288-0009 3.435 Those clouds seem as if they were going to crush the sea". 260-123440-0019 6.63 cried Alice again, for this time the Mouse was bristling all over, and she felt certain it must be really offended. +260-123440-0018 3.64 I am very tired of swimming about here, O Mouse"! 260-123440-0020 4.995 We won't talk about her any more if you'd rather not". "We indeed"! +2300-131720-0006 4.12 There seems no good reason for believing that it will change. 2300-131720-0000 5.08 The Paris plant, like that at the Crystal Palace, was a temporary exhibit. +2300-131720-0014 3.75 mister Edison was a leader far ahead of the time. 2300-131720-0005 6.9 Why, if we erect a station at the falls, it is a great economy to get it up to the city. +2300-131720-0041 3.75 We had meters in which there were two bottles of liquid. 2300-131720-0006 4.12 There seems no good reason for believing that it will change. +2300-131720-0014 3.75 mister Edison was a leader far ahead of the time. 2300-131720-0008 9.125 Everything he has done has been aimed at the conservation of energy, the contraction of space, the intensification of culture. +2300-131720-0041 3.75 We had meters in which there were two bottles of liquid. 2300-131720-0009 9.605 For some years it was not found feasible to operate motors on alternating current circuits, and that reason was often urged against it seriously. +2300-131720-0006 4.12 There seems no good reason for believing that it will change. 2300-131720-0015 8.875 He obtained the desired speed and load with a friction brake; also regulator of speed; but waited for an indicator to verify it. +2300-131720-0041 3.75 We had meters in which there were two bottles of liquid. 2300-131720-0024 4.77 But the plant ran, and it was the first three wire station in this country". +2300-131720-0014 3.75 mister Edison was a leader far ahead of the time. 2300-131720-0027 8.62 Edison held that the electricity sold must be measured just like gas or water, and he proceeded to develop a meter. +2300-131720-0014 3.75 mister Edison was a leader far ahead of the time. 2300-131720-0029 6.425 Hence the Edison electrolytic meter is no longer used, despite its excellent qualities. +2300-131720-0006 4.12 There seems no good reason for believing that it will change. 2300-131720-0030 9.98 The principle employed in the Edison electrolytic meter is that which exemplifies the power of electricity to decompose a chemical substance. +2300-131720-0041 3.75 We had meters in which there were two bottles of liquid. 2300-131720-0034 8.605 the others having been in operation too short a time to show definite results, although they also went quickly to a dividend basis. +2300-131720-0014 3.75 mister Edison was a leader far ahead of the time. 2300-131720-0037 7.965 He weighed and reweighed the meter plates, and pursued every line of investigation imaginable, but all in vain. +2300-131720-0041 3.75 We had meters in which there were two bottles of liquid. 2300-131720-0038 5.61 He felt he was up against it, and that perhaps another kind of a job would suit him better. +2300-131720-0041 3.75 We had meters in which there were two bottles of liquid. 2300-131720-0040 5.455 We were more interested in the technical condition of the station than in the commercial part. +908-157963-0002 2.755 why fades the lotus of the water? 908-31957-0002 4.79 I did not wrong myself so, but I placed A wrong on thee. +908-157963-0018 4.255 And fearest thou because I vanish and am seen no more. 908-31957-0003 6.565 When called before, I told how hastily I dropped my flowers or brake off from a game. +908-157963-0001 2.885 O life of this our spring! 908-31957-0005 4.49 Alas, I have grieved so I am hard to love. +908-31957-0018 3.915 But thou art not such A lover, my Beloved! 908-31957-0006 5.89 Open thy heart wide, And fold within, the wet wings of thy dove. +908-157963-0002 2.755 why fades the lotus of the water? 908-31957-0007 5.8 Could it mean To last, a love set pendulous between Sorrow and sorrow? +908-157963-0029 3.63 Why a Tongue impressed with honey from every wind? 908-31957-0009 7.705 And, though I have grown serene And strong since then, I think that God has willed A still renewable fear... +908-31957-0005 4.49 Alas, I have grieved so I am hard to love. 908-31957-0012 7.615 if he, to keep one oath, Must lose one joy, by his life's star foretold. +908-157963-0002 2.755 why fades the lotus of the water? 908-31957-0013 6.18 Slow to world greetings, quick with its "O, list," When the angels speak. +908-157963-0024 3.44 image of weakness, art thou but a Worm? 908-31957-0014 7.56 A ring of amethyst I could not wear here, plainer to my sight, Than that first kiss. +908-31957-0005 4.49 Alas, I have grieved so I am hard to love. 908-31957-0016 6.48 Dearest, teach me so To pour out gratitude, as thou dost, good! +908-31957-0018 3.915 But thou art not such A lover, my Beloved! 908-31957-0017 7.795 Mussulmans and Giaours Throw kerchiefs at a smile, and have no ruth For any weeping. +908-157963-0002 2.755 why fades the lotus of the water? 908-31957-0019 9.54 thou canst wait Through sorrow and sickness, to bring souls to touch, And think it soon when others cry "Too late". +908-157963-0013 4.315 And why it scatters its bright beauty thro the humid air. 908-31957-0020 5.895 I thank all who have loved me in their hearts, With thanks and love from mine. +908-31957-0018 3.915 But thou art not such A lover, my Beloved! 908-31957-0023 8.515 I love thee freely, as men strive for Right; I love thee purely, as they turn from Praise. +908-157963-0002 2.755 why fades the lotus of the water? 908-31957-0024 7.54 I love thee with the passion put to use In my old griefs, and with my childhood's faith. +4992-41797-0016 3.3 They couldn't run nor move; they're just pasteboard". 4992-41806-0001 8.31 To night there was no need of extra heat, and there were great ceremonies to be observed in lighting the fires on the hearthstones. +4992-41797-0016 3.3 They couldn't run nor move; they're just pasteboard". 4992-41806-0003 9.24 Kathleen waved the torch to and fro as she recited some beautiful lines written for some such purpose as that which called them together to night. +4992-41797-0016 3.3 They couldn't run nor move; they're just pasteboard". 4992-41806-0009 4.355 exclaimed Bill Harmon to his wife as they went through the lighted hall. +4992-23283-0007 4.045 To ask any more questions of you, I believe, would be unfair. 4992-41806-0011 7.84 Mother Carey poured coffee, Nancy chocolate, and the others helped serve the sandwiches and cake, doughnuts and tarts. +4992-23283-0016 4.495 Again he searched his own thoughts; nor ineffectually as before. 4992-41806-0012 6.73 At that moment the gentleman entered, bearing a huge object concealed by a piece of green felt. +4992-41797-0016 3.3 They couldn't run nor move; they're just pasteboard". 4992-41806-0013 6.02 Approaching the dining table, he carefully placed the article in the centre and removed the cloth. +7021-85628-0004 2.805 Yes, why not"? thought Anders. 7021-85628-0002 6.455 He was such a big boy that he wore high boots and carried a jack knife. +7021-85628-0006 3.58 I am going to the court ball," answered Anders. 7021-85628-0005 5.015 Seeing that I am so fine, I may as well go and visit the King". +7021-85628-0025 2.775 But his mother hugged him close. 7021-85628-0008 7.125 For, like as not, they must have thought him a prince when they saw his fine cap. +7021-79759-0001 2.48 That is comparatively nothing. 7021-85628-0009 8.54 At the farther end of the largest hall a table was set with golden cups and golden plates in long rows. +7021-85628-0019 3.255 With one jump Anders got out of his chair. 7021-85628-0010 8.015 On huge silver platters were pyramids of tarts and cakes, and red wine sparkled in glittering decanters. +7021-79740-0012 3.26 said she, pointing to the playthings; "see! 7021-85628-0011 8.995 The Princess sat down under a blue canopy with bouquets of roses; and she let Anders sit in a golden chair by her side. +7021-79740-0009 3.635 They were now playing with their dolls in the parlor. 7021-85628-0012 5.33 But you must not eat with your cap on your head," she said, and was going to take it off. +7021-85628-0026 2.74 No, my little son," she said. 7021-85628-0016 4.28 That is a very fine cap you have," he said. +7021-79740-0012 3.26 said she, pointing to the playthings; "see! 7021-85628-0018 8.22 And it is made of mother's best yarn, and she knitted it herself, and everybody wants to get it away from me". +7021-79740-0012 3.26 said she, pointing to the playthings; "see! 7021-85628-0020 6.45 He darted like an arrow through all the halls, down all the stairs, and across the yard. +7021-79740-0009 3.635 They were now playing with their dolls in the parlor. 7021-85628-0021 5.365 He still held on to it with both hands as he rushed into his mother's cottage. +7021-79740-0009 3.635 They were now playing with their dolls in the parlor. 7021-85628-0022 5.145 And all his brothers and sisters stood round and listened with their mouths open. +7021-79740-0009 3.635 They were now playing with their dolls in the parlor. 7021-85628-0023 9.03 But when his big brother heard that he had refused to give his cap for a King's golden crown, he said that Anders was a stupid. +7021-85628-0019 3.255 With one jump Anders got out of his chair. 7021-85628-0027 8.5 If you dressed in silk and gold from top to toe, you could not look any nicer than in your little red cap". +1284-1181-0007 4.04 She poured into the dish a quantity from each of these bottles. 1284-134647-0000 8.53 The grateful applause of the clergy has consecrated the memory of a prince who indulged their passions and promoted their interest. +4970-29095-0011 3.355 Does thee think thee could stand it six months? 4970-29095-0002 5.48 Well, mother," said the young student, looking up, with a shade of impatience. +4970-29095-0006 4.47 Is thy father willing thee should go away to a school of the world's people"? 4970-29095-0004 9.61 I heard father tell cousin Abner that he was whipped so often for whistling when he was a boy that he was determined to have what compensation he could get now". +4970-29095-0014 3.26 Where thee and thy family are known"? 4970-29095-0005 4.65 Thy ways greatly try me, Ruth, and all thy relations. +4970-29093-0015 3.325 You can begin by carrying a rod, and putting down the figures. 4970-29095-0006 4.47 Is thy father willing thee should go away to a school of the world's people"? +4970-29095-0014 3.26 Where thee and thy family are known"? 4970-29095-0009 5.6 Margaret Bolton almost lost for a moment her habitual placidity. +4970-29095-0000 2.865 She was tired of other things. 4970-29095-0012 4.68 And, besides, suppose thee does learn medicine"? +4970-29095-0014 3.26 Where thee and thy family are known"? 4970-29095-0016 6.945 Ruth sat quite still for a time, with face intent and flushed. It was out now. +4970-29095-0011 3.355 Does thee think thee could stand it six months? 4970-29095-0022 4.765 Is thee going to the Yearly Meeting, Ruth"? asked one of the girls. +4970-29093-0000 3.03 You'll never dig it out of the Astor Library". 4970-29095-0024 6.04 It has occupied mother a long time, to find at the shops the exact shade for her new bonnet. +4970-29093-0017 2.865 I've been ready to go anywhere for six months. 4970-29095-0027 9.795 It's such a crush at the Yearly Meeting at Arch Street, and then there's the row of sleek looking young men who line the curbstone and stare at us as we come out. +4970-29093-0008 3.58 He wanted to begin at the top of the ladder. 4970-29095-0030 4.67 Father, thee's unjust to Philip. He's going into business". +4970-29095-0017 3.93 The sight seers returned in high spirits from the city. 4970-29095-0032 6.61 But Philip is honest, and he has talent enough, if he will stop scribbling, to make his way. +4970-29093-0008 3.58 He wanted to begin at the top of the ladder. 4970-29095-0034 5.81 Why should I rust, and be stupid, and sit in inaction because I am a girl? +4970-29095-0011 3.355 Does thee think thee could stand it six months? 4970-29095-0035 4.75 And if I had a fortune, would thee want me to lead a useless life"? +4970-29093-0017 2.865 I've been ready to go anywhere for six months. 4970-29095-0036 5.25 Has thee consulted thy mother about a career, I suppose it is a career thee wants"? +4970-29093-0000 3.03 You'll never dig it out of the Astor Library". 4970-29095-0037 6.885 But that wise and placid woman understood the sweet rebel a great deal better than Ruth understood herself. +4970-29093-0000 3.03 You'll never dig it out of the Astor Library". 4970-29095-0038 8.74 Ruth was glad to hear that Philip had made a push into the world, and she was sure that his talent and courage would make a way for him. +121-127105-0032 3.17 Yes, but that's just the beauty of her passion". 121-127105-0000 9.875 It was this observation that drew from Douglas not immediately, but later in the evening a reply that had the interesting consequence to which I call attention. +121-127105-0018 2.77 cried the ladies whose departure had been fixed. 121-127105-0001 5.025 Someone else told a story not particularly effective, which I saw he was not following. +121-127105-0032 3.17 Yes, but that's just the beauty of her passion". 121-127105-0002 7.495 cried one of the women. He took no notice of her; he looked at me, but as if, instead of me, he saw what he spoke of. +121-127105-0036 4.15 But was that all her reward"? one of the ladies asked. 121-127105-0003 7.725 There was a unanimous groan at this, and much reproach; after which, in his preoccupied way, he explained. +121-127105-0032 3.17 Yes, but that's just the beauty of her passion". 121-127105-0005 5.82 I could write to my man and enclose the key; he could send down the packet as he finds it". +121-127105-0018 2.77 cried the ladies whose departure had been fixed. 121-127105-0006 4.725 The others resented postponement, but it was just his scruples that charmed me. +121-127105-0036 4.15 But was that all her reward"? one of the ladies asked. 121-127105-0007 5.79 To this his answer was prompt. "Oh, thank God, no"! "And is the record yours? +121-127105-0010 2.85 She sent me the pages in question before she died". 121-127105-0011 5.78 She was the most agreeable woman I've ever known in her position; she would have been worthy of any whatever. +121-127105-0010 2.85 She sent me the pages in question before she died". 121-127105-0012 4.83 It wasn't simply that she said so, but that I knew she hadn't. I was sure; I could see. +121-127105-0010 2.85 She sent me the pages in question before she died". 121-127105-0013 5.895 You'll easily judge why when you hear". "Because the thing had been such a scare"? He continued to fix me. +121-127105-0036 4.15 But was that all her reward"? one of the ladies asked. 121-127105-0022 5.075 Well, if I don't know who she was in love with, I know who he was". +121-127105-0018 2.77 cried the ladies whose departure had been fixed. 121-127105-0026 7.53 The first of these touches conveyed that the written statement took up the tale at a point after it had, in a manner, begun. +121-127105-0018 2.77 cried the ladies whose departure had been fixed. 121-127105-0028 6.75 The awkward thing was that they had practically no other relations and that his own affairs took up all his time. +121-127105-0015 2.96 He quitted the fire and dropped back into his chair. 121-127105-0029 7.31 There were plenty of people to help, but of course the young lady who should go down as governess would be in supreme authority. +121-127105-0036 4.15 But was that all her reward"? one of the ladies asked. 121-127105-0034 7.41 It sounded dull it sounded strange; and all the more so because of his main condition". "Which was-"? +121-127105-0008 2.76 He hung fire again. "A woman's. 121-127105-0036 4.15 But was that all her reward"? one of the ladies asked. +260-123288-0012 3.545 That will be safest". "No, no! Never"! 260-123286-0000 7.04 Saturday, august fifteenth. - The sea unbroken all round. No land in sight. +260-123286-0012 2.43 But there seemed no reason to fear. 260-123286-0002 9.985 All my danger and sufferings were needed to strike a spark of human feeling out of him; but now that I am well his nature has resumed its sway. +260-123440-0005 3.105 And yesterday things went on just as usual. 260-123286-0003 7.37 You seem anxious, my uncle," I said, seeing him continually with his glass to his eye. "Anxious! +260-123286-0024 3.04 There's a whale, a whale"! cried the Professor. 260-123286-0005 4.81 I am not complaining that the rate is slow, but that the sea is so wide". +260-123288-0019 2.955 At noon the violence of the storm redoubles. 260-123286-0006 7.405 We are losing time, and the fact is, I have not come all this way to take a little sail upon a pond on a raft". +260-123288-0019 2.955 At noon the violence of the storm redoubles. 260-123286-0007 4.55 He called this sea a pond, and our long voyage, taking a little sail! +260-123286-0022 3.235 Two hours afterwards a terrible shock awoke me. 260-123286-0009 5.795 I take this as my answer, and I leave the Professor to bite his lips with impatience. +260-123286-0001 3.07 The horizon seems extremely distant. 260-123286-0011 4.255 Nothing new. Weather unchanged. The wind freshens. +260-123286-0024 3.04 There's a whale, a whale"! cried the Professor. 260-123286-0013 4.73 The shadow of the raft was clearly outlined upon the surface of the waves. +260-123440-0018 3.64 I am very tired of swimming about here, O Mouse"! 260-123286-0015 5.21 It must be as wide as the Mediterranean or the Atlantic - and why not? +260-123288-0019 2.955 At noon the violence of the storm redoubles. 260-123286-0016 7 These thoughts agitated me all day, and my imagination scarcely calmed down after several hours' sleep. +260-123440-0006 2.715 I wonder if I've been changed in the night? 260-123286-0018 5.67 I saw at the Hamburg museum the skeleton of one of these creatures thirty feet in length. +260-123288-0009 3.435 Those clouds seem as if they were going to crush the sea". 260-123286-0023 5.875 The raft was heaved up on a watery mountain and pitched down again, at a distance of twenty fathoms. +260-123286-0024 3.04 There's a whale, a whale"! cried the Professor. 260-123286-0025 9.205 Flight was out of the question now. The reptiles rose; they wheeled around our little raft with a rapidity greater than that of express trains. +260-123288-0020 2.9 Each of us is lashed to some part of the raft. 260-123286-0026 6.94 Two monsters only were creating all this commotion; and before my eyes are two reptiles of the primitive world. +260-123286-0022 3.235 Two hours afterwards a terrible shock awoke me. 260-123286-0027 7.17 I can distinguish the eye of the ichthyosaurus glowing like a red hot coal, and as large as a man's head. +260-123286-0024 3.04 There's a whale, a whale"! cried the Professor. 260-123286-0029 4.545 Those huge creatures attacked each other with the greatest animosity. +260-123440-0005 3.105 And yesterday things went on just as usual. 260-123286-0030 7.53 Suddenly the ichthyosaurus and the plesiosaurus disappear below, leaving a whirlpool eddying in the water. +260-123288-0022 3.705 They seem to be 'We are lost'; but I am not sure. 260-123286-0031 5.06 As for the ichthyosaurus - has he returned to his submarine cavern? +3575-170457-0031 4 On august twenty seventh, eighteen thirty seven, she writes: 3575-170457-0000 8.23 And often has my mother said, While on her lap I laid my head, She feared for time I was not made, But for Eternity. +3575-170457-0032 3.03 Come, come. I am getting really tired of your absence. 3575-170457-0003 7.595 Surely, it must be because we are in danger of loving each other too well - of losing sight of the Creator in idolatry of the creature. +3575-170457-0049 2.715 This decision was communicated to the girls. 3575-170457-0005 7.34 She, a Tory and clergyman's daughter, was always in a minority of one in our house of violent Dissent and Radicalism. +3575-170457-0052 3 She had another weight on her mind this Christmas. 3575-170457-0006 8.3 Her feeble health gave her her yielding manner, for she could never oppose any one without gathering up all her strength for the struggle. +3575-170457-0031 4 On august twenty seventh, eighteen thirty seven, she writes: 3575-170457-0007 7.775 He spoke French perfectly, I have been told, when need was; but delighted usually in talking the broadest Yorkshire. +3575-170457-0031 4 On august twenty seventh, eighteen thirty seven, she writes: 3575-170457-0010 4.79 I am not depreciating it when I say that in these times it is not rare. +3575-170457-0049 2.715 This decision was communicated to the girls. 3575-170457-0011 7.015 But it is not with a view to distinction that you should cultivate this talent, if you consult your own happiness. +3575-170457-0049 2.715 This decision was communicated to the girls. 3575-170457-0012 5.850062 You will say that a woman has no need of such a caution; there can be no peril in it for her. +3575-170457-0031 4 On august twenty seventh, eighteen thirty seven, she writes: 3575-170457-0013 9.175 The more she is engaged in her proper duties, the less leisure will she have for it, even as an accomplishment and a recreation. +3575-170457-0031 4 On august twenty seventh, eighteen thirty seven, she writes: 3575-170457-0014 6.68 To those duties you have not yet been called, and when you are you will be less eager for celebrity. +3575-170457-0004 3.105 We used to dispute about politics and religion. 3575-170457-0019 6.155 I had not ventured to hope for such a reply; so considerate in its tone, so noble in its spirit. +3575-170457-0056 3.370062 I doubt whether Branwell was maintaining himself at this time. 3575-170457-0020 8.645 I know the first letter I wrote to you was all senseless trash from beginning to end; but I am not altogether the idle dreaming being it would seem to denote. +3575-170457-0032 3.03 Come, come. I am getting really tired of your absence. 3575-170457-0021 4.18 I thought it therefore my duty, when I left school, to become a governess. +3575-170457-0004 3.105 We used to dispute about politics and religion. 3575-170457-0022 5.825 In the evenings, I confess, I do think, but I never trouble any one else with my thoughts. +3575-170457-0049 2.715 This decision was communicated to the girls. 3575-170457-0023 9.095 I carefully avoid any appearance of preoccupation and eccentricity, which might lead those I live amongst to suspect the nature of my pursuits. +3575-170457-0034 3.495 in this monotonous life of mine, that was a pleasant event. 3575-170457-0025 9.205 Again I thank you. This incident, I suppose, will be renewed no more; if I live to be an old woman, I shall remember it thirty years hence as a bright dream. +3575-170457-0031 4 On august twenty seventh, eighteen thirty seven, she writes: 3575-170457-0027 4.58 I cannot deny myself the gratification of inserting Southey's reply: +3575-170457-0049 2.715 This decision was communicated to the girls. 3575-170457-0029 6.055 Your letter has given me great pleasure, and I should not forgive myself if I did not tell you so. +3575-170457-0049 2.715 This decision was communicated to the girls. 3575-170457-0030 8.945063 Of this second letter, also, she spoke, and told me that it contained an invitation for her to go and see the poet if ever she visited the Lakes. +3575-170457-0021 4.18 I thought it therefore my duty, when I left school, to become a governess. 3575-170457-0033 8.5 Saturday after Saturday comes round, and I can have no hope of hearing your knock at the door, and then being told that 'Miss E. is come'. Oh, dear! +3575-170457-0049 2.715 This decision was communicated to the girls. 3575-170457-0035 9.37 I wish it would recur again; but it will take two or three interviews before the stiffness - the estrangement of this long separation - will wear away". +3575-170457-0034 3.495 in this monotonous life of mine, that was a pleasant event. 3575-170457-0040 6.905 Indeed, there were only one or two strangers who could be admitted among the sisters without producing the same result. +3575-170457-0049 2.715 This decision was communicated to the girls. 3575-170457-0044 9.72 After this disappointment, I never dare reckon with certainty on the enjoyment of a pleasure again; it seems as if some fatality stood between you and me. +3575-170457-0001 2.99 Why are we to be denied each other's society? 3575-170457-0045 6.52 I am not good enough for you, and you must be kept from the contamination of too intimate society. +3575-170457-0049 2.715 This decision was communicated to the girls. 3575-170457-0047 6.525 Tabby had lived with them for ten or twelve years, and was, as Charlotte expressed it, "one of the family". +3575-170457-0052 3 She had another weight on her mind this Christmas. 3575-170457-0048 5.555 He refused at first to listen to the careful advice; it was repugnant to his liberal nature. +3575-170457-0049 2.715 This decision was communicated to the girls. 3575-170457-0050 6.405 Tabby had tended them in their childhood; they, and none other, should tend her in her infirmity and age. +3575-170457-0056 3.370062 I doubt whether Branwell was maintaining himself at this time. 3575-170457-0051 4.915 At tea time, they were sad and silent, and the meal went away untouched by any of the three. +3575-170457-0031 4 On august twenty seventh, eighteen thirty seven, she writes: 3575-170457-0054 8.005 Stung by anxiety for this little sister, she upbraided Miss W -- for her fancied indifference to Anne's state of health. +4970-29093-0008 3.58 He wanted to begin at the top of the ladder. 4970-29093-0007 6.995 It is such a noble ambition, that it is a pity it has usually such a shallow foundation. +4970-29095-0011 3.355 Does thee think thee could stand it six months? 4970-29093-0009 9.12 Philip therefore read diligently in the Astor library, planned literary works that should compel attention, and nursed his genius. +4970-29093-0017 2.865 I've been ready to go anywhere for six months. 4970-29093-0012 8.71 But Philip did afford it, and he wrote, thanking his friends, and declining because he said the political scheme would fail, and ought to fail. +4970-29093-0017 2.865 I've been ready to go anywhere for six months. 4970-29093-0013 8.01 And he went back to his books and to his waiting for an opening large enough for his dignified entrance into the literary world. +4970-29095-0008 3.04 Mother, I'm going to study medicine"? 4970-29093-0014 4.275 Well, I'm going as an engineer. You can go as one". +4970-29093-0017 2.865 I've been ready to go anywhere for six months. 4970-29093-0018 9.715 The two young men who were by this time full of the adventure, went down to the Wall street office of Henry's uncle and had a talk with that wily operator. +4970-29093-0015 3.325 You can begin by carrying a rod, and putting down the figures. 4970-29093-0019 7.47 The night was spent in packing up and writing letters, for Philip would not take such an important step without informing his friends. +4970-29093-0004 3.75 He was unable to decide exactly what it should be. 4970-29093-0020 5.58 Why, it's in Missouri somewhere, on the frontier I think. We'll get a map". +4970-29093-0017 2.865 I've been ready to go anywhere for six months. 4970-29093-0022 6.22 He knew his uncle would be glad to hear that he had at last turned his thoughts to a practical matter. +4970-29095-0011 3.355 Does thee think thee could stand it six months? 4970-29093-0023 8.07 He well knew the perils of the frontier, the savage state of society, the lurking Indians and the dangers of fever. +1284-1181-0019 3.2 I now use them as ornamental statuary in my garden. 1284-1180-0000 8.12 He wore blue silk stockings, blue knee pants with gold buckles, a blue ruffled waist and a jacket of bright blue braided with gold. +1284-1181-0007 4.04 She poured into the dish a quantity from each of these bottles. 1284-1180-0001 7.755 His hat had a peaked crown and a flat brim, and around the brim was a row of tiny golden bells that tinkled when he moved. +1284-1181-0021 2.7 asked the voice, in scornful accents. 1284-1180-0002 7.68 Instead of shoes, the old man wore boots with turnover tops and his blue coat had wide cuffs of gold braid. +1284-1180-0004 4.285 When they were outside, Unc simply latched the door and started up the path. 1284-1180-0003 4.835 For a long time he had wished to explore the beautiful Land of Oz in which they lived. +1284-1180-0014 3.665 Ojo had never eaten such a fine meal in all his life. 1284-1180-0004 4.285 When they were outside, Unc simply latched the door and started up the path. +1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1180-0005 6.55 No one would disturb their little house, even if anyone came so far into the thick forest while they were gone. +1284-1180-0004 4.285 When they were outside, Unc simply latched the door and started up the path. 1284-1180-0006 6.865 At the foot of the mountain that separated the Country of the Munchkins from the Country of the Gillikins, the path divided. +1284-1180-0004 4.285 When they were outside, Unc simply latched the door and started up the path. 1284-1180-0007 6.265 He knew it would take them to the house of the Crooked Magician, whom he had never seen but who was their nearest neighbor. +1284-1180-0014 3.665 Ojo had never eaten such a fine meal in all his life. 1284-1180-0009 6.285 Then they started on again and two hours later came in sight of the house of doctor Pipt. +1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1180-0010 8.635 Unc knocked at the door of the house and a chubby, pleasant faced woman, dressed all in blue, opened it and greeted the visitors with a smile. +1284-1180-0014 3.665 Ojo had never eaten such a fine meal in all his life. 1284-1180-0011 4.275 I am, my dear, and all strangers are welcome to my home". +1284-1180-0011 4.275 I am, my dear, and all strangers are welcome to my home". 1284-1180-0012 4.88 We have come from a far lonelier place than this". "A lonelier place! +1284-1180-0022 2.885 I'm afraid I don't know much about the Land of Oz. 1284-1180-0015 5.835 We are traveling," replied Ojo, "and we stopped at your house just to rest and refresh ourselves. +1284-1180-0004 4.285 When they were outside, Unc simply latched the door and started up the path. 1284-1180-0020 5.87 The first lot we tested on our Glass Cat, which not only began to live but has lived ever since. +1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1180-0021 9.84 I think the next Glass Cat the Magician makes will have neither brains nor heart, for then it will not object to catching mice and may prove of some use to us". +1284-1180-0022 2.885 I'm afraid I don't know much about the Land of Oz. 1284-1180-0023 5.61 You see, I've lived all my life with Unc Nunkie, the Silent One, and there was no one to tell me anything". +1284-1181-0007 4.04 She poured into the dish a quantity from each of these bottles. 1284-1180-0024 5.26 That is one reason you are Ojo the Unlucky," said the woman, in a sympathetic tone. +1284-1181-0007 4.04 She poured into the dish a quantity from each of these bottles. 1284-1180-0025 8.705 I think I must show you my Patchwork Girl," said Margolotte, laughing at the boy's astonishment, "for she is rather difficult to explain. +1284-1180-0004 4.285 When they were outside, Unc simply latched the door and started up the path. 1284-1180-0026 8.29 But first I will tell you that for many years I have longed for a servant to help me with the housework and to cook the meals and wash the dishes. +1284-1181-0007 4.04 She poured into the dish a quantity from each of these bottles. 1284-1180-0028 6.045 A bed quilt made of patches of different kinds and colors of cloth, all neatly sewed together. +1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1180-0029 5.335 Sometimes it is called a 'crazy quilt,' because the patches and colors are so mixed up. +1284-1180-0004 4.285 When they were outside, Unc simply latched the door and started up the path. 1284-1180-0031 4.825 At the Emerald City, where our Princess Ozma lives, green is the popular color. +1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1180-0032 5.78 I will show you what a good job I did," and she went to a tall cupboard and threw open the doors. +3570-5694-0022 4.295 The livery becomes obnoxious to nearly all who are required to wear it. 3570-5694-0001 5.675 The utility of consumption as an evidence of wealth is to be classed as a derivative growth. +3570-5694-0022 4.295 The livery becomes obnoxious to nearly all who are required to wear it. 3570-5694-0004 5.33 In the nature of things, luxuries and the comforts of life belong to the leisure class. +3570-5694-0022 4.295 The livery becomes obnoxious to nearly all who are required to wear it. 3570-5694-0005 8.405 Under the tabu, certain victuals, and more particularly certain beverages, are strictly reserved for the use of the superior class. +3570-5694-0022 4.295 The livery becomes obnoxious to nearly all who are required to wear it. 3570-5694-0008 9.495 The consumption of luxuries, in the true sense, is a consumption directed to the comfort of the consumer himself, and is, therefore, a mark of the master. +3570-5694-0012 3.205 There is a more or less elaborate system of rank and grades. 3570-5694-0013 5.61 This differentiation is furthered by the inheritance of wealth and the consequent inheritance of gentility. +3570-5694-0022 4.295 The livery becomes obnoxious to nearly all who are required to wear it. 3570-5694-0015 8.435 So many of them, however, as make up the retainer and hangers on of the patron may be classed as vicarious consumer without qualification. +3570-5694-0019 3.755 But the general distinction is not on that account to be overlooked. 3570-5694-0017 8.335 The wearing of uniforms or liveries implies a considerable degree of dependence, and may even be said to be a mark of servitude, real or ostensible. +3570-5694-0022 4.295 The livery becomes obnoxious to nearly all who are required to wear it. 3570-5694-0018 7.815 The wearers of uniforms and liveries may be roughly divided into two classes the free and the servile, or the noble and the ignoble. +3570-5694-0019 3.755 But the general distinction is not on that account to be overlooked. 3570-5694-0022 4.295 The livery becomes obnoxious to nearly all who are required to wear it. +8463-287645-0010 4.325 He worked me very hard; he wanted to be beating me all the time". 8463-294828-0001 9.19 THREE SECONDS before the arrival of JB Hobson's letter, I no more dreamed of chasing the unicorn than of trying for the Northwest Passage. +8463-287645-0014 3.02 of starting. I didn't know the way to come. 8463-294828-0002 6.19 Even so, I had just returned from an arduous journey, exhausted and badly needing a rest. +8463-294828-0021 2.735 A route slightly less direct, that's all. 8463-294828-0003 9.34 I wanted nothing more than to see my country again, my friends, my modest quarters by the Botanical Gardens, my dearly beloved collections! +8463-294828-0026 2.745 We have a commander who's game for anything"! 8463-294828-0006 7.32 From rubbing shoulders with scientists in our little universe by the Botanical Gardens, the boy had come to know a thing or two. +8463-294828-0026 2.745 We have a commander who's game for anything"! 8463-294828-0009 4.17 Not once did he comment on the length or the hardships of a journey. +8463-287645-0009 3.71 I never knew of but one man who could ever please him. 8463-294828-0010 8.34 Never did he object to buckling up his suitcase for any country whatever, China or the Congo, no matter how far off it was. +8463-294828-0011 3.91 He went here, there, and everywhere in perfect contentment. 8463-294828-0012 4.905 Please forgive me for this underhanded way of admitting I had turned forty. +8463-287645-0008 3.325 As usual nothing was done in the way of punishment". 8463-294828-0013 7.2 He was a fanatic on formality, and he only addressed me in the third person to the point where it got tiresome. +8463-287645-0009 3.71 I never knew of but one man who could ever please him. 8463-294828-0014 5.725 There was good reason to stop and think, even for the world's most emotionless man. +8463-294828-0005 2.44 Conseil was my manservant. 8463-294828-0015 4.88 Conseil"! I called a third time. Conseil appeared. +8463-287645-0008 3.325 As usual nothing was done in the way of punishment". 8463-294828-0017 9.3 Pack as much into my trunk as you can, my traveling kit, my suits, shirts, and socks, don't bother counting, just squeeze it all in and hurry"! +8463-294825-0008 3.98 But much of the novel's brooding power comes from Captain Nemo. 8463-294828-0019 4.53 Anyhow, we'll leave instructions to ship the whole menagerie to France". +8463-287645-0001 3.545 It is hardly necessary to say more of them here. 8463-294828-0020 5.915 Yes, we are... certainly...," I replied evasively, "but after we make a detour". +8463-287645-0008 3.325 As usual nothing was done in the way of punishment". 8463-294828-0023 4.745 You see, my friend, it's an issue of the monster, the notorious narwhale. +8463-294828-0026 2.745 We have a commander who's game for anything"! 8463-294828-0027 5.98 I left instructions for shipping my containers of stuffed animals and dried plants to Paris, France. +8463-294828-0034 3.505 We'll be quite comfortable here," I told Conseil. 8463-294828-0028 7.915 I opened a line of credit sufficient to cover the babirusa and, Conseil at my heels, I jumped into a carriage. +8463-294828-0011 3.91 He went here, there, and everywhere in perfect contentment. 8463-294828-0029 5.285 Our baggage was immediately carried to the deck of the frigate. I rushed aboard. +8463-294828-0026 2.745 We have a commander who's game for anything"! 8463-294828-0031 7.765 One of the sailors led me to the afterdeck, where I stood in the presence of a smart looking officer who extended his hand to me. +8463-287645-0008 3.325 As usual nothing was done in the way of punishment". 8463-294828-0032 4.395 In person. Welcome aboard, professor. Your cabin is waiting for you". +8463-294825-0008 3.98 But much of the novel's brooding power comes from Captain Nemo. 8463-294828-0033 6.365 I was well satisfied with my cabin, which was located in the stern and opened into the officers' mess. +8463-294828-0009 4.17 Not once did he comment on the length or the hardships of a journey. 8463-294828-0036 6.985 The wharves of Brooklyn, and every part of New York bordering the East River, were crowded with curiosity seekers. +7127-75947-0008 4.155 The arrow pierced his heart and wounded him mortally. 7127-75947-0001 6.64 Upon this Madame deigned to turn her eyes languishingly towards the comte, observing. +7127-75947-0002 3.235 Do you think so"? she replied with indifference. 7127-75947-0003 5.98 Yes; the character which your royal highness assumed is in perfect harmony with your own". +7127-75946-0025 3.96 The ballet began; the effect was more than beautiful. 7127-75947-0007 5.46 She then rose, humming the air to which she was presently going to dance. +7127-75946-0005 2.67 What do you mean"? inquired Louis, 7127-75947-0008 4.155 The arrow pierced his heart and wounded him mortally. +7127-75947-0002 3.235 Do you think so"? she replied with indifference. 7127-75947-0010 8.865 When she perceived the young man, she rose, like a woman surprised in the midst of ideas she was desirous of concealing from herself. +7127-75946-0005 2.67 What do you mean"? inquired Louis, 7127-75947-0013 5.045 I remember now, and I congratulate myself. Do you love any one"? +7127-75947-0018 4.04 I have been here this quarter of an hour," replied La Valliere. 7127-75947-0015 6.26 There cannot be a doubt he received you kindly, for, in fact, you returned without his permission". +7127-75946-0010 3.6 Your majesty's plan, then, in this affair, is 7127-75947-0016 7.48 Oh! mademoiselle, why have I not a devoted sister, or a true friend, such as yourself"? +7127-75947-0018 4.04 I have been here this quarter of an hour," replied La Valliere. 7127-75947-0024 7.33 Look yonder, do you not see the moon slowly rising, silvering the topmost branches of the chestnuts and the oaks. +7127-75947-0018 4.04 I have been here this quarter of an hour," replied La Valliere. 7127-75947-0025 5.57 exquisite soft turf of the woods, the happiness which your friendship confers upon me! +7127-75946-0025 3.96 The ballet began; the effect was more than beautiful. 7127-75947-0028 7.46 Quick, quick, then, among the high reed grass," said Montalais; "stoop, Athenais, you are so tall". +7127-75946-0025 3.96 The ballet began; the effect was more than beautiful. 7127-75947-0029 5.285 The young girls had, indeed, made themselves small - indeed invisible. +7127-75947-0019 3.875 Did not the dancing amuse you"? "No". 7127-75947-0032 4.745 Yes; but perhaps I frightened her". "In what way"? +7127-75947-0018 4.04 I have been here this quarter of an hour," replied La Valliere. 7127-75947-0035 4.415 Good gracious! has the king any right to interfere in matters of that kind? +7127-75947-0018 4.04 I have been here this quarter of an hour," replied La Valliere. 7127-75947-0037 8.824938 Oh! I am speaking seriously," replied Montalais, "and my opinion in this case is quite as good as the king's, I suppose; is it not, Louise"? +121-121726-0011 4.035 HUSBAND The next thing to a wife. 121-123859-0004 9.505 So I return rebuked to my content, And gain by ill thrice more than I have spent. +908-31957-0005 4.49 Alas, I have grieved so I am hard to love. 908-157963-0005 7.035 Like the doves voice, like transient day, like music in the air: Ah! +908-157963-0009 4.06 Why should the mistress of the vales of Har, utter a sigh. 908-157963-0006 8.11 And gentle sleep the sleep of death, and gently hear the voice Of him that walketh in the garden in the evening time. +908-157963-0029 3.63 Why a Tongue impressed with honey from every wind? 908-157963-0009 4.06 Why should the mistress of the vales of Har, utter a sigh. +908-31957-0018 3.915 But thou art not such A lover, my Beloved! 908-157963-0010 6.28 She ceasd and smiled in tears, then sat down in her silver shrine. +908-157963-0018 4.255 And fearest thou because I vanish and am seen no more. 908-157963-0013 4.315 And why it scatters its bright beauty thro the humid air. +908-157963-0018 4.255 And fearest thou because I vanish and am seen no more. 908-157963-0014 4.52 Descend O little cloud and hover before the eyes of Thel. +908-31957-0018 3.915 But thou art not such A lover, my Beloved! 908-157963-0016 5.105 I pass away, yet I complain, and no one hears my voice. +908-157963-0013 4.315 And why it scatters its bright beauty thro the humid air. 908-157963-0017 4.95 The Cloud then shewd his golden head and his bright form emerged. +908-157963-0003 3.08 Why fade these children of the spring? 908-157963-0018 4.255 And fearest thou because I vanish and am seen no more. +908-157963-0024 3.44 image of weakness, art thou but a Worm? 908-157963-0020 9.8 Till we arise linked in a golden band and never part: But walk united bearing food to all our tender flowers. +908-157963-0013 4.315 And why it scatters its bright beauty thro the humid air. 908-157963-0022 4.61 Come forth worm and the silent valley, to thy pensive queen. +908-157963-0002 2.755 why fades the lotus of the water? 908-157963-0023 9.625 The helpless worm arose and sat upon the Lillys leaf, And the bright Cloud saild on, to find his partner in the vale. +908-157963-0024 3.44 image of weakness, art thou but a Worm? 908-157963-0025 9.265 I see they lay helpless and naked: weeping And none to answer, none to cherish thee with mothers smiles. +908-157963-0029 3.63 Why a Tongue impressed with honey from every wind? 908-157963-0026 8.1 And says; Thou mother of my children, I have loved thee And I have given thee a crown that none can take away. +908-157963-0024 3.44 image of weakness, art thou but a Worm? 908-157963-0027 5.225 And lay me down in thy cold bed, and leave my shining lot. +908-157963-0003 3.08 Why fade these children of the spring? 908-157963-0028 4.955 Or an Eye of gifts and graces showring fruits and coined gold! +908-157963-0024 3.44 image of weakness, art thou but a Worm? 908-157963-0030 4.52 Why an Ear, a whirlpool fierce to draw creations in? +4446-2271-0003 3.7 It's been on only two weeks, and I've been half a dozen times already. 4446-2271-0001 6.35 He had preconceived ideas about everything, and his idea about Americans was that they should be engineers or mechanics. +4446-2275-0005 4.445 I felt it in my bones when I woke this morning that something splendid was going to turn up. 4446-2271-0008 5.495 Irene Burgoyne, one of her family, told me in confidence that there was a romance somewhere back in the beginning. +4446-2271-0005 3.395 She saves her hand, too. She's at her best in the second act. 4446-2271-0009 7.82 Mainhall vouched for her constancy with a loftiness that made Alexander smile, even while a kind of rapid excitement was tingling through him. +4446-2273-0009 4.015 It's not particularly rare," she said, "but some of it was my mother's. 4446-2271-0013 4.4 Do you know, I thought the dance a bit conscious to night, for the first time. +4446-2273-0002 3.295 Lamb wouldn't care a great deal about many of them, I fancy". 4446-2271-0014 5.34 Westmere and I were back after the first act, and we thought she seemed quite uncertain of herself. +4446-2273-0033 3.3 For a long time neither Hilda nor Bartley spoke. 4446-2271-0018 5.715 She considered a moment and then said "No, I think not, though I am glad you ask me. +4446-2275-0045 2.635 We've tortured each other enough for tonight. 4446-2271-0020 7.55 Of course," he reflected, "she always had that combination of something homely and sensible, and something utterly wild and daft. +4446-2271-0005 3.395 She saves her hand, too. She's at her best in the second act. 4446-2273-0000 8.995 Hilda was very nice to him, and he sat on the edge of his chair, flushed with his conversational efforts and moving his chin about nervously over his high collar. +4446-2273-0002 3.295 Lamb wouldn't care a great deal about many of them, I fancy". 4446-2273-0001 4.66 They asked him to come to see them in Chelsea, and they spoke very tenderly of Hilda. +4446-2273-0002 3.295 Lamb wouldn't care a great deal about many of them, I fancy". 4446-2273-0003 7.835 When Bartley arrived at Bedford Square on Sunday evening, Marie, the pretty little French girl, met him at the door and conducted him upstairs. +4446-2275-0022 3.28 But why didn't you tell me when you were here in the summer"? 4446-2273-0004 5.435 I should never have asked you if Molly had been here, for I remember you don't like English cookery". +4446-2273-0034 3.59 He felt a tremor run through the slender yellow figure in front of him. 4446-2273-0005 4.125 I haven't had a chance yet to tell you what a jolly little place I think this is. +4446-2273-0002 3.295 Lamb wouldn't care a great deal about many of them, I fancy". 4446-2273-0008 7.715 I've managed to save something every year, and that with helping my three sisters now and then, and tiding poor Cousin Mike over bad seasons. +4446-2271-0013 4.4 Do you know, I thought the dance a bit conscious to night, for the first time. 4446-2273-0009 4.015 It's not particularly rare," she said, "but some of it was my mother's. +4446-2271-0000 3.495 Mainhall liked Alexander because he was an engineer. 4446-2273-0015 4.505 Don't I, though! I'm so sorry to hear it. How did her son turn out? +4446-2271-0005 3.395 She saves her hand, too. She's at her best in the second act. 4446-2273-0016 9.645 Her hair is still like flax, and her blue eyes are just like a baby's, and she has the same three freckles on her little nose, and talks about going back to her bains de mer". +4446-2275-0015 2.98 He pulled up a window as if the air were heavy. 4446-2273-0021 5.255 What she wanted from us was neither our flowers nor our francs, but just our youth. +4446-2271-0013 4.4 Do you know, I thought the dance a bit conscious to night, for the first time. 4446-2273-0022 5.865 They were both remembering what the woman had said when she took the money: "God give you a happy love"! +4446-2273-0012 2.98 Thank you. But I don't like it so well as this". 4446-2273-0023 6.1 The strange woman, and her passionate sentence that rang out so sharply, had frightened them both. +4446-2271-0024 3.16 I shouldn't wonder if she could laugh about it with me now. 4446-2273-0024 4.825 Bartley started when Hilda rang the little bell beside her. "Dear me, why did you do that? +4446-2271-0011 3.945 Sir Harry Towne, mister Bartley Alexander, the American engineer". 4446-2273-0025 4.83 It was very jolly," he murmured lazily, as Marie came in to take away the coffee. +4446-2271-0013 4.4 Do you know, I thought the dance a bit conscious to night, for the first time. 4446-2273-0028 5.405 Nonsense. Of course I can't really sing, except the way my mother and grandmother did before me. +4446-2273-0011 2.79 There is nothing else that looks so jolly". 4446-2273-0032 7.835 He stood a little behind her, and tried to steady himself as he said: "It's soft and misty. See how white the stars are". +4446-2271-0012 3.78 I say, Sir Harry, the little girl's going famously to night, isn't she"? 4446-2273-0035 6.15 Bartley leaned over her shoulder, without touching her, and whispered in her ear: "You are giving me a chance"? "Yes. +1188-133604-0013 3.02 It must, remember, be one or the other. 1188-133604-0001 9.04 They unite every quality; and sometimes you will find me referring to them as colorists, sometimes as chiaroscurists. +1188-133604-0031 4.25 There's one, and there's another - the "Dudley" and the "Flint". 1188-133604-0005 8.56 It is the head of a parrot with a little flower in his beak from a picture of Carpaccio's, one of his series of the Life of Saint George. +1188-133604-0031 4.25 There's one, and there's another - the "Dudley" and the "Flint". 1188-133604-0010 6.095 But in this vignette, copied from Turner, you have the two principles brought out perfectly. +1188-133604-0040 3.23 The crampness and the poverty are all intended. 1188-133604-0014 4.39 Do not, therefore, think that the Gothic school is an easy one. +1188-133604-0031 4.25 There's one, and there's another - the "Dudley" and the "Flint". 1188-133604-0017 4.615 That a style is restrained or severe does not mean that it is also erroneous. +1188-133604-0014 4.39 Do not, therefore, think that the Gothic school is an easy one. 1188-133604-0022 9.63 You must look at him in the face - fight him - conquer him with what scathe you may: you need not think to keep out of the way of him. +1188-133604-0031 4.25 There's one, and there's another - the "Dudley" and the "Flint". 1188-133604-0025 7.45 You know I have just been telling you how this school of materialism and clay involved itself at last in cloud and fire. +1188-133604-0040 3.23 The crampness and the poverty are all intended. 1188-133604-0031 4.25 There's one, and there's another - the "Dudley" and the "Flint". +1188-133604-0006 2.4 Then he comes to the beak of it. 1188-133604-0033 6.625 Every plant in the grass is set formally, grows perfectly, and may be realized completely. +1188-133604-0014 4.39 Do not, therefore, think that the Gothic school is an easy one. 1188-133604-0036 7.97 In both these high mythical subjects the surrounding nature, though suffering, is still dignified and beautiful. +1188-133604-0031 4.25 There's one, and there's another - the "Dudley" and the "Flint". 1188-133604-0038 5.365 But now here is a subject of which you will wonder at first why Turner drew it at all. +1188-133604-0031 4.25 There's one, and there's another - the "Dudley" and the "Flint". 1188-133604-0039 6.625 It has no beauty whatsoever, no specialty of picturesqueness; and all its lines are cramped and poor. +1188-133604-0031 4.25 There's one, and there's another - the "Dudley" and the "Flint". 1188-133604-0043 4.885 See that your lives be in nothing worse than a boy's climbing for his entangled kite. +7729-102255-0000 3.285 The bogus Legislature numbered thirty six members. 7729-102255-0002 8.3 That summer's emigration, however, being mainly from the free States, greatly changed the relative strength of the two parties. +7729-102255-0034 2.71 To their sorrow they were soon undeceived. 7729-102255-0005 5.18 This was a formidable array of advantages; slavery was playing with loaded dice. +7729-102255-0013 2.675 It was, in fact, the best weapon of its day. 7729-102255-0010 8.54 Of the lynchings, the mobs, and the murders, it would be impossible, except in a very extended work, to note the frequent and atrocious details. +7729-102255-0034 2.71 To their sorrow they were soon undeceived. 7729-102255-0012 4.075 Several hundred free State men promptly responded to the summons. +7729-102255-0034 2.71 To their sorrow they were soon undeceived. 7729-102255-0014 5.295 The leaders of the conspiracy became distrustful of their power to crush the town. +7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0021 7.93 But the affair was magnified as a crowning proof that the free State men were insurrectionists and outlaws. +7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0023 5.5 Their distinctive characters, however, display one broad and unfailing difference. +7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0025 5.485 Their assumed character changed with their changing opportunities or necessities. +7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0028 9.6 Private persons who had leased the Free State Hotel vainly besought the various authorities to prevent the destruction of their property. +7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0029 7.06 Ten days were consumed in these negotiations; but the spirit of vengeance refused to yield. +7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0030 7.25 He summoned half a dozen citizens to join his posse, who followed, obeyed, and assisted him. +7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0031 6.75 He continued his pretended search and, to give color to his errand, made two arrests. +7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0033 6.775 As he had promised to protect the hotel, the reassured citizens began to laugh at their own fears. +7729-102255-0034 2.71 To their sorrow they were soon undeceived. 7729-102255-0035 5.625 The military force, partly rabble, partly organized, had meanwhile moved into the town. +7729-102255-0012 4.075 Several hundred free State men promptly responded to the summons. 7729-102255-0036 7.705 He planted a company before the hotel, and demanded a surrender of the arms belonging to the free- State military companies. +7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0038 7.92 Atchison, who had been haranguing the mob, planted his two guns before the building and trained them upon it. +7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0039 6.815 The inmates being removed, at the appointed hour a few cannon balls were fired through the stone walls. +7729-102255-0001 3.45 This was at the March election, eighteen fifty five. 7729-102255-0045 6.805 Captain Martin said: 'I shall give you a pistol to help protect yourself if worse comes to worst! +3570-5694-0022 4.295 The livery becomes obnoxious to nearly all who are required to wear it. 3570-5695-0000 4.83 In a general way, though not wholly nor consistently, these two groups coincide. +3570-5694-0012 3.205 There is a more or less elaborate system of rank and grades. 3570-5695-0002 7.805 But as we descend the social scale, the point is presently reached where the duties of vicarious leisure and consumption devolve upon the wife alone. +3570-5694-0012 3.205 There is a more or less elaborate system of rank and grades. 3570-5695-0003 5.355 In the communities of the Western culture, this point is at present found among the lower middle class. +3570-5694-0019 3.755 But the general distinction is not on that account to be overlooked. 3570-5695-0006 7.47 Very much of squalor and discomfort will be endured before the last trinket or the last pretense of pecuniary decency is put away. +3570-5694-0019 3.755 But the general distinction is not on that account to be overlooked. 3570-5695-0007 9.755 There is no class and no country that has yielded so abjectly before the pressure of physical want as to deny themselves all gratification of this higher or spiritual need. +3570-5694-0019 3.755 But the general distinction is not on that account to be overlooked. 3570-5695-0008 6.845 The question is, which of the two methods will most effectively reach the persons whose convictions it is desired to affect. +3570-5694-0019 3.755 But the general distinction is not on that account to be overlooked. 3570-5695-0009 5.025 Each will therefore serve about equally well during the earlier stages of social growth. +3570-5694-0019 3.755 But the general distinction is not on that account to be overlooked. 3570-5695-0010 4.665 The modern organization of industry works in the same direction also by another line. +3570-5696-0006 4.16 As used in the speech of everyday life the word carries an undertone of deprecation. 3570-5695-0011 8.26 It is evident, therefore, that the present trend of the development is in the direction of heightening the utility of conspicuous consumption as compared with leisure. +3570-5696-0006 4.16 As used in the speech of everyday life the word carries an undertone of deprecation. 3570-5695-0013 4.64 Consumption becomes a larger element in the standard of living in the city than in the country. +3570-5694-0012 3.205 There is a more or less elaborate system of rank and grades. 3570-5695-0015 7.95 The result is a great mobility of the labor employed in printing; perhaps greater than in any other equally well defined and considerable body of workmen. +260-123440-0008 3.745 I'll try if I know all the things I used to know. 260-123288-0001 5.08 The weather - if we may use that term - will change before long. +260-123288-0020 2.9 Each of us is lashed to some part of the raft. 260-123288-0002 7.25 The atmosphere is charged with vapours, pervaded with the electricity generated by the evaporation of saline waters. +260-123288-0009 3.435 Those clouds seem as if they were going to crush the sea". 260-123288-0003 8.905 The electric light can scarcely penetrate through the dense curtain which has dropped over the theatre on which the battle of the elements is about to be waged. +260-123286-0020 3.06 Tuesday, august eighteenth. 260-123288-0004 4.31 The air is heavy; the sea is calm. +260-123440-0005 3.105 And yesterday things went on just as usual. 260-123288-0006 4.88 The atmosphere is evidently charged and surcharged with electricity. +260-123440-0008 3.745 I'll try if I know all the things I used to know. 260-123288-0008 5.515 There's a heavy storm coming on," I cried, pointing towards the horizon. +260-123440-0006 2.715 I wonder if I've been changed in the night? 260-123288-0011 8.98 But if we have now ceased to advance why do we yet leave that sail loose, which at the first shock of the tempest may capsize us in a moment? +260-123288-0019 2.955 At noon the violence of the storm redoubles. 260-123288-0016 4.865 I refer to the thermometer; it indicates... (the figure is obliterated). +260-123440-0006 2.715 I wonder if I've been changed in the night? 260-123288-0017 5.225 Is the atmospheric condition, having once reached this density, to become final? +260-123440-0005 3.105 And yesterday things went on just as usual. 260-123288-0027 6.305 A suffocating smell of nitrogen fills the air, it enters the throat, it fills the lungs. +8455-210777-0062 3.05 When do you intend that the John Bright shall start"? 8455-210777-0000 8.745 I remained there alone for many hours, but I must acknowledge that before I left the chambers I had gradually brought myself to look at the matter in another light. +8455-210777-0026 3 And the death of which I dreamt could not, alas! 8455-210777-0002 6.24 On arriving at home at my own residence, I found that our salon was filled with a brilliant company. +8455-210777-0026 3 And the death of which I dreamt could not, alas! 8455-210777-0005 5.685 We have our little struggles here as elsewhere, and all things cannot be done by rose water. +8455-210777-0047 2.54 You propose to kidnap me," I said. 8455-210777-0006 4.52 We are quite satisfied now, Captain Battleax," said my wife. +8455-210777-0049 4.11 Lieutenant Crosstrees is a very gallant officer. 8455-210777-0009 4.58 No doubt, in process of time the ladies will follow +8455-210777-0025 3.63 What could I do now but just lay myself down and die? 8455-210777-0011 6.63 I did not mean," said Captain Battleax, "to touch upon public subjects at such a moment as this. +8455-210777-0050 3.945 One of us always remains on board while the other is on shore. 8455-210777-0013 7.41 Jack had been standing in the far corner of the room talking to Eva, and was now reduced to silence by his praises. +8455-210777-0066 2.76 They, of course, must all be altered". 8455-210777-0014 4.12 Sir Kennington Oval is a very fine player," said my wife. +8455-210777-0014 4.12 Sir Kennington Oval is a very fine player," said my wife. 8455-210777-0015 8.615 I and my wife and son, and the two Craswellers, and three or four others, agreed to dine on board the ship on the next. +8455-210777-0026 3 And the death of which I dreamt could not, alas! 8455-210777-0017 5.330063 My wife, on the spur of the moment, managed to give the gentlemen a very good dinner. +8455-210777-0025 3.63 What could I do now but just lay myself down and die? 8455-210777-0018 5.925 This, she said, was true hospitality; and I am not sure that I did not agree with her. +8455-210777-0062 3.05 When do you intend that the John Bright shall start"? 8455-210777-0019 8.105 Then there were three or four leading men of the community, with their wives, who were for the most part the fathers and mothers of the young ladies. +8455-210777-0026 3 And the death of which I dreamt could not, alas! 8455-210777-0023 4.73 We sat with the officers some little time after dinner, and then went ashore. +8455-210777-0043 3.145 But what is the delicate mission"? I asked. 8455-210777-0024 7.56 How much of evil, - of real accomplished evil, - had there not occurred to me during the last few days! +8455-210777-0068 2.59 Your power is sufficient," I said. 8455-210777-0028 7.735 Jack would become Eva's happy husband, and would remain amidst the hurried duties of the eager world. +8455-210777-0025 3.63 What could I do now but just lay myself down and die? 8455-210777-0031 7.67 You have received us with all that courtesy and hospitality for which your character in England stands so high. +8455-210777-0026 3 And the death of which I dreamt could not, alas! 8455-210777-0033 7.51 But your power is so superior to any that I can advance, as to make us here feel that there is no disgrace in yielding to it. +8455-210777-0050 3.945 One of us always remains on board while the other is on shore. 8455-210777-0034 7.7 Not a doubt but had your force been only double or treble our own, I should have found it my duty to struggle with you. +8455-210777-0068 2.59 Your power is sufficient," I said. 8455-210777-0037 4.735 You have come to us threatening us with absolute destruction. +8455-210777-0026 3 And the death of which I dreamt could not, alas! 8455-210777-0039 5.59 I can assure you he has not even allowed me to see the trigger since I have been on board. +8455-210777-0025 3.63 What could I do now but just lay myself down and die? 8455-210777-0040 6.195 Then," said Sir Ferdinando, "there is nothing for it but that he must take you with him". +8455-210777-0026 3 And the death of which I dreamt could not, alas! 8455-210777-0041 6.37 There came upon me a sudden shock when I heard these words, which exceeded anything which I had yet felt. +8455-210777-0050 3.945 One of us always remains on board while the other is on shore. 8455-210777-0044 7.17 I was to be taken away and carried to England or elsewhere, - or drowned upon the voyage, it mattered not which. +8455-210777-0062 3.05 When do you intend that the John Bright shall start"? 8455-210777-0046 9.33 You may be quite sure it's there," said Captain Battleax, "and that I can so use it as to half obliterate your town within two minutes of my return on board". +8455-210777-0020 3.155 Oh yes," said Jack, "and I'm nowhere. 8455-210777-0049 4.11 Lieutenant Crosstrees is a very gallant officer. +8455-210777-0048 3.43 What would become of your gun were I to kidnap you"? 8455-210777-0052 4.94 You will allow me to suggest," said he, "that that is a matter of opinion. +8455-210777-0062 3.05 When do you intend that the John Bright shall start"? 8455-210777-0053 6.955 Were I to comply with your orders without expressing my own opinion, I should seem to have done so willingly hereafter. +8455-210777-0025 3.63 What could I do now but just lay myself down and die? 8455-210777-0055 9.555 SIR, - I have it in command to inform your Excellency that you have been appointed Governor of the Crown colony which is called Britannula. +8455-210777-0025 3.63 What could I do now but just lay myself down and die? 8455-210777-0056 5.545 The peculiar circumstances of the colony are within your Excellency's knowledge. +8455-210777-0050 3.945 One of us always remains on board while the other is on shore. 8455-210777-0058 7.16 It is founded on the acknowledged weakness of those who survive that period of life at which men cease to work. +8455-210777-0064 3.835 And I have no one ready to whom I can give up the archives of the Government". 8455-210777-0059 5.535 But it is surmised that you will find difficulties in the way of your entering at once upon your government. +8455-210777-0062 3.05 When do you intend that the John Bright shall start"? 8455-210777-0060 7.075 The John Bright is armed with a weapon of great power, against which it is impossible that the people of Britannula should prevail. +8455-210777-0064 3.835 And I have no one ready to whom I can give up the archives of the Government". 8455-210777-0069 8.915 If you will give us your promise to meet Captain Battleaxe here at this time tomorrow, we will stretch a point and delay the departure of the John Bright for twenty four hours". +8455-210777-0026 3 And the death of which I dreamt could not, alas! 8455-210777-0070 5.945 And this plan was adopted, too, in order to extract from me a promise that I would depart in peace. +6829-68769-0043 2.59 And he deserves a term in state's prison". 6829-68771-0002 8.94 The "weak kneed" contingency must be strengthened and fortified, and a couple of hundred votes in one way or another secured from the opposition. +6829-68769-0016 4.12 He unlocked the door, and called: "Here's visitors, Tom". 6829-68771-0003 4.015 The Democratic Committee figured out a way to do this. +6829-68769-0014 3.655 They followed the jailer along a succession of passages. 6829-68771-0004 8.44 Under ordinary conditions Reynolds was sure to be elected, but the Committee proposed to sacrifice him in order to elect Hopkins. +6829-68769-0037 2.53 I've seen lots of that kind in my day. 6829-68771-0005 6.165 The only thing necessary was to "fix" Seth Reynolds, and this Hopkins arranged personally. +6829-68769-0012 4.295 Oh, say! that's different," observed Markham, altering his demeanor. 6829-68771-0006 5.92 And this was why Kenneth and Beth discovered him conversing with the young woman in the buggy. +6829-68769-0039 4.045 He looked up rather ungraciously, but motioned them to be seated. 6829-68771-0008 7.18 These women were flattered by the attention of the young lady and had promised to assist in electing mister Forbes. +6829-68769-0051 3.545 There was a grim smile of amusement on his shrewd face. 6829-68771-0010 9.82 The Fairview band was engaged to discourse as much harmony as it could produce, and the resources of the great house were taxed to entertain the guests. +6829-68769-0037 2.53 I've seen lots of that kind in my day. 6829-68771-0011 5.625 Tables were spread on the lawn and a dainty but substantial repast was to be served. +6829-68769-0028 3.29 He is supposed to sign all the checks of the concern. 6829-68771-0014 4.77 We ought to have more attendants, Beth," said Louise, approaching her cousin. +6829-68769-0033 4.02 It was better for him to think the girl unfeeling than to know the truth. 6829-68771-0015 4.525 Won't you run into the house and see if Martha can't spare one or two more maids"? +6829-68769-0035 2.755 It won't be much, but I'm grateful to find a friend. 6829-68771-0016 6.99 She was very fond of the young ladies, whom she had known when Aunt Jane was the mistress here, and Beth was her especial favorite. +6829-68771-0021 2.61 But it can't be," protested the girl. 6829-68771-0018 8.445 For a moment Beth stood staring, while the new maid regarded her with composure and a slight smile upon her beautiful face. +6829-68771-0031 2.515 Her eyes wandered to the maid's hands. 6829-68771-0019 7.42 She was dressed in the regulation costume of the maids at Elmhurst, a plain black gown with white apron and cap. +6829-68771-0022 3.8 I attend to the household mending, you know, and care for the linen. 6829-68771-0020 4.615 Then she gave a little laugh, and replied: "No, Miss Beth. I'm Elizabeth Parsons". +6829-68769-0012 4.295 Oh, say! that's different," observed Markham, altering his demeanor. 6829-68771-0023 5.425 You speak like an educated person," said Beth, wonderingly. "Where is your home"? +6829-68771-0035 4.39 Will you leave me alone in my own room, or must I go away to escape you"? 6829-68771-0024 6.245 For the first time the maid seemed a little confused, and her gaze wandered from the face of her visitor. +6829-68769-0051 3.545 There was a grim smile of amusement on his shrewd face. 6829-68771-0025 7.83 She sat down in a rocking chair, and clasping her hands in her lap, rocked slowly back and forth. "I'm sorry," said Beth. +6829-68769-0051 3.545 There was a grim smile of amusement on his shrewd face. 6829-68771-0027 5.32 They - they excite me, in some way, and I - I can't bear them. You must excuse me". +6829-68771-0035 4.39 Will you leave me alone in my own room, or must I go away to escape you"? 6829-68771-0029 8.945 Beth was a beautiful girl - the handsomest of the three cousins, by far; yet Eliza surpassed her in natural charm, and seemed well aware of the fact. +6829-68769-0003 4.215 It was a deliberate theft from his employers to protect a girl he loved. 6829-68771-0030 6.225 Her manner was neither independent nor assertive, but rather one of well bred composure and calm reliance. +6829-68769-0002 3.075 I can't see it in that light," said the old lawyer. 6829-68771-0032 6.555 However her features and form might repress any evidence of nervousness, these hands told a different story. +6829-68771-0034 2.475 I wish I knew myself," she cried, fiercely. 6829-68771-0033 5.45 She rose quickly to her feet, with an impetuous gesture that made her visitor catch her breath. +6829-68769-0002 3.075 I can't see it in that light," said the old lawyer. 6829-68771-0035 4.39 Will you leave me alone in my own room, or must I go away to escape you"? +6829-68769-0028 3.29 He is supposed to sign all the checks of the concern. 6829-68771-0036 5.2 Eliza closed the door behind her with a decided slam, and a key clicked in the lock. +8463-287645-0008 3.325 As usual nothing was done in the way of punishment". 8463-287645-0000 4.73 This was what did the mischief so far as the "running away" was concerned. +8463-294828-0008 2.65 And yet, what a fine, gallant lad! 8463-287645-0003 7.905 Of this party, Edward, a boy of seventeen, called forth much sympathy; he too was claimed by Hollan. +8463-294828-0026 2.745 We have a commander who's game for anything"! 8463-287645-0006 7.71 The doctor who attended the injured creature in this case was simply told that she slipped and fell down stairs as she was coming down. +8463-294828-0021 2.735 A route slightly less direct, that's all. 8463-287645-0010 4.325 He worked me very hard; he wanted to be beating me all the time". +8463-287645-0008 3.325 As usual nothing was done in the way of punishment". 8463-287645-0011 6.38 She was a large, homely woman; they were common white people, with no reputation in the community". +8463-294828-0011 3.91 He went here, there, and everywhere in perfect contentment. 8463-287645-0012 5.425 Substantially this was Jacob's unvarnished description of his master and mistress. +8463-294828-0032 4.395 In person. Welcome aboard, professor. Your cabin is waiting for you". 8463-287645-0013 6.665 As to his age, and also the name of his master, Jacob's statement varied somewhat from the advertisement. +3729-6852-0016 4.195 Madame Quinson, besides, can answer your enquiries. 3729-6852-0011 7.37 I had a name, I believe, in my young days, but I have forgotten it since I have been in service. +3729-6852-0010 2.755 I never had any family. 3729-6852-0014 5.71 Here, go and get me change for a Louis". "I have it, sir". +3729-6852-0025 3 Is there not a meridian everywhere"? 3729-6852-0016 4.195 Madame Quinson, besides, can answer your enquiries. +3729-6852-0016 4.195 Madame Quinson, besides, can answer your enquiries. 3729-6852-0018 6.21 I sit down at a small table: a waiter comes immediately to enquire my wishes. +3729-6852-0019 3.305 I tell him to give me some coffee, if it is good. 3729-6852-0022 8.315 I address him in Italian, and he answers very wittily, but his way of speaking makes me smile, and I tell him why. +3729-6852-0019 3.305 I tell him to give me some coffee, if it is good. 3729-6852-0023 8.185 My remark pleases him, but I soon prove to him that it is not the right way to speak, however perfect may have been the language of that ancient writer. +3729-6852-0019 3.305 I tell him to give me some coffee, if it is good. 3729-6852-0024 5.515 I see a crowd in one corner of the garden, everybody standing still and looking up. +3729-6852-0016 4.195 Madame Quinson, besides, can answer your enquiries. 3729-6852-0026 4.69 Yes, but the meridian of the Palais Royal is the most exact". +3729-6852-0019 3.305 I tell him to give me some coffee, if it is good. 3729-6852-0028 5.265 All these honest persons are waiting their turn to get their snuff boxes filled". +3729-6852-0010 2.755 I never had any family. 3729-6852-0029 8.605 It is sold everywhere, but for the last three weeks nobody will use any snuff but that sold at the 'Civet Cat. +3729-6852-0025 3 Is there not a meridian everywhere"? 3729-6852-0031 4.4 But how did she manage to render it so fashionable"? +3729-6852-0019 3.305 I tell him to give me some coffee, if it is good. 3729-6852-0037 5.89 She introduced me to all her guests, and gave me some particulars respecting every one of them. +3729-6852-0021 2.96 I thank him and take my leave. 3729-6852-0038 5.77 What, sir"! I said to him, "am I fortunate enough to see you? +3729-6852-0019 3.305 I tell him to give me some coffee, if it is good. 3729-6852-0039 8.825 He himself recited the same passage in French, and politely pointed out the parts in which he thought that I had improved on the original. +3729-6852-0019 3.305 I tell him to give me some coffee, if it is good. 3729-6852-0044 6.98 I will make you translate them into French, and you need not be afraid of my finding you insatiable". +7176-92135-0026 2.95 Enter Hamlet with his favourite boar hound. 7176-88083-0000 5.695 All about him was a tumult of bright and broken color, scattered in broad splashes. +7176-92135-0039 3.125 Tea, please, Matthews. Butler (impassively). 7176-88083-0002 7.51 His feet were red, his long narrow beak, with its saw toothed edges and sharp hooked tip, was bright red. +7176-92135-0024 4.1 To be or not to be, that is the question; whether 'tis nobler 7176-88083-0003 7.6 But here he was at a terrible disadvantage as compared with the owls, hawks, and eagles. He had no rending claws. +7176-88083-0016 3.92 Straightway the hawk glided from his perch and darted after him. 7176-88083-0004 7.5 But suddenly, straight and swift as a diving cormorant, he shot down into the torrent and disappeared beneath the surface. +7176-88083-0016 3.92 Straightway the hawk glided from his perch and darted after him. 7176-88083-0005 4.7 Once fairly a wing, however, he wheeled and made back hurriedly for his perch. +7176-92135-0008 4.43 Lend me your ear for ten minutes, and you shall learn just what stagecraft is". 7176-88083-0006 4.295 It might have seemed that a trout of this size was a fairly substantial meal. +7176-92135-0008 4.43 Lend me your ear for ten minutes, and you shall learn just what stagecraft is". 7176-88083-0009 4.045 The great hawk followed hurriedly, to retrieve his prey from the ground. +7176-88083-0008 3.28 In despair he hurled himself downward too soon. 7176-88083-0010 6.74 The cat growled softly, picked up the prize in her jaws and trotted into the bushes to devour it. +7176-88083-0016 3.92 Straightway the hawk glided from his perch and darted after him. 7176-88083-0012 5.045 The hawk alighted on the dead branch, and sat upright, motionless, as if surprised. +7176-88083-0009 4.045 The great hawk followed hurriedly, to retrieve his prey from the ground. 7176-88083-0014 4.67 The hawk sat upon the branch and watched his quarry swimming beneath the surface. +7176-88083-0016 3.92 Straightway the hawk glided from his perch and darted after him. 7176-88083-0019 5.81 As he flew, his down reaching, clutching talons were not half a yard above the fugitive's head. +7176-88083-0009 4.045 The great hawk followed hurriedly, to retrieve his prey from the ground. 7176-88083-0020 5.415 Where the waves for an instant sank, they came closer, - but not quite within grasping reach. +7176-92135-0024 4.1 To be or not to be, that is the question; whether 'tis nobler 7176-88083-0022 9.485 The hawk, embittered by the loss of his first quarry, had become as dogged in pursuit as a weasel, not to be shaken off or evaded or deceived. +7176-88083-0016 3.92 Straightway the hawk glided from his perch and darted after him. 7176-88083-0023 9.645 He had a lot of line out, and the place was none too free for a long cast; but he was impatient to drop his flies again on the spot where the big fish was feeding. +7176-92135-0024 4.1 To be or not to be, that is the question; whether 'tis nobler 7176-88083-0024 8.195 The last drop fly, as luck would have it, caught just in the corner of the hawk's angrily open beak, hooking itself firmly. +7176-88083-0006 4.295 It might have seemed that a trout of this size was a fairly substantial meal. 7176-88083-0025 7.38 At the sudden sharp sting of it, the great bird turned his head and noticed, for the first time, the fisherman standing on the bank. +7176-88083-0009 4.045 The great hawk followed hurriedly, to retrieve his prey from the ground. 7176-88083-0026 5.53 The drag upon his beak and the light check upon his wings were inexplicable to him, and appalling. +7127-75947-0008 4.155 The arrow pierced his heart and wounded him mortally. 7127-75946-0004 4.49 Certainly, sire; but I must have money to do that". "What! +7127-75947-0035 4.415 Good gracious! has the king any right to interfere in matters of that kind? 7127-75946-0006 7.98 He has given them with too much grace not to have others still to give, if they are required, which is the case at the present moment. +7127-75947-0017 2.665 What, already here"! they said to her. 7127-75946-0007 4.755 It is necessary, therefore, that he should comply". The king frowned. +7127-75947-0030 2.76 She was here just now," said the count. 7127-75946-0008 4.46 Does your majesty then no longer believe the disloyal attempt"? +7127-75946-0005 2.67 What do you mean"? inquired Louis, 7127-75946-0009 4.72 Not at all; you are, on the contrary, most agreeable to me". +7127-75947-0011 3.62 Remain, I implore you: the evening is most lovely. 7127-75946-0012 9.87 The news circulated with the rapidity of lightning; during its progress it kindled every variety of coquetry, desire, and wild ambition. +7127-75947-0002 3.235 Do you think so"? she replied with indifference. 7127-75946-0013 8.58 The king had completed his toilette by nine o'clock; he appeared in an open carriage decorated with branches of trees and flowers. +7127-75947-0018 4.04 I have been here this quarter of an hour," replied La Valliere. 7127-75946-0015 7.515 Suddenly, for the purpose of restoring peace and order, Spring, accompanied by his whole court, made his appearance. +7127-75947-0018 4.04 I have been here this quarter of an hour," replied La Valliere. 7127-75946-0018 9.14 There was something in his carriage which resembled the buoyant movements of an immortal, and he did not dance so much as seem to soar along. +7127-75947-0018 4.04 I have been here this quarter of an hour," replied La Valliere. 7127-75946-0020 6.52 Far from it, sire; your majesty having given no directions about it, the musicians have retained it". +7127-75947-0002 3.235 Do you think so"? she replied with indifference. 7127-75946-0024 5.09 Monsieur was the only one who did not understand anything about the matter. +7127-75947-0018 4.04 I have been here this quarter of an hour," replied La Valliere. 7127-75946-0027 9.675 Disdainful of a success of which Madame showed no acknowledgement, he thought of nothing but boldly regaining the marked preference of the princess. +7127-75946-0023 3.745 The king seemed only pleased with every one present. 7127-75946-0029 9.285 The king, who had from this moment become in reality the principal dancer in the quadrille, cast a look upon his vanquished rival. +5105-28240-0018 2.885 You will take me on board, count, will you not"? 5105-28241-0000 6.455 Her sea going qualities were excellent, and would have amply sufficed for a circumnavigation of the globe. +5105-28240-0016 4.17 To all these inquiries, the count responded in the affirmative. 5105-28241-0005 8.415 For a few miles she followed the line hitherto presumably occupied by the coast of Algeria; but no land appeared to the south. +5105-28233-0001 4.49 He seemed born to please without being conscious of the power he possessed. 5105-28241-0006 7.55 The log and the compass, therefore, were able to be called upon to do the work of the sextant, which had become utterly useless. +5105-28240-0002 4.01 exclaimed Servadac, keeping his eye unmoved at his telescope. 5105-28241-0008 8.54 The earth has undoubtedly entered upon a new orbit, but she is not incurring any probable risk of being precipitated onto the sun". +5105-28240-0013 2.96 Nothing more than you know yourself". 5105-28241-0009 7.01 And what demonstration do you offer," asked Servadac eagerly, "that it will not happen"? +5105-28240-0010 2.935 Captain Servadac hastened towards him. 5105-28241-0012 6.775 Is it not impossible," he murmured aloud, "that any city should disappear so completely? +5105-28241-0014 2.995 Another circumstance was most remarkable. 5105-28241-0013 4.82 Would not the loftiest eminences of the city at least be visible? +5105-28240-0018 2.885 You will take me on board, count, will you not"? 5105-28241-0016 6.285 You must see, lieutenant, I should think, that we are not so near the coast of Algeria as you imagined". +5105-28240-0018 2.885 You will take me on board, count, will you not"? 5105-28241-0019 5.29 Nothing was to be done but to put about, and return in disappointment towards the north. +7021-85628-0004 2.805 Yes, why not"? thought Anders. 7021-79759-0000 4.775 Nature of the Effect produced by Early Impressions. +7021-79740-0009 3.635 They were now playing with their dolls in the parlor. 7021-79759-0002 5.25 They are chiefly formed from combinations of the impressions made in childhood. +7021-79759-0001 2.48 That is comparatively nothing. 7021-79759-0003 4.62 Vast Importance and Influence of this mental Furnishing, +1320-122617-0041 4.15 Uncas cast his skin, and stepped forth in his own beautiful proportions. 1320-122612-0001 9.52 The dews were suffered to exhale, and the sun had dispersed the mists, and was shedding a strong and clear light in the forest, when the travelers resumed their journey. +1320-122612-0014 3.515 The examination, however, resulted in no discovery. 1320-122612-0002 7.46 After proceeding a few miles, the progress of Hawkeye, who led the advance, became more deliberate and watchful. +1320-122617-0005 4.4 The bear shook his shaggy sides, and then a well known voice replied: 1320-122612-0003 9.865 He often stopped to examine the trees; nor did he cross a rivulet without attentively considering the quantity, the velocity, and the color of its waters. +1320-122617-0005 4.4 The bear shook his shaggy sides, and then a well known voice replied: 1320-122612-0004 6.425 Distrusting his own judgment, his appeals to the opinion of Chingachgook were frequent and earnest. +1320-122612-0009 3.88 It would have been more wonderful had he spoken without a bidding. 1320-122612-0005 5.915 Yet here are we, within a short range of the Scaroons, and not a sign of a trail have we crossed! +1320-122617-0030 3.98 So choose for yourself to make a rush or tarry here". 1320-122612-0006 4.845 Let us retrace our steps, and examine as we go, with keener eyes. +1320-122612-0014 3.515 The examination, however, resulted in no discovery. 1320-122612-0007 5.54 Chingachgook had caught the look, and motioning with his hand, he bade him speak. +1320-122612-0009 3.88 It would have been more wonderful had he spoken without a bidding. 1320-122612-0008 7.875 The eyes of the whole party followed the unexpected movement, and read their success in the air of triumph that the youth assumed. +1320-122612-0009 3.88 It would have been more wonderful had he spoken without a bidding. 1320-122612-0013 6.55 A circle of a few hundred feet in circumference was drawn, and each of the party took a segment for his portion. +1320-122617-0041 4.15 Uncas cast his skin, and stepped forth in his own beautiful proportions. 1320-122612-0015 6.385 The whole party crowded to the spot where Uncas pointed out the impression of a moccasin in the moist alluvion. +5142-33396-0028 3.755 On a bench in a far corner were a dozen people huddled together. 5142-33396-0001 5.02 What is your country, Olaf? Have you always been a thrall"? The thrall's eyes flashed. +5142-33396-0010 3.455 In the stern I curved the tail up almost as high as the head. 5142-33396-0006 6.23 I made her for only twenty oars because I thought few men would follow me; for I was young, fifteen years old. +5142-33396-0003 3.47 The rest of you, off a viking'! "He had three ships. 5142-33396-0007 4.975 At the prow I carved the head with open mouth and forked tongue thrust out. +5142-33396-0050 2.885 May you drink heart's ease from it for many years. 5142-33396-0012 4.59 Then I will get me a farm and will winter in that land. Now who will follow me? +5142-33396-0021 3.505 Up and down the water we went to get much wealth and much frolic. 5142-33396-0015 4.31 As our boat flashed down the rollers into the water I made this song and sang it: +5142-33396-0014 3.245 Thirty men, one after another, raised their horns and said: 5142-33396-0019 4.985 Oh! it is better to live on the sea and let other men raise your crops and cook your meals. +5142-33396-0036 4.26 So I will give out this law: that my men shall never leave you alone. 5142-33396-0022 4.77 What of the farm, Olaf'? "'Not yet,' I answered. 'Viking is better for summer. +5142-33396-0047 2.535 My men pounded the table with their fists. 5142-33396-0024 5.345 I stood with my back to the wall; for I wanted no sword reaching out of the dark for me. +5142-33396-0037 3.575 Hakon there shall be your constant companion, friend farmer. 5142-33396-0031 7.845 They set up a crane over the fire and hung the pot upon it, and we sat and watched it boil while we joked. At last the supper began. +5142-33396-0010 3.455 In the stern I curved the tail up almost as high as the head. 5142-33396-0032 9.785 The farmer sat gloomily on the bench and would not eat, and you cannot wonder; for he saw us putting potfuls of his good beef and basket loads of bread into our big mouths. +5142-33396-0050 2.885 May you drink heart's ease from it for many years. 5142-33396-0033 5.28 You would not eat with us. You cannot say no to half of my ale. I drink this to your health. +5142-33396-0009 3.37 There, stand so'! I said, 'and glare and hiss at my foes. 5142-33396-0034 6.615 Then I drank half of the hornful and sent the rest across the fire to the farmer. He took it and smiled, saying: +5142-36586-0000 3.65 It is manifest that man is now subject to much variability. 5142-33396-0036 4.26 So I will give out this law: that my men shall never leave you alone. +5142-33396-0060 2.615 Take him out, Thorkel, and let him taste your sword. 5142-33396-0038 4.18 He shall not leave you day or night, whether you are working or playing or sleeping. +5142-33396-0030 2.765 The thralls were bringing in a great pot of meat. 5142-33396-0042 6.095 So no tales got out to the neighbors. Besides, it was a lonely place, and by good luck no one came that way. +5142-33396-0030 2.765 The thralls were bringing in a great pot of meat. 5142-33396-0044 4.855 I am stiff with long sitting,' he said. 'I itch for a fight'. "I turned to the farmer. +5142-33396-0014 3.245 Thirty men, one after another, raised their horns and said: 5142-33396-0051 5.57 And with it I leave you a name, Sif the Friendly. I shall hope to drink with you sometime in Valhalla. +5142-33396-0060 2.615 Take him out, Thorkel, and let him taste your sword. 5142-33396-0052 5.88 Here is a ring for Sif the Friendly'. "'And here is a bracelet'. "'A sword would not be ashamed to hang at your side. +5142-33396-0049 3.305 Here, friend, take it,' and he thrust it into the farmer's hand. 5142-33396-0054 5.745 That is the best way to decide, for the spear will always point somewhere, and one thing is as good as another. +5142-33396-0050 2.885 May you drink heart's ease from it for many years. 5142-33396-0059 5.47 Yes. And with all your fingers it took you a year to catch me'. "The king frowned more angrily. +5142-33396-0025 3.32 Come, come'! I called, when no one obeyed. 'A fire! 5142-33396-0065 5.195 Soft heart'! he said gently to her; then to Thorkel, 'Well, let him go, Thorkel! +5142-33396-0049 3.305 Here, friend, take it,' and he thrust it into the farmer's hand. 5142-33396-0067 5.565 But, young sharp tongue, now that we have caught you we will put you into a trap that you cannot get out of. +5683-32866-0000 2.645 Miss Lake declined the carriage to night. 5683-32879-0000 8.92 It was not very much past eleven that morning when the pony carriage from Brandon drew up before the little garden wicket of Redman's Farm. +5683-32879-0022 4.175 I like you still, Rachel; I'm sure I'll always like you. 5683-32879-0003 9.345 Women can hide their pain better than we men, and bear it better, too, except when shame drops fire into the dreadful chalice. +5683-32866-0001 3.47 And he added something still less complimentary. 5683-32879-0005 6.11 This transient spring and lighting up are beautiful - a glamour beguiling our senses. +5683-32865-0001 2.58 said Lord Chelford, addressing me. 5683-32879-0007 6.795 Rachel's pale and sharpened features and dilated eye struck her with a painful surprise. +5683-32879-0008 2.95 You have been so ill, my poor Rachel. 5683-32879-0009 5.135 Ill and troubled, dear - troubled in mind, and miserably nervous. +5683-32866-0006 4.215 Yes, so they said; but that would, I think, have been worse. 5683-32879-0010 7.75 Poor Rachel! her nature recoiled from deceit, and she told, at all events, as much of the truth as she dared. +5683-32865-0014 2.615 He's not a man for country quarters! 5683-32879-0011 9.21 She spoke with a sudden energy, which partook of fear and passion, and flushed her thin cheek, and made her languid eyes flash. +5683-32865-0015 4.145 I had a horrid dream about him last night.' That? 5683-32879-0012 4.38 Thank you, Rachel, my Cousin Rachel, my only friend. +5683-32879-0001 3.66 Well, she was better, though she had had a bad night. 5683-32879-0014 8.405 Yes, something - everything,' said Rachel, hurriedly, looking frowningly at a flower which she was twirling in her fingers. +5683-32866-0023 2.745 All the furniture belonged to other times. 5683-32879-0018 7.44 It is an antipathy - an antipathy I cannot get over, dear Dorcas; you may think it a madness, but don't blame me. +5683-32866-0007 4.12 If a fellow's been a little bit wild, he's Beelzebub at once. 5683-32879-0019 6.35 I have very few to love me now, and I thought you might love me, as I have begun to love you. +5683-32865-0014 2.615 He's not a man for country quarters! 5683-32879-0020 6.545 And she threw her arms round her cousin's neck, and brave Rachel at last burst into tears. +5683-32865-0006 3.35 At dinner Lake was easy and amusing. 5683-32879-0021 4.09 Dorcas, in her strange way, was moved. +5683-32865-0003 3.51 They are cousins, you know; we are all cousins. 5683-32879-0022 4.175 I like you still, Rachel; I'm sure I'll always like you. +5683-32866-0001 3.47 And he added something still less complimentary. 5683-32879-0023 4.975 You resemble me, Rachel: you are fearless and inflexible and generous. +1580-141084-0003 4.1 No names, please"! said Holmes, as we knocked at Gilchrist's door. 1580-141084-0000 4.615 It was the Indian, whose dark silhouette appeared suddenly upon his blind. +1580-141084-0034 4.49 Well, well, don't trouble to answer. Listen, and see that I do you no injustice. 1580-141084-0002 5.905 This set of rooms is quite the oldest in the college, and it is not unusual for visitors to go over them. +1580-141083-0041 3.575 Let us hear the suspicions. I will look after the proofs". 1580-141084-0003 4.1 No names, please"! said Holmes, as we knocked at Gilchrist's door. +1580-141083-0050 3.085 I really don't think he knew much about it, mister Holmes. 1580-141084-0004 9.005 Of course, he did not realize that it was I who was knocking, but none the less his conduct was very uncourteous, and, indeed, under the circumstances rather suspicious". +1580-141083-0046 3.53 But I have occasionally done the same thing at other times". 1580-141084-0008 6.795 I cannot allow the examination to be held if one of the papers has been tampered with. The situation must be faced". +1580-141083-0021 3.715 There is no opening except the one pane," said our learned guide. 1580-141084-0009 4.685 It is possible that I may be in a position then to indicate some course of action. +1580-141084-0037 2.965 When I approached your room, I examined the window. 1580-141084-0011 5 When we were out in the darkness of the quadrangle, we again looked up at the windows. +1580-141084-0045 3.625 Suddenly he heard him at the very door. There was no possible escape. 1580-141084-0016 5.96 My friend did not appear to be depressed by his failure, but shrugged his shoulders in half humorous resignation. +1580-141083-0016 4.255 I was in such a hurry to come to you". "You left your door open"? 1580-141084-0021 4.01 On the palm were three little pyramids of black, doughy clay. +1580-141083-0030 3.48 mister Soames was somewhat overwhelmed by this flood of information. 1580-141084-0023 8.735 In a few hours the examination would commence, and he was still in the dilemma between making the facts public and allowing the culprit to compete for the valuable scholarship. +1580-141083-0046 3.53 But I have occasionally done the same thing at other times". 1580-141084-0024 9.185 He could hardly stand still so great was his mental agitation, and he ran towards Holmes with two eager hands outstretched. "Thank heaven that you have come! +1580-141083-0025 3.905 The man entered and took the papers, sheet by sheet, from the central table. 1580-141084-0026 6.995 If this matter is not to become public, we must give ourselves certain powers and resolve ourselves into a small private court martial. +1580-141083-0046 3.53 But I have occasionally done the same thing at other times". 1580-141084-0029 8.075 His troubled blue eyes glanced at each of us, and finally rested with an expression of blank dismay upon Bannister in the farther corner. +1580-141083-0050 3.085 I really don't think he knew much about it, mister Holmes. 1580-141084-0031 6.47 We want to know, mister Gilchrist, how you, an honourable man, ever came to commit such an action as that of yesterday"? +1580-141083-0028 2.585 Then he tossed it down and seized the next. 1580-141084-0032 4.995 For a moment Gilchrist, with upraised hand, tried to control his writhing features. +1580-141083-0040 3.75 One hardly likes to throw suspicion where there are no proofs". 1580-141084-0033 7 Come, come," said Holmes, kindly, "it is human to err, and at least no one can accuse you of being a callous criminal. +1580-141083-0036 3.98 Holmes held it out on his open palm in the glare of the electric light. 1580-141084-0034 4.49 Well, well, don't trouble to answer. Listen, and see that I do you no injustice. +1580-141084-0035 2.63 He could examine the papers in his own office. 1580-141084-0039 4.885 I entered, and I took you into my confidence as to the suggestions of the side table. +1580-141084-0035 2.63 He could examine the papers in his own office. 1580-141084-0040 5.985 He returned carrying his jumping shoes, which are provided, as you are aware, with several sharp spikes. +1580-141084-0045 3.625 Suddenly he heard him at the very door. There was no possible escape. 1580-141084-0041 7.99 No harm would have been done had it not been that, as he passed your door, he perceived the key which had been left by the carelessness of your servant. +1580-141083-0024 4.48 You left him in a chair, you say. Which chair"? "By the window there". 1580-141084-0042 5.06 A sudden impulse came over him to enter, and see if they were indeed the proofs. +1580-141083-0030 3.48 mister Soames was somewhat overwhelmed by this flood of information. 1580-141084-0047 5.25 I have a letter here, mister Soames, which I wrote to you early this morning in the middle of a restless night. +1580-141084-0045 3.625 Suddenly he heard him at the very door. There was no possible escape. 1580-141084-0048 9.265 It will be clear to you, from what I have said, that only you could have let this young man out, since you were left in the room, and must have locked the door when you went out. +1580-141083-0024 4.48 You left him in a chair, you say. Which chair"? "By the window there". 1580-141084-0049 7.575 It was simple enough, sir, if you only had known, but, with all your cleverness, it was impossible that you could know. +6930-76324-0010 2.69 What in the world is that"? queried Joyce. 6930-75918-0002 5.025 Congratulations were poured in upon the princess everywhere during her journey. +6930-76324-0013 4.305 It can't hurt anything, I'm sure, for we won't disturb things at all. 6930-75918-0006 5.85 This has indeed been a harassing day," continued the young man, his eyes fixed upon his friend. +6930-75918-0000 3.505 Concord returned to its place amidst the tents. 6930-75918-0008 4.785 Can you imagine why Buckingham has been so violent"? "I suspect". +6930-76324-0019 2.575 Now let's dust the furniture and pictures". 6930-75918-0009 7.28 It is you who are mistaken, Raoul; I have read his distress in his eyes, in his every gesture and action the whole day". +6930-75918-0000 3.505 Concord returned to its place amidst the tents. 6930-75918-0015 6.38 Thus it is that the honor of three is saved: our country's, our master's, and our own. +6930-76324-0013 4.305 It can't hurt anything, I'm sure, for we won't disturb things at all. 6930-75918-0017 6.16 But in this friendly pressure Raoul could detect the nervous agitation of a great internal conflict. +4077-13751-0019 2.92 Who began the quarrel? Was it the "Mormons"? 4077-13754-0000 4.78 The army found the people in poverty, and left them in comparative wealth. +4077-13751-0013 4.315 Their sufferings have never yet been fitly chronicled by human scribe. 4077-13754-0003 5.68 Moreover, had the people been inclined to rebellion what greater opportunity could they have wished? +4077-13754-0001 3.77 But a word further concerning the expedition in general. 4077-13754-0004 4.985 Already a North and a South were talked of - why not set up also a West? +4077-13751-0013 4.315 Their sufferings have never yet been fitly chronicled by human scribe. 4077-13754-0009 7.65 At the inception of plural marriage among the Latter day Saints, there was no law, national or state, against its practise. +1995-1837-0015 4.485 The squares of cotton, sharp edged, heavy, were just about to burst to bolls! 1995-1826-0000 9.485 In the debate between the senior societies her defence of the Fifteenth Amendment had been not only a notable bit of reasoning, but delivered with real enthusiasm. +1995-1837-0015 4.485 The squares of cotton, sharp edged, heavy, were just about to burst to bolls! 1995-1826-0002 4.605 John Taylor, who had supported her through college, was interested in cotton. +1995-1837-0000 3.865 He knew the Silver Fleece - his and Zora's - must be ruined. 1995-1826-0005 5.125 But, John, there's no society - just elementary work +1995-1837-0013 3.195 Then he looked down. The lagoon was dry. 1995-1826-0009 7.57 You ought to know, John, if I teach Negroes I'll scarcely see much of people in my own class". +1995-1837-0020 3.21 The years of the days of her dying were ten. 1995-1826-0011 8.94 Here she was teaching dirty children, and the smell of confused odors and bodily perspiration was to her at times unbearable. +1995-1836-0007 3.435 But you believe in some education"? asked Mary Taylor. 1995-1826-0012 6.18 She wanted a glance of the new books and periodicals and talk of great philanthropies and reforms. +1995-1837-0009 3.76 The lagoon had been level with the dykes a week ago; and now? 1995-1826-0013 8.77 So for the hundredth time she was thinking today, as she walked alone up the lane back of the barn, and then slowly down through the bottoms. +1995-1826-0015 3.55 She had almost forgotten that it was here within touch and sight. 1995-1826-0016 5.9 The glimmering sea of delicate leaves whispered and murmured before her, stretching away to the Northward. +1995-1837-0022 3.415 Up in the sick room Zora lay on the little white bed. 1995-1826-0017 6.145 There might be a bit of poetry here and there, but most of this place was such desperate prose. +1995-1837-0015 4.485 The squares of cotton, sharp edged, heavy, were just about to burst to bolls! 1995-1826-0018 5.01 Her regard shifted to the green stalks and leaves again, and she started to move away. +1995-1826-0004 3.035 Might learn something useful down there". 1995-1826-0019 5.25 Cotton is a wonderful thing, is it not, boys"? she said rather primly. +1995-1837-0011 3.375 He started at the thought. He hurried forth sadly. 1995-1826-0020 6.12 Miss Taylor did not know much about cotton, but at least one more remark seemed called for. +1995-1826-0003 3.09 Better go," he had counselled, sententiously. 1995-1826-0022 4.745 I suppose, though, it's too early for them". Then came the explosion. +1995-1837-0002 2.79 Ah! the swamp, the cruel swamp! 1995-1826-0024 5.095 The Golden Fleece - it's the Silver Fleece"! He harkened. +5683-32866-0001 3.47 And he added something still less complimentary. 5683-32865-0004 7.365 Whatever Lord Chelford said, Miss Brandon received it very graciously, and even with a momentary smile. +5683-32865-0002 2.78 He had his hand upon Lake's shoulder. 5683-32865-0007 6.065 I'm glad you like it,' says Wylder, chuckling benignantly on it, over his shoulder. +5683-32866-0001 3.47 And he added something still less complimentary. 5683-32865-0008 6.12 I believe I have a little taste that way; those are all real, you know, those jewels. +5683-32866-0000 2.645 Miss Lake declined the carriage to night. 5683-32865-0009 9.89 And he placed it in that gentleman's fingers, who now took his turn at the lamp, and contemplated the little parallelogram with a gleam of sly amusement. +5683-32866-0006 4.215 Yes, so they said; but that would, I think, have been worse. 5683-32865-0010 6.335 I was thinking it's very like the ace of hearts,' answered the captain softly, smiling on. +5683-32865-0003 3.51 They are cousins, you know; we are all cousins. 5683-32865-0011 6.355 Whereupon Lake laughed quietly, still looking on the ace of hearts with his sly eyes. +5683-32865-0015 4.145 I had a horrid dream about him last night.' That? 5683-32865-0013 7.095 Do you know?' 'Lake? Oh! I really can't tell; but he'll soon tire of country life. +5683-32879-0012 4.38 Thank you, Rachel, my Cousin Rachel, my only friend. 5683-32865-0015 4.145 I had a horrid dream about him last night.' That? +5683-32866-0006 4.215 Yes, so they said; but that would, I think, have been worse. 5683-32865-0017 5.455 All the time he was talking to me his angry little eyes were following Lake. +1320-122617-0005 4.4 The bear shook his shaggy sides, and then a well known voice replied: 1320-122617-0000 7.835 Notwithstanding the high resolution of Hawkeye he fully comprehended all the difficulties and danger he was about to incur. +1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0003 6.285 There was something in his air and manner that betrayed to the scout the utter confusion of the state of his mind. +1320-122617-0008 4.185 The young man is in bondage, and much I fear his death is decreed. 1320-122617-0005 4.4 The bear shook his shaggy sides, and then a well known voice replied: +1320-122612-0016 3.49 Run back, Uncas, and bring me the size of the singer's foot. 1320-122617-0006 5.655 Can these things be"? returned David, breathing more freely, as the truth began to dawn upon him. +1320-122617-0005 4.4 The bear shook his shaggy sides, and then a well known voice replied: 1320-122617-0008 4.185 The young man is in bondage, and much I fear his death is decreed. +1320-122612-0009 3.88 It would have been more wonderful had he spoken without a bidding. 1320-122617-0009 7.705 I greatly mourn that one so well disposed should die in his ignorance, and I have sought a goodly hymn-" "Can you lead me to him"? +1320-122617-0005 4.4 The bear shook his shaggy sides, and then a well known voice replied: 1320-122617-0010 10 The task will not be difficult," returned David, hesitating; "though I greatly fear your presence would rather increase than mitigate his unhappy fortunes". +1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0011 9.76 The lodge in which Uncas was confined was in the very center of the village, and in a situation, perhaps, more difficult than any other to approach, or leave, without observation. +1320-122617-0041 4.15 Uncas cast his skin, and stepped forth in his own beautiful proportions. 1320-122617-0012 7.59 Four or five of the latter only lingered about the door of the prison of Uncas, wary but close observers of the manner of their captive. +1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0014 4.9 They drew back a little from the entrance and motioned to the supposed conjurer to enter. +1320-122617-0005 4.4 The bear shook his shaggy sides, and then a well known voice replied: 1320-122617-0015 5.125 But the bear, instead of obeying, maintained the seat it had taken, and growled: +1320-122612-0016 3.49 Run back, Uncas, and bring me the size of the singer's foot. 1320-122617-0017 5.655 Then, as if satisfied of their safety, the scout left his position, and slowly entered the place. +1320-122617-0008 4.185 The young man is in bondage, and much I fear his death is decreed. 1320-122617-0018 9.695 It was silent and gloomy, being tenanted solely by the captive, and lighted by the dying embers of a fire, which had been used for the purposed of cookery. +1320-122617-0005 4.4 The bear shook his shaggy sides, and then a well known voice replied: 1320-122617-0019 8.23 Uncas occupied a distant corner, in a reclining attitude, being rigidly bound, both hands and feet, by strong and painful withes. +1320-122617-0041 4.15 Uncas cast his skin, and stepped forth in his own beautiful proportions. 1320-122617-0020 8.895 The scout, who had left David at the door, to ascertain they were not observed, thought it prudent to preserve his disguise until assured of their privacy. +1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0021 5.335 What shall we do with the Mingoes at the door? They count six, and this singer is as good as nothing". +1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0023 7.815 Uncas, who had already approached the door, in readiness to lead the way, now recoiled, and placed himself, once more, in the bottom of the lodge. +1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0024 7.555 But Hawkeye, who was too much occupied with his own thoughts to note the movement, continued speaking more to himself than to his companion. +1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0025 6.36 So, Uncas, you had better take the lead, while I will put on the skin again, and trust to cunning for want of speed". +1320-122617-0005 4.4 The bear shook his shaggy sides, and then a well known voice replied: 1320-122617-0026 5.225 Well, what can't be done by main courage, in war, must be done by circumvention. +1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0027 5.689938 As soon as these dispositions were made, the scout turned to David, and gave him his parting instructions. +1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0029 7.875 If you are not then knocked on the head, your being a non composser will protect you; and you'll then have a good reason to expect to die in your bed. +1320-122617-0008 4.185 The young man is in bondage, and much I fear his death is decreed. 1320-122617-0031 6.285 Bravely and generously has he battled in my behalf, and this, and more, will I dare in his service". +1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0034 9.485 Hold"! said David, perceiving that with this assurance they were about to leave him; "I am an unworthy and humble follower of one who taught not the damnable principle of revenge. +1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0037 7.18 The Delaware dog"! he said, leaning forward, and peering through the dim light to catch the expression of the other's features; "is he afraid? +1320-122617-0022 3.855 The Delawares are children of the tortoise, and they outstrip the deer". 1320-122617-0039 7.055 The Mohican started on his feet, and shook his shaggy covering, as though the animal he counterfeited was about to make some desperate effort. +1320-122617-0041 4.15 Uncas cast his skin, and stepped forth in his own beautiful proportions. 1320-122617-0040 7.975 He had no occasion to delay, for at the next instant a burst of cries filled the outer air, and ran along the whole extent of the village. +1320-122612-0016 3.49 Run back, Uncas, and bring me the size of the singer's foot. 1320-122617-0041 4.15 Uncas cast his skin, and stepped forth in his own beautiful proportions. +121-127105-0036 4.15 But was that all her reward"? one of the ladies asked. 121-121726-0000 8.46 Also, a popular contrivance whereby love making may be suspended but not stopped during the picnic season. +121-121726-0004 4.02 Heaven, a good place to be raised to. 121-121726-0001 5.925 Harangue The tiresome product of a tireless tongue. +121-121726-0013 2.49 Tied to a woman. 121-121726-0002 4.41 angor, pain. Painful to hear. +121-127105-0008 2.76 He hung fire again. "A woman's. 121-121726-0003 6.755 Hay fever, a heart trouble caused by falling in love with a grass widow. +121-121726-0006 3.895 Heredity, the cause of all our faults. 121-121726-0004 4.02 Heaven, a good place to be raised to. +121-127105-0008 2.76 He hung fire again. "A woman's. 121-121726-0007 6.73 Horse sense, a degree of wisdom that keeps one from betting on the races. +121-121726-0014 3.165 Hypocrite, a horse dealer. 121-121726-0008 4.99 Hose Man's excuse for wetting the walk. +121-121726-0006 3.895 Heredity, the cause of all our faults. 121-121726-0009 7.26 Hotel, a place where a guest often gives up good dollars for poor quarters. +121-127105-0008 2.76 He hung fire again. "A woman's. 121-121726-0010 9.81 Housecleaning, a domestic upheaval that makes it easy for the government to enlist all the soldiers it needs. +121-121726-0014 3.165 Hypocrite, a horse dealer. 121-121726-0011 4.035 Husband, the next thing to a wife. +121-121726-0002 4.41 angor, pain. Painful to hear. 121-121726-0012 4.045 hussy, woman, and bond, tie. +61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. 61-70970-0000 6.075 Young Fitzooth had been commanded to his mother's chamber so soon as he had come out from his converse with the Squire. +61-70970-0012 3.135 Yet he will teach you a few tricks when morning is come. 61-70970-0001 6.155 There befell an anxious interview, Mistress Fitzooth arguing for and against the Squire's project in a breath. +61-70968-0045 3.475 Pray follow us, with mine and my lord Sheriff's men". 61-70970-0002 4.165 Most of all Robin thought of his father. What would he counsel? +61-70968-0056 3.565 The wine did certainly bring back the color to the Squire's cheeks. 61-70970-0007 4.485 He was in deep converse with the clerk, and entered the hall holding him by the arm. +61-70968-0039 3.805 And mine is Will Stuteley. Shall we be comrades"? 61-70970-0011 6.075 As any in England, I would say," said Gamewell, proudly. "That is, in his day. +61-70968-0016 3.72 And then they became vexed, and would have snatched your purse from us. 61-70970-0013 4.35 There was no chance to alter his sleeping room to one nearer to Gamewell's chamber. +61-70968-0046 3.55 Nottingham Castle was reached, and admittance was demanded. 61-70970-0015 8.415 Will," cried he, softly; and Stuteley, who had chosen his couch across the door of his young master's chamber, sprang up at once in answer. +61-70968-0029 3.495 The Squire helped to thrust them all in and entered swiftly himself. 61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. +61-70968-0046 3.55 Nottingham Castle was reached, and admittance was demanded. 61-70970-0018 4.6 The hours passed wearily by, and movement could yet be heard about the hall. +61-70970-0009 3.405 Tis late; and I go myself within a short space. 61-70970-0020 5.025 Will," whispered Robin, opening his door as he spoke, "are you ready"? +61-70970-0013 4.35 There was no chance to alter his sleeping room to one nearer to Gamewell's chamber. 61-70970-0021 5.405 They then renewed their journey, and, under the better light, made a safe crossing of the stable roofs. +61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. 61-70970-0024 7.235 They moved thereafter cautiously about the hut, groping before and about them to find something to show that Warrenton had fulfilled his mission. +61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. 61-70970-0025 7.435 They were upon the verge of an open trap, in the far corner of the hut; and Stuteley had tripped over the edge of the reversed flap mouth of this pit. +61-70970-0033 3.42 Truly such a horse should be worth much in Nottingham Fair! 61-70970-0026 5.475 Fitzooth's hand rested at last upon the top rung of a ladder, and slowly the truth came to him. +61-70970-0032 3.135 enquired Robin, with his suspicions still upon him. 61-70970-0027 5.08 Robin carefully descended the ladder and found himself soon upon firm rocky ground. +61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. 61-70970-0028 6.55 Stuteley was by his side in a flash: and then they both began feeling about them to ascertain the shape and character of this vault. +61-70968-0055 3.965 Robin was glad when, at length, they were left to their own devices. 61-70970-0029 4.03 From the blackness behind the light they heard a voice - Warrenton's! +61-70970-0007 4.485 He was in deep converse with the clerk, and entered the hall holding him by the arm. 61-70970-0031 5.135 cried he, waving the lanthorn before him to make sure that these were no ghosts in front of him. +61-70968-0039 3.805 And mine is Will Stuteley. Shall we be comrades"? 61-70970-0034 4.485 Nay, nay, lording," answered Warrenton, with a half laugh. +61-70968-0006 2.935 But then the picture was gone as quickly as it came". 61-70970-0035 7.405 Warrenton spoke thus with significance, to show Robin that he was not to think Geoffrey's claims to the estate would be passed by. +61-70970-0033 3.42 Truly such a horse should be worth much in Nottingham Fair! 61-70970-0036 6.785 Robin Fitzooth saw that his doubts of Warrenton had been unfair: and he became ashamed of himself for harboring them. +61-70968-0052 2.65 But who is this fellow plucking at your sleeve? 61-70970-0037 5.98 His tones rang pleasantly on Warrenton's ears, and forthwith a good fellowship was heralded between them. +61-70968-0046 3.55 Nottingham Castle was reached, and admittance was demanded. 61-70970-0039 6.665 He implores us to be discreet as the grave in this matter, for in sooth his life is in the hollow of our hands". +61-70970-0016 4.37 We will go out together to the bower; there is a way down to the court from my window. 61-70970-0040 4.165 They regained their apartment, apparently without disturbing the household of Gamewell. +5105-28240-0002 4.01 exclaimed Servadac, keeping his eye unmoved at his telescope. 5105-28240-0000 5.455 Fast as his legs could carry him, Servadac had made his way to the top of the cliff. +5105-28240-0016 4.17 To all these inquiries, the count responded in the affirmative. 5105-28240-0002 4.01 exclaimed Servadac, keeping his eye unmoved at his telescope. +5105-28240-0013 2.96 Nothing more than you know yourself". 5105-28240-0003 5.515 She is under sail; but she is Count Timascheff's yacht". He was right. +5105-28240-0014 3.07 Are you certain that this is the Mediterranean"? 5105-28240-0004 6.015 If the count were on board, a strange fatality was bringing him to the presence of his rival. +5105-28240-0014 3.07 Are you certain that this is the Mediterranean"? 5105-28240-0005 7.4 He reckoned, therefore, not only upon ascertaining the extent of the late catastrophe, but upon learning its cause. +5105-28240-0014 3.07 Are you certain that this is the Mediterranean"? 5105-28240-0007 4.625 Servadac took it for granted that the Dobryna was endeavoring to put in. +5105-28241-0014 2.995 Another circumstance was most remarkable. 5105-28240-0011 6.02 I left you on a continent, and here I have the honor of finding you on an island". +5105-28240-0014 3.07 Are you certain that this is the Mediterranean"? 5105-28240-0015 8.525 For some moments he seemed perfectly stupefied; then, recovering himself, he began to overwhelm the count with a torrent of questions. +5105-28240-0002 4.01 exclaimed Servadac, keeping his eye unmoved at his telescope. 5105-28240-0016 4.17 To all these inquiries, the count responded in the affirmative. +5105-28241-0014 2.995 Another circumstance was most remarkable. 5105-28240-0017 5.665 Some mysterious force seemed to have brought about a convulsion of the elements. +5105-28241-0003 3.98 Steam up and canvas spread, the schooner started eastwards. 5105-28240-0019 6.240062 My yacht is at your service, sir, even should you require to make a tour round the world". +5105-28233-0001 4.49 He seemed born to please without being conscious of the power he possessed. 5105-28240-0022 4.725 It was on the last day of January that the repairs of the schooner were completed. +5105-28241-0003 3.98 Steam up and canvas spread, the schooner started eastwards. 5105-28240-0024 8.2 Doubts now arose, and some discussion followed, whether or not it was desirable for Ben Zoof to accompany his master. +1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1181-0003 4.505 The hair was of brown yarn and hung down on her neck in several neat braids. +1284-1180-0027 3.27 Yet that task was not so easy as you may suppose. 1284-1181-0004 7.15 Gold is the most common metal in the Land of Oz and is used for many purposes because it is soft and pliable. +1284-1180-0027 3.27 Yet that task was not so easy as you may suppose. 1284-1181-0007 4.04 She poured into the dish a quantity from each of these bottles. +1284-1180-0027 3.27 Yet that task was not so easy as you may suppose. 1284-1181-0008 6.08 I think that will do," she continued, "for the other qualities are not needed in a servant". +1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1181-0009 5.245 She ran to her husband's side at once and helped him lift the four kettles from the fire. +1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1181-0010 6.435 Their contents had all boiled away, leaving in the bottom of each kettle a few grains of fine white powder. +1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1181-0011 7.75 Very carefully the Magician removed this powder, placing it all together in a golden dish, where he mixed it with a golden spoon. +1284-1180-0004 4.285 When they were outside, Unc simply latched the door and started up the path. 1284-1181-0012 8.51 No one saw him do this, for all were looking at the Powder of Life; but soon the woman remembered what she had been doing, and came back to the cupboard. +1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1181-0014 7.92 He selected a small gold bottle with a pepper box top, so that the powder might be sprinkled on any object through the small holes. +1284-1181-0007 4.04 She poured into the dish a quantity from each of these bottles. 1284-1181-0015 5.115 Most people talk too much, so it is a relief to find one who talks too little". +1284-1181-0007 4.04 She poured into the dish a quantity from each of these bottles. 1284-1181-0016 9.515 I am not allowed to perform magic, except for my own amusement," he told his visitors, as he lighted a pipe with a crooked stem and began to smoke. +1284-1181-0002 3.835 The head of the Patchwork Girl was the most curious part of her. 1284-1181-0020 6.73 Dear me; what a chatterbox you're getting to be, Unc," remarked the Magician, who was pleased with the compliment. +4446-2271-0012 3.78 I say, Sir Harry, the little girl's going famously to night, isn't she"? 4446-2275-0000 6.34 The stop at Queenstown, the tedious passage up the Mersey, were things that he noted dimly through his growing impatience. +4446-2273-0002 3.295 Lamb wouldn't care a great deal about many of them, I fancy". 4446-2275-0001 4.66 She blushed and smiled and fumbled his card in her confusion before she ran upstairs. +4446-2271-0005 3.395 She saves her hand, too. She's at her best in the second act. 4446-2275-0002 7.675 Alexander paced up and down the hallway, buttoning and unbuttoning his overcoat, until she returned and took him up to Hilda's living room. +4446-2271-0006 2.905 He's been wanting to marry Hilda these three years and more. 4446-2275-0005 4.445 I felt it in my bones when I woke this morning that something splendid was going to turn up. +4446-2273-0005 4.125 I haven't had a chance yet to tell you what a jolly little place I think this is. 4446-2275-0007 8.975 She pushed him toward the big chair by the fire, and sat down on a stool at the opposite side of the hearth, her knees drawn up to her chin, laughing like a happy little girl. +4446-2271-0003 3.7 It's been on only two weeks, and I've been half a dozen times already. 4446-2275-0008 4.13 When did you come, Bartley, and how did it happen? You haven't spoken a word". +4446-2275-0035 4.075 Alexander rose and shook himself angrily. "Yes, I know I'm cowardly. 4446-2275-0012 6.025 She looked at his heavy shoulders and big, determined head, thrust forward like a catapult in leash. +4446-2273-0036 3.12 Alexander unclenched the two hands at his sides. 4446-2275-0016 7.3 Hilda watched him from her corner, trembling and scarcely breathing, dark shadows growing about her eyes. "It... +4446-2275-0015 2.98 He pulled up a window as if the air were heavy. 4446-2275-0019 4.93 The world is all there, just as it used to be, but I can't get at it any more. +4446-2273-0033 3.3 For a long time neither Hilda nor Bartley spoke. 4446-2275-0021 5.05 Hilda's face quivered, but she whispered: "Yes, I think it must have been. +4446-2273-0030 2.885 Alexander went over and opened the window for her. 4446-2275-0026 5.495 She closed her eyes and took a deep breath, as if to draw in again the fragrance of those days. +4446-2275-0035 4.075 Alexander rose and shook himself angrily. "Yes, I know I'm cowardly. 4446-2275-0029 6.28 Please tell me one thing, Bartley. At least, tell me that you believe I thought I was making you happy". +4446-2275-0010 3.735 Alexander leaned forward and warmed his hands before the blaze. 4446-2275-0033 7.06 What I mean is that I want you to promise never to see me again, no matter how often I come, no matter how hard I beg". +4446-2271-0011 3.945 Sir Harry Towne, mister Bartley Alexander, the American engineer". 4446-2275-0035 4.075 Alexander rose and shook himself angrily. "Yes, I know I'm cowardly. +4446-2273-0017 2.74 How jolly it was being young, Hilda! 4446-2275-0038 4.53 I will ask the least imaginable, but I must have something! +4446-2271-0005 3.395 She saves her hand, too. She's at her best in the second act. 4446-2275-0040 6.965 The sight of you, Bartley, to see you living and happy and successful can I never make you understand what that means to me"? +4446-2271-0005 3.395 She saves her hand, too. She's at her best in the second act. 4446-2275-0041 4.755 You see, loving some one as I love you makes the whole world different. +4446-2275-0011 2.435 Bartley bent lower over the fire. 4446-2275-0042 5.4 And then you came back, not caring very much, but it made no difference". +4446-2273-0033 3.3 For a long time neither Hilda nor Bartley spoke. 4446-2275-0043 5.88 Bartley bent over and took her in his arms, kissing her mouth and her wet, tired eyes. +5142-33396-0015 4.31 As our boat flashed down the rollers into the water I made this song and sang it: 5142-36377-0001 5.39 In five minutes I was in a new world, and my melancholy room was full of the liveliest French company. +5142-33396-0062 2.9 Now she put her hand on his arm and smiled and said: 5142-36377-0002 5.62 The sound of an imperative and uncompromising bell recalled me in due time to the regions of reality. +5142-33396-0050 2.885 May you drink heart's ease from it for many years. 5142-36377-0004 5.485 She signed to me, with a ghostly solemnity, to take the vacant place on the left of her father. +5142-33396-0023 3.48 It was so dark that I could see nothing but a few sparks on the hearth. 5142-36377-0005 7.085 The door opened again while I was still studying the two brothers, without, I honestly confess, being very favorably impressed by either of them. +5142-33396-0049 3.305 Here, friend, take it,' and he thrust it into the farmer's hand. 5142-36377-0006 4.635 A new member of the family circle, who instantly attracted my attention, entered the room. +5142-33396-0053 3.93 I took five great bracelets of gold from our treasure chest and gave them to him. 5142-36377-0007 6.18 A little cracked" - that in the popular phrase was my impression of the stranger who now made his appearance in the supper room. +5142-36586-0000 3.65 It is manifest that man is now subject to much variability. 5142-36377-0010 4.294937 He is not well; he has come over the ocean for rest, and change of scene. +5142-33396-0023 3.48 It was so dark that I could see nothing but a few sparks on the hearth. 5142-36377-0013 6.585 They pointedly drew back from John Jago as he approached the empty chair next to me and moved round to the opposite side of the table. +5142-33396-0049 3.305 Here, friend, take it,' and he thrust it into the farmer's hand. 5142-36377-0015 4.34 Our first impressions of people are, in nine cases out of ten, the right impressions. +5142-33396-0049 3.305 Here, friend, take it,' and he thrust it into the farmer's hand. 5142-36377-0017 4.685 The only cheerful conversation was the conversation across the table between Naomi and me. +5142-33396-0002 3.67 Two hundred warriors feasted in his hall and followed him to battle. 5142-36377-0018 4.97 He looked up at Naomi doubtingly from his plate, and looked down again slowly with a frown. +5142-33396-0011 3.52 There she sat on the rollers, as fair a ship as I ever saw. 5142-36377-0020 4.53 A more dreary and more disunited family party I never sat at the table with. +5142-36586-0000 3.65 It is manifest that man is now subject to much variability. 5142-36377-0023 5.79 You were quite right to say 'No,'" Ambrose began. "Never smoke with John Jago. His cigars will poison you". +5142-33396-0040 2.81 And these shall follow your thralls in the same way. 5142-36377-0024 5.78 Naomi shook her forefinger reproachfully at them, as if the two sturdy young farmers had been two children. +8555-292519-0015 2.85 He had broken into her courtyard. 8555-292519-0005 9.575 While the old gold and the marble stays, Forever gleaming its soft strong blaze, Calm in the early evening glow. +8555-292519-0013 4.185 That was but rustling of dripping plants in the dark. 8555-292519-0007 8.405 It is my heart hung in the sky; And no clouds ever float between The grave flowers and my heart on high. +8555-292519-0015 2.85 He had broken into her courtyard. 8555-292519-0008 6.025 Over the track lined city street The young men, the grinning men, pass. +8555-284449-0009 3.27 You are, mate," replied the sailor. 8555-292519-0010 5.77 Old dances are simplified of their yearning, bleached by Time. +8555-292519-0015 2.85 He had broken into her courtyard. 8555-292519-0012 5.17 Through the black night rain, he sang to her window bars: +8555-292519-0015 2.85 He had broken into her courtyard. 8555-292519-0013 4.185 That was but rustling of dripping plants in the dark. +5683-32865-0001 2.58 said Lord Chelford, addressing me. 5683-32866-0002 5.125 But don't these very wise things sometimes turn out very foolishly? +5683-32865-0001 2.58 said Lord Chelford, addressing me. 5683-32866-0004 9.225 By this time Lord Chelford and Wylder returned; and, disgusted rather with myself, I ruminated on my want of general ship. +5683-32866-0014 3.97 Don't insult me, Stanley, by talking again as you did this morning. 5683-32866-0005 4.59 and he made a little dip of his cane towards Brandon Hall, over his shoulder. +5683-32866-0008 3.3 Bracton's a very good fellow, I can assure you. 5683-32866-0006 4.215 Yes, so they said; but that would, I think, have been worse. +5683-32879-0001 3.66 Well, she was better, though she had had a bad night. 5683-32866-0007 4.12 If a fellow's been a little bit wild, he's Beelzebub at once. +5683-32866-0015 2.83 What I say is altogether on your own account. 5683-32866-0011 7.37 Their walk continued silent for the greater part, neither was quite satisfied with the other. But Rachel at last said +5683-32866-0015 2.83 What I say is altogether on your own account. 5683-32866-0012 8.26 Now that's impossible, Radie; for I really don't think I once thought of him all this evening - except just while we were talking. +5683-32866-0014 3.97 Don't insult me, Stanley, by talking again as you did this morning. 5683-32866-0013 9.93 There was a bright moonlight, broken by the shadows of overhanging boughs and withered leaves; and the mottled lights and shadows glided oddly across his pale features. +5683-32866-0006 4.215 Yes, so they said; but that would, I think, have been worse. 5683-32866-0016 4.88 Mark my words, you'll find him too strong for you; aye, and too deep. +5683-32865-0001 2.58 said Lord Chelford, addressing me. 5683-32866-0017 4.585 I am very uneasy about it, whatever it is. I can't help it. +5683-32879-0001 3.66 Well, she was better, though she had had a bad night. 5683-32866-0018 5.455 To my mind there has always been something inexpressibly awful in family feuds. +5683-32866-0001 3.47 And he added something still less complimentary. 5683-32866-0021 7.9 My bed was unexceptionably comfortable, but, in my then mood, I could have wished it a great deal more modern. +5683-32866-0014 3.97 Don't insult me, Stanley, by talking again as you did this morning. 5683-32866-0024 9.855 I shan't trouble you about my train of thoughts or fancies; but I began to feel very like a gentleman in a ghost story, watching experimentally in a haunted chamber. +5683-32866-0008 3.3 Bracton's a very good fellow, I can assure you. 5683-32866-0027 4.755 A cold, bright moon was shining with clear sharp lights and shadows. +5683-32879-0012 4.38 Thank you, Rachel, my Cousin Rachel, my only friend. 5683-32866-0028 5.62 The sombre old trees, like gigantic hearse plumes, black and awful. +5683-32866-0003 2.865 In the meantime I had formed a new idea of her. 5683-32866-0030 4.845 A little bit of plaster tumbled down the chimney, and startled me confoundedly. +8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284449-0001 8.63 Then they all marched out a little way into the fields and found that the Army of Pinkies had already formed and was advancing steadily toward them. +8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284449-0003 8.875 When the Blueskins saw Ghip Ghisizzle they raised another great shout, for he was the favorite of the soldiers and very popular with all the people. +8555-284447-0003 4.415 But Captain Bill made no such attempt, knowing it would be useless. 8555-284449-0007 9.31 Now, then, let's enter the City and enjoy the grand feast that's being cooked. I'm nearly starved, myself, for this conquering kingdoms is hard work". +8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284449-0008 6.135 Then she gave Rosalie back her magic ring, thanking the kind Witch for all she had done for them. +8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284449-0012 9.87 I'll gladly do that," promised the new Boolooroo; "and I'll feed the honorable goat all the shavings and leather and tin cans he can eat, besides the grass. +8555-284447-0003 4.415 But Captain Bill made no such attempt, knowing it would be useless. 8555-284449-0013 5.775 Scuse me," said Trot; "I neglected to tell you that you're not the Boolooroo any more. +8555-292519-0013 4.185 That was but rustling of dripping plants in the dark. 8555-284449-0015 5.12 I'll not be wicked any more," sighed the old Boolooroo; "I'll reform. +8555-284447-0022 3.56 I had a notion it was you, mate, as saved me from the knife. 8555-284449-0016 5.895 As a private citizen I shall be a model of deportment, because it would be dangerous to be otherwise". +8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284449-0018 7.03 So Ghip Ghisizzle ordered the Captain to take a file of soldiers and escort the raving beauties to their new home. +8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284449-0019 7.61 That evening Trot gave a grand ball in the palace, to which the most important of the Pinkies and the Blueskins were invited. +8555-284447-0020 4.09 The goat's warlike spirit was roused by this successful attack. 8555-284449-0020 5.095 The combined bands of both the countries played the music and a fine supper was served. diff --git a/finetune-cli.py b/finetune-cli.py index bc11ee2cf4ffb5f72e8f341f572658bdffb18217..79ce9bb045e3d4a31737837027e29ab01554cb10 100644 --- a/finetune-cli.py +++ b/finetune-cli.py @@ -1,57 +1,42 @@ import argparse -from model import CFM, UNetT, DiT, Trainer +from model import CFM, UNetT, DiT, MMDiT, Trainer from model.utils import get_tokenizer from model.dataset import load_dataset from cached_path import cached_path -import shutil -import os - +import shutil,os # -------------------------- Dataset Settings --------------------------- # target_sample_rate = 24000 n_mel_channels = 100 hop_length = 256 +tokenizer = "pinyin" # 'pinyin', 'char', or 'custom' +tokenizer_path = None # if tokenizer = 'custom', define the path to the tokenizer you want to use (should be vocab.txt) # -------------------------- Argument Parsing --------------------------- # def parse_args(): - parser = argparse.ArgumentParser(description="Train CFM Model") - - parser.add_argument( - "--exp_name", type=str, default="F5TTS_Base", choices=["F5TTS_Base", "E2TTS_Base"], help="Experiment name" - ) - parser.add_argument("--dataset_name", type=str, default="Emilia_ZH_EN", help="Name of the dataset to use") - parser.add_argument("--learning_rate", type=float, default=1e-4, help="Learning rate for training") - parser.add_argument("--batch_size_per_gpu", type=int, default=256, help="Batch size per GPU") - parser.add_argument( - "--batch_size_type", type=str, default="frame", choices=["frame", "sample"], help="Batch size type" - ) - parser.add_argument("--max_samples", type=int, default=16, help="Max sequences per batch") - parser.add_argument("--grad_accumulation_steps", type=int, default=1, help="Gradient accumulation steps") - parser.add_argument("--max_grad_norm", type=float, default=1.0, help="Max gradient norm for clipping") - parser.add_argument("--epochs", type=int, default=10, help="Number of training epochs") - parser.add_argument("--num_warmup_updates", type=int, default=5, help="Warmup steps") - parser.add_argument("--save_per_updates", type=int, default=10, help="Save checkpoint every X steps") - parser.add_argument("--last_per_steps", type=int, default=10, help="Save last checkpoint every X steps") - parser.add_argument("--finetune", type=bool, default=True, help="Use Finetune") - - parser.add_argument( - "--tokenizer", type=str, default="pinyin", choices=["pinyin", "char", "custom"], help="Tokenizer type" - ) - parser.add_argument( - "--tokenizer_path", - type=str, - default=None, - help="Path to custom tokenizer vocab file (only used if tokenizer = 'custom')", - ) - + parser = argparse.ArgumentParser(description='Train CFM Model') + + parser.add_argument('--exp_name', type=str, default="F5TTS_Base", choices=["F5TTS_Base", "E2TTS_Base"],help='Experiment name') + parser.add_argument('--dataset_name', type=str, default="Emilia_ZH_EN", help='Name of the dataset to use') + parser.add_argument('--learning_rate', type=float, default=1e-4, help='Learning rate for training') + parser.add_argument('--batch_size_per_gpu', type=int, default=256, help='Batch size per GPU') + parser.add_argument('--batch_size_type', type=str, default="frame", choices=["frame", "sample"],help='Batch size type') + parser.add_argument('--max_samples', type=int, default=16, help='Max sequences per batch') + parser.add_argument('--grad_accumulation_steps', type=int, default=1,help='Gradient accumulation steps') + parser.add_argument('--max_grad_norm', type=float, default=1.0, help='Max gradient norm for clipping') + parser.add_argument('--epochs', type=int, default=10, help='Number of training epochs') + parser.add_argument('--num_warmup_updates', type=int, default=5, help='Warmup steps') + parser.add_argument('--save_per_updates', type=int, default=10, help='Save checkpoint every X steps') + parser.add_argument('--last_per_steps', type=int, default=10, help='Save last checkpoint every X steps') + parser.add_argument('--finetune', type=bool, default=True, help='Use Finetune') + return parser.parse_args() - # -------------------------- Training Settings -------------------------- # - def main(): args = parse_args() + # Model parameters based on experiment name if args.exp_name == "F5TTS_Base": @@ -59,31 +44,24 @@ def main(): model_cls = DiT model_cfg = dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4) if args.finetune: - ckpt_path = str(cached_path("hf://SWivid/F5-TTS/F5TTS_Base/model_1200000.pt")) + ckpt_path = str(cached_path(f"hf://SWivid/F5-TTS/F5TTS_Base/model_1200000.pt")) elif args.exp_name == "E2TTS_Base": wandb_resume_id = None model_cls = UNetT model_cfg = dict(dim=1024, depth=24, heads=16, ff_mult=4) if args.finetune: - ckpt_path = str(cached_path("hf://SWivid/E2-TTS/E2TTS_Base/model_1200000.pt")) - + ckpt_path = str(cached_path(f"hf://SWivid/E2-TTS/E2TTS_Base/model_1200000.pt")) + if args.finetune: - path_ckpt = os.path.join("ckpts", args.dataset_name) - if not os.path.isdir(path_ckpt): - os.makedirs(path_ckpt, exist_ok=True) - shutil.copy2(ckpt_path, os.path.join(path_ckpt, os.path.basename(ckpt_path))) - - checkpoint_path = os.path.join("ckpts", args.dataset_name) - - # Use the tokenizer and tokenizer_path provided in the command line arguments - tokenizer = args.tokenizer - if tokenizer == "custom": - if not args.tokenizer_path: - raise ValueError("Custom tokenizer selected, but no tokenizer_path provided.") - tokenizer_path = args.tokenizer_path - else: - tokenizer_path = args.dataset_name - + path_ckpt = os.path.join("ckpts",args.dataset_name) + if os.path.isdir(path_ckpt)==False: + os.makedirs(path_ckpt,exist_ok=True) + shutil.copy2(ckpt_path,os.path.join(path_ckpt,os.path.basename(ckpt_path))) + + checkpoint_path=os.path.join("ckpts",args.dataset_name) + + # Use the dataset_name provided in the command line + tokenizer_path = args.dataset_name if tokenizer != "custom" else tokenizer_path vocab_char_map, vocab_size = get_tokenizer(tokenizer_path, tokenizer) mel_spec_kwargs = dict( @@ -93,7 +71,11 @@ def main(): ) e2tts = CFM( - transformer=model_cls(**model_cfg, text_num_embeds=vocab_size, mel_dim=n_mel_channels), + transformer=model_cls( + **model_cfg, + text_num_embeds=vocab_size, + mel_dim=n_mel_channels + ), mel_spec_kwargs=mel_spec_kwargs, vocab_char_map=vocab_char_map, ) @@ -117,11 +99,10 @@ def main(): ) train_dataset = load_dataset(args.dataset_name, tokenizer, mel_spec_kwargs=mel_spec_kwargs) - trainer.train( - train_dataset, - resumable_with_seed=666, # seed for shuffling dataset - ) + trainer.train(train_dataset, + resumable_with_seed=666 # seed for shuffling dataset + ) -if __name__ == "__main__": +if __name__ == '__main__': main() diff --git a/finetune_gradio.py b/finetune_gradio.py index a61d95ac2db386712fb935c5ef55fe25f2026c6a..d6db8cc4bd8322800380f93b9372e179e7ac67fe 100644 --- a/finetune_gradio.py +++ b/finetune_gradio.py @@ -1,12 +1,8 @@ -import os -import sys +import os,sys -import tempfile -import random from transformers import pipeline import gradio as gr import torch -import gc import click import torchaudio from glob import glob @@ -23,43 +19,35 @@ import psutil import platform import subprocess from datasets.arrow_writer import ArrowWriter -from datasets import Dataset as Dataset_ -from api import F5TTS +import json -training_process = None +training_process = None system = platform.system() python_executable = sys.executable or "python" -tts_api = None -last_checkpoint = "" -last_device = "" -path_data = "data" +path_data="data" -device = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu" +device = ( +"cuda" + if torch.cuda.is_available() + else "mps" if torch.backends.mps.is_available() else "cpu" +) pipe = None - # Load metadata def get_audio_duration(audio_path): """Calculate the duration of an audio file.""" audio, sample_rate = torchaudio.load(audio_path) - num_channels = audio.shape[0] + num_channels = audio.shape[0] return audio.shape[1] / (sample_rate * num_channels) - def clear_text(text): """Clean and prepare text by lowering the case and stripping whitespace.""" return text.lower().strip() - -def get_rms( - y, - frame_length=2048, - hop_length=512, - pad_mode="constant", -): # https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/slicer2.py +def get_rms(y,frame_length=2048,hop_length=512,pad_mode="constant",): # https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/slicer2.py padding = (int(frame_length // 2), int(frame_length // 2)) y = np.pad(y, padding, mode=pad_mode) @@ -86,8 +74,7 @@ def get_rms( return np.sqrt(power) - -class Slicer: # https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/slicer2.py +class Slicer: # https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/slicer2.py def __init__( self, sr: int, @@ -98,9 +85,13 @@ class Slicer: # https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/slicer2. max_sil_kept: int = 2000, ): if not min_length >= min_interval >= hop_size: - raise ValueError("The following condition must be satisfied: min_length >= min_interval >= hop_size") + raise ValueError( + "The following condition must be satisfied: min_length >= min_interval >= hop_size" + ) if not max_sil_kept >= hop_size: - raise ValueError("The following condition must be satisfied: max_sil_kept >= hop_size") + raise ValueError( + "The following condition must be satisfied: max_sil_kept >= hop_size" + ) min_interval = sr * min_interval / 1000 self.threshold = 10 ** (threshold / 20.0) self.hop_size = round(sr * hop_size / 1000) @@ -111,9 +102,13 @@ class Slicer: # https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/slicer2. def _apply_slice(self, waveform, begin, end): if len(waveform.shape) > 1: - return waveform[:, begin * self.hop_size : min(waveform.shape[1], end * self.hop_size)] + return waveform[ + :, begin * self.hop_size : min(waveform.shape[1], end * self.hop_size) + ] else: - return waveform[begin * self.hop_size : min(waveform.shape[0], end * self.hop_size)] + return waveform[ + begin * self.hop_size : min(waveform.shape[0], end * self.hop_size) + ] # @timeit def slice(self, waveform): @@ -123,7 +118,9 @@ class Slicer: # https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/slicer2. samples = waveform if samples.shape[0] <= self.min_length: return [waveform] - rms_list = get_rms(y=samples, frame_length=self.win_size, hop_length=self.hop_size).squeeze(0) + rms_list = get_rms( + y=samples, frame_length=self.win_size, hop_length=self.hop_size + ).squeeze(0) sil_tags = [] silence_start = None clip_start = 0 @@ -139,7 +136,10 @@ class Slicer: # https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/slicer2. continue # Clear recorded silence start if interval is not enough or clip is too short is_leading_silence = silence_start == 0 and i > self.max_sil_kept - need_slice_middle = i - silence_start >= self.min_interval and i - clip_start >= self.min_length + need_slice_middle = ( + i - silence_start >= self.min_interval + and i - clip_start >= self.min_length + ) if not is_leading_silence and not need_slice_middle: silence_start = None continue @@ -152,10 +152,21 @@ class Slicer: # https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/slicer2. sil_tags.append((pos, pos)) clip_start = pos elif i - silence_start <= self.max_sil_kept * 2: - pos = rms_list[i - self.max_sil_kept : silence_start + self.max_sil_kept + 1].argmin() + pos = rms_list[ + i - self.max_sil_kept : silence_start + self.max_sil_kept + 1 + ].argmin() pos += i - self.max_sil_kept - pos_l = rms_list[silence_start : silence_start + self.max_sil_kept + 1].argmin() + silence_start - pos_r = rms_list[i - self.max_sil_kept : i + 1].argmin() + i - self.max_sil_kept + pos_l = ( + rms_list[ + silence_start : silence_start + self.max_sil_kept + 1 + ].argmin() + + silence_start + ) + pos_r = ( + rms_list[i - self.max_sil_kept : i + 1].argmin() + + i + - self.max_sil_kept + ) if silence_start == 0: sil_tags.append((0, pos_r)) clip_start = pos_r @@ -163,8 +174,17 @@ class Slicer: # https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/slicer2. sil_tags.append((min(pos_l, pos), max(pos_r, pos))) clip_start = max(pos_r, pos) else: - pos_l = rms_list[silence_start : silence_start + self.max_sil_kept + 1].argmin() + silence_start - pos_r = rms_list[i - self.max_sil_kept : i + 1].argmin() + i - self.max_sil_kept + pos_l = ( + rms_list[ + silence_start : silence_start + self.max_sil_kept + 1 + ].argmin() + + silence_start + ) + pos_r = ( + rms_list[i - self.max_sil_kept : i + 1].argmin() + + i + - self.max_sil_kept + ) if silence_start == 0: sil_tags.append((0, pos_r)) else: @@ -173,39 +193,33 @@ class Slicer: # https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/slicer2. silence_start = None # Deal with trailing silence. total_frames = rms_list.shape[0] - if silence_start is not None and total_frames - silence_start >= self.min_interval: + if ( + silence_start is not None + and total_frames - silence_start >= self.min_interval + ): silence_end = min(total_frames, silence_start + self.max_sil_kept) pos = rms_list[silence_start : silence_end + 1].argmin() + silence_start sil_tags.append((pos, total_frames + 1)) # Apply and return slices. ####音频+起始时间+终止时间 if len(sil_tags) == 0: - return [[waveform, 0, int(total_frames * self.hop_size)]] + return [[waveform,0,int(total_frames*self.hop_size)]] else: chunks = [] if sil_tags[0][0] > 0: - chunks.append([self._apply_slice(waveform, 0, sil_tags[0][0]), 0, int(sil_tags[0][0] * self.hop_size)]) + chunks.append([self._apply_slice(waveform, 0, sil_tags[0][0]),0,int(sil_tags[0][0]*self.hop_size)]) for i in range(len(sil_tags) - 1): chunks.append( - [ - self._apply_slice(waveform, sil_tags[i][1], sil_tags[i + 1][0]), - int(sil_tags[i][1] * self.hop_size), - int(sil_tags[i + 1][0] * self.hop_size), - ] + [self._apply_slice(waveform, sil_tags[i][1], sil_tags[i + 1][0]),int(sil_tags[i][1]*self.hop_size),int(sil_tags[i + 1][0]*self.hop_size)] ) if sil_tags[-1][1] < total_frames: chunks.append( - [ - self._apply_slice(waveform, sil_tags[-1][1], total_frames), - int(sil_tags[-1][1] * self.hop_size), - int(total_frames * self.hop_size), - ] + [self._apply_slice(waveform, sil_tags[-1][1], total_frames),int(sil_tags[-1][1]*self.hop_size),int(total_frames*self.hop_size)] ) return chunks - -# terminal -def terminate_process_tree(pid, including_parent=True): +#terminal +def terminate_process_tree(pid, including_parent=True): try: parent = psutil.Process(pid) except psutil.NoSuchProcess: @@ -224,7 +238,6 @@ def terminate_process_tree(pid, including_parent=True): except OSError: pass - def terminate_process(pid): if system == "Windows": cmd = f"taskkill /t /f /pid {pid}" @@ -232,160 +245,130 @@ def terminate_process(pid): else: terminate_process_tree(pid) +def start_training(dataset_name="", + exp_name="F5TTS_Base", + learning_rate=1e-4, + batch_size_per_gpu=400, + batch_size_type="frame", + max_samples=64, + grad_accumulation_steps=1, + max_grad_norm=1.0, + epochs=11, + num_warmup_updates=200, + save_per_updates=400, + last_per_steps=800, + finetune=True, + ): -def start_training( - dataset_name="", - exp_name="F5TTS_Base", - learning_rate=1e-4, - batch_size_per_gpu=400, - batch_size_type="frame", - max_samples=64, - grad_accumulation_steps=1, - max_grad_norm=1.0, - epochs=11, - num_warmup_updates=200, - save_per_updates=400, - last_per_steps=800, - finetune=True, -): - global training_process, tts_api - - if tts_api is not None: - del tts_api - gc.collect() - torch.cuda.empty_cache() - tts_api = None + + global training_process path_project = os.path.join(path_data, dataset_name + "_pinyin") - if not os.path.isdir(path_project): - yield ( - f"There is not project with name {dataset_name}", - gr.update(interactive=True), - gr.update(interactive=False), - ) + if os.path.isdir(path_project)==False: + yield f"There is not project with name {dataset_name}",gr.update(interactive=True),gr.update(interactive=False) return - file_raw = os.path.join(path_project, "raw.arrow") - if not os.path.isfile(file_raw): - yield f"There is no file {file_raw}", gr.update(interactive=True), gr.update(interactive=False) - return + file_raw = os.path.join(path_project,"raw.arrow") + if os.path.isfile(file_raw)==False: + yield f"There is no file {file_raw}",gr.update(interactive=True),gr.update(interactive=False) + return # Check if a training process is already running if training_process is not None: - return "Train run already!", gr.update(interactive=False), gr.update(interactive=True) + return "Train run already!",gr.update(interactive=False),gr.update(interactive=True) - yield "start train", gr.update(interactive=False), gr.update(interactive=False) + yield "start train",gr.update(interactive=False),gr.update(interactive=False) # Command to run the training script with the specified arguments - cmd = ( - f"accelerate launch finetune-cli.py --exp_name {exp_name} " - f"--learning_rate {learning_rate} " - f"--batch_size_per_gpu {batch_size_per_gpu} " - f"--batch_size_type {batch_size_type} " - f"--max_samples {max_samples} " - f"--grad_accumulation_steps {grad_accumulation_steps} " - f"--max_grad_norm {max_grad_norm} " - f"--epochs {epochs} " - f"--num_warmup_updates {num_warmup_updates} " - f"--save_per_updates {save_per_updates} " - f"--last_per_steps {last_per_steps} " - f"--dataset_name {dataset_name}" - ) - if finetune: - cmd += f" --finetune {finetune}" - - print(cmd) - + cmd = f"accelerate launch finetune-cli.py --exp_name {exp_name} " \ + f"--learning_rate {learning_rate} " \ + f"--batch_size_per_gpu {batch_size_per_gpu} " \ + f"--batch_size_type {batch_size_type} " \ + f"--max_samples {max_samples} " \ + f"--grad_accumulation_steps {grad_accumulation_steps} " \ + f"--max_grad_norm {max_grad_norm} " \ + f"--epochs {epochs} " \ + f"--num_warmup_updates {num_warmup_updates} " \ + f"--save_per_updates {save_per_updates} " \ + f"--last_per_steps {last_per_steps} " \ + f"--dataset_name {dataset_name}" + if finetune:cmd += f" --finetune {finetune}" + print(cmd) try: - # Start the training process - training_process = subprocess.Popen(cmd, shell=True) - - time.sleep(5) - yield "train start", gr.update(interactive=False), gr.update(interactive=True) + # Start the training process + training_process = subprocess.Popen(cmd, shell=True) - # Wait for the training process to finish - training_process.wait() - time.sleep(1) - - if training_process is None: - text_info = "train stop" - else: - text_info = "train complete !" + time.sleep(5) + yield "check terminal for wandb",gr.update(interactive=False),gr.update(interactive=True) + + # Wait for the training process to finish + training_process.wait() + time.sleep(1) + + if training_process is None: + text_info = 'train stop' + else: + text_info = "train complete !" except Exception as e: # Catch all exceptions # Ensure that we reset the training process variable in case of an error - text_info = f"An error occurred: {str(e)}" - - training_process = None - - yield text_info, gr.update(interactive=True), gr.update(interactive=False) + text_info=f"An error occurred: {str(e)}" + + training_process=None + yield text_info,gr.update(interactive=True),gr.update(interactive=False) def stop_training(): global training_process - if training_process is None: - return "Train not run !", gr.update(interactive=True), gr.update(interactive=False) + if training_process is None:return f"Train not run !",gr.update(interactive=True),gr.update(interactive=False) terminate_process_tree(training_process.pid) training_process = None - return "train stop", gr.update(interactive=True), gr.update(interactive=False) - + return 'train stop',gr.update(interactive=True),gr.update(interactive=False) def create_data_project(name): - name += "_pinyin" - os.makedirs(os.path.join(path_data, name), exist_ok=True) - os.makedirs(os.path.join(path_data, name, "dataset"), exist_ok=True) - - -def transcribe(file_audio, language="english"): + name+="_pinyin" + os.makedirs(os.path.join(path_data,name),exist_ok=True) + os.makedirs(os.path.join(path_data,name,"dataset"),exist_ok=True) + +def transcribe(file_audio,language="english"): global pipe if pipe is None: - pipe = pipeline( - "automatic-speech-recognition", - model="openai/whisper-large-v3-turbo", - torch_dtype=torch.float16, - device=device, - ) + pipe = pipeline("automatic-speech-recognition",model="openai/whisper-large-v3-turbo", torch_dtype=torch.float16,device=device) text_transcribe = pipe( file_audio, chunk_length_s=30, batch_size=128, - generate_kwargs={"task": "transcribe", "language": language}, + generate_kwargs={"task": "transcribe","language": language}, return_timestamps=False, )["text"].strip() return text_transcribe +def transcribe_all(name_project,audio_files,language,user=False,progress=gr.Progress()): + name_project+="_pinyin" + path_project= os.path.join(path_data,name_project) + path_dataset = os.path.join(path_project,"dataset") + path_project_wavs = os.path.join(path_project,"wavs") + file_metadata = os.path.join(path_project,"metadata.csv") -def transcribe_all(name_project, audio_files, language, user=False, progress=gr.Progress()): - name_project += "_pinyin" - path_project = os.path.join(path_data, name_project) - path_dataset = os.path.join(path_project, "dataset") - path_project_wavs = os.path.join(path_project, "wavs") - file_metadata = os.path.join(path_project, "metadata.csv") - - if audio_files is None: - return "You need to load an audio file." + if audio_files is None:return "You need to load an audio file." if os.path.isdir(path_project_wavs): - shutil.rmtree(path_project_wavs) + shutil.rmtree(path_project_wavs) if os.path.isfile(file_metadata): - os.remove(file_metadata) - - os.makedirs(path_project_wavs, exist_ok=True) + os.remove(file_metadata) + os.makedirs(path_project_wavs,exist_ok=True) + if user: - file_audios = [ - file - for format in ("*.wav", "*.ogg", "*.opus", "*.mp3", "*.flac") - for file in glob(os.path.join(path_dataset, format)) - ] - if file_audios == []: - return "No audio file was found in the dataset." + file_audios = [file for format in ('*.wav', '*.ogg', '*.opus', '*.mp3', '*.flac') for file in glob(os.path.join(path_dataset, format))] + if file_audios==[]:return "No audio file was found in the dataset." else: - file_audios = audio_files + file_audios = audio_files + alpha = 0.5 _max = 1.0 @@ -393,213 +376,179 @@ def transcribe_all(name_project, audio_files, language, user=False, progress=gr. num = 0 error_num = 0 - data = "" - for file_audio in progress.tqdm(file_audios, desc="transcribe files", total=len((file_audios))): - audio, _ = librosa.load(file_audio, sr=24000, mono=True) - - list_slicer = slicer.slice(audio) - for chunk, start, end in progress.tqdm(list_slicer, total=len(list_slicer), desc="slicer files"): + data="" + for file_audio in progress.tqdm(file_audios, desc="transcribe files",total=len((file_audios))): + + audio, _ = librosa.load(file_audio, sr=24000, mono=True) + + list_slicer=slicer.slice(audio) + for chunk, start, end in progress.tqdm(list_slicer,total=len(list_slicer), desc="slicer files"): + name_segment = os.path.join(f"segment_{num}") - file_segment = os.path.join(path_project_wavs, f"{name_segment}.wav") - + file_segment = os.path.join(path_project_wavs, f"{name_segment}.wav") + tmp_max = np.abs(chunk).max() - if tmp_max > 1: - chunk /= tmp_max + if(tmp_max>1):chunk/=tmp_max chunk = (chunk / tmp_max * (_max * alpha)) + (1 - alpha) * chunk - wavfile.write(file_segment, 24000, (chunk * 32767).astype(np.int16)) - + wavfile.write(file_segment,24000, (chunk * 32767).astype(np.int16)) + try: - text = transcribe(file_segment, language) - text = text.lower().strip().replace('"', "") + text=transcribe(file_segment,language) + text = text.lower().strip().replace('"',"") - data += f"{name_segment}|{text}\n" + data+= f"{name_segment}|{text}\n" - num += 1 - except: # noqa: E722 - error_num += 1 + num+=1 + except: + error_num +=1 - with open(file_metadata, "w", encoding="utf-8") as f: + with open(file_metadata,"w",encoding="utf-8") as f: f.write(data) - - if error_num != []: - error_text = f"\nerror files : {error_num}" + + if error_num!=[]: + error_text=f"\nerror files : {error_num}" else: - error_text = "" - + error_text="" + return f"transcribe complete samples : {num}\npath : {path_project_wavs}{error_text}" - def format_seconds_to_hms(seconds): hours = int(seconds / 3600) minutes = int((seconds % 3600) / 60) seconds = seconds % 60 return "{:02d}:{:02d}:{:02d}".format(hours, minutes, int(seconds)) - -def create_metadata(name_project, progress=gr.Progress()): - name_project += "_pinyin" - path_project = os.path.join(path_data, name_project) - path_project_wavs = os.path.join(path_project, "wavs") - file_metadata = os.path.join(path_project, "metadata.csv") - file_raw = os.path.join(path_project, "raw.arrow") - file_duration = os.path.join(path_project, "duration.json") - file_vocab = os.path.join(path_project, "vocab.txt") - - if not os.path.isfile(file_metadata): - return "The file was not found in " + file_metadata - - with open(file_metadata, "r", encoding="utf-8") as f: - data = f.read() - - audio_path_list = [] - text_list = [] - duration_list = [] - - count = data.split("\n") - lenght = 0 - result = [] - error_files = [] - for line in progress.tqdm(data.split("\n"), total=count): - sp_line = line.split("|") - if len(sp_line) != 2: - continue - name_audio, text = sp_line[:2] +def create_metadata(name_project,progress=gr.Progress()): + name_project+="_pinyin" + path_project= os.path.join(path_data,name_project) + path_project_wavs = os.path.join(path_project,"wavs") + file_metadata = os.path.join(path_project,"metadata.csv") + file_raw = os.path.join(path_project,"raw.arrow") + file_duration = os.path.join(path_project,"duration.json") + file_vocab = os.path.join(path_project,"vocab.txt") + + if os.path.isfile(file_metadata)==False: return "The file was not found in " + file_metadata + + with open(file_metadata,"r",encoding="utf-8") as f: + data=f.read() + + audio_path_list=[] + text_list=[] + duration_list=[] + + count=data.split("\n") + lenght=0 + result=[] + error_files=[] + for line in progress.tqdm(data.split("\n"),total=count): + sp_line=line.split("|") + if len(sp_line)!=2:continue + name_audio,text = sp_line[:2] file_audio = os.path.join(path_project_wavs, name_audio + ".wav") - if not os.path.isfile(file_audio): + if os.path.isfile(file_audio)==False: error_files.append(file_audio) continue duraction = get_audio_duration(file_audio) - if duraction < 2 and duraction > 15: - continue - if len(text) < 4: - continue + if duraction<2 and duraction>15:continue + if len(text)<4:continue text = clear_text(text) - text = convert_char_to_pinyin([text], polyphone=True)[0] + text = convert_char_to_pinyin([text], polyphone = True)[0] audio_path_list.append(file_audio) duration_list.append(duraction) text_list.append(text) - + result.append({"audio_path": file_audio, "text": text, "duration": duraction}) - lenght += duraction + lenght+=duraction - if duration_list == []: - error_files_text = "\n".join(error_files) + if duration_list==[]: + error_files_text="\n".join(error_files) return f"Error: No audio files found in the specified path : \n{error_files_text}" - - min_second = round(min(duration_list), 2) - max_second = round(max(duration_list), 2) + + min_second = round(min(duration_list),2) + max_second = round(max(duration_list),2) with ArrowWriter(path=file_raw, writer_batch_size=1) as writer: - for line in progress.tqdm(result, total=len(result), desc="prepare data"): + for line in progress.tqdm(result,total=len(result), desc=f"prepare data"): writer.write(line) - with open(file_duration, "w", encoding="utf-8") as f: + with open(file_duration, 'w', encoding='utf-8') as f: json.dump({"duration": duration_list}, f, ensure_ascii=False) - - file_vocab_finetune = "data/Emilia_ZH_EN_pinyin/vocab.txt" - if not os.path.isfile(file_vocab_finetune): - return "Error: Vocabulary file 'Emilia_ZH_EN_pinyin' not found!" + + file_vocab_finetune = "data/Emilia_ZH_EN_pinyin/vocab.txt" + if os.path.isfile(file_vocab_finetune==False):return "Error: Vocabulary file 'Emilia_ZH_EN_pinyin' not found!" shutil.copy2(file_vocab_finetune, file_vocab) - - if error_files != []: - error_text = "error files\n" + "\n".join(error_files) + + if error_files!=[]: + error_text="error files\n" + "\n".join(error_files) else: - error_text = "" - + error_text="" + return f"prepare complete \nsamples : {len(text_list)}\ntime data : {format_seconds_to_hms(lenght)}\nmin sec : {min_second}\nmax sec : {max_second}\nfile_arrow : {file_raw}\n{error_text}" - def check_user(value): - return gr.update(visible=not value), gr.update(visible=value) - - -def calculate_train( - name_project, - batch_size_type, - max_samples, - learning_rate, - num_warmup_updates, - save_per_updates, - last_per_steps, - finetune, -): - name_project += "_pinyin" - path_project = os.path.join(path_data, name_project) - file_duraction = os.path.join(path_project, "duration.json") - - if not os.path.isfile(file_duraction): - return ( - 1000, - max_samples, - num_warmup_updates, - save_per_updates, - last_per_steps, - "project not found !", - learning_rate, - ) + return gr.update(visible=not value),gr.update(visible=value) - with open(file_duraction, "r") as file: - data = json.load(file) +def calculate_train(name_project,batch_size_type,max_samples,learning_rate,num_warmup_updates,save_per_updates,last_per_steps,finetune): + name_project+="_pinyin" + path_project= os.path.join(path_data,name_project) + file_duraction = os.path.join(path_project,"duration.json") - duration_list = data["duration"] + with open(file_duraction, 'r') as file: + data = json.load(file) + + duration_list = data['duration'] samples = len(duration_list) if torch.cuda.is_available(): gpu_properties = torch.cuda.get_device_properties(0) - total_memory = gpu_properties.total_memory / (1024**3) + total_memory = gpu_properties.total_memory / (1024 ** 3) elif torch.backends.mps.is_available(): - total_memory = psutil.virtual_memory().available / (1024**3) - - if batch_size_type == "frame": - batch = int(total_memory * 0.5) - batch = (lambda num: num + 1 if num % 2 != 0 else num)(batch) - batch_size_per_gpu = int(38400 / batch) - else: - batch_size_per_gpu = int(total_memory / 8) - batch_size_per_gpu = (lambda num: num + 1 if num % 2 != 0 else num)(batch_size_per_gpu) - batch = batch_size_per_gpu - - if batch_size_per_gpu <= 0: - batch_size_per_gpu = 1 - - if samples < 64: - max_samples = int(samples * 0.25) + total_memory = psutil.virtual_memory().available / (1024 ** 3) + + if batch_size_type=="frame": + batch = int(total_memory * 0.5) + batch = (lambda num: num + 1 if num % 2 != 0 else num)(batch) + batch_size_per_gpu = int(38400 / batch ) else: - max_samples = 64 - - num_warmup_updates = int(samples * 0.05) - save_per_updates = int(samples * 0.10) - last_per_steps = int(save_per_updates * 5) - + batch_size_per_gpu = int(total_memory / 8) + batch_size_per_gpu = (lambda num: num + 1 if num % 2 != 0 else num)(batch_size_per_gpu) + batch = batch_size_per_gpu + + if batch_size_per_gpu<=0:batch_size_per_gpu=1 + + if samples<64: + max_samples = int(samples * 0.25) + + num_warmup_updates = int(samples * 0.10) + save_per_updates = int(samples * 0.25) + last_per_steps =int(save_per_updates * 5) + max_samples = (lambda num: num + 1 if num % 2 != 0 else num)(max_samples) num_warmup_updates = (lambda num: num + 1 if num % 2 != 0 else num)(num_warmup_updates) save_per_updates = (lambda num: num + 1 if num % 2 != 0 else num)(save_per_updates) last_per_steps = (lambda num: num + 1 if num % 2 != 0 else num)(last_per_steps) - if finetune: - learning_rate = 1e-5 - else: - learning_rate = 7.5e-5 - - return batch_size_per_gpu, max_samples, num_warmup_updates, save_per_updates, last_per_steps, samples, learning_rate + if finetune:learning_rate=1e-4 + else:learning_rate=7.5e-5 + return batch_size_per_gpu,max_samples,num_warmup_updates,save_per_updates,last_per_steps,samples,learning_rate def extract_and_save_ema_model(checkpoint_path: str, new_checkpoint_path: str) -> None: try: checkpoint = torch.load(checkpoint_path) print("Original Checkpoint Keys:", checkpoint.keys()) - - ema_model_state_dict = checkpoint.get("ema_model_state_dict", None) + + ema_model_state_dict = checkpoint.get('ema_model_state_dict', None) if ema_model_state_dict is not None: - new_checkpoint = {"ema_model_state_dict": ema_model_state_dict} + new_checkpoint = {'ema_model_state_dict': ema_model_state_dict} torch.save(new_checkpoint, new_checkpoint_path) return f"New checkpoint saved at: {new_checkpoint_path}" else: @@ -608,136 +557,65 @@ def extract_and_save_ema_model(checkpoint_path: str, new_checkpoint_path: str) - except Exception as e: return f"An error occurred: {e}" - def vocab_check(project_name): name_project = project_name + "_pinyin" path_project = os.path.join(path_data, name_project) file_metadata = os.path.join(path_project, "metadata.csv") - - file_vocab = "data/Emilia_ZH_EN_pinyin/vocab.txt" - if not os.path.isfile(file_vocab): + + file_vocab="data/Emilia_ZH_EN_pinyin/vocab.txt" + if os.path.isfile(file_vocab)==False: return f"the file {file_vocab} not found !" - - with open(file_vocab, "r", encoding="utf-8") as f: - data = f.read() + + with open(file_vocab,"r",encoding="utf-8") as f: + data=f.read() vocab = data.split("\n") - if not os.path.isfile(file_metadata): + if os.path.isfile(file_metadata)==False: return f"the file {file_metadata} not found !" - with open(file_metadata, "r", encoding="utf-8") as f: - data = f.read() + with open(file_metadata,"r",encoding="utf-8") as f: + data=f.read() - miss_symbols = [] - miss_symbols_keep = {} + miss_symbols=[] + miss_symbols_keep={} for item in data.split("\n"): - sp = item.split("|") - if len(sp) != 2: - continue + sp=item.split("|") + if len(sp)!=2:continue + text=sp[1].lower().strip() - text = sp[1].lower().strip() + for t in text: + if (t in vocab)==False and (t in miss_symbols_keep)==False: + miss_symbols.append(t) + miss_symbols_keep[t]=t - for t in text: - if t not in vocab and t not in miss_symbols_keep: - miss_symbols.append(t) - miss_symbols_keep[t] = t - if miss_symbols == []: - info = "You can train using your language !" - else: - info = f"The following symbols are missing in your language : {len(miss_symbols)}\n\n" + "\n".join(miss_symbols) + + if miss_symbols==[]:info ="You can train using your language !" + else:info = f"The following symbols are missing in your language : {len(miss_symbols)}\n\n" + "\n".join(miss_symbols) return info -def get_random_sample_prepare(project_name): - name_project = project_name + "_pinyin" - path_project = os.path.join(path_data, name_project) - file_arrow = os.path.join(path_project, "raw.arrow") - if not os.path.isfile(file_arrow): - return "", None - dataset = Dataset_.from_file(file_arrow) - random_sample = dataset.shuffle(seed=random.randint(0, 1000)).select([0]) - text = "[" + " , ".join(["' " + t + " '" for t in random_sample["text"][0]]) + "]" - audio_path = random_sample["audio_path"][0] - return text, audio_path - - -def get_random_sample_transcribe(project_name): - name_project = project_name + "_pinyin" - path_project = os.path.join(path_data, name_project) - file_metadata = os.path.join(path_project, "metadata.csv") - if not os.path.isfile(file_metadata): - return "", None - - data = "" - with open(file_metadata, "r", encoding="utf-8") as f: - data = f.read() - - list_data = [] - for item in data.split("\n"): - sp = item.split("|") - if len(sp) != 2: - continue - list_data.append([os.path.join(path_project, "wavs", sp[0] + ".wav"), sp[1]]) - if list_data == []: - return "", None - - random_item = random.choice(list_data) - - return random_item[1], random_item[0] - - -def get_random_sample_infer(project_name): - text, audio = get_random_sample_transcribe(project_name) - return ( - text, - text, - audio, - ) - - -def infer(file_checkpoint, exp_name, ref_text, ref_audio, gen_text, nfe_step): - global last_checkpoint, last_device, tts_api - - if not os.path.isfile(file_checkpoint): - return None - - if training_process is not None: - device_test = "cpu" - else: - device_test = None - - if last_checkpoint != file_checkpoint or last_device != device_test: - if last_checkpoint != file_checkpoint: - last_checkpoint = file_checkpoint - if last_device != device_test: - last_device = device_test - - tts_api = F5TTS(model_type=exp_name, ckpt_file=file_checkpoint, device=device_test) - - print("update", device_test, file_checkpoint) +with gr.Blocks() as app: - with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f: - tts_api.infer(gen_text=gen_text, ref_text=ref_text, ref_file=ref_audio, nfe_step=nfe_step, file_wave=f.name) - return f.name + with gr.Row(): + project_name=gr.Textbox(label="project name",value="my_speak") + bt_create=gr.Button("create new project") + + bt_create.click(fn=create_data_project,inputs=[project_name]) + with gr.Tabs(): + -with gr.Blocks() as app: - with gr.Row(): - project_name = gr.Textbox(label="project name", value="my_speak") - bt_create = gr.Button("create new project") + with gr.TabItem("transcribe Data"): - bt_create.click(fn=create_data_project, inputs=[project_name]) - with gr.Tabs(): - with gr.TabItem("transcribe Data"): - ch_manual = gr.Checkbox(label="user", value=False) + ch_manual = gr.Checkbox(label="user",value=False) - mark_info_transcribe = gr.Markdown( - """```plaintext + mark_info_transcribe=gr.Markdown( + """```plaintext Place your 'wavs' folder and 'metadata.csv' file in the {your_project_name}' directory. my_speak/ @@ -746,36 +624,18 @@ with gr.Blocks() as app: ├── audio1.wav └── audio2.wav ... - ```""", - visible=False, - ) - - audio_speaker = gr.File(label="voice", type="filepath", file_count="multiple") - txt_lang = gr.Text(label="Language", value="english") - bt_transcribe = bt_create = gr.Button("transcribe") - txt_info_transcribe = gr.Text(label="info", value="") - bt_transcribe.click( - fn=transcribe_all, - inputs=[project_name, audio_speaker, txt_lang, ch_manual], - outputs=[txt_info_transcribe], - ) - ch_manual.change(fn=check_user, inputs=[ch_manual], outputs=[audio_speaker, mark_info_transcribe]) - - random_sample_transcribe = gr.Button("random sample") - - with gr.Row(): - random_text_transcribe = gr.Text(label="Text") - random_audio_transcribe = gr.Audio(label="Audio", type="filepath") - - random_sample_transcribe.click( - fn=get_random_sample_transcribe, - inputs=[project_name], - outputs=[random_text_transcribe, random_audio_transcribe], - ) - - with gr.TabItem("prepare Data"): - gr.Markdown( - """```plaintext + ```""",visible=False) + + audio_speaker = gr.File(label="voice",type="filepath",file_count="multiple") + txt_lang = gr.Text(label="Language",value="english") + bt_transcribe=bt_create=gr.Button("transcribe") + txt_info_transcribe=gr.Text(label="info",value="") + bt_transcribe.click(fn=transcribe_all,inputs=[project_name,audio_speaker,txt_lang,ch_manual],outputs=[txt_info_transcribe]) + ch_manual.change(fn=check_user,inputs=[ch_manual],outputs=[audio_speaker,mark_info_transcribe]) + + with gr.TabItem("prepare Data"): + gr.Markdown( + """```plaintext place all your wavs folder and your metadata.csv file in {your name project} my_speak/ │ @@ -792,136 +652,61 @@ with gr.Blocks() as app: audio2|text1 ... - ```""" - ) - - bt_prepare = bt_create = gr.Button("prepare") - txt_info_prepare = gr.Text(label="info", value="") - bt_prepare.click(fn=create_metadata, inputs=[project_name], outputs=[txt_info_prepare]) - - random_sample_prepare = gr.Button("random sample") - - with gr.Row(): - random_text_prepare = gr.Text(label="Pinyin") - random_audio_prepare = gr.Audio(label="Audio", type="filepath") - - random_sample_prepare.click( - fn=get_random_sample_prepare, inputs=[project_name], outputs=[random_text_prepare, random_audio_prepare] - ) - - with gr.TabItem("train Data"): - with gr.Row(): - bt_calculate = bt_create = gr.Button("Auto Settings") - ch_finetune = bt_create = gr.Checkbox(label="finetune", value=True) - lb_samples = gr.Label(label="samples") - batch_size_type = gr.Radio(label="Batch Size Type", choices=["frame", "sample"], value="frame") - - with gr.Row(): - exp_name = gr.Radio(label="Model", choices=["F5TTS_Base", "E2TTS_Base"], value="F5TTS_Base") - learning_rate = gr.Number(label="Learning Rate", value=1e-5, step=1e-5) - - with gr.Row(): - batch_size_per_gpu = gr.Number(label="Batch Size per GPU", value=1000) - max_samples = gr.Number(label="Max Samples", value=64) - - with gr.Row(): - grad_accumulation_steps = gr.Number(label="Gradient Accumulation Steps", value=1) - max_grad_norm = gr.Number(label="Max Gradient Norm", value=1.0) - - with gr.Row(): - epochs = gr.Number(label="Epochs", value=10) - num_warmup_updates = gr.Number(label="Warmup Updates", value=5) - - with gr.Row(): - save_per_updates = gr.Number(label="Save per Updates", value=10) - last_per_steps = gr.Number(label="Last per Steps", value=50) - - with gr.Row(): - start_button = gr.Button("Start Training") - stop_button = gr.Button("Stop Training", interactive=False) - - txt_info_train = gr.Text(label="info", value="") - start_button.click( - fn=start_training, - inputs=[ - project_name, - exp_name, - learning_rate, - batch_size_per_gpu, - batch_size_type, - max_samples, - grad_accumulation_steps, - max_grad_norm, - epochs, - num_warmup_updates, - save_per_updates, - last_per_steps, - ch_finetune, - ], - outputs=[txt_info_train, start_button, stop_button], - ) - stop_button.click(fn=stop_training, outputs=[txt_info_train, start_button, stop_button]) - bt_calculate.click( - fn=calculate_train, - inputs=[ - project_name, - batch_size_type, - max_samples, - learning_rate, - num_warmup_updates, - save_per_updates, - last_per_steps, - ch_finetune, - ], - outputs=[ - batch_size_per_gpu, - max_samples, - num_warmup_updates, - save_per_updates, - last_per_steps, - lb_samples, - learning_rate, - ], - ) - - with gr.TabItem("reduse checkpoint"): - txt_path_checkpoint = gr.Text(label="path checkpoint :") - txt_path_checkpoint_small = gr.Text(label="path output :") - txt_info_reduse = gr.Text(label="info", value="") - reduse_button = gr.Button("reduse") - reduse_button.click( - fn=extract_and_save_ema_model, - inputs=[txt_path_checkpoint, txt_path_checkpoint_small], - outputs=[txt_info_reduse], - ) - - with gr.TabItem("vocab check experiment"): - check_button = gr.Button("check vocab") - txt_info_check = gr.Text(label="info", value="") - check_button.click(fn=vocab_check, inputs=[project_name], outputs=[txt_info_check]) - - with gr.TabItem("test model"): - exp_name = gr.Radio(label="Model", choices=["F5-TTS", "E2-TTS"], value="F5-TTS") - nfe_step = gr.Number(label="n_step", value=32) - file_checkpoint_pt = gr.Textbox(label="Checkpoint", value="") - - random_sample_infer = gr.Button("random sample") - - ref_text = gr.Textbox(label="ref text") - ref_audio = gr.Audio(label="audio ref", type="filepath") - gen_text = gr.Textbox(label="gen text") - random_sample_infer.click( - fn=get_random_sample_infer, inputs=[project_name], outputs=[ref_text, gen_text, ref_audio] - ) - check_button_infer = gr.Button("infer") - gen_audio = gr.Audio(label="audio gen", type="filepath") - - check_button_infer.click( - fn=infer, - inputs=[file_checkpoint_pt, exp_name, ref_text, ref_audio, gen_text, nfe_step], - outputs=[gen_audio], - ) - + ```""") + + bt_prepare=bt_create=gr.Button("prepare") + txt_info_prepare=gr.Text(label="info",value="") + bt_prepare.click(fn=create_metadata,inputs=[project_name],outputs=[txt_info_prepare]) + + with gr.TabItem("train Data"): + + with gr.Row(): + bt_calculate=bt_create=gr.Button("Auto Settings") + ch_finetune=bt_create=gr.Checkbox(label="finetune",value=True) + lb_samples = gr.Label(label="samples") + batch_size_type = gr.Radio(label="Batch Size Type", choices=["frame", "sample"], value="frame") + + with gr.Row(): + exp_name = gr.Radio(label="Model", choices=["F5TTS_Base", "E2TTS_Base"], value="F5TTS_Base") + learning_rate = gr.Number(label="Learning Rate", value=1e-4, step=1e-4) + + with gr.Row(): + batch_size_per_gpu = gr.Number(label="Batch Size per GPU", value=1000) + max_samples = gr.Number(label="Max Samples", value=16) + + with gr.Row(): + grad_accumulation_steps = gr.Number(label="Gradient Accumulation Steps", value=1) + max_grad_norm = gr.Number(label="Max Gradient Norm", value=1.0) + + with gr.Row(): + epochs = gr.Number(label="Epochs", value=10) + num_warmup_updates = gr.Number(label="Warmup Updates", value=5) + + with gr.Row(): + save_per_updates = gr.Number(label="Save per Updates", value=10) + last_per_steps = gr.Number(label="Last per Steps", value=50) + + with gr.Row(): + start_button = gr.Button("Start Training") + stop_button = gr.Button("Stop Training",interactive=False) + + txt_info_train=gr.Text(label="info",value="") + start_button.click(fn=start_training,inputs=[project_name,exp_name,learning_rate,batch_size_per_gpu,batch_size_type,max_samples,grad_accumulation_steps,max_grad_norm,epochs,num_warmup_updates,save_per_updates,last_per_steps,ch_finetune],outputs=[txt_info_train,start_button,stop_button]) + stop_button.click(fn=stop_training,outputs=[txt_info_train,start_button,stop_button]) + bt_calculate.click(fn=calculate_train,inputs=[project_name,batch_size_type,max_samples,learning_rate,num_warmup_updates,save_per_updates,last_per_steps,ch_finetune],outputs=[batch_size_per_gpu,max_samples,num_warmup_updates,save_per_updates,last_per_steps,lb_samples,learning_rate]) + + with gr.TabItem("reduse checkpoint"): + txt_path_checkpoint = gr.Text(label="path checkpoint :") + txt_path_checkpoint_small = gr.Text(label="path output :") + txt_info_reduse = gr.Text(label="info",value="") + reduse_button = gr.Button("reduse") + reduse_button.click(fn=extract_and_save_ema_model,inputs=[txt_path_checkpoint,txt_path_checkpoint_small],outputs=[txt_info_reduse]) + + with gr.TabItem("vocab check experiment"): + check_button = gr.Button("check vocab") + txt_info_check=gr.Text(label="info",value="") + check_button.click(fn=vocab_check,inputs=[project_name],outputs=[txt_info_check]) + @click.command() @click.option("--port", "-p", default=None, type=int, help="Port to run the app on") @@ -936,9 +721,10 @@ with gr.Blocks() as app: @click.option("--api", "-a", default=True, is_flag=True, help="Allow API access") def main(port, host, share, api): global app - print("Starting app...") - app.queue(api_open=api).launch(server_name=host, server_port=port, share=share, show_api=api) - + print(f"Starting app...") + app.queue(api_open=api).launch( + server_name=host, server_port=port, share=share, show_api=api + ) if __name__ == "__main__": main() diff --git a/gradio_app.py b/gradio_app.py deleted file mode 100644 index 492793dd0f8f3269a3eff388296a96ed3a9c33c9..0000000000000000000000000000000000000000 --- a/gradio_app.py +++ /dev/null @@ -1,824 +0,0 @@ -import os -import re -import torch -import torchaudio -import gradio as gr -import numpy as np -import tempfile -from einops import rearrange -from vocos import Vocos -from pydub import AudioSegment, silence -from model import CFM, UNetT, DiT, MMDiT -from cached_path import cached_path -from model.utils import ( - load_checkpoint, - get_tokenizer, - convert_char_to_pinyin, - save_spectrogram, -) -from transformers import pipeline -import librosa -import click -import soundfile as sf - -try: - import spaces - USING_SPACES = True -except ImportError: - USING_SPACES = False - -def gpu_decorator(func): - if USING_SPACES: - return spaces.GPU(func) - else: - return func - - - -SPLIT_WORDS = [ - "but", "however", "nevertheless", "yet", "still", - "therefore", "thus", "hence", "consequently", - "moreover", "furthermore", "additionally", - "meanwhile", "alternatively", "otherwise", - "namely", "specifically", "for example", "such as", - "in fact", "indeed", "notably", - "in contrast", "on the other hand", "conversely", - "in conclusion", "to summarize", "finally" -] - -device = ( - "cuda" - if torch.cuda.is_available() - else "mps" if torch.backends.mps.is_available() else "cpu" -) - -print(f"Using {device} device") - -pipe = pipeline( - "automatic-speech-recognition", - model="openai/whisper-large-v3-turbo", - torch_dtype=torch.float16, - device=device, -) -vocos = Vocos.from_pretrained("charactr/vocos-mel-24khz") - -# --------------------- Settings -------------------- # - -target_sample_rate = 24000 -n_mel_channels = 100 -hop_length = 256 -target_rms = 0.1 -nfe_step = 32 # 16, 32 -cfg_strength = 2.0 -ode_method = "euler" -sway_sampling_coef = -1.0 -speed = 1.0 -# fix_duration = 27 # None or float (duration in seconds) -fix_duration = None - - -def load_model(repo_name, exp_name, model_cls, model_cfg, ckpt_step): - ckpt_path = str(cached_path(f"hf://SWivid/{repo_name}/{exp_name}/model_{ckpt_step}.safetensors")) - # ckpt_path = f"ckpts/{exp_name}/model_{ckpt_step}.pt" # .pt | .safetensors - vocab_char_map, vocab_size = get_tokenizer("Emilia_ZH_EN", "pinyin") - model = CFM( - transformer=model_cls( - **model_cfg, text_num_embeds=vocab_size, mel_dim=n_mel_channels - ), - mel_spec_kwargs=dict( - target_sample_rate=target_sample_rate, - n_mel_channels=n_mel_channels, - hop_length=hop_length, - ), - odeint_kwargs=dict( - method=ode_method, - ), - vocab_char_map=vocab_char_map, - ).to(device) - - model = load_checkpoint(model, ckpt_path, device, use_ema = True) - - return model - - -# load models -F5TTS_model_cfg = dict( - dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4 -) -E2TTS_model_cfg = dict(dim=1024, depth=24, heads=16, ff_mult=4) - -F5TTS_ema_model = load_model( - "F5-TTS", "F5TTS_Base", DiT, F5TTS_model_cfg, 1200000 -) -E2TTS_ema_model = load_model( - "E2-TTS", "E2TTS_Base", UNetT, E2TTS_model_cfg, 1200000 -) - -def split_text_into_batches(text, max_chars=200, split_words=SPLIT_WORDS): - if len(text.encode('utf-8')) <= max_chars: - return [text] - if text[-1] not in ['。', '.', '!', '!', '?', '?']: - text += '.' - - sentences = re.split('([。.!?!?])', text) - sentences = [''.join(i) for i in zip(sentences[0::2], sentences[1::2])] - - batches = [] - current_batch = "" - - def split_by_words(text): - words = text.split() - current_word_part = "" - word_batches = [] - for word in words: - if len(current_word_part.encode('utf-8')) + len(word.encode('utf-8')) + 1 <= max_chars: - current_word_part += word + ' ' - else: - if current_word_part: - # Try to find a suitable split word - for split_word in split_words: - split_index = current_word_part.rfind(' ' + split_word + ' ') - if split_index != -1: - word_batches.append(current_word_part[:split_index].strip()) - current_word_part = current_word_part[split_index:].strip() + ' ' - break - else: - # If no suitable split word found, just append the current part - word_batches.append(current_word_part.strip()) - current_word_part = "" - current_word_part += word + ' ' - if current_word_part: - word_batches.append(current_word_part.strip()) - return word_batches - - for sentence in sentences: - if len(current_batch.encode('utf-8')) + len(sentence.encode('utf-8')) <= max_chars: - current_batch += sentence - else: - # If adding this sentence would exceed the limit - if current_batch: - batches.append(current_batch) - current_batch = "" - - # If the sentence itself is longer than max_chars, split it - if len(sentence.encode('utf-8')) > max_chars: - # First, try to split by colon - colon_parts = sentence.split(':') - if len(colon_parts) > 1: - for part in colon_parts: - if len(part.encode('utf-8')) <= max_chars: - batches.append(part) - else: - # If colon part is still too long, split by comma - comma_parts = re.split('[,,]', part) - if len(comma_parts) > 1: - current_comma_part = "" - for comma_part in comma_parts: - if len(current_comma_part.encode('utf-8')) + len(comma_part.encode('utf-8')) <= max_chars: - current_comma_part += comma_part + ',' - else: - if current_comma_part: - batches.append(current_comma_part.rstrip(',')) - current_comma_part = comma_part + ',' - if current_comma_part: - batches.append(current_comma_part.rstrip(',')) - else: - # If no comma, split by words - batches.extend(split_by_words(part)) - else: - # If no colon, split by comma - comma_parts = re.split('[,,]', sentence) - if len(comma_parts) > 1: - current_comma_part = "" - for comma_part in comma_parts: - if len(current_comma_part.encode('utf-8')) + len(comma_part.encode('utf-8')) <= max_chars: - current_comma_part += comma_part + ',' - else: - if current_comma_part: - batches.append(current_comma_part.rstrip(',')) - current_comma_part = comma_part + ',' - if current_comma_part: - batches.append(current_comma_part.rstrip(',')) - else: - # If no comma, split by words - batches.extend(split_by_words(sentence)) - else: - current_batch = sentence - - if current_batch: - batches.append(current_batch) - - return batches - -def infer_batch(ref_audio, ref_text, gen_text_batches, exp_name, remove_silence, progress=gr.Progress()): - if exp_name == "F5-TTS": - ema_model = F5TTS_ema_model - elif exp_name == "E2-TTS": - ema_model = E2TTS_ema_model - - audio, sr = ref_audio - if audio.shape[0] > 1: - audio = torch.mean(audio, dim=0, keepdim=True) - - rms = torch.sqrt(torch.mean(torch.square(audio))) - if rms < target_rms: - audio = audio * target_rms / rms - if sr != target_sample_rate: - resampler = torchaudio.transforms.Resample(sr, target_sample_rate) - audio = resampler(audio) - audio = audio.to(device) - - generated_waves = [] - spectrograms = [] - - for i, gen_text in enumerate(progress.tqdm(gen_text_batches)): - # Prepare the text - if len(ref_text[-1].encode('utf-8')) == 1: - ref_text = ref_text + " " - text_list = [ref_text + gen_text] - final_text_list = convert_char_to_pinyin(text_list) - - # Calculate duration - ref_audio_len = audio.shape[-1] // hop_length - zh_pause_punc = r"。,、;:?!" - ref_text_len = len(ref_text.encode('utf-8')) + 3 * len(re.findall(zh_pause_punc, ref_text)) - gen_text_len = len(gen_text.encode('utf-8')) + 3 * len(re.findall(zh_pause_punc, gen_text)) - duration = ref_audio_len + int(ref_audio_len / ref_text_len * gen_text_len / speed) - - # inference - with torch.inference_mode(): - generated, _ = ema_model.sample( - cond=audio, - text=final_text_list, - duration=duration, - steps=nfe_step, - cfg_strength=cfg_strength, - sway_sampling_coef=sway_sampling_coef, - ) - - generated = generated[:, ref_audio_len:, :] - generated_mel_spec = rearrange(generated, "1 n d -> 1 d n") - generated_wave = vocos.decode(generated_mel_spec.cpu()) - if rms < target_rms: - generated_wave = generated_wave * rms / target_rms - - # wav -> numpy - generated_wave = generated_wave.squeeze().cpu().numpy() - - generated_waves.append(generated_wave) - spectrograms.append(generated_mel_spec[0].cpu().numpy()) - - # Combine all generated waves - final_wave = np.concatenate(generated_waves) - - # Remove silence - if remove_silence: - with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f: - sf.write(f.name, final_wave, target_sample_rate) - aseg = AudioSegment.from_file(f.name) - non_silent_segs = silence.split_on_silence(aseg, min_silence_len=1000, silence_thresh=-50, keep_silence=500) - non_silent_wave = AudioSegment.silent(duration=0) - for non_silent_seg in non_silent_segs: - non_silent_wave += non_silent_seg - aseg = non_silent_wave - aseg.export(f.name, format="wav") - final_wave, _ = torchaudio.load(f.name) - final_wave = final_wave.squeeze().cpu().numpy() - - # Create a combined spectrogram - combined_spectrogram = np.concatenate(spectrograms, axis=1) - - with tempfile.NamedTemporaryFile(suffix=".png", delete=False) as tmp_spectrogram: - spectrogram_path = tmp_spectrogram.name - save_spectrogram(combined_spectrogram, spectrogram_path) - - return (target_sample_rate, final_wave), spectrogram_path - -def infer(ref_audio_orig, ref_text, gen_text, exp_name, remove_silence, custom_split_words=''): - if not custom_split_words.strip(): - custom_words = [word.strip() for word in custom_split_words.split(',')] - global SPLIT_WORDS - SPLIT_WORDS = custom_words - - print(gen_text) - - gr.Info("Converting audio...") - with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f: - aseg = AudioSegment.from_file(ref_audio_orig) - - non_silent_segs = silence.split_on_silence(aseg, min_silence_len=1000, silence_thresh=-50, keep_silence=500) - non_silent_wave = AudioSegment.silent(duration=0) - for non_silent_seg in non_silent_segs: - non_silent_wave += non_silent_seg - aseg = non_silent_wave - - audio_duration = len(aseg) - if audio_duration > 15000: - gr.Warning("Audio is over 15s, clipping to only first 15s.") - aseg = aseg[:15000] - aseg.export(f.name, format="wav") - ref_audio = f.name - - if not ref_text.strip(): - gr.Info("No reference text provided, transcribing reference audio...") - ref_text = pipe( - ref_audio, - chunk_length_s=30, - batch_size=128, - generate_kwargs={"task": "transcribe"}, - return_timestamps=False, - )["text"].strip() - gr.Info("Finished transcription") - else: - gr.Info("Using custom reference text...") - - # Split the input text into batches - audio, sr = torchaudio.load(ref_audio) - max_chars = int(len(ref_text.encode('utf-8')) / (audio.shape[-1] / sr) * (30 - audio.shape[-1] / sr)) - gen_text_batches = split_text_into_batches(gen_text, max_chars=max_chars) - print('ref_text', ref_text) - for i, gen_text in enumerate(gen_text_batches): - print(f'gen_text {i}', gen_text) - - gr.Info(f"Generating audio using {exp_name} in {len(gen_text_batches)} batches") - return infer_batch((audio, sr), ref_text, gen_text_batches, exp_name, remove_silence) - -def generate_podcast(script, speaker1_name, ref_audio1, ref_text1, speaker2_name, ref_audio2, ref_text2, exp_name, remove_silence): - # Split the script into speaker blocks - speaker_pattern = re.compile(f"^({re.escape(speaker1_name)}|{re.escape(speaker2_name)}):", re.MULTILINE) - speaker_blocks = speaker_pattern.split(script)[1:] # Skip the first empty element - - generated_audio_segments = [] - - for i in range(0, len(speaker_blocks), 2): - speaker = speaker_blocks[i] - text = speaker_blocks[i+1].strip() - - # Determine which speaker is talking - if speaker == speaker1_name: - ref_audio = ref_audio1 - ref_text = ref_text1 - elif speaker == speaker2_name: - ref_audio = ref_audio2 - ref_text = ref_text2 - else: - continue # Skip if the speaker is neither speaker1 nor speaker2 - - # Generate audio for this block - audio, _ = infer(ref_audio, ref_text, text, exp_name, remove_silence) - - # Convert the generated audio to a numpy array - sr, audio_data = audio - - # Save the audio data as a WAV file - with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as temp_file: - sf.write(temp_file.name, audio_data, sr) - audio_segment = AudioSegment.from_wav(temp_file.name) - - generated_audio_segments.append(audio_segment) - - # Add a short pause between speakers - pause = AudioSegment.silent(duration=500) # 500ms pause - generated_audio_segments.append(pause) - - # Concatenate all audio segments - final_podcast = sum(generated_audio_segments) - - # Export the final podcast - with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as temp_file: - podcast_path = temp_file.name - final_podcast.export(podcast_path, format="wav") - - return podcast_path - -def parse_speechtypes_text(gen_text): - # Pattern to find (Emotion) - pattern = r'\((.*?)\)' - - # Split the text by the pattern - tokens = re.split(pattern, gen_text) - - segments = [] - - current_emotion = 'Regular' - - for i in range(len(tokens)): - if i % 2 == 0: - # This is text - text = tokens[i].strip() - if text: - segments.append({'emotion': current_emotion, 'text': text}) - else: - # This is emotion - emotion = tokens[i].strip() - current_emotion = emotion - - return segments - -def update_speed(new_speed): - global speed - speed = new_speed - return f"Speed set to: {speed}" - -with gr.Blocks() as app_credits: - gr.Markdown(""" -# Credits - -* [mrfakename](https://github.com/fakerybakery) for the original [online demo](https://huggingface.co/spaces/mrfakename/E2-F5-TTS) -* [RootingInLoad](https://github.com/RootingInLoad) for the podcast generation -""") -with gr.Blocks() as app_tts: - gr.Markdown("# Batched TTS") - ref_audio_input = gr.Audio(label="Reference Audio", type="filepath") - gen_text_input = gr.Textbox(label="Text to Generate", lines=10) - model_choice = gr.Radio( - choices=["F5-TTS", "E2-TTS"], label="Choose TTS Model", value="F5-TTS" - ) - generate_btn = gr.Button("Synthesize", variant="primary") - with gr.Accordion("Advanced Settings", open=False): - ref_text_input = gr.Textbox( - label="Reference Text", - info="Leave blank to automatically transcribe the reference audio. If you enter text it will override automatic transcription.", - lines=2, - ) - remove_silence = gr.Checkbox( - label="Remove Silences", - info="The model tends to produce silences, especially on longer audio. We can manually remove silences if needed. Note that this is an experimental feature and may produce strange results. This will also increase generation time.", - value=True, - ) - split_words_input = gr.Textbox( - label="Custom Split Words", - info="Enter custom words to split on, separated by commas. Leave blank to use default list.", - lines=2, - ) - speed_slider = gr.Slider( - label="Speed", - minimum=0.3, - maximum=2.0, - value=speed, - step=0.1, - info="Adjust the speed of the audio.", - ) - speed_slider.change(update_speed, inputs=speed_slider) - - audio_output = gr.Audio(label="Synthesized Audio") - spectrogram_output = gr.Image(label="Spectrogram") - - generate_btn.click( - infer, - inputs=[ - ref_audio_input, - ref_text_input, - gen_text_input, - model_choice, - remove_silence, - split_words_input, - ], - outputs=[audio_output, spectrogram_output], - ) - -with gr.Blocks() as app_podcast: - gr.Markdown("# Podcast Generation") - speaker1_name = gr.Textbox(label="Speaker 1 Name") - ref_audio_input1 = gr.Audio(label="Reference Audio (Speaker 1)", type="filepath") - ref_text_input1 = gr.Textbox(label="Reference Text (Speaker 1)", lines=2) - - speaker2_name = gr.Textbox(label="Speaker 2 Name") - ref_audio_input2 = gr.Audio(label="Reference Audio (Speaker 2)", type="filepath") - ref_text_input2 = gr.Textbox(label="Reference Text (Speaker 2)", lines=2) - - script_input = gr.Textbox(label="Podcast Script", lines=10, - placeholder="Enter the script with speaker names at the start of each block, e.g.:\nSean: How did you start studying...\n\nMeghan: I came to my interest in technology...\nIt was a long journey...\n\nSean: That's fascinating. Can you elaborate...") - - podcast_model_choice = gr.Radio( - choices=["F5-TTS", "E2-TTS"], label="Choose TTS Model", value="F5-TTS" - ) - podcast_remove_silence = gr.Checkbox( - label="Remove Silences", - value=True, - ) - generate_podcast_btn = gr.Button("Generate Podcast", variant="primary") - podcast_output = gr.Audio(label="Generated Podcast") - - def podcast_generation(script, speaker1, ref_audio1, ref_text1, speaker2, ref_audio2, ref_text2, model, remove_silence): - return generate_podcast(script, speaker1, ref_audio1, ref_text1, speaker2, ref_audio2, ref_text2, model, remove_silence) - - generate_podcast_btn.click( - podcast_generation, - inputs=[ - script_input, - speaker1_name, - ref_audio_input1, - ref_text_input1, - speaker2_name, - ref_audio_input2, - ref_text_input2, - podcast_model_choice, - podcast_remove_silence, - ], - outputs=podcast_output, - ) - -def parse_emotional_text(gen_text): - # Pattern to find (Emotion) - pattern = r'\((.*?)\)' - - # Split the text by the pattern - tokens = re.split(pattern, gen_text) - - segments = [] - - current_emotion = 'Regular' - - for i in range(len(tokens)): - if i % 2 == 0: - # This is text - text = tokens[i].strip() - if text: - segments.append({'emotion': current_emotion, 'text': text}) - else: - # This is emotion - emotion = tokens[i].strip() - current_emotion = emotion - - return segments - -with gr.Blocks() as app_emotional: - # New section for emotional generation - gr.Markdown( - """ - # Multiple Speech-Type Generation - - This section allows you to upload different audio clips for each speech type. 'Regular' emotion is mandatory. You can add additional speech types by clicking the "Add Speech Type" button. Enter your text in the format shown below, and the system will generate speech using the appropriate emotions. If unspecified, the model will use the regular speech type. The current speech type will be used until the next speech type is specified. - - **Example Input:** - - (Regular) Hello, I'd like to order a sandwich please. (Surprised) What do you mean you're out of bread? (Sad) I really wanted a sandwich though... (Angry) You know what, darn you and your little shop, you suck! (Whisper) I'll just go back home and cry now. (Shouting) Why me?! - """ - ) - - gr.Markdown("Upload different audio clips for each speech type. 'Regular' emotion is mandatory. You can add additional speech types by clicking the 'Add Speech Type' button.") - - # Regular speech type (mandatory) - with gr.Row(): - regular_name = gr.Textbox(value='Regular', label='Speech Type Name', interactive=False) - regular_audio = gr.Audio(label='Regular Reference Audio', type='filepath') - regular_ref_text = gr.Textbox(label='Reference Text (Regular)', lines=2) - - # Additional speech types (up to 9 more) - max_speech_types = 10 - speech_type_names = [] - speech_type_audios = [] - speech_type_ref_texts = [] - speech_type_delete_btns = [] - - for i in range(max_speech_types - 1): - with gr.Row(): - name_input = gr.Textbox(label='Speech Type Name', visible=False) - audio_input = gr.Audio(label='Reference Audio', type='filepath', visible=False) - ref_text_input = gr.Textbox(label='Reference Text', lines=2, visible=False) - delete_btn = gr.Button("Delete", variant="secondary", visible=False) - speech_type_names.append(name_input) - speech_type_audios.append(audio_input) - speech_type_ref_texts.append(ref_text_input) - speech_type_delete_btns.append(delete_btn) - - # Button to add speech type - add_speech_type_btn = gr.Button("Add Speech Type") - - # Keep track of current number of speech types - speech_type_count = gr.State(value=0) - - # Function to add a speech type - def add_speech_type_fn(speech_type_count): - if speech_type_count < max_speech_types - 1: - speech_type_count += 1 - # Prepare updates for the components - name_updates = [] - audio_updates = [] - ref_text_updates = [] - delete_btn_updates = [] - for i in range(max_speech_types - 1): - if i < speech_type_count: - name_updates.append(gr.update(visible=True)) - audio_updates.append(gr.update(visible=True)) - ref_text_updates.append(gr.update(visible=True)) - delete_btn_updates.append(gr.update(visible=True)) - else: - name_updates.append(gr.update()) - audio_updates.append(gr.update()) - ref_text_updates.append(gr.update()) - delete_btn_updates.append(gr.update()) - else: - # Optionally, show a warning - # gr.Warning("Maximum number of speech types reached.") - name_updates = [gr.update() for _ in range(max_speech_types - 1)] - audio_updates = [gr.update() for _ in range(max_speech_types - 1)] - ref_text_updates = [gr.update() for _ in range(max_speech_types - 1)] - delete_btn_updates = [gr.update() for _ in range(max_speech_types - 1)] - return [speech_type_count] + name_updates + audio_updates + ref_text_updates + delete_btn_updates - - add_speech_type_btn.click( - add_speech_type_fn, - inputs=speech_type_count, - outputs=[speech_type_count] + speech_type_names + speech_type_audios + speech_type_ref_texts + speech_type_delete_btns - ) - - # Function to delete a speech type - def make_delete_speech_type_fn(index): - def delete_speech_type_fn(speech_type_count): - # Prepare updates - name_updates = [] - audio_updates = [] - ref_text_updates = [] - delete_btn_updates = [] - - for i in range(max_speech_types - 1): - if i == index: - name_updates.append(gr.update(visible=False, value='')) - audio_updates.append(gr.update(visible=False, value=None)) - ref_text_updates.append(gr.update(visible=False, value='')) - delete_btn_updates.append(gr.update(visible=False)) - else: - name_updates.append(gr.update()) - audio_updates.append(gr.update()) - ref_text_updates.append(gr.update()) - delete_btn_updates.append(gr.update()) - - speech_type_count = max(0, speech_type_count - 1) - - return [speech_type_count] + name_updates + audio_updates + ref_text_updates + delete_btn_updates - - return delete_speech_type_fn - - for i, delete_btn in enumerate(speech_type_delete_btns): - delete_fn = make_delete_speech_type_fn(i) - delete_btn.click( - delete_fn, - inputs=speech_type_count, - outputs=[speech_type_count] + speech_type_names + speech_type_audios + speech_type_ref_texts + speech_type_delete_btns - ) - - # Text input for the prompt - gen_text_input_emotional = gr.Textbox(label="Text to Generate", lines=10) - - # Model choice - model_choice_emotional = gr.Radio( - choices=["F5-TTS", "E2-TTS"], label="Choose TTS Model", value="F5-TTS" - ) - - with gr.Accordion("Advanced Settings", open=False): - remove_silence_emotional = gr.Checkbox( - label="Remove Silences", - value=True, - ) - - # Generate button - generate_emotional_btn = gr.Button("Generate Emotional Speech", variant="primary") - - # Output audio - audio_output_emotional = gr.Audio(label="Synthesized Audio") - - def generate_emotional_speech( - regular_audio, - regular_ref_text, - gen_text, - *args, - ): - num_additional_speech_types = max_speech_types - 1 - speech_type_names_list = args[:num_additional_speech_types] - speech_type_audios_list = args[num_additional_speech_types:2 * num_additional_speech_types] - speech_type_ref_texts_list = args[2 * num_additional_speech_types:3 * num_additional_speech_types] - model_choice = args[3 * num_additional_speech_types] - remove_silence = args[3 * num_additional_speech_types + 1] - - # Collect the speech types and their audios into a dict - speech_types = {'Regular': {'audio': regular_audio, 'ref_text': regular_ref_text}} - - for name_input, audio_input, ref_text_input in zip(speech_type_names_list, speech_type_audios_list, speech_type_ref_texts_list): - if name_input and audio_input: - speech_types[name_input] = {'audio': audio_input, 'ref_text': ref_text_input} - - # Parse the gen_text into segments - segments = parse_speechtypes_text(gen_text) - - # For each segment, generate speech - generated_audio_segments = [] - current_emotion = 'Regular' - - for segment in segments: - emotion = segment['emotion'] - text = segment['text'] - - if emotion in speech_types: - current_emotion = emotion - else: - # If emotion not available, default to Regular - current_emotion = 'Regular' - - ref_audio = speech_types[current_emotion]['audio'] - ref_text = speech_types[current_emotion].get('ref_text', '') - - # Generate speech for this segment - audio, _ = infer(ref_audio, ref_text, text, model_choice, remove_silence, "") - sr, audio_data = audio - - generated_audio_segments.append(audio_data) - - # Concatenate all audio segments - if generated_audio_segments: - final_audio_data = np.concatenate(generated_audio_segments) - return (sr, final_audio_data) - else: - gr.Warning("No audio generated.") - return None - - generate_emotional_btn.click( - generate_emotional_speech, - inputs=[ - regular_audio, - regular_ref_text, - gen_text_input_emotional, - ] + speech_type_names + speech_type_audios + speech_type_ref_texts + [ - model_choice_emotional, - remove_silence_emotional, - ], - outputs=audio_output_emotional, - ) - - # Validation function to disable Generate button if speech types are missing - def validate_speech_types( - gen_text, - regular_name, - *args - ): - num_additional_speech_types = max_speech_types - 1 - speech_type_names_list = args[:num_additional_speech_types] - - # Collect the speech types names - speech_types_available = set() - if regular_name: - speech_types_available.add(regular_name) - for name_input in speech_type_names_list: - if name_input: - speech_types_available.add(name_input) - - # Parse the gen_text to get the speech types used - segments = parse_emotional_text(gen_text) - speech_types_in_text = set(segment['emotion'] for segment in segments) - - # Check if all speech types in text are available - missing_speech_types = speech_types_in_text - speech_types_available - - if missing_speech_types: - # Disable the generate button - return gr.update(interactive=False) - else: - # Enable the generate button - return gr.update(interactive=True) - - gen_text_input_emotional.change( - validate_speech_types, - inputs=[gen_text_input_emotional, regular_name] + speech_type_names, - outputs=generate_emotional_btn - ) -with gr.Blocks() as app: - gr.Markdown( - """ -# E2/F5 TTS - -This is a local web UI for F5 TTS with advanced batch processing support. This app supports the following TTS models: - -* [F5-TTS](https://arxiv.org/abs/2410.06885) (A Fairytaler that Fakes Fluent and Faithful Speech with Flow Matching) -* [E2 TTS](https://arxiv.org/abs/2406.18009) (Embarrassingly Easy Fully Non-Autoregressive Zero-Shot TTS) - -The checkpoints support English and Chinese. - -If you're having issues, try converting your reference audio to WAV or MP3, clipping it to 15s, and shortening your prompt. - -**NOTE: Reference text will be automatically transcribed with Whisper if not provided. For best results, keep your reference clips short (<15s). Ensure the audio is fully uploaded before generating.** -""" - ) - gr.TabbedInterface([app_tts, app_podcast, app_emotional, app_credits], ["TTS", "Podcast", "Multi-Style", "Credits"]) - -@click.command() -@click.option("--port", "-p", default=None, type=int, help="Port to run the app on") -@click.option("--host", "-H", default=None, help="Host to run the app on") -@click.option( - "--share", - "-s", - default=False, - is_flag=True, - help="Share the app via Gradio share link", -) -@click.option("--api", "-a", default=True, is_flag=True, help="Allow API access") -def main(port, host, share, api): - global app - print(f"Starting app...") - app.queue(api_open=api).launch( - server_name=host, server_port=port, share=share, show_api=api - ) - - -if __name__ == "__main__": - main() diff --git a/inference-cli.py b/inference-cli.py index 1e74eec2d22bc14ef63e733962740bf0fc023efc..9d054ba75077875634ade95ab8279eb12679b2ea 100644 --- a/inference-cli.py +++ b/inference-cli.py @@ -1,22 +1,24 @@ import argparse import codecs import re +import tempfile from pathlib import Path import numpy as np import soundfile as sf import tomli +import torch +import torchaudio +import tqdm from cached_path import cached_path +from einops import rearrange +from pydub import AudioSegment, silence +from transformers import pipeline +from vocos import Vocos -from model import DiT, UNetT -from model.utils_infer import ( - load_vocoder, - load_model, - preprocess_ref_audio_text, - infer_process, - remove_silence_for_generated_wav, -) - +from model import CFM, DiT, MMDiT, UNetT +from model.utils import (convert_char_to_pinyin, get_tokenizer, + load_checkpoint, save_spectrogram) parser = argparse.ArgumentParser( prog="python3 inference-cli.py", @@ -35,17 +37,18 @@ parser.add_argument( help="F5-TTS | E2-TTS", ) parser.add_argument( - "-p", - "--ckpt_file", - help="The Checkpoint .pt", + "-r", + "--ref_audio", + type=str, + help="Reference audio file < 15 seconds." ) parser.add_argument( - "-v", - "--vocab_file", - help="The vocab .txt", + "-s", + "--ref_text", + type=str, + default="666", + help="Subtitle for the reference audio." ) -parser.add_argument("-r", "--ref_audio", type=str, help="Reference audio file < 15 seconds.") -parser.add_argument("-s", "--ref_text", type=str, default="666", help="Subtitle for the reference audio.") parser.add_argument( "-t", "--gen_text", @@ -85,86 +88,305 @@ if gen_file: gen_text = codecs.open(gen_file, "r", "utf-8").read() output_dir = args.output_dir if args.output_dir else config["output_dir"] model = args.model if args.model else config["model"] -ckpt_file = args.ckpt_file if args.ckpt_file else "" -vocab_file = args.vocab_file if args.vocab_file else "" remove_silence = args.remove_silence if args.remove_silence else config["remove_silence"] -wave_path = Path(output_dir) / "out.wav" -spectrogram_path = Path(output_dir) / "out.png" +wave_path = Path(output_dir)/"out.wav" +spectrogram_path = Path(output_dir)/"out.png" vocos_local_path = "../checkpoints/charactr/vocos-mel-24khz" -vocos = load_vocoder(is_local=args.load_vocoder_from_local, local_path=vocos_local_path) +device = ( + "cuda" + if torch.cuda.is_available() + else "mps" if torch.backends.mps.is_available() else "cpu" +) + +if args.load_vocoder_from_local: + print(f"Load vocos from local path {vocos_local_path}") + vocos = Vocos.from_hparams(f"{vocos_local_path}/config.yaml") + state_dict = torch.load(f"{vocos_local_path}/pytorch_model.bin", map_location=device) + vocos.load_state_dict(state_dict) + vocos.eval() +else: + print("Donwload Vocos from huggingface charactr/vocos-mel-24khz") + vocos = Vocos.from_pretrained("charactr/vocos-mel-24khz") + +print(f"Using {device} device") + +# --------------------- Settings -------------------- # + +target_sample_rate = 24000 +n_mel_channels = 100 +hop_length = 256 +target_rms = 0.1 +nfe_step = 32 # 16, 32 +cfg_strength = 2.0 +ode_method = "euler" +sway_sampling_coef = -1.0 +speed = 1.0 +# fix_duration = 27 # None or float (duration in seconds) +fix_duration = None + +def load_model(repo_name, exp_name, model_cls, model_cfg, ckpt_step): + ckpt_path = f"ckpts/{exp_name}/model_{ckpt_step}.pt" # .pt | .safetensors + if not Path(ckpt_path).exists(): + ckpt_path = str(cached_path(f"hf://SWivid/{repo_name}/{exp_name}/model_{ckpt_step}.safetensors")) + vocab_char_map, vocab_size = get_tokenizer("Emilia_ZH_EN", "pinyin") + model = CFM( + transformer=model_cls( + **model_cfg, text_num_embeds=vocab_size, mel_dim=n_mel_channels + ), + mel_spec_kwargs=dict( + target_sample_rate=target_sample_rate, + n_mel_channels=n_mel_channels, + hop_length=hop_length, + ), + odeint_kwargs=dict( + method=ode_method, + ), + vocab_char_map=vocab_char_map, + ).to(device) + + model = load_checkpoint(model, ckpt_path, device, use_ema = True) + + return model # load models -if model == "F5-TTS": - model_cls = DiT - model_cfg = dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4) - if ckpt_file == "": - repo_name = "F5-TTS" - exp_name = "F5TTS_Base" - ckpt_step = 1200000 - ckpt_file = str(cached_path(f"hf://SWivid/{repo_name}/{exp_name}/model_{ckpt_step}.safetensors")) - # ckpt_file = f"ckpts/{exp_name}/model_{ckpt_step}.pt" # .pt | .safetensors; local path - -elif model == "E2-TTS": - model_cls = UNetT - model_cfg = dict(dim=1024, depth=24, heads=16, ff_mult=4) - if ckpt_file == "": - repo_name = "E2-TTS" - exp_name = "E2TTS_Base" - ckpt_step = 1200000 - ckpt_file = str(cached_path(f"hf://SWivid/{repo_name}/{exp_name}/model_{ckpt_step}.safetensors")) - # ckpt_file = f"ckpts/{exp_name}/model_{ckpt_step}.pt" # .pt | .safetensors; local path - -print(f"Using {model}...") -ema_model = load_model(model_cls, model_cfg, ckpt_file, vocab_file) - - -def main_process(ref_audio, ref_text, text_gen, model_obj, remove_silence): - main_voice = {"ref_audio": ref_audio, "ref_text": ref_text} +F5TTS_model_cfg = dict( + dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4 +) +E2TTS_model_cfg = dict(dim=1024, depth=24, heads=16, ff_mult=4) + + +def chunk_text(text, max_chars=135): + """ + Splits the input text into chunks, each with a maximum number of characters. + Args: + text (str): The text to be split. + max_chars (int): The maximum number of characters per chunk. + Returns: + List[str]: A list of text chunks. + """ + chunks = [] + current_chunk = "" + # Split the text into sentences based on punctuation followed by whitespace + sentences = re.split(r'(?<=[;:,.!?])\s+|(?<=[;:,。!?])', text) + + for sentence in sentences: + if len(current_chunk.encode('utf-8')) + len(sentence.encode('utf-8')) <= max_chars: + current_chunk += sentence + " " if sentence and len(sentence[-1].encode('utf-8')) == 1 else sentence + else: + if current_chunk: + chunks.append(current_chunk.strip()) + current_chunk = sentence + " " if sentence and len(sentence[-1].encode('utf-8')) == 1 else sentence + + if current_chunk: + chunks.append(current_chunk.strip()) + + return chunks + + +def infer_batch(ref_audio, ref_text, gen_text_batches, model, remove_silence, cross_fade_duration=0.15): + if model == "F5-TTS": + ema_model = load_model(model, "F5TTS_Base", DiT, F5TTS_model_cfg, 1200000) + elif model == "E2-TTS": + ema_model = load_model(model, "E2TTS_Base", UNetT, E2TTS_model_cfg, 1200000) + + audio, sr = ref_audio + if audio.shape[0] > 1: + audio = torch.mean(audio, dim=0, keepdim=True) + + rms = torch.sqrt(torch.mean(torch.square(audio))) + if rms < target_rms: + audio = audio * target_rms / rms + if sr != target_sample_rate: + resampler = torchaudio.transforms.Resample(sr, target_sample_rate) + audio = resampler(audio) + audio = audio.to(device) + + generated_waves = [] + spectrograms = [] + + for i, gen_text in enumerate(tqdm.tqdm(gen_text_batches)): + # Prepare the text + if len(ref_text[-1].encode('utf-8')) == 1: + ref_text = ref_text + " " + text_list = [ref_text + gen_text] + final_text_list = convert_char_to_pinyin(text_list) + + # Calculate duration + ref_audio_len = audio.shape[-1] // hop_length + zh_pause_punc = r"。,、;:?!" + ref_text_len = len(ref_text.encode('utf-8')) + 3 * len(re.findall(zh_pause_punc, ref_text)) + gen_text_len = len(gen_text.encode('utf-8')) + 3 * len(re.findall(zh_pause_punc, gen_text)) + duration = ref_audio_len + int(ref_audio_len / ref_text_len * gen_text_len / speed) + + # inference + with torch.inference_mode(): + generated, _ = ema_model.sample( + cond=audio, + text=final_text_list, + duration=duration, + steps=nfe_step, + cfg_strength=cfg_strength, + sway_sampling_coef=sway_sampling_coef, + ) + + generated = generated[:, ref_audio_len:, :] + generated_mel_spec = rearrange(generated, "1 n d -> 1 d n") + generated_wave = vocos.decode(generated_mel_spec.cpu()) + if rms < target_rms: + generated_wave = generated_wave * rms / target_rms + + # wav -> numpy + generated_wave = generated_wave.squeeze().cpu().numpy() + + generated_waves.append(generated_wave) + spectrograms.append(generated_mel_spec[0].cpu().numpy()) + + # Combine all generated waves with cross-fading + if cross_fade_duration <= 0: + # Simply concatenate + final_wave = np.concatenate(generated_waves) + else: + final_wave = generated_waves[0] + for i in range(1, len(generated_waves)): + prev_wave = final_wave + next_wave = generated_waves[i] + + # Calculate cross-fade samples, ensuring it does not exceed wave lengths + cross_fade_samples = int(cross_fade_duration * target_sample_rate) + cross_fade_samples = min(cross_fade_samples, len(prev_wave), len(next_wave)) + + if cross_fade_samples <= 0: + # No overlap possible, concatenate + final_wave = np.concatenate([prev_wave, next_wave]) + continue + + # Overlapping parts + prev_overlap = prev_wave[-cross_fade_samples:] + next_overlap = next_wave[:cross_fade_samples] + + # Fade out and fade in + fade_out = np.linspace(1, 0, cross_fade_samples) + fade_in = np.linspace(0, 1, cross_fade_samples) + + # Cross-faded overlap + cross_faded_overlap = prev_overlap * fade_out + next_overlap * fade_in + + # Combine + new_wave = np.concatenate([ + prev_wave[:-cross_fade_samples], + cross_faded_overlap, + next_wave[cross_fade_samples:] + ]) + + final_wave = new_wave + + # Create a combined spectrogram + combined_spectrogram = np.concatenate(spectrograms, axis=1) + + return final_wave, combined_spectrogram + +def process_voice(ref_audio_orig, ref_text): + print("Converting audio...") + with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f: + aseg = AudioSegment.from_file(ref_audio_orig) + + non_silent_segs = silence.split_on_silence(aseg, min_silence_len=1000, silence_thresh=-50, keep_silence=1000) + non_silent_wave = AudioSegment.silent(duration=0) + for non_silent_seg in non_silent_segs: + non_silent_wave += non_silent_seg + aseg = non_silent_wave + + audio_duration = len(aseg) + if audio_duration > 15000: + print("Audio is over 15s, clipping to only first 15s.") + aseg = aseg[:15000] + aseg.export(f.name, format="wav") + ref_audio = f.name + + if not ref_text.strip(): + print("No reference text provided, transcribing reference audio...") + pipe = pipeline( + "automatic-speech-recognition", + model="openai/whisper-large-v3-turbo", + torch_dtype=torch.float16, + device=device, + ) + ref_text = pipe( + ref_audio, + chunk_length_s=30, + batch_size=128, + generate_kwargs={"task": "transcribe"}, + return_timestamps=False, + )["text"].strip() + print("Finished transcription") + else: + print("Using custom reference text...") + return ref_audio, ref_text + +def infer(ref_audio, ref_text, gen_text, model, remove_silence, cross_fade_duration=0.15): + print(gen_text) + # Add the functionality to ensure it ends with ". " + if not ref_text.endswith(". ") and not ref_text.endswith("。"): + if ref_text.endswith("."): + ref_text += " " + else: + ref_text += ". " + + # Split the input text into batches + audio, sr = torchaudio.load(ref_audio) + max_chars = int(len(ref_text.encode('utf-8')) / (audio.shape[-1] / sr) * (25 - audio.shape[-1] / sr)) + gen_text_batches = chunk_text(gen_text, max_chars=max_chars) + print('ref_text', ref_text) + for i, gen_text in enumerate(gen_text_batches): + print(f'gen_text {i}', gen_text) + + print(f"Generating audio using {model} in {len(gen_text_batches)} batches, loading models...") + return infer_batch((audio, sr), ref_text, gen_text_batches, model, remove_silence, cross_fade_duration) + + +def process(ref_audio, ref_text, text_gen, model, remove_silence): + main_voice = {"ref_audio":ref_audio, "ref_text":ref_text} if "voices" not in config: voices = {"main": main_voice} else: voices = config["voices"] voices["main"] = main_voice for voice in voices: - voices[voice]["ref_audio"], voices[voice]["ref_text"] = preprocess_ref_audio_text( - voices[voice]["ref_audio"], voices[voice]["ref_text"] - ) - print("Voice:", voice) - print("Ref_audio:", voices[voice]["ref_audio"]) - print("Ref_text:", voices[voice]["ref_text"]) + voices[voice]['ref_audio'], voices[voice]['ref_text'] = process_voice(voices[voice]['ref_audio'], voices[voice]['ref_text']) generated_audio_segments = [] - reg1 = r"(?=\[\w+\])" + reg1 = r'(?=\[\w+\])' chunks = re.split(reg1, text_gen) - reg2 = r"\[(\w+)\]" + reg2 = r'\[(\w+)\]' for text in chunks: match = re.match(reg2, text) - if match: - voice = match[1] - else: - print("No voice tag found, using main.") - voice = "main" - if voice not in voices: - print(f"Voice {voice} not found, using main.") + if not match or voice not in voices: voice = "main" + else: + voice = match[1] text = re.sub(reg2, "", text) gen_text = text.strip() - ref_audio = voices[voice]["ref_audio"] - ref_text = voices[voice]["ref_text"] + ref_audio = voices[voice]['ref_audio'] + ref_text = voices[voice]['ref_text'] print(f"Voice: {voice}") - audio, final_sample_rate, spectragram = infer_process(ref_audio, ref_text, gen_text, model_obj) + audio, spectragram = infer(ref_audio, ref_text, gen_text, model, remove_silence) generated_audio_segments.append(audio) if generated_audio_segments: final_wave = np.concatenate(generated_audio_segments) with open(wave_path, "wb") as f: - sf.write(f.name, final_wave, final_sample_rate) + sf.write(f.name, final_wave, target_sample_rate) # Remove silence if remove_silence: - remove_silence_for_generated_wav(f.name) + aseg = AudioSegment.from_file(f.name) + non_silent_segs = silence.split_on_silence(aseg, min_silence_len=1000, silence_thresh=-50, keep_silence=500) + non_silent_wave = AudioSegment.silent(duration=0) + for non_silent_seg in non_silent_segs: + non_silent_wave += non_silent_seg + aseg = non_silent_wave + aseg.export(f.name, format="wav") print(f.name) - -main_process(ref_audio, ref_text, gen_text, ema_model, remove_silence) +process(ref_audio, ref_text, gen_text, model, remove_silence) \ No newline at end of file diff --git a/model/__init__.py b/model/__init__.py index 4b4f031397a3b21cd54675fc3d28421eb2b36c42..d505b15dcaafb8aca9b6ae6cb0a3de3ba31b45fc 100644 --- a/model/__init__.py +++ b/model/__init__.py @@ -5,6 +5,3 @@ from model.backbones.dit import DiT from model.backbones.mmdit import MMDiT from model.trainer import Trainer - - -__all__ = ["CFM", "UNetT", "DiT", "MMDiT", "Trainer"] diff --git a/model/backbones/dit.py b/model/backbones/dit.py index b8e6dc3f8ce2ff1f007b04b182b64a9a8e03a09c..5654191fd7c5820788ed794861682f2c16c03e4f 100644 --- a/model/backbones/dit.py +++ b/model/backbones/dit.py @@ -13,6 +13,8 @@ import torch from torch import nn import torch.nn.functional as F +from einops import repeat + from x_transformers.x_transformers import RotaryEmbedding from model.modules import ( @@ -21,16 +23,14 @@ from model.modules import ( ConvPositionEmbedding, DiTBlock, AdaLayerNormZero_Final, - precompute_freqs_cis, - get_pos_embed_indices, + precompute_freqs_cis, get_pos_embed_indices, ) # Text embedding - class TextEmbedding(nn.Module): - def __init__(self, text_num_embeds, text_dim, conv_layers=0, conv_mult=2): + def __init__(self, text_num_embeds, text_dim, conv_layers = 0, conv_mult = 2): super().__init__() self.text_embed = nn.Embedding(text_num_embeds + 1, text_dim) # use 0 as filler token @@ -38,22 +38,20 @@ class TextEmbedding(nn.Module): self.extra_modeling = True self.precompute_max_pos = 4096 # ~44s of 24khz audio self.register_buffer("freqs_cis", precompute_freqs_cis(text_dim, self.precompute_max_pos), persistent=False) - self.text_blocks = nn.Sequential( - *[ConvNeXtV2Block(text_dim, text_dim * conv_mult) for _ in range(conv_layers)] - ) + self.text_blocks = nn.Sequential(*[ConvNeXtV2Block(text_dim, text_dim * conv_mult) for _ in range(conv_layers)]) else: self.extra_modeling = False - def forward(self, text: int["b nt"], seq_len, drop_text=False): # noqa: F722 + def forward(self, text: int['b nt'], seq_len, drop_text = False): + batch, text_len = text.shape[0], text.shape[1] text = text + 1 # use 0 as filler token. preprocess of batch pad -1, see list_str_to_idx() text = text[:, :seq_len] # curtail if character tokens are more than the mel spec tokens - batch, text_len = text.shape[0], text.shape[1] - text = F.pad(text, (0, seq_len - text_len), value=0) + text = F.pad(text, (0, seq_len - text_len), value = 0) if drop_text: # cfg for text text = torch.zeros_like(text) - text = self.text_embed(text) # b n -> b n d + text = self.text_embed(text) # b n -> b n d # possible extra modeling if self.extra_modeling: @@ -71,91 +69,88 @@ class TextEmbedding(nn.Module): # noised input audio and context mixing embedding - class InputEmbedding(nn.Module): def __init__(self, mel_dim, text_dim, out_dim): super().__init__() self.proj = nn.Linear(mel_dim * 2 + text_dim, out_dim) - self.conv_pos_embed = ConvPositionEmbedding(dim=out_dim) + self.conv_pos_embed = ConvPositionEmbedding(dim = out_dim) - def forward(self, x: float["b n d"], cond: float["b n d"], text_embed: float["b n d"], drop_audio_cond=False): # noqa: F722 + def forward(self, x: float['b n d'], cond: float['b n d'], text_embed: float['b n d'], drop_audio_cond = False): if drop_audio_cond: # cfg for cond audio cond = torch.zeros_like(cond) - x = self.proj(torch.cat((x, cond, text_embed), dim=-1)) + x = self.proj(torch.cat((x, cond, text_embed), dim = -1)) x = self.conv_pos_embed(x) + x return x - + # Transformer backbone using DiT blocks - class DiT(nn.Module): - def __init__( - self, - *, - dim, - depth=8, - heads=8, - dim_head=64, - dropout=0.1, - ff_mult=4, - mel_dim=100, - text_num_embeds=256, - text_dim=None, - conv_layers=0, - long_skip_connection=False, + def __init__(self, *, + dim, depth = 8, heads = 8, dim_head = 64, dropout = 0.1, ff_mult = 4, + mel_dim = 100, text_num_embeds = 256, text_dim = None, conv_layers = 0, + long_skip_connection = False, ): super().__init__() self.time_embed = TimestepEmbedding(dim) if text_dim is None: text_dim = mel_dim - self.text_embed = TextEmbedding(text_num_embeds, text_dim, conv_layers=conv_layers) + self.text_embed = TextEmbedding(text_num_embeds, text_dim, conv_layers = conv_layers) self.input_embed = InputEmbedding(mel_dim, text_dim, dim) self.rotary_embed = RotaryEmbedding(dim_head) self.dim = dim self.depth = depth - + self.transformer_blocks = nn.ModuleList( - [DiTBlock(dim=dim, heads=heads, dim_head=dim_head, ff_mult=ff_mult, dropout=dropout) for _ in range(depth)] + [ + DiTBlock( + dim = dim, + heads = heads, + dim_head = dim_head, + ff_mult = ff_mult, + dropout = dropout + ) + for _ in range(depth) + ] ) - self.long_skip_connection = nn.Linear(dim * 2, dim, bias=False) if long_skip_connection else None - + self.long_skip_connection = nn.Linear(dim * 2, dim, bias = False) if long_skip_connection else None + self.norm_out = AdaLayerNormZero_Final(dim) # final modulation self.proj_out = nn.Linear(dim, mel_dim) def forward( self, - x: float["b n d"], # nosied input audio # noqa: F722 - cond: float["b n d"], # masked cond audio # noqa: F722 - text: int["b nt"], # text # noqa: F722 - time: float["b"] | float[""], # time step # noqa: F821 F722 + x: float['b n d'], # nosied input audio + cond: float['b n d'], # masked cond audio + text: int['b nt'], # text + time: float['b'] | float[''], # time step drop_audio_cond, # cfg for cond audio - drop_text, # cfg for text - mask: bool["b n"] | None = None, # noqa: F722 + drop_text, # cfg for text + mask: bool['b n'] | None = None, ): batch, seq_len = x.shape[0], x.shape[1] if time.ndim == 0: - time = time.repeat(batch) - + time = repeat(time, ' -> b', b = batch) + # t: conditioning time, c: context (text + masked cond audio), x: noised input audio t = self.time_embed(time) - text_embed = self.text_embed(text, seq_len, drop_text=drop_text) - x = self.input_embed(x, cond, text_embed, drop_audio_cond=drop_audio_cond) - + text_embed = self.text_embed(text, seq_len, drop_text = drop_text) + x = self.input_embed(x, cond, text_embed, drop_audio_cond = drop_audio_cond) + rope = self.rotary_embed.forward_from_seq_len(seq_len) if self.long_skip_connection is not None: residual = x for block in self.transformer_blocks: - x = block(x, t, mask=mask, rope=rope) + x = block(x, t, mask = mask, rope = rope) if self.long_skip_connection is not None: - x = self.long_skip_connection(torch.cat((x, residual), dim=-1)) + x = self.long_skip_connection(torch.cat((x, residual), dim = -1)) x = self.norm_out(x, t) output = self.proj_out(x) diff --git a/model/backbones/mmdit.py b/model/backbones/mmdit.py index 86313b136205788d7599896f8c36d2498c17ce6c..f1b3b7d53effb436fee783147a9c391734f89615 100644 --- a/model/backbones/mmdit.py +++ b/model/backbones/mmdit.py @@ -12,6 +12,8 @@ from __future__ import annotations import torch from torch import nn +from einops import repeat + from x_transformers.x_transformers import RotaryEmbedding from model.modules import ( @@ -19,14 +21,12 @@ from model.modules import ( ConvPositionEmbedding, MMDiTBlock, AdaLayerNormZero_Final, - precompute_freqs_cis, - get_pos_embed_indices, + precompute_freqs_cis, get_pos_embed_indices, ) # text embedding - class TextEmbedding(nn.Module): def __init__(self, out_dim, text_num_embeds): super().__init__() @@ -35,7 +35,7 @@ class TextEmbedding(nn.Module): self.precompute_max_pos = 1024 self.register_buffer("freqs_cis", precompute_freqs_cis(out_dim, self.precompute_max_pos), persistent=False) - def forward(self, text: int["b nt"], drop_text=False) -> int["b nt d"]: # noqa: F722 + def forward(self, text: int['b nt'], drop_text = False) -> int['b nt d']: text = text + 1 if drop_text: text = torch.zeros_like(text) @@ -54,37 +54,27 @@ class TextEmbedding(nn.Module): # noised input & masked cond audio embedding - class AudioEmbedding(nn.Module): def __init__(self, in_dim, out_dim): super().__init__() self.linear = nn.Linear(2 * in_dim, out_dim) self.conv_pos_embed = ConvPositionEmbedding(out_dim) - def forward(self, x: float["b n d"], cond: float["b n d"], drop_audio_cond=False): # noqa: F722 + def forward(self, x: float['b n d'], cond: float['b n d'], drop_audio_cond = False): if drop_audio_cond: cond = torch.zeros_like(cond) - x = torch.cat((x, cond), dim=-1) + x = torch.cat((x, cond), dim = -1) x = self.linear(x) x = self.conv_pos_embed(x) + x return x - + # Transformer backbone using MM-DiT blocks - class MMDiT(nn.Module): - def __init__( - self, - *, - dim, - depth=8, - heads=8, - dim_head=64, - dropout=0.1, - ff_mult=4, - text_num_embeds=256, - mel_dim=100, + def __init__(self, *, + dim, depth = 8, heads = 8, dim_head = 64, dropout = 0.1, ff_mult = 4, + text_num_embeds = 256, mel_dim = 100, ): super().__init__() @@ -96,16 +86,16 @@ class MMDiT(nn.Module): self.dim = dim self.depth = depth - + self.transformer_blocks = nn.ModuleList( [ MMDiTBlock( - dim=dim, - heads=heads, - dim_head=dim_head, - dropout=dropout, - ff_mult=ff_mult, - context_pre_only=i == depth - 1, + dim = dim, + heads = heads, + dim_head = dim_head, + dropout = dropout, + ff_mult = ff_mult, + context_pre_only = i == depth - 1, ) for i in range(depth) ] @@ -115,30 +105,30 @@ class MMDiT(nn.Module): def forward( self, - x: float["b n d"], # nosied input audio # noqa: F722 - cond: float["b n d"], # masked cond audio # noqa: F722 - text: int["b nt"], # text # noqa: F722 - time: float["b"] | float[""], # time step # noqa: F821 F722 + x: float['b n d'], # nosied input audio + cond: float['b n d'], # masked cond audio + text: int['b nt'], # text + time: float['b'] | float[''], # time step drop_audio_cond, # cfg for cond audio - drop_text, # cfg for text - mask: bool["b n"] | None = None, # noqa: F722 + drop_text, # cfg for text + mask: bool['b n'] | None = None, ): batch = x.shape[0] if time.ndim == 0: - time = time.repeat(batch) + time = repeat(time, ' -> b', b = batch) # t: conditioning (time), c: context (text + masked cond audio), x: noised input audio t = self.time_embed(time) - c = self.text_embed(text, drop_text=drop_text) - x = self.audio_embed(x, cond, drop_audio_cond=drop_audio_cond) + c = self.text_embed(text, drop_text = drop_text) + x = self.audio_embed(x, cond, drop_audio_cond = drop_audio_cond) seq_len = x.shape[1] text_len = text.shape[1] rope_audio = self.rotary_embed.forward_from_seq_len(seq_len) rope_text = self.rotary_embed.forward_from_seq_len(text_len) - + for block in self.transformer_blocks: - c, x = block(x, c, t, mask=mask, rope=rope_audio, c_rope=rope_text) + c, x = block(x, c, t, mask = mask, rope = rope_audio, c_rope = rope_text) x = self.norm_out(x, t) output = self.proj_out(x) diff --git a/model/backbones/unett.py b/model/backbones/unett.py index ac1d3d3563fdd95e34f904a3c19fcdca4b1a3efa..b1881bf96462d859e92cd2ab2a7aefb4e364c52e 100644 --- a/model/backbones/unett.py +++ b/model/backbones/unett.py @@ -14,6 +14,8 @@ import torch from torch import nn import torch.nn.functional as F +from einops import repeat, pack, unpack + from x_transformers import RMSNorm from x_transformers.x_transformers import RotaryEmbedding @@ -24,16 +26,14 @@ from model.modules import ( Attention, AttnProcessor, FeedForward, - precompute_freqs_cis, - get_pos_embed_indices, + precompute_freqs_cis, get_pos_embed_indices, ) # Text embedding - class TextEmbedding(nn.Module): - def __init__(self, text_num_embeds, text_dim, conv_layers=0, conv_mult=2): + def __init__(self, text_num_embeds, text_dim, conv_layers = 0, conv_mult = 2): super().__init__() self.text_embed = nn.Embedding(text_num_embeds + 1, text_dim) # use 0 as filler token @@ -41,22 +41,20 @@ class TextEmbedding(nn.Module): self.extra_modeling = True self.precompute_max_pos = 4096 # ~44s of 24khz audio self.register_buffer("freqs_cis", precompute_freqs_cis(text_dim, self.precompute_max_pos), persistent=False) - self.text_blocks = nn.Sequential( - *[ConvNeXtV2Block(text_dim, text_dim * conv_mult) for _ in range(conv_layers)] - ) + self.text_blocks = nn.Sequential(*[ConvNeXtV2Block(text_dim, text_dim * conv_mult) for _ in range(conv_layers)]) else: self.extra_modeling = False - def forward(self, text: int["b nt"], seq_len, drop_text=False): # noqa: F722 + def forward(self, text: int['b nt'], seq_len, drop_text = False): + batch, text_len = text.shape[0], text.shape[1] text = text + 1 # use 0 as filler token. preprocess of batch pad -1, see list_str_to_idx() text = text[:, :seq_len] # curtail if character tokens are more than the mel spec tokens - batch, text_len = text.shape[0], text.shape[1] - text = F.pad(text, (0, seq_len - text_len), value=0) + text = F.pad(text, (0, seq_len - text_len), value = 0) if drop_text: # cfg for text text = torch.zeros_like(text) - text = self.text_embed(text) # b n -> b n d + text = self.text_embed(text) # b n -> b n d # possible extra modeling if self.extra_modeling: @@ -74,40 +72,28 @@ class TextEmbedding(nn.Module): # noised input audio and context mixing embedding - class InputEmbedding(nn.Module): def __init__(self, mel_dim, text_dim, out_dim): super().__init__() self.proj = nn.Linear(mel_dim * 2 + text_dim, out_dim) - self.conv_pos_embed = ConvPositionEmbedding(dim=out_dim) + self.conv_pos_embed = ConvPositionEmbedding(dim = out_dim) - def forward(self, x: float["b n d"], cond: float["b n d"], text_embed: float["b n d"], drop_audio_cond=False): # noqa: F722 + def forward(self, x: float['b n d'], cond: float['b n d'], text_embed: float['b n d'], drop_audio_cond = False): if drop_audio_cond: # cfg for cond audio cond = torch.zeros_like(cond) - x = self.proj(torch.cat((x, cond, text_embed), dim=-1)) + x = self.proj(torch.cat((x, cond, text_embed), dim = -1)) x = self.conv_pos_embed(x) + x return x # Flat UNet Transformer backbone - class UNetT(nn.Module): - def __init__( - self, - *, - dim, - depth=8, - heads=8, - dim_head=64, - dropout=0.1, - ff_mult=4, - mel_dim=100, - text_num_embeds=256, - text_dim=None, - conv_layers=0, - skip_connect_type: Literal["add", "concat", "none"] = "concat", + def __init__(self, *, + dim, depth = 8, heads = 8, dim_head = 64, dropout = 0.1, ff_mult = 4, + mel_dim = 100, text_num_embeds = 256, text_dim = None, conv_layers = 0, + skip_connect_type: Literal['add', 'concat', 'none'] = 'concat', ): super().__init__() assert depth % 2 == 0, "UNet-Transformer's depth should be even." @@ -115,7 +101,7 @@ class UNetT(nn.Module): self.time_embed = TimestepEmbedding(dim) if text_dim is None: text_dim = mel_dim - self.text_embed = TextEmbedding(text_num_embeds, text_dim, conv_layers=conv_layers) + self.text_embed = TextEmbedding(text_num_embeds, text_dim, conv_layers = conv_layers) self.input_embed = InputEmbedding(mel_dim, text_dim, dim) self.rotary_embed = RotaryEmbedding(dim_head) @@ -124,7 +110,7 @@ class UNetT(nn.Module): self.dim = dim self.skip_connect_type = skip_connect_type - needs_skip_proj = skip_connect_type == "concat" + needs_skip_proj = skip_connect_type == 'concat' self.depth = depth self.layers = nn.ModuleList([]) @@ -134,57 +120,53 @@ class UNetT(nn.Module): attn_norm = RMSNorm(dim) attn = Attention( - processor=AttnProcessor(), - dim=dim, - heads=heads, - dim_head=dim_head, - dropout=dropout, - ) + processor = AttnProcessor(), + dim = dim, + heads = heads, + dim_head = dim_head, + dropout = dropout, + ) ff_norm = RMSNorm(dim) - ff = FeedForward(dim=dim, mult=ff_mult, dropout=dropout, approximate="tanh") - - skip_proj = nn.Linear(dim * 2, dim, bias=False) if needs_skip_proj and is_later_half else None - - self.layers.append( - nn.ModuleList( - [ - skip_proj, - attn_norm, - attn, - ff_norm, - ff, - ] - ) - ) + ff = FeedForward(dim = dim, mult = ff_mult, dropout = dropout, approximate = "tanh") + + skip_proj = nn.Linear(dim * 2, dim, bias = False) if needs_skip_proj and is_later_half else None + + self.layers.append(nn.ModuleList([ + skip_proj, + attn_norm, + attn, + ff_norm, + ff, + ])) self.norm_out = RMSNorm(dim) self.proj_out = nn.Linear(dim, mel_dim) def forward( self, - x: float["b n d"], # nosied input audio # noqa: F722 - cond: float["b n d"], # masked cond audio # noqa: F722 - text: int["b nt"], # text # noqa: F722 - time: float["b"] | float[""], # time step # noqa: F821 F722 + x: float['b n d'], # nosied input audio + cond: float['b n d'], # masked cond audio + text: int['b nt'], # text + time: float['b'] | float[''], # time step drop_audio_cond, # cfg for cond audio - drop_text, # cfg for text - mask: bool["b n"] | None = None, # noqa: F722 + drop_text, # cfg for text + mask: bool['b n'] | None = None, ): batch, seq_len = x.shape[0], x.shape[1] if time.ndim == 0: - time = time.repeat(batch) - + time = repeat(time, ' -> b', b = batch) + # t: conditioning time, c: context (text + masked cond audio), x: noised input audio t = self.time_embed(time) - text_embed = self.text_embed(text, seq_len, drop_text=drop_text) - x = self.input_embed(x, cond, text_embed, drop_audio_cond=drop_audio_cond) + text_embed = self.text_embed(text, seq_len, drop_text = drop_text) + x = self.input_embed(x, cond, text_embed, drop_audio_cond = drop_audio_cond) # postfix time t to input x, [b n d] -> [b n+1 d] - x = torch.cat([t.unsqueeze(1), x], dim=1) # pack t to x + x, ps = pack((t, x), 'b * d') if mask is not None: mask = F.pad(mask, (1, 0), value=1) - + rope = self.rotary_embed.forward_from_seq_len(seq_len + 1) # flat unet transformer @@ -202,18 +184,18 @@ class UNetT(nn.Module): if is_later_half: skip = skips.pop() - if skip_connect_type == "concat": - x = torch.cat((x, skip), dim=-1) + if skip_connect_type == 'concat': + x = torch.cat((x, skip), dim = -1) x = maybe_skip_proj(x) - elif skip_connect_type == "add": + elif skip_connect_type == 'add': x = x + skip # attention and feedforward blocks - x = attn(attn_norm(x), rope=rope, mask=mask) + x + x = attn(attn_norm(x), rope = rope, mask = mask) + x x = ff(ff_norm(x)) + x assert len(skips) == 0 - x = self.norm_out(x)[:, 1:, :] # unpack t from x + _, x = unpack(self.norm_out(x), ps, 'b * d') return self.proj_out(x) diff --git a/model/cfm.py b/model/cfm.py index e2d7f726ff6bc2ec06f371c84b82376955d3709f..70a38a7d9abd8984b1cad63d37e149174eed07fe 100644 --- a/model/cfm.py +++ b/model/cfm.py @@ -18,34 +18,34 @@ from torch.nn.utils.rnn import pad_sequence from torchdiffeq import odeint +from einops import rearrange + from model.modules import MelSpec + from model.utils import ( - default, - exists, - list_str_to_idx, - list_str_to_tensor, - lens_to_mask, - mask_from_frac_lengths, -) + default, exists, + list_str_to_idx, list_str_to_tensor, + lens_to_mask, mask_from_frac_lengths, +) class CFM(nn.Module): def __init__( self, transformer: nn.Module, - sigma=0.0, + sigma = 0., odeint_kwargs: dict = dict( # atol = 1e-5, # rtol = 1e-5, - method="euler" # 'midpoint' + method = 'euler' # 'midpoint' ), - audio_drop_prob=0.3, - cond_drop_prob=0.2, - num_channels=None, + audio_drop_prob = 0.3, + cond_drop_prob = 0.2, + num_channels = None, mel_spec_module: nn.Module | None = None, mel_spec_kwargs: dict = dict(), - frac_lengths_mask: tuple[float, float] = (0.7, 1.0), - vocab_char_map: dict[str:int] | None = None, + frac_lengths_mask: tuple[float, float] = (0.7, 1.), + vocab_char_map: dict[str: int] | None = None ): super().__init__() @@ -81,37 +81,34 @@ class CFM(nn.Module): @torch.no_grad() def sample( self, - cond: float["b n d"] | float["b nw"], # noqa: F722 - text: int["b nt"] | list[str], # noqa: F722 - duration: int | int["b"], # noqa: F821 + cond: float['b n d'] | float['b nw'], + text: int['b nt'] | list[str], + duration: int | int['b'], *, - lens: int["b"] | None = None, # noqa: F821 - steps=32, - cfg_strength=1.0, - sway_sampling_coef=None, + lens: int['b'] | None = None, + steps = 32, + cfg_strength = 1., + sway_sampling_coef = None, seed: int | None = None, - max_duration=4096, - vocoder: Callable[[float["b d n"]], float["b nw"]] | None = None, # noqa: F722 - no_ref_audio=False, - duplicate_test=False, - t_inter=0.1, - edit_mask=None, + max_duration = 4096, + vocoder: Callable[[float['b d n']], float['b nw']] | None = None, + no_ref_audio = False, + duplicate_test = False, + t_inter = 0.1, + edit_mask = None, ): self.eval() - if next(self.parameters()).dtype == torch.float16: - cond = cond.half() - # raw wave if cond.ndim == 2: cond = self.mel_spec(cond) - cond = cond.permute(0, 2, 1) + cond = rearrange(cond, 'b d n -> b n d') assert cond.shape[-1] == self.num_channels batch, cond_seq_len, device = *cond.shape[:2], cond.device if not exists(lens): - lens = torch.full((batch,), cond_seq_len, device=device, dtype=torch.long) + lens = torch.full((batch,), cond_seq_len, device = device, dtype = torch.long) # text @@ -123,8 +120,8 @@ class CFM(nn.Module): assert text.shape[0] == batch if exists(text): - text_lens = (text != -1).sum(dim=-1) - lens = torch.maximum(text_lens, lens) # make sure lengths are at least those of the text characters + text_lens = (text != -1).sum(dim = -1) + lens = torch.maximum(text_lens, lens) # make sure lengths are at least those of the text characters # duration @@ -133,22 +130,20 @@ class CFM(nn.Module): cond_mask = cond_mask & edit_mask if isinstance(duration, int): - duration = torch.full((batch,), duration, device=device, dtype=torch.long) + duration = torch.full((batch,), duration, device = device, dtype = torch.long) - duration = torch.maximum(lens + 1, duration) # just add one token so something is generated - duration = duration.clamp(max=max_duration) + duration = torch.maximum(lens + 1, duration) # just add one token so something is generated + duration = duration.clamp(max = max_duration) max_duration = duration.amax() - + # duplicate test corner for inner time step oberservation if duplicate_test: - test_cond = F.pad(cond, (0, 0, cond_seq_len, max_duration - 2 * cond_seq_len), value=0.0) - - cond = F.pad(cond, (0, 0, 0, max_duration - cond_seq_len), value=0.0) - cond_mask = F.pad(cond_mask, (0, max_duration - cond_mask.shape[-1]), value=False) - cond_mask = cond_mask.unsqueeze(-1) - step_cond = torch.where( - cond_mask, cond, torch.zeros_like(cond) - ) # allow direct control (cut cond audio) with lens passed in + test_cond = F.pad(cond, (0, 0, cond_seq_len, max_duration - 2*cond_seq_len), value = 0.) + + cond = F.pad(cond, (0, 0, 0, max_duration - cond_seq_len), value = 0.) + cond_mask = F.pad(cond_mask, (0, max_duration - cond_mask.shape[-1]), value = False) + cond_mask = rearrange(cond_mask, '... -> ... 1') + step_cond = torch.where(cond_mask, cond, torch.zeros_like(cond)) # allow direct control (cut cond audio) with lens passed in if batch > 1: mask = lens_to_mask(duration) @@ -166,15 +161,11 @@ class CFM(nn.Module): # step_cond = torch.where(cond_mask, cond, torch.zeros_like(cond)) # predict flow - pred = self.transformer( - x=x, cond=step_cond, text=text, time=t, mask=mask, drop_audio_cond=False, drop_text=False - ) + pred = self.transformer(x = x, cond = step_cond, text = text, time = t, mask = mask, drop_audio_cond = False, drop_text = False) if cfg_strength < 1e-5: return pred - - null_pred = self.transformer( - x=x, cond=step_cond, text=text, time=t, mask=mask, drop_audio_cond=True, drop_text=True - ) + + null_pred = self.transformer(x = x, cond = step_cond, text = text, time = t, mask = mask, drop_audio_cond = True, drop_text = True) return pred + (pred - null_pred) * cfg_strength # noise input @@ -184,8 +175,8 @@ class CFM(nn.Module): for dur in duration: if exists(seed): torch.manual_seed(seed) - y0.append(torch.randn(dur, self.num_channels, device=self.device, dtype=step_cond.dtype)) - y0 = pad_sequence(y0, padding_value=0, batch_first=True) + y0.append(torch.randn(dur, self.num_channels, device = self.device)) + y0 = pad_sequence(y0, padding_value = 0, batch_first = True) t_start = 0 @@ -195,37 +186,37 @@ class CFM(nn.Module): y0 = (1 - t_start) * y0 + t_start * test_cond steps = int(steps * (1 - t_start)) - t = torch.linspace(t_start, 1, steps, device=self.device, dtype=step_cond.dtype) + t = torch.linspace(t_start, 1, steps, device = self.device) if sway_sampling_coef is not None: t = t + sway_sampling_coef * (torch.cos(torch.pi / 2 * t) - 1 + t) trajectory = odeint(fn, y0, t, **self.odeint_kwargs) - + sampled = trajectory[-1] out = sampled out = torch.where(cond_mask, cond, out) if exists(vocoder): - out = out.permute(0, 2, 1) + out = rearrange(out, 'b n d -> b d n') out = vocoder(out) return out, trajectory def forward( self, - inp: float["b n d"] | float["b nw"], # mel or raw wave # noqa: F722 - text: int["b nt"] | list[str], # noqa: F722 + inp: float['b n d'] | float['b nw'], # mel or raw wave + text: int['b nt'] | list[str], *, - lens: int["b"] | None = None, # noqa: F821 + lens: int['b'] | None = None, noise_scheduler: str | None = None, ): # handle raw wave if inp.ndim == 2: inp = self.mel_spec(inp) - inp = inp.permute(0, 2, 1) + inp = rearrange(inp, 'b d n -> b n d') assert inp.shape[-1] == self.num_channels - batch, seq_len, dtype, device, _σ1 = *inp.shape[:2], inp.dtype, self.device, self.sigma + batch, seq_len, dtype, device, σ1 = *inp.shape[:2], inp.dtype, self.device, self.sigma # handle text as string if isinstance(text, list): @@ -237,12 +228,12 @@ class CFM(nn.Module): # lens and mask if not exists(lens): - lens = torch.full((batch,), seq_len, device=device) - - mask = lens_to_mask(lens, length=seq_len) # useless here, as collate_fn will pad to max length in batch + lens = torch.full((batch,), seq_len, device = device) + + mask = lens_to_mask(lens, length = seq_len) # useless here, as collate_fn will pad to max length in batch # get a random span to mask out for training conditionally - frac_lengths = torch.zeros((batch,), device=self.device).float().uniform_(*self.frac_lengths_mask) + frac_lengths = torch.zeros((batch,), device = self.device).float().uniform_(*self.frac_lengths_mask) rand_span_mask = mask_from_frac_lengths(lens, frac_lengths) if exists(mask): @@ -255,16 +246,19 @@ class CFM(nn.Module): x0 = torch.randn_like(x1) # time step - time = torch.rand((batch,), dtype=dtype, device=self.device) + time = torch.rand((batch,), dtype = dtype, device = self.device) # TODO. noise_scheduler # sample xt (φ_t(x) in the paper) - t = time.unsqueeze(-1).unsqueeze(-1) + t = rearrange(time, 'b -> b 1 1') φ = (1 - t) * x0 + t * x1 flow = x1 - x0 # only predict what is within the random mask span for infilling - cond = torch.where(rand_span_mask[..., None], torch.zeros_like(x1), x1) + cond = torch.where( + rand_span_mask[..., None], + torch.zeros_like(x1), x1 + ) # transformer and cfg training with a drop rate drop_audio_cond = random() < self.audio_drop_prob # p_drop in voicebox paper @@ -273,15 +267,13 @@ class CFM(nn.Module): drop_text = True else: drop_text = False - + # if want rigourously mask out padding, record in collate_fn in dataset.py, and pass in here # adding mask will use more memory, thus also need to adjust batchsampler with scaled down threshold for long sequences - pred = self.transformer( - x=φ, cond=cond, text=text, time=time, drop_audio_cond=drop_audio_cond, drop_text=drop_text - ) + pred = self.transformer(x = φ, cond = cond, text = text, time = time, drop_audio_cond = drop_audio_cond, drop_text = drop_text) # flow matching loss - loss = F.mse_loss(pred, flow, reduction="none") + loss = F.mse_loss(pred, flow, reduction = 'none') loss = loss[rand_span_mask] return loss.mean(), cond, pred diff --git a/model/dataset.py b/model/dataset.py index c293fe23a55e712e7ac1a89fc4bcfcfc54faafa7..a7369c3c1fd8ca11a11ceaf3bb5799746b5c15ed 100644 --- a/model/dataset.py +++ b/model/dataset.py @@ -6,67 +6,65 @@ import torch import torch.nn.functional as F from torch.utils.data import Dataset, Sampler import torchaudio -from datasets import load_from_disk +from datasets import load_dataset, load_from_disk from datasets import Dataset as Dataset_ -from torch import nn + +from einops import rearrange from model.modules import MelSpec -from model.utils import default class HFDataset(Dataset): def __init__( self, hf_dataset: Dataset, - target_sample_rate=24_000, - n_mel_channels=100, - hop_length=256, + target_sample_rate = 24_000, + n_mel_channels = 100, + hop_length = 256, ): self.data = hf_dataset self.target_sample_rate = target_sample_rate self.hop_length = hop_length - self.mel_spectrogram = MelSpec( - target_sample_rate=target_sample_rate, n_mel_channels=n_mel_channels, hop_length=hop_length - ) - + self.mel_spectrogram = MelSpec(target_sample_rate=target_sample_rate, n_mel_channels=n_mel_channels, hop_length=hop_length) + def get_frame_len(self, index): row = self.data[index] - audio = row["audio"]["array"] - sample_rate = row["audio"]["sampling_rate"] + audio = row['audio']['array'] + sample_rate = row['audio']['sampling_rate'] return audio.shape[-1] / sample_rate * self.target_sample_rate / self.hop_length def __len__(self): return len(self.data) - + def __getitem__(self, index): row = self.data[index] - audio = row["audio"]["array"] + audio = row['audio']['array'] # logger.info(f"Audio shape: {audio.shape}") - sample_rate = row["audio"]["sampling_rate"] + sample_rate = row['audio']['sampling_rate'] duration = audio.shape[-1] / sample_rate if duration > 30 or duration < 0.3: return self.__getitem__((index + 1) % len(self.data)) - + audio_tensor = torch.from_numpy(audio).float() - + if sample_rate != self.target_sample_rate: resampler = torchaudio.transforms.Resample(sample_rate, self.target_sample_rate) audio_tensor = resampler(audio_tensor) - - audio_tensor = audio_tensor.unsqueeze(0) # 't -> 1 t') - + + audio_tensor = rearrange(audio_tensor, 't -> 1 t') + mel_spec = self.mel_spectrogram(audio_tensor) - - mel_spec = mel_spec.squeeze(0) # '1 d t -> d t' - - text = row["text"] - + + mel_spec = rearrange(mel_spec, '1 d t -> d t') + + text = row['text'] + return dict( - mel_spec=mel_spec, - text=text, + mel_spec = mel_spec, + text = text, ) @@ -74,39 +72,28 @@ class CustomDataset(Dataset): def __init__( self, custom_dataset: Dataset, - durations=None, - target_sample_rate=24_000, - hop_length=256, - n_mel_channels=100, - preprocessed_mel=False, - mel_spec_module: nn.Module | None = None, + durations = None, + target_sample_rate = 24_000, + hop_length = 256, + n_mel_channels = 100, + preprocessed_mel = False, ): self.data = custom_dataset self.durations = durations self.target_sample_rate = target_sample_rate self.hop_length = hop_length self.preprocessed_mel = preprocessed_mel - if not preprocessed_mel: - self.mel_spectrogram = default( - mel_spec_module, - MelSpec( - target_sample_rate=target_sample_rate, - hop_length=hop_length, - n_mel_channels=n_mel_channels, - ), - ) + self.mel_spectrogram = MelSpec(target_sample_rate=target_sample_rate, hop_length=hop_length, n_mel_channels=n_mel_channels) def get_frame_len(self, index): - if ( - self.durations is not None - ): # Please make sure the separately provided durations are correct, otherwise 99.99% OOM + if self.durations is not None: # Please make sure the separately provided durations are correct, otherwise 99.99% OOM return self.durations[index] * self.target_sample_rate / self.hop_length return self.data[index]["duration"] * self.target_sample_rate / self.hop_length - + def __len__(self): return len(self.data) - + def __getitem__(self, index): row = self.data[index] audio_path = row["audio_path"] @@ -118,57 +105,48 @@ class CustomDataset(Dataset): else: audio, source_sample_rate = torchaudio.load(audio_path) - if audio.shape[0] > 1: - audio = torch.mean(audio, dim=0, keepdim=True) if duration > 30 or duration < 0.3: return self.__getitem__((index + 1) % len(self.data)) - + if source_sample_rate != self.target_sample_rate: resampler = torchaudio.transforms.Resample(source_sample_rate, self.target_sample_rate) audio = resampler(audio) - + mel_spec = self.mel_spectrogram(audio) - mel_spec = mel_spec.squeeze(0) # '1 d t -> d t') - + mel_spec = rearrange(mel_spec, '1 d t -> d t') + return dict( - mel_spec=mel_spec, - text=text, + mel_spec = mel_spec, + text = text, ) - + # Dynamic Batch Sampler - class DynamicBatchSampler(Sampler[list[int]]): - """Extension of Sampler that will do the following: - 1. Change the batch size (essentially number of sequences) - in a batch to ensure that the total number of frames are less - than a certain threshold. - 2. Make sure the padding efficiency in the batch is high. + """ Extension of Sampler that will do the following: + 1. Change the batch size (essentially number of sequences) + in a batch to ensure that the total number of frames are less + than a certain threshold. + 2. Make sure the padding efficiency in the batch is high. """ - def __init__( - self, sampler: Sampler[int], frames_threshold: int, max_samples=0, random_seed=None, drop_last: bool = False - ): + def __init__(self, sampler: Sampler[int], frames_threshold: int, max_samples=0, random_seed=None, drop_last: bool = False): self.sampler = sampler self.frames_threshold = frames_threshold self.max_samples = max_samples indices, batches = [], [] data_source = self.sampler.data_source - - for idx in tqdm( - self.sampler, desc="Sorting with sampler... if slow, check whether dataset is provided with duration" - ): + + for idx in tqdm(self.sampler, desc=f"Sorting with sampler... if slow, check whether dataset is provided with duration"): indices.append((idx, data_source.get_frame_len(idx))) - indices.sort(key=lambda elem: elem[1]) + indices.sort(key=lambda elem : elem[1]) batch = [] batch_frames = 0 - for idx, frame_len in tqdm( - indices, desc=f"Creating dynamic batches with {frames_threshold} audio frames per gpu" - ): + for idx, frame_len in tqdm(indices, desc=f"Creating dynamic batches with {frames_threshold} audio frames per gpu"): if batch_frames + frame_len <= self.frames_threshold and (max_samples == 0 or len(batch) < max_samples): batch.append(idx) batch_frames += frame_len @@ -204,91 +182,76 @@ class DynamicBatchSampler(Sampler[list[int]]): # Load dataset - def load_dataset( - dataset_name: str, - tokenizer: str = "pinyin", - dataset_type: str = "CustomDataset", - audio_type: str = "raw", - mel_spec_module: nn.Module | None = None, - mel_spec_kwargs: dict = dict(), -) -> CustomDataset | HFDataset: - """ + dataset_name: str, + tokenizer: str = "pinyin", + dataset_type: str = "CustomDataset", + audio_type: str = "raw", + mel_spec_kwargs: dict = dict() + ) -> CustomDataset | HFDataset: + ''' dataset_type - "CustomDataset" if you want to use tokenizer name and default data path to load for train_dataset - "CustomDatasetPath" if you just want to pass the full path to a preprocessed dataset without relying on tokenizer - """ - + ''' + print("Loading dataset ...") if dataset_type == "CustomDataset": if audio_type == "raw": try: train_dataset = load_from_disk(f"data/{dataset_name}_{tokenizer}/raw") - except: # noqa: E722 + except: train_dataset = Dataset_.from_file(f"data/{dataset_name}_{tokenizer}/raw.arrow") preprocessed_mel = False elif audio_type == "mel": train_dataset = Dataset_.from_file(f"data/{dataset_name}_{tokenizer}/mel.arrow") preprocessed_mel = True - with open(f"data/{dataset_name}_{tokenizer}/duration.json", "r", encoding="utf-8") as f: + with open(f"data/{dataset_name}_{tokenizer}/duration.json", 'r', encoding='utf-8') as f: data_dict = json.load(f) durations = data_dict["duration"] - train_dataset = CustomDataset( - train_dataset, - durations=durations, - preprocessed_mel=preprocessed_mel, - mel_spec_module=mel_spec_module, - **mel_spec_kwargs, - ) - + train_dataset = CustomDataset(train_dataset, durations=durations, preprocessed_mel=preprocessed_mel, **mel_spec_kwargs) + elif dataset_type == "CustomDatasetPath": try: train_dataset = load_from_disk(f"{dataset_name}/raw") - except: # noqa: E722 + except: train_dataset = Dataset_.from_file(f"{dataset_name}/raw.arrow") - - with open(f"{dataset_name}/duration.json", "r", encoding="utf-8") as f: + + with open(f"{dataset_name}/duration.json", 'r', encoding='utf-8') as f: data_dict = json.load(f) durations = data_dict["duration"] - train_dataset = CustomDataset( - train_dataset, durations=durations, preprocessed_mel=preprocessed_mel, **mel_spec_kwargs - ) - + train_dataset = CustomDataset(train_dataset, durations=durations, preprocessed_mel=preprocessed_mel, **mel_spec_kwargs) + elif dataset_type == "HFDataset": - print( - "Should manually modify the path of huggingface dataset to your need.\n" - + "May also the corresponding script cuz different dataset may have different format." - ) + print("Should manually modify the path of huggingface dataset to your need.\n" + + "May also the corresponding script cuz different dataset may have different format.") pre, post = dataset_name.split("_") - train_dataset = HFDataset( - load_dataset(f"{pre}/{pre}", split=f"train.{post}", cache_dir="./data"), - ) + train_dataset = HFDataset(load_dataset(f"{pre}/{pre}", split=f"train.{post}", cache_dir="./data"),) return train_dataset # collation - def collate_fn(batch): - mel_specs = [item["mel_spec"].squeeze(0) for item in batch] + mel_specs = [item['mel_spec'].squeeze(0) for item in batch] mel_lengths = torch.LongTensor([spec.shape[-1] for spec in mel_specs]) max_mel_length = mel_lengths.amax() padded_mel_specs = [] for spec in mel_specs: # TODO. maybe records mask for attention here padding = (0, max_mel_length - spec.size(-1)) - padded_spec = F.pad(spec, padding, value=0) + padded_spec = F.pad(spec, padding, value = 0) padded_mel_specs.append(padded_spec) - + mel_specs = torch.stack(padded_mel_specs) - text = [item["text"] for item in batch] + text = [item['text'] for item in batch] text_lengths = torch.LongTensor([len(item) for item in text]) return dict( - mel=mel_specs, - mel_lengths=mel_lengths, - text=text, - text_lengths=text_lengths, + mel = mel_specs, + mel_lengths = mel_lengths, + text = text, + text_lengths = text_lengths, ) diff --git a/model/ecapa_tdnn.py b/model/ecapa_tdnn.py index 6bc431eb9e2fc6173e6009ef3b0326a40618b1ec..30b611eda2dd8dc8fed4f59997e976181c07f78e 100644 --- a/model/ecapa_tdnn.py +++ b/model/ecapa_tdnn.py @@ -9,14 +9,13 @@ import torch.nn as nn import torch.nn.functional as F -""" Res2Conv1d + BatchNorm1d + ReLU -""" - +''' Res2Conv1d + BatchNorm1d + ReLU +''' class Res2Conv1dReluBn(nn.Module): - """ + ''' in_channels == out_channels == channels - """ + ''' def __init__(self, channels, kernel_size=1, stride=1, padding=0, dilation=1, bias=True, scale=4): super().__init__() @@ -52,9 +51,8 @@ class Res2Conv1dReluBn(nn.Module): return out -""" Conv1d + BatchNorm1d + ReLU -""" - +''' Conv1d + BatchNorm1d + ReLU +''' class Conv1dReluBn(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding=0, dilation=1, bias=True): @@ -66,9 +64,8 @@ class Conv1dReluBn(nn.Module): return self.bn(F.relu(self.conv(x))) -""" The SE connection of 1D case. -""" - +''' The SE connection of 1D case. +''' class SE_Connect(nn.Module): def __init__(self, channels, se_bottleneck_dim=128): @@ -85,8 +82,8 @@ class SE_Connect(nn.Module): return out -""" SE-Res2Block of the ECAPA-TDNN architecture. -""" +''' SE-Res2Block of the ECAPA-TDNN architecture. +''' # def SE_Res2Block(channels, kernel_size, stride, padding, dilation, scale): # return nn.Sequential( @@ -96,7 +93,6 @@ class SE_Connect(nn.Module): # SE_Connect(channels) # ) - class SE_Res2Block(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride, padding, dilation, scale, se_bottleneck_dim): super().__init__() @@ -126,9 +122,8 @@ class SE_Res2Block(nn.Module): return x + residual -""" Attentive weighted mean and standard deviation pooling. -""" - +''' Attentive weighted mean and standard deviation pooling. +''' class AttentiveStatsPool(nn.Module): def __init__(self, in_dim, attention_channels=128, global_context_att=False): @@ -143,6 +138,7 @@ class AttentiveStatsPool(nn.Module): self.linear2 = nn.Conv1d(attention_channels, in_dim, kernel_size=1) # equals V and k in the paper def forward(self, x): + if self.global_context_att: context_mean = torch.mean(x, dim=-1, keepdim=True).expand_as(x) context_std = torch.sqrt(torch.var(x, dim=-1, keepdim=True) + 1e-10).expand_as(x) @@ -155,52 +151,38 @@ class AttentiveStatsPool(nn.Module): # alpha = F.relu(self.linear1(x_in)) alpha = torch.softmax(self.linear2(alpha), dim=2) mean = torch.sum(alpha * x, dim=2) - residuals = torch.sum(alpha * (x**2), dim=2) - mean**2 + residuals = torch.sum(alpha * (x ** 2), dim=2) - mean ** 2 std = torch.sqrt(residuals.clamp(min=1e-9)) return torch.cat([mean, std], dim=1) class ECAPA_TDNN(nn.Module): - def __init__( - self, - feat_dim=80, - channels=512, - emb_dim=192, - global_context_att=False, - feat_type="wavlm_large", - sr=16000, - feature_selection="hidden_states", - update_extract=False, - config_path=None, - ): + def __init__(self, feat_dim=80, channels=512, emb_dim=192, global_context_att=False, + feat_type='wavlm_large', sr=16000, feature_selection="hidden_states", update_extract=False, config_path=None): super().__init__() self.feat_type = feat_type self.feature_selection = feature_selection self.update_extract = update_extract self.sr = sr - - torch.hub._validate_not_a_forked_repo = lambda a, b, c: True + + torch.hub._validate_not_a_forked_repo=lambda a,b,c: True try: local_s3prl_path = os.path.expanduser("~/.cache/torch/hub/s3prl_s3prl_main") - self.feature_extract = torch.hub.load(local_s3prl_path, feat_type, source="local", config_path=config_path) - except: # noqa: E722 - self.feature_extract = torch.hub.load("s3prl/s3prl", feat_type) + self.feature_extract = torch.hub.load(local_s3prl_path, feat_type, source='local', config_path=config_path) + except: + self.feature_extract = torch.hub.load('s3prl/s3prl', feat_type) - if len(self.feature_extract.model.encoder.layers) == 24 and hasattr( - self.feature_extract.model.encoder.layers[23].self_attn, "fp32_attention" - ): + if len(self.feature_extract.model.encoder.layers) == 24 and hasattr(self.feature_extract.model.encoder.layers[23].self_attn, "fp32_attention"): self.feature_extract.model.encoder.layers[23].self_attn.fp32_attention = False - if len(self.feature_extract.model.encoder.layers) == 24 and hasattr( - self.feature_extract.model.encoder.layers[11].self_attn, "fp32_attention" - ): + if len(self.feature_extract.model.encoder.layers) == 24 and hasattr(self.feature_extract.model.encoder.layers[11].self_attn, "fp32_attention"): self.feature_extract.model.encoder.layers[11].self_attn.fp32_attention = False self.feat_num = self.get_feat_num() self.feature_weight = nn.Parameter(torch.zeros(self.feat_num)) - if feat_type != "fbank" and feat_type != "mfcc": - freeze_list = ["final_proj", "label_embs_concat", "mask_emb", "project_q", "quantizer"] + if feat_type != 'fbank' and feat_type != 'mfcc': + freeze_list = ['final_proj', 'label_embs_concat', 'mask_emb', 'project_q', 'quantizer'] for name, param in self.feature_extract.named_parameters(): for freeze_val in freeze_list: if freeze_val in name: @@ -216,46 +198,18 @@ class ECAPA_TDNN(nn.Module): self.channels = [channels] * 4 + [1536] self.layer1 = Conv1dReluBn(feat_dim, self.channels[0], kernel_size=5, padding=2) - self.layer2 = SE_Res2Block( - self.channels[0], - self.channels[1], - kernel_size=3, - stride=1, - padding=2, - dilation=2, - scale=8, - se_bottleneck_dim=128, - ) - self.layer3 = SE_Res2Block( - self.channels[1], - self.channels[2], - kernel_size=3, - stride=1, - padding=3, - dilation=3, - scale=8, - se_bottleneck_dim=128, - ) - self.layer4 = SE_Res2Block( - self.channels[2], - self.channels[3], - kernel_size=3, - stride=1, - padding=4, - dilation=4, - scale=8, - se_bottleneck_dim=128, - ) + self.layer2 = SE_Res2Block(self.channels[0], self.channels[1], kernel_size=3, stride=1, padding=2, dilation=2, scale=8, se_bottleneck_dim=128) + self.layer3 = SE_Res2Block(self.channels[1], self.channels[2], kernel_size=3, stride=1, padding=3, dilation=3, scale=8, se_bottleneck_dim=128) + self.layer4 = SE_Res2Block(self.channels[2], self.channels[3], kernel_size=3, stride=1, padding=4, dilation=4, scale=8, se_bottleneck_dim=128) # self.conv = nn.Conv1d(self.channels[-1], self.channels[-1], kernel_size=1) cat_channels = channels * 3 self.conv = nn.Conv1d(cat_channels, self.channels[-1], kernel_size=1) - self.pooling = AttentiveStatsPool( - self.channels[-1], attention_channels=128, global_context_att=global_context_att - ) + self.pooling = AttentiveStatsPool(self.channels[-1], attention_channels=128, global_context_att=global_context_att) self.bn = nn.BatchNorm1d(self.channels[-1] * 2) self.linear = nn.Linear(self.channels[-1] * 2, emb_dim) + def get_feat_num(self): self.feature_extract.eval() wav = [torch.randn(self.sr).to(next(self.feature_extract.parameters()).device)] @@ -272,12 +226,12 @@ class ECAPA_TDNN(nn.Module): x = self.feature_extract([sample for sample in x]) else: with torch.no_grad(): - if self.feat_type == "fbank" or self.feat_type == "mfcc": + if self.feat_type == 'fbank' or self.feat_type == 'mfcc': x = self.feature_extract(x) + 1e-6 # B x feat_dim x time_len else: x = self.feature_extract([sample for sample in x]) - if self.feat_type == "fbank": + if self.feat_type == 'fbank': x = x.log() if self.feat_type != "fbank" and self.feat_type != "mfcc": @@ -309,22 +263,6 @@ class ECAPA_TDNN(nn.Module): return out -def ECAPA_TDNN_SMALL( - feat_dim, - emb_dim=256, - feat_type="wavlm_large", - sr=16000, - feature_selection="hidden_states", - update_extract=False, - config_path=None, -): - return ECAPA_TDNN( - feat_dim=feat_dim, - channels=512, - emb_dim=emb_dim, - feat_type=feat_type, - sr=sr, - feature_selection=feature_selection, - update_extract=update_extract, - config_path=config_path, - ) +def ECAPA_TDNN_SMALL(feat_dim, emb_dim=256, feat_type='wavlm_large', sr=16000, feature_selection="hidden_states", update_extract=False, config_path=None): + return ECAPA_TDNN(feat_dim=feat_dim, channels=512, emb_dim=emb_dim, + feat_type=feat_type, sr=sr, feature_selection=feature_selection, update_extract=update_extract, config_path=config_path) diff --git a/model/modules.py b/model/modules.py index c026eff106bb58db9ca5106d4bcc88346609af03..fa2e3b1d274046fd8520fd188be36b92c9fad883 100644 --- a/model/modules.py +++ b/model/modules.py @@ -16,45 +16,45 @@ from torch import nn import torch.nn.functional as F import torchaudio +from einops import rearrange from x_transformers.x_transformers import apply_rotary_pos_emb # raw wav to mel spec - class MelSpec(nn.Module): def __init__( self, - filter_length=1024, - hop_length=256, - win_length=1024, - n_mel_channels=100, - target_sample_rate=24_000, - normalize=False, - power=1, - norm=None, - center=True, + filter_length = 1024, + hop_length = 256, + win_length = 1024, + n_mel_channels = 100, + target_sample_rate = 24_000, + normalize = False, + power = 1, + norm = None, + center = True, ): super().__init__() self.n_mel_channels = n_mel_channels self.mel_stft = torchaudio.transforms.MelSpectrogram( - sample_rate=target_sample_rate, - n_fft=filter_length, - win_length=win_length, - hop_length=hop_length, - n_mels=n_mel_channels, - power=power, - center=center, - normalized=normalize, - norm=norm, + sample_rate = target_sample_rate, + n_fft = filter_length, + win_length = win_length, + hop_length = hop_length, + n_mels = n_mel_channels, + power = power, + center = center, + normalized = normalize, + norm = norm, ) - self.register_buffer("dummy", torch.tensor(0), persistent=False) + self.register_buffer('dummy', torch.tensor(0), persistent = False) def forward(self, inp): if len(inp.shape) == 3: - inp = inp.squeeze(1) # 'b 1 nw -> b nw' + inp = rearrange(inp, 'b 1 nw -> b nw') assert len(inp.shape) == 2 @@ -62,13 +62,12 @@ class MelSpec(nn.Module): self.to(inp.device) mel = self.mel_stft(inp) - mel = mel.clamp(min=1e-5).log() + mel = mel.clamp(min = 1e-5).log() return mel - + # sinusoidal position embedding - class SinusPositionEmbedding(nn.Module): def __init__(self, dim): super().__init__() @@ -86,37 +85,35 @@ class SinusPositionEmbedding(nn.Module): # convolutional position embedding - class ConvPositionEmbedding(nn.Module): - def __init__(self, dim, kernel_size=31, groups=16): + def __init__(self, dim, kernel_size = 31, groups = 16): super().__init__() assert kernel_size % 2 != 0 self.conv1d = nn.Sequential( - nn.Conv1d(dim, dim, kernel_size, groups=groups, padding=kernel_size // 2), + nn.Conv1d(dim, dim, kernel_size, groups = groups, padding = kernel_size // 2), nn.Mish(), - nn.Conv1d(dim, dim, kernel_size, groups=groups, padding=kernel_size // 2), + nn.Conv1d(dim, dim, kernel_size, groups = groups, padding = kernel_size // 2), nn.Mish(), ) - def forward(self, x: float["b n d"], mask: bool["b n"] | None = None): # noqa: F722 + def forward(self, x: float['b n d'], mask: bool['b n'] | None = None): if mask is not None: mask = mask[..., None] - x = x.masked_fill(~mask, 0.0) + x = x.masked_fill(~mask, 0.) - x = x.permute(0, 2, 1) + x = rearrange(x, 'b n d -> b d n') x = self.conv1d(x) - out = x.permute(0, 2, 1) + out = rearrange(x, 'b d n -> b n d') if mask is not None: - out = out.masked_fill(~mask, 0.0) + out = out.masked_fill(~mask, 0.) return out # rotary positional embedding related - -def precompute_freqs_cis(dim: int, end: int, theta: float = 10000.0, theta_rescale_factor=1.0): +def precompute_freqs_cis(dim: int, end: int, theta: float = 10000.0, theta_rescale_factor=1.): # proposed by reddit user bloc97, to rescale rotary embeddings to longer sequence length without fine-tuning # has some connection to NTK literature # https://www.reddit.com/r/LocalLLaMA/comments/14lz7j5/ntkaware_scaled_rope_allows_llama_models_to_have/ @@ -129,14 +126,12 @@ def precompute_freqs_cis(dim: int, end: int, theta: float = 10000.0, theta_resca freqs_sin = torch.sin(freqs) # imaginary part return torch.cat([freqs_cos, freqs_sin], dim=-1) - -def get_pos_embed_indices(start, length, max_pos, scale=1.0): +def get_pos_embed_indices(start, length, max_pos, scale=1.): # length = length if isinstance(length, int) else length.max() scale = scale * torch.ones_like(start, dtype=torch.float32) # in case scale is a scalar - pos = ( - start.unsqueeze(1) - + (torch.arange(length, device=start.device, dtype=torch.float32).unsqueeze(0) * scale.unsqueeze(1)).long() - ) + pos = start.unsqueeze(1) + ( + torch.arange(length, device=start.device, dtype=torch.float32).unsqueeze(0) * + scale.unsqueeze(1)).long() # avoid extra long error. pos = torch.where(pos < max_pos, pos, max_pos - 1) return pos @@ -144,7 +139,6 @@ def get_pos_embed_indices(start, length, max_pos, scale=1.0): # Global Response Normalization layer (Instance Normalization ?) - class GRN(nn.Module): def __init__(self, dim): super().__init__() @@ -160,7 +154,6 @@ class GRN(nn.Module): # ConvNeXt-V2 Block https://github.com/facebookresearch/ConvNeXt-V2/blob/main/models/convnextv2.py # ref: https://github.com/bfs18/e2_tts/blob/main/rfwave/modules.py#L108 - class ConvNeXtV2Block(nn.Module): def __init__( self, @@ -170,9 +163,7 @@ class ConvNeXtV2Block(nn.Module): ): super().__init__() padding = (dilation * (7 - 1)) // 2 - self.dwconv = nn.Conv1d( - dim, dim, kernel_size=7, padding=padding, groups=dim, dilation=dilation - ) # depthwise conv + self.dwconv = nn.Conv1d(dim, dim, kernel_size=7, padding=padding, groups=dim, dilation=dilation) # depthwise conv self.norm = nn.LayerNorm(dim, eps=1e-6) self.pwconv1 = nn.Linear(dim, intermediate_dim) # pointwise/1x1 convs, implemented with linear layers self.act = nn.GELU() @@ -195,7 +186,6 @@ class ConvNeXtV2Block(nn.Module): # AdaLayerNormZero # return with modulated x for attn input, and params for later mlp modulation - class AdaLayerNormZero(nn.Module): def __init__(self, dim): super().__init__() @@ -205,7 +195,7 @@ class AdaLayerNormZero(nn.Module): self.norm = nn.LayerNorm(dim, elementwise_affine=False, eps=1e-6) - def forward(self, x, emb=None): + def forward(self, x, emb = None): emb = self.linear(self.silu(emb)) shift_msa, scale_msa, gate_msa, shift_mlp, scale_mlp, gate_mlp = torch.chunk(emb, 6, dim=1) @@ -216,7 +206,6 @@ class AdaLayerNormZero(nn.Module): # AdaLayerNormZero for final layer # return only with modulated x for attn input, cuz no more mlp modulation - class AdaLayerNormZero_Final(nn.Module): def __init__(self, dim): super().__init__() @@ -236,16 +225,22 @@ class AdaLayerNormZero_Final(nn.Module): # FeedForward - class FeedForward(nn.Module): - def __init__(self, dim, dim_out=None, mult=4, dropout=0.0, approximate: str = "none"): + def __init__(self, dim, dim_out = None, mult = 4, dropout = 0., approximate: str = 'none'): super().__init__() inner_dim = int(dim * mult) dim_out = dim_out if dim_out is not None else dim activation = nn.GELU(approximate=approximate) - project_in = nn.Sequential(nn.Linear(dim, inner_dim), activation) - self.ff = nn.Sequential(project_in, nn.Dropout(dropout), nn.Linear(inner_dim, dim_out)) + project_in = nn.Sequential( + nn.Linear(dim, inner_dim), + activation + ) + self.ff = nn.Sequential( + project_in, + nn.Dropout(dropout), + nn.Linear(inner_dim, dim_out) + ) def forward(self, x): return self.ff(x) @@ -254,7 +249,6 @@ class FeedForward(nn.Module): # Attention with possible joint part # modified from diffusers/src/diffusers/models/attention_processor.py - class Attention(nn.Module): def __init__( self, @@ -263,8 +257,8 @@ class Attention(nn.Module): heads: int = 8, dim_head: int = 64, dropout: float = 0.0, - context_dim: Optional[int] = None, # if not None -> joint attention - context_pre_only=None, + context_dim: Optional[int] = None, # if not None -> joint attention + context_pre_only = None, ): super().__init__() @@ -300,21 +294,20 @@ class Attention(nn.Module): def forward( self, - x: float["b n d"], # noised input x # noqa: F722 - c: float["b n d"] = None, # context c # noqa: F722 - mask: bool["b n"] | None = None, # noqa: F722 - rope=None, # rotary position embedding for x - c_rope=None, # rotary position embedding for c + x: float['b n d'], # noised input x + c: float['b n d'] = None, # context c + mask: bool['b n'] | None = None, + rope = None, # rotary position embedding for x + c_rope = None, # rotary position embedding for c ) -> torch.Tensor: if c is not None: - return self.processor(self, x, c=c, mask=mask, rope=rope, c_rope=c_rope) + return self.processor(self, x, c = c, mask = mask, rope = rope, c_rope = c_rope) else: - return self.processor(self, x, mask=mask, rope=rope) + return self.processor(self, x, mask = mask, rope = rope) # Attention processor - class AttnProcessor: def __init__(self): pass @@ -322,10 +315,11 @@ class AttnProcessor: def __call__( self, attn: Attention, - x: float["b n d"], # noised input x # noqa: F722 - mask: bool["b n"] | None = None, # noqa: F722 - rope=None, # rotary position embedding + x: float['b n d'], # noised input x + mask: bool['b n'] | None = None, + rope = None, # rotary position embedding ) -> torch.FloatTensor: + batch_size = x.shape[0] # `sample` projections. @@ -336,7 +330,7 @@ class AttnProcessor: # apply rotary position embedding if rope is not None: freqs, xpos_scale = rope - q_xpos_scale, k_xpos_scale = (xpos_scale, xpos_scale**-1.0) if xpos_scale is not None else (1.0, 1.0) + q_xpos_scale, k_xpos_scale = (xpos_scale, xpos_scale ** -1.) if xpos_scale is not None else (1., 1.) query = apply_rotary_pos_emb(query, freqs, q_xpos_scale) key = apply_rotary_pos_emb(key, freqs, k_xpos_scale) @@ -351,7 +345,7 @@ class AttnProcessor: # mask. e.g. inference got a batch with different target durations, mask out the padding if mask is not None: attn_mask = mask - attn_mask = attn_mask.unsqueeze(1).unsqueeze(1) # 'b n -> b 1 1 n' + attn_mask = rearrange(attn_mask, 'b n -> b 1 1 n') attn_mask = attn_mask.expand(batch_size, attn.heads, query.shape[-2], key.shape[-2]) else: attn_mask = None @@ -366,16 +360,15 @@ class AttnProcessor: x = attn.to_out[1](x) if mask is not None: - mask = mask.unsqueeze(-1) - x = x.masked_fill(~mask, 0.0) + mask = rearrange(mask, 'b n -> b n 1') + x = x.masked_fill(~mask, 0.) return x - + # Joint Attention processor for MM-DiT # modified from diffusers/src/diffusers/models/attention_processor.py - class JointAttnProcessor: def __init__(self): pass @@ -383,11 +376,11 @@ class JointAttnProcessor: def __call__( self, attn: Attention, - x: float["b n d"], # noised input x # noqa: F722 - c: float["b nt d"] = None, # context c, here text # noqa: F722 - mask: bool["b n"] | None = None, # noqa: F722 - rope=None, # rotary position embedding for x - c_rope=None, # rotary position embedding for c + x: float['b n d'], # noised input x + c: float['b nt d'] = None, # context c, here text + mask: bool['b n'] | None = None, + rope = None, # rotary position embedding for x + c_rope = None, # rotary position embedding for c ) -> torch.FloatTensor: residual = x @@ -406,12 +399,12 @@ class JointAttnProcessor: # apply rope for context and noised input independently if rope is not None: freqs, xpos_scale = rope - q_xpos_scale, k_xpos_scale = (xpos_scale, xpos_scale**-1.0) if xpos_scale is not None else (1.0, 1.0) + q_xpos_scale, k_xpos_scale = (xpos_scale, xpos_scale ** -1.) if xpos_scale is not None else (1., 1.) query = apply_rotary_pos_emb(query, freqs, q_xpos_scale) key = apply_rotary_pos_emb(key, freqs, k_xpos_scale) if c_rope is not None: freqs, xpos_scale = c_rope - q_xpos_scale, k_xpos_scale = (xpos_scale, xpos_scale**-1.0) if xpos_scale is not None else (1.0, 1.0) + q_xpos_scale, k_xpos_scale = (xpos_scale, xpos_scale ** -1.) if xpos_scale is not None else (1., 1.) c_query = apply_rotary_pos_emb(c_query, freqs, q_xpos_scale) c_key = apply_rotary_pos_emb(c_key, freqs, k_xpos_scale) @@ -428,8 +421,8 @@ class JointAttnProcessor: # mask. e.g. inference got a batch with different target durations, mask out the padding if mask is not None: - attn_mask = F.pad(mask, (0, c.shape[1]), value=True) # no mask for c (text) - attn_mask = attn_mask.unsqueeze(1).unsqueeze(1) # 'b n -> b 1 1 n' + attn_mask = F.pad(mask, (0, c.shape[1]), value = True) # no mask for c (text) + attn_mask = rearrange(attn_mask, 'b n -> b 1 1 n') attn_mask = attn_mask.expand(batch_size, attn.heads, query.shape[-2], key.shape[-2]) else: attn_mask = None @@ -440,8 +433,8 @@ class JointAttnProcessor: # Split the attention outputs. x, c = ( - x[:, : residual.shape[1]], - x[:, residual.shape[1] :], + x[:, :residual.shape[1]], + x[:, residual.shape[1]:], ) # linear proj @@ -452,8 +445,8 @@ class JointAttnProcessor: c = attn.to_out_c(c) if mask is not None: - mask = mask.unsqueeze(-1) - x = x.masked_fill(~mask, 0.0) + mask = rearrange(mask, 'b n -> b n 1') + x = x.masked_fill(~mask, 0.) # c = c.masked_fill(~mask, 0.) # no mask for c (text) return x, c @@ -461,24 +454,24 @@ class JointAttnProcessor: # DiT Block - class DiTBlock(nn.Module): - def __init__(self, dim, heads, dim_head, ff_mult=4, dropout=0.1): - super().__init__() + def __init__(self, dim, heads, dim_head, ff_mult = 4, dropout = 0.1): + super().__init__() + self.attn_norm = AdaLayerNormZero(dim) self.attn = Attention( - processor=AttnProcessor(), - dim=dim, - heads=heads, - dim_head=dim_head, - dropout=dropout, - ) - + processor = AttnProcessor(), + dim = dim, + heads = heads, + dim_head = dim_head, + dropout = dropout, + ) + self.ff_norm = nn.LayerNorm(dim, elementwise_affine=False, eps=1e-6) - self.ff = FeedForward(dim=dim, mult=ff_mult, dropout=dropout, approximate="tanh") + self.ff = FeedForward(dim = dim, mult = ff_mult, dropout = dropout, approximate = "tanh") - def forward(self, x, t, mask=None, rope=None): # x: noised input, t: time embedding + def forward(self, x, t, mask = None, rope = None): # x: noised input, t: time embedding # pre-norm & modulation for attention input norm, gate_msa, shift_mlp, scale_mlp, gate_mlp = self.attn_norm(x, emb=t) @@ -487,7 +480,7 @@ class DiTBlock(nn.Module): # process attention output for input x x = x + gate_msa.unsqueeze(1) * attn_output - + norm = self.ff_norm(x) * (1 + scale_mlp[:, None]) + shift_mlp[:, None] ff_output = self.ff(norm) x = x + gate_mlp.unsqueeze(1) * ff_output @@ -497,9 +490,8 @@ class DiTBlock(nn.Module): # MMDiT Block https://arxiv.org/abs/2403.03206 - class MMDiTBlock(nn.Module): - r""" + r""" modified from diffusers/src/diffusers/models/attention.py notes. @@ -508,33 +500,33 @@ class MMDiTBlock(nn.Module): context_pre_only: last layer only do prenorm + modulation cuz no more ffn """ - def __init__(self, dim, heads, dim_head, ff_mult=4, dropout=0.1, context_pre_only=False): + def __init__(self, dim, heads, dim_head, ff_mult = 4, dropout = 0.1, context_pre_only = False): super().__init__() self.context_pre_only = context_pre_only - + self.attn_norm_c = AdaLayerNormZero_Final(dim) if context_pre_only else AdaLayerNormZero(dim) self.attn_norm_x = AdaLayerNormZero(dim) self.attn = Attention( - processor=JointAttnProcessor(), - dim=dim, - heads=heads, - dim_head=dim_head, - dropout=dropout, - context_dim=dim, - context_pre_only=context_pre_only, - ) + processor = JointAttnProcessor(), + dim = dim, + heads = heads, + dim_head = dim_head, + dropout = dropout, + context_dim = dim, + context_pre_only = context_pre_only, + ) if not context_pre_only: self.ff_norm_c = nn.LayerNorm(dim, elementwise_affine=False, eps=1e-6) - self.ff_c = FeedForward(dim=dim, mult=ff_mult, dropout=dropout, approximate="tanh") + self.ff_c = FeedForward(dim = dim, mult = ff_mult, dropout = dropout, approximate = "tanh") else: self.ff_norm_c = None self.ff_c = None self.ff_norm_x = nn.LayerNorm(dim, elementwise_affine=False, eps=1e-6) - self.ff_x = FeedForward(dim=dim, mult=ff_mult, dropout=dropout, approximate="tanh") + self.ff_x = FeedForward(dim = dim, mult = ff_mult, dropout = dropout, approximate = "tanh") - def forward(self, x, c, t, mask=None, rope=None, c_rope=None): # x: noised input, c: context, t: time embedding + def forward(self, x, c, t, mask = None, rope = None, c_rope = None): # x: noised input, c: context, t: time embedding # pre-norm & modulation for attention input if self.context_pre_only: norm_c = self.attn_norm_c(c, t) @@ -548,7 +540,7 @@ class MMDiTBlock(nn.Module): # process attention output for context c if self.context_pre_only: c = None - else: # if not last layer + else: # if not last layer c = c + c_gate_msa.unsqueeze(1) * c_attn_output norm_c = self.ff_norm_c(c) * (1 + c_scale_mlp[:, None]) + c_shift_mlp[:, None] @@ -557,7 +549,7 @@ class MMDiTBlock(nn.Module): # process attention output for input x x = x + x_gate_msa.unsqueeze(1) * x_attn_output - + norm_x = self.ff_norm_x(x) * (1 + x_scale_mlp[:, None]) + x_shift_mlp[:, None] x_ff_output = self.ff_x(norm_x) x = x + x_gate_mlp.unsqueeze(1) * x_ff_output @@ -567,15 +559,17 @@ class MMDiTBlock(nn.Module): # time step conditioning embedding - class TimestepEmbedding(nn.Module): def __init__(self, dim, freq_embed_dim=256): super().__init__() self.time_embed = SinusPositionEmbedding(freq_embed_dim) - self.time_mlp = nn.Sequential(nn.Linear(freq_embed_dim, dim), nn.SiLU(), nn.Linear(dim, dim)) + self.time_mlp = nn.Sequential( + nn.Linear(freq_embed_dim, dim), + nn.SiLU(), + nn.Linear(dim, dim) + ) - def forward(self, timestep: float["b"]): # noqa: F821 + def forward(self, timestep: float['b']): time_hidden = self.time_embed(timestep) - time_hidden = time_hidden.to(timestep.dtype) time = self.time_mlp(time_hidden) # b d return time diff --git a/model/trainer.py b/model/trainer.py index 5ab9ba2a6ce2b9a92050070232faab014633e31f..676a7d09366e4106420fba3dc6d1e7324ce2e16f 100644 --- a/model/trainer.py +++ b/model/trainer.py @@ -10,6 +10,8 @@ from torch.optim import AdamW from torch.utils.data import DataLoader, Dataset, SequentialSampler from torch.optim.lr_scheduler import LinearLR, SequentialLR +from einops import rearrange + from accelerate import Accelerator from accelerate.utils import DistributedDataParallelKwargs @@ -22,69 +24,66 @@ from model.dataset import DynamicBatchSampler, collate_fn # trainer - class Trainer: def __init__( self, model: CFM, epochs, learning_rate, - num_warmup_updates=20000, - save_per_updates=1000, - checkpoint_path=None, - batch_size=32, + num_warmup_updates = 20000, + save_per_updates = 1000, + checkpoint_path = None, + batch_size = 32, batch_size_type: str = "sample", - max_samples=32, - grad_accumulation_steps=1, - max_grad_norm=1.0, + max_samples = 32, + grad_accumulation_steps = 1, + max_grad_norm = 1.0, noise_scheduler: str | None = None, duration_predictor: torch.nn.Module | None = None, - wandb_project="test_e2-tts", - wandb_run_name="test_run", + wandb_project = "test_e2-tts", + wandb_run_name = "test_run", wandb_resume_id: str = None, - last_per_steps=None, + last_per_steps = None, accelerate_kwargs: dict = dict(), - ema_kwargs: dict = dict(), - bnb_optimizer: bool = False, + ema_kwargs: dict = dict() ): - ddp_kwargs = DistributedDataParallelKwargs(find_unused_parameters=True) - - logger = "wandb" if wandb.api.api_key else None - print(f"Using logger: {logger}") + + ddp_kwargs = DistributedDataParallelKwargs(find_unused_parameters = True) self.accelerator = Accelerator( - log_with=logger, - kwargs_handlers=[ddp_kwargs], - gradient_accumulation_steps=grad_accumulation_steps, - **accelerate_kwargs, + log_with = "wandb", + kwargs_handlers = [ddp_kwargs], + gradient_accumulation_steps = grad_accumulation_steps, + **accelerate_kwargs ) - - if logger == "wandb": - if exists(wandb_resume_id): - init_kwargs = {"wandb": {"resume": "allow", "name": wandb_run_name, "id": wandb_resume_id}} - else: - init_kwargs = {"wandb": {"resume": "allow", "name": wandb_run_name}} - self.accelerator.init_trackers( - project_name=wandb_project, - init_kwargs=init_kwargs, - config={ - "epochs": epochs, + + if exists(wandb_resume_id): + init_kwargs={"wandb": {"resume": "allow", "name": wandb_run_name, 'id': wandb_resume_id}} + else: + init_kwargs={"wandb": {"resume": "allow", "name": wandb_run_name}} + self.accelerator.init_trackers( + project_name = wandb_project, + init_kwargs=init_kwargs, + config={"epochs": epochs, "learning_rate": learning_rate, - "num_warmup_updates": num_warmup_updates, + "num_warmup_updates": num_warmup_updates, "batch_size": batch_size, "batch_size_type": batch_size_type, "max_samples": max_samples, "grad_accumulation_steps": grad_accumulation_steps, "max_grad_norm": max_grad_norm, "gpus": self.accelerator.num_processes, - "noise_scheduler": noise_scheduler, - }, + "noise_scheduler": noise_scheduler} ) self.model = model if self.is_main: - self.ema_model = EMA(model, include_online_model=False, **ema_kwargs) + self.ema_model = EMA( + model, + include_online_model = False, + **ema_kwargs + ) self.ema_model.to(self.accelerator.device) @@ -92,7 +91,7 @@ class Trainer: self.num_warmup_updates = num_warmup_updates self.save_per_updates = save_per_updates self.last_per_steps = default(last_per_steps, save_per_updates * grad_accumulation_steps) - self.checkpoint_path = default(checkpoint_path, "ckpts/test_e2-tts") + self.checkpoint_path = default(checkpoint_path, 'ckpts/test_e2-tts') self.batch_size = batch_size self.batch_size_type = batch_size_type @@ -104,13 +103,10 @@ class Trainer: self.duration_predictor = duration_predictor - if bnb_optimizer: - import bitsandbytes as bnb - - self.optimizer = bnb.optim.AdamW8bit(model.parameters(), lr=learning_rate) - else: - self.optimizer = AdamW(model.parameters(), lr=learning_rate) - self.model, self.optimizer = self.accelerator.prepare(self.model, self.optimizer) + self.optimizer = AdamW(model.parameters(), lr=learning_rate) + self.model, self.optimizer = self.accelerator.prepare( + self.model, self.optimizer + ) @property def is_main(self): @@ -120,112 +116,81 @@ class Trainer: self.accelerator.wait_for_everyone() if self.is_main: checkpoint = dict( - model_state_dict=self.accelerator.unwrap_model(self.model).state_dict(), - optimizer_state_dict=self.accelerator.unwrap_model(self.optimizer).state_dict(), - ema_model_state_dict=self.ema_model.state_dict(), - scheduler_state_dict=self.scheduler.state_dict(), - step=step, + model_state_dict = self.accelerator.unwrap_model(self.model).state_dict(), + optimizer_state_dict = self.accelerator.unwrap_model(self.optimizer).state_dict(), + ema_model_state_dict = self.ema_model.state_dict(), + scheduler_state_dict = self.scheduler.state_dict(), + step = step ) if not os.path.exists(self.checkpoint_path): os.makedirs(self.checkpoint_path) - if last: + if last == True: self.accelerator.save(checkpoint, f"{self.checkpoint_path}/model_last.pt") print(f"Saved last checkpoint at step {step}") else: self.accelerator.save(checkpoint, f"{self.checkpoint_path}/model_{step}.pt") def load_checkpoint(self): - if ( - not exists(self.checkpoint_path) - or not os.path.exists(self.checkpoint_path) - or not os.listdir(self.checkpoint_path) - ): + if not exists(self.checkpoint_path) or not os.path.exists(self.checkpoint_path) or not os.listdir(self.checkpoint_path): return 0 - + self.accelerator.wait_for_everyone() if "model_last.pt" in os.listdir(self.checkpoint_path): latest_checkpoint = "model_last.pt" else: - latest_checkpoint = sorted( - [f for f in os.listdir(self.checkpoint_path) if f.endswith(".pt")], - key=lambda x: int("".join(filter(str.isdigit, x))), - )[-1] + latest_checkpoint = sorted([f for f in os.listdir(self.checkpoint_path) if f.endswith('.pt')], key=lambda x: int(''.join(filter(str.isdigit, x))))[-1] # checkpoint = torch.load(f"{self.checkpoint_path}/{latest_checkpoint}", map_location=self.accelerator.device) # rather use accelerator.load_state ಥ_ಥ checkpoint = torch.load(f"{self.checkpoint_path}/{latest_checkpoint}", weights_only=True, map_location="cpu") if self.is_main: - self.ema_model.load_state_dict(checkpoint["ema_model_state_dict"]) + self.ema_model.load_state_dict(checkpoint['ema_model_state_dict']) - if "step" in checkpoint: - self.accelerator.unwrap_model(self.model).load_state_dict(checkpoint["model_state_dict"]) - self.accelerator.unwrap_model(self.optimizer).load_state_dict(checkpoint["optimizer_state_dict"]) + if 'step' in checkpoint: + self.accelerator.unwrap_model(self.model).load_state_dict(checkpoint['model_state_dict']) + self.accelerator.unwrap_model(self.optimizer).load_state_dict(checkpoint['optimizer_state_dict']) if self.scheduler: - self.scheduler.load_state_dict(checkpoint["scheduler_state_dict"]) - step = checkpoint["step"] + self.scheduler.load_state_dict(checkpoint['scheduler_state_dict']) + step = checkpoint['step'] else: - checkpoint["model_state_dict"] = { - k.replace("ema_model.", ""): v - for k, v in checkpoint["ema_model_state_dict"].items() - if k not in ["initted", "step"] - } - self.accelerator.unwrap_model(self.model).load_state_dict(checkpoint["model_state_dict"]) + checkpoint['model_state_dict'] = {k.replace("ema_model.", ""): v for k, v in checkpoint['ema_model_state_dict'].items() if k not in ["initted", "step"]} + self.accelerator.unwrap_model(self.model).load_state_dict(checkpoint['model_state_dict']) step = 0 - del checkpoint - gc.collect() + del checkpoint; gc.collect() return step def train(self, train_dataset: Dataset, num_workers=16, resumable_with_seed: int = None): + if exists(resumable_with_seed): generator = torch.Generator() generator.manual_seed(resumable_with_seed) - else: + else: generator = None if self.batch_size_type == "sample": - train_dataloader = DataLoader( - train_dataset, - collate_fn=collate_fn, - num_workers=num_workers, - pin_memory=True, - persistent_workers=True, - batch_size=self.batch_size, - shuffle=True, - generator=generator, - ) + train_dataloader = DataLoader(train_dataset, collate_fn=collate_fn, num_workers=num_workers, pin_memory=True, persistent_workers=True, + batch_size=self.batch_size, shuffle=True, generator=generator) elif self.batch_size_type == "frame": self.accelerator.even_batches = False sampler = SequentialSampler(train_dataset) - batch_sampler = DynamicBatchSampler( - sampler, self.batch_size, max_samples=self.max_samples, random_seed=resumable_with_seed, drop_last=False - ) - train_dataloader = DataLoader( - train_dataset, - collate_fn=collate_fn, - num_workers=num_workers, - pin_memory=True, - persistent_workers=True, - batch_sampler=batch_sampler, - ) + batch_sampler = DynamicBatchSampler(sampler, self.batch_size, max_samples=self.max_samples, random_seed=resumable_with_seed, drop_last=False) + train_dataloader = DataLoader(train_dataset, collate_fn=collate_fn, num_workers=num_workers, pin_memory=True, persistent_workers=True, + batch_sampler=batch_sampler) else: raise ValueError(f"batch_size_type must be either 'sample' or 'frame', but received {self.batch_size_type}") - + # accelerator.prepare() dispatches batches to devices; # which means the length of dataloader calculated before, should consider the number of devices - warmup_steps = ( - self.num_warmup_updates * self.accelerator.num_processes - ) # consider a fixed warmup steps while using accelerate multi-gpu ddp - # otherwise by default with split_batches=False, warmup steps change with num_processes + warmup_steps = self.num_warmup_updates * self.accelerator.num_processes # consider a fixed warmup steps while using accelerate multi-gpu ddp + # otherwise by default with split_batches=False, warmup steps change with num_processes total_steps = len(train_dataloader) * self.epochs / self.grad_accumulation_steps decay_steps = total_steps - warmup_steps warmup_scheduler = LinearLR(self.optimizer, start_factor=1e-8, end_factor=1.0, total_iters=warmup_steps) decay_scheduler = LinearLR(self.optimizer, start_factor=1.0, end_factor=1e-8, total_iters=decay_steps) - self.scheduler = SequentialLR( - self.optimizer, schedulers=[warmup_scheduler, decay_scheduler], milestones=[warmup_steps] - ) - train_dataloader, self.scheduler = self.accelerator.prepare( - train_dataloader, self.scheduler - ) # actual steps = 1 gpu steps / gpus + self.scheduler = SequentialLR(self.optimizer, + schedulers=[warmup_scheduler, decay_scheduler], + milestones=[warmup_steps]) + train_dataloader, self.scheduler = self.accelerator.prepare(train_dataloader, self.scheduler) # actual steps = 1 gpu steps / gpus start_step = self.load_checkpoint() global_step = start_step @@ -240,36 +205,23 @@ class Trainer: for epoch in range(skipped_epoch, self.epochs): self.model.train() if exists(resumable_with_seed) and epoch == skipped_epoch: - progress_bar = tqdm( - skipped_dataloader, - desc=f"Epoch {epoch+1}/{self.epochs}", - unit="step", - disable=not self.accelerator.is_local_main_process, - initial=skipped_batch, - total=orig_epoch_step, - ) + progress_bar = tqdm(skipped_dataloader, desc=f"Epoch {epoch+1}/{self.epochs}", unit="step", disable=not self.accelerator.is_local_main_process, + initial=skipped_batch, total=orig_epoch_step) else: - progress_bar = tqdm( - train_dataloader, - desc=f"Epoch {epoch+1}/{self.epochs}", - unit="step", - disable=not self.accelerator.is_local_main_process, - ) + progress_bar = tqdm(train_dataloader, desc=f"Epoch {epoch+1}/{self.epochs}", unit="step", disable=not self.accelerator.is_local_main_process) for batch in progress_bar: with self.accelerator.accumulate(self.model): - text_inputs = batch["text"] - mel_spec = batch["mel"].permute(0, 2, 1) + text_inputs = batch['text'] + mel_spec = rearrange(batch['mel'], 'b d n -> b n d') mel_lengths = batch["mel_lengths"] # TODO. add duration predictor training if self.duration_predictor is not None and self.accelerator.is_local_main_process: - dur_loss = self.duration_predictor(mel_spec, lens=batch.get("durations")) + dur_loss = self.duration_predictor(mel_spec, lens=batch.get('durations')) self.accelerator.log({"duration loss": dur_loss.item()}, step=global_step) - loss, cond, pred = self.model( - mel_spec, text=text_inputs, lens=mel_lengths, noise_scheduler=self.noise_scheduler - ) + loss, cond, pred = self.model(mel_spec, text=text_inputs, lens=mel_lengths, noise_scheduler=self.noise_scheduler) self.accelerator.backward(loss) if self.max_grad_norm > 0 and self.accelerator.sync_gradients: @@ -286,15 +238,13 @@ class Trainer: if self.accelerator.is_local_main_process: self.accelerator.log({"loss": loss.item(), "lr": self.scheduler.get_last_lr()[0]}, step=global_step) - + progress_bar.set_postfix(step=str(global_step), loss=loss.item()) - + if global_step % (self.save_per_updates * self.grad_accumulation_steps) == 0: self.save_checkpoint(global_step) - + if global_step % self.last_per_steps == 0: self.save_checkpoint(global_step, last=True) - - self.save_checkpoint(global_step, last=True) - + self.accelerator.end_training() diff --git a/model/utils.py b/model/utils.py index 2253cb812e945a75da858b29c0ccdb482f23fafb..6a030b4265506d47823200c3de1831c660eabfa8 100644 --- a/model/utils.py +++ b/model/utils.py @@ -1,6 +1,7 @@ from __future__ import annotations import os +import re import math import random import string @@ -8,7 +9,6 @@ from tqdm import tqdm from collections import defaultdict import matplotlib - matplotlib.use("Agg") import matplotlib.pylab as plt @@ -17,6 +17,9 @@ import torch.nn.functional as F from torch.nn.utils.rnn import pad_sequence import torchaudio +import einx +from einops import rearrange, reduce + import jieba from pypinyin import lazy_pinyin, Style @@ -26,102 +29,107 @@ from model.modules import MelSpec # seed everything - -def seed_everything(seed=0): +def seed_everything(seed = 0): random.seed(seed) - os.environ["PYTHONHASHSEED"] = str(seed) + os.environ['PYTHONHASHSEED'] = str(seed) torch.manual_seed(seed) torch.cuda.manual_seed(seed) torch.cuda.manual_seed_all(seed) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False - # helpers - def exists(v): return v is not None - def default(v, d): return v if exists(v) else d - # tensor helpers +def lens_to_mask( + t: int['b'], + length: int | None = None +) -> bool['b n']: -def lens_to_mask(t: int["b"], length: int | None = None) -> bool["b n"]: # noqa: F722 F821 if not exists(length): length = t.amax() - seq = torch.arange(length, device=t.device) - return seq[None, :] < t[:, None] - - -def mask_from_start_end_indices(seq_len: int["b"], start: int["b"], end: int["b"]): # noqa: F722 F821 - max_seq_len = seq_len.max().item() - seq = torch.arange(max_seq_len, device=start.device).long() - start_mask = seq[None, :] >= start[:, None] - end_mask = seq[None, :] < end[:, None] - return start_mask & end_mask + seq = torch.arange(length, device = t.device) + return einx.less('n, b -> b n', seq, t) +def mask_from_start_end_indices( + seq_len: int['b'], + start: int['b'], + end: int['b'] +): + max_seq_len = seq_len.max().item() + seq = torch.arange(max_seq_len, device = start.device).long() + return einx.greater_equal('n, b -> b n', seq, start) & einx.less('n, b -> b n', seq, end) -def mask_from_frac_lengths(seq_len: int["b"], frac_lengths: float["b"]): # noqa: F722 F821 +def mask_from_frac_lengths( + seq_len: int['b'], + frac_lengths: float['b'] +): lengths = (frac_lengths * seq_len).long() max_start = seq_len - lengths rand = torch.rand_like(frac_lengths) - start = (max_start * rand).long().clamp(min=0) + start = (max_start * rand).long().clamp(min = 0) end = start + lengths return mask_from_start_end_indices(seq_len, start, end) +def maybe_masked_mean( + t: float['b n d'], + mask: bool['b n'] = None +) -> float['b d']: -def maybe_masked_mean(t: float["b n d"], mask: bool["b n"] = None) -> float["b d"]: # noqa: F722 if not exists(mask): - return t.mean(dim=1) + return t.mean(dim = 1) - t = torch.where(mask[:, :, None], t, torch.tensor(0.0, device=t.device)) - num = t.sum(dim=1) - den = mask.float().sum(dim=1) + t = einx.where('b n, b n d, -> b n d', mask, t, 0.) + num = reduce(t, 'b n d -> b d', 'sum') + den = reduce(mask.float(), 'b n -> b', 'sum') - return num / den.clamp(min=1.0) + return einx.divide('b d, b -> b d', num, den.clamp(min = 1.)) # simple utf-8 tokenizer, since paper went character based -def list_str_to_tensor(text: list[str], padding_value=-1) -> int["b nt"]: # noqa: F722 - list_tensors = [torch.tensor([*bytes(t, "UTF-8")]) for t in text] # ByT5 style - text = pad_sequence(list_tensors, padding_value=padding_value, batch_first=True) +def list_str_to_tensor( + text: list[str], + padding_value = -1 +) -> int['b nt']: + list_tensors = [torch.tensor([*bytes(t, 'UTF-8')]) for t in text] # ByT5 style + text = pad_sequence(list_tensors, padding_value = padding_value, batch_first = True) return text - # char tokenizer, based on custom dataset's extracted .txt file def list_str_to_idx( text: list[str] | list[list[str]], vocab_char_map: dict[str, int], # {char: idx} - padding_value=-1, -) -> int["b nt"]: # noqa: F722 + padding_value = -1 +) -> int['b nt']: list_idx_tensors = [torch.tensor([vocab_char_map.get(c, 0) for c in t]) for t in text] # pinyin or char style - text = pad_sequence(list_idx_tensors, padding_value=padding_value, batch_first=True) + text = pad_sequence(list_idx_tensors, padding_value = padding_value, batch_first = True) return text # Get tokenizer - def get_tokenizer(dataset_name, tokenizer: str = "pinyin"): - """ + ''' tokenizer - "pinyin" do g2p for only chinese characters, need .txt vocab_file - "char" for char-wise tokenizer, need .txt vocab_file - "byte" for utf-8 tokenizer - "custom" if you're directly passing in a path to the vocab.txt you want to use vocab_size - if use "pinyin", all available pinyin types, common alphabets (also those with accent) and symbols - if use "char", derived from unfiltered character & symbol counts of custom dataset - - if use "byte", set to 256 (unicode byte range) - """ + - if use "byte", set to 256 (unicode byte range) + ''' if tokenizer in ["pinyin", "char"]: - with open(f"data/{dataset_name}_{tokenizer}/vocab.txt", "r", encoding="utf-8") as f: + with open (f"data/{dataset_name}_{tokenizer}/vocab.txt", "r", encoding="utf-8") as f: vocab_char_map = {} for i, char in enumerate(f): vocab_char_map[char[:-1]] = i @@ -132,7 +140,7 @@ def get_tokenizer(dataset_name, tokenizer: str = "pinyin"): vocab_char_map = None vocab_size = 256 elif tokenizer == "custom": - with open(dataset_name, "r", encoding="utf-8") as f: + with open (dataset_name, "r", encoding="utf-8") as f: vocab_char_map = {} for i, char in enumerate(f): vocab_char_map[char[:-1]] = i @@ -143,19 +151,16 @@ def get_tokenizer(dataset_name, tokenizer: str = "pinyin"): # convert char to pinyin - -def convert_char_to_pinyin(text_list, polyphone=True): +def convert_char_to_pinyin(text_list, polyphone = True): final_text_list = [] - god_knows_why_en_testset_contains_zh_quote = str.maketrans( - {"“": '"', "”": '"', "‘": "'", "’": "'"} - ) # in case librispeech (orig no-pc) test-clean - custom_trans = str.maketrans({";": ","}) # add custom trans here, to address oov + god_knows_why_en_testset_contains_zh_quote = str.maketrans({'“': '"', '”': '"', '‘': "'", '’': "'"}) # in case librispeech (orig no-pc) test-clean + custom_trans = str.maketrans({';': ','}) # add custom trans here, to address oov for text in text_list: char_list = [] text = text.translate(god_knows_why_en_testset_contains_zh_quote) text = text.translate(custom_trans) for seg in jieba.cut(text): - seg_byte_len = len(bytes(seg, "UTF-8")) + seg_byte_len = len(bytes(seg, 'UTF-8')) if seg_byte_len == len(seg): # if pure alphabets and symbols if char_list and seg_byte_len > 1 and char_list[-1] not in " :'\"": char_list.append(" ") @@ -184,7 +189,7 @@ def convert_char_to_pinyin(text_list, polyphone=True): # save spectrogram def save_spectrogram(spectrogram, path): plt.figure(figsize=(12, 4)) - plt.imshow(spectrogram, origin="lower", aspect="auto") + plt.imshow(spectrogram, origin='lower', aspect='auto') plt.colorbar() plt.savefig(path) plt.close() @@ -192,15 +197,13 @@ def save_spectrogram(spectrogram, path): # seedtts testset metainfo: utt, prompt_text, prompt_wav, gt_text, gt_wav def get_seedtts_testset_metainfo(metalst): - f = open(metalst) - lines = f.readlines() - f.close() + f = open(metalst); lines = f.readlines(); f.close() metainfo = [] for line in lines: - if len(line.strip().split("|")) == 5: - utt, prompt_text, prompt_wav, gt_text, gt_wav = line.strip().split("|") - elif len(line.strip().split("|")) == 4: - utt, prompt_text, prompt_wav, gt_text = line.strip().split("|") + if len(line.strip().split('|')) == 5: + utt, prompt_text, prompt_wav, gt_text, gt_wav = line.strip().split('|') + elif len(line.strip().split('|')) == 4: + utt, prompt_text, prompt_wav, gt_text = line.strip().split('|') gt_wav = os.path.join(os.path.dirname(metalst), "wavs", utt + ".wav") if not os.path.isabs(prompt_wav): prompt_wav = os.path.join(os.path.dirname(metalst), prompt_wav) @@ -210,20 +213,18 @@ def get_seedtts_testset_metainfo(metalst): # librispeech test-clean metainfo: gen_utt, ref_txt, ref_wav, gen_txt, gen_wav def get_librispeech_test_clean_metainfo(metalst, librispeech_test_clean_path): - f = open(metalst) - lines = f.readlines() - f.close() + f = open(metalst); lines = f.readlines(); f.close() metainfo = [] for line in lines: - ref_utt, ref_dur, ref_txt, gen_utt, gen_dur, gen_txt = line.strip().split("\t") + ref_utt, ref_dur, ref_txt, gen_utt, gen_dur, gen_txt = line.strip().split('\t') # ref_txt = ref_txt[0] + ref_txt[1:].lower() + '.' # if use librispeech test-clean (no-pc) - ref_spk_id, ref_chaptr_id, _ = ref_utt.split("-") - ref_wav = os.path.join(librispeech_test_clean_path, ref_spk_id, ref_chaptr_id, ref_utt + ".flac") + ref_spk_id, ref_chaptr_id, _ = ref_utt.split('-') + ref_wav = os.path.join(librispeech_test_clean_path, ref_spk_id, ref_chaptr_id, ref_utt + '.flac') # gen_txt = gen_txt[0] + gen_txt[1:].lower() + '.' # if use librispeech test-clean (no-pc) - gen_spk_id, gen_chaptr_id, _ = gen_utt.split("-") - gen_wav = os.path.join(librispeech_test_clean_path, gen_spk_id, gen_chaptr_id, gen_utt + ".flac") + gen_spk_id, gen_chaptr_id, _ = gen_utt.split('-') + gen_wav = os.path.join(librispeech_test_clean_path, gen_spk_id, gen_chaptr_id, gen_utt + '.flac') metainfo.append((gen_utt, ref_txt, ref_wav, " " + gen_txt, gen_wav)) @@ -235,30 +236,21 @@ def padded_mel_batch(ref_mels): max_mel_length = torch.LongTensor([mel.shape[-1] for mel in ref_mels]).amax() padded_ref_mels = [] for mel in ref_mels: - padded_ref_mel = F.pad(mel, (0, max_mel_length - mel.shape[-1]), value=0) + padded_ref_mel = F.pad(mel, (0, max_mel_length - mel.shape[-1]), value = 0) padded_ref_mels.append(padded_ref_mel) padded_ref_mels = torch.stack(padded_ref_mels) - padded_ref_mels = padded_ref_mels.permute(0, 2, 1) + padded_ref_mels = rearrange(padded_ref_mels, 'b d n -> b n d') return padded_ref_mels # get prompts from metainfo containing: utt, prompt_text, prompt_wav, gt_text, gt_wav - def get_inference_prompt( - metainfo, - speed=1.0, - tokenizer="pinyin", - polyphone=True, - target_sample_rate=24000, - n_mel_channels=100, - hop_length=256, - target_rms=0.1, - use_truth_duration=False, - infer_batch_size=1, - num_buckets=200, - min_secs=3, - max_secs=40, + metainfo, + speed = 1., tokenizer = "pinyin", polyphone = True, + target_sample_rate = 24000, n_mel_channels = 100, hop_length = 256, target_rms = 0.1, + use_truth_duration = False, + infer_batch_size = 1, num_buckets = 200, min_secs = 3, max_secs = 40, ): prompts_all = [] @@ -266,15 +258,13 @@ def get_inference_prompt( max_tokens = max_secs * target_sample_rate // hop_length batch_accum = [0] * num_buckets - utts, ref_rms_list, ref_mels, ref_mel_lens, total_mel_lens, final_text_list = ( - [[] for _ in range(num_buckets)] for _ in range(6) - ) + utts, ref_rms_list, ref_mels, ref_mel_lens, total_mel_lens, final_text_list = \ + ([[] for _ in range(num_buckets)] for _ in range(6)) - mel_spectrogram = MelSpec( - target_sample_rate=target_sample_rate, n_mel_channels=n_mel_channels, hop_length=hop_length - ) + mel_spectrogram = MelSpec(target_sample_rate=target_sample_rate, n_mel_channels=n_mel_channels, hop_length=hop_length) for utt, prompt_text, prompt_wav, gt_text, gt_wav in tqdm(metainfo, desc="Processing prompts..."): + # Audio ref_audio, ref_sr = torchaudio.load(prompt_wav) ref_rms = torch.sqrt(torch.mean(torch.square(ref_audio))) @@ -286,11 +276,11 @@ def get_inference_prompt( ref_audio = resampler(ref_audio) # Text - if len(prompt_text[-1].encode("utf-8")) == 1: + if len(prompt_text[-1].encode('utf-8')) == 1: prompt_text = prompt_text + " " text = [prompt_text + gt_text] if tokenizer == "pinyin": - text_list = convert_char_to_pinyin(text, polyphone=polyphone) + text_list = convert_char_to_pinyin(text, polyphone = polyphone) else: text_list = text @@ -306,19 +296,19 @@ def get_inference_prompt( # # test vocoder resynthesis # ref_audio = gt_audio else: - ref_text_len = len(prompt_text.encode("utf-8")) - gen_text_len = len(gt_text.encode("utf-8")) + zh_pause_punc = r"。,、;:?!" + ref_text_len = len(prompt_text.encode('utf-8')) + 3 * len(re.findall(zh_pause_punc, prompt_text)) + gen_text_len = len(gt_text.encode('utf-8')) + 3 * len(re.findall(zh_pause_punc, gt_text)) total_mel_len = ref_mel_len + int(ref_mel_len / ref_text_len * gen_text_len / speed) # to mel spectrogram ref_mel = mel_spectrogram(ref_audio) - ref_mel = ref_mel.squeeze(0) + ref_mel = rearrange(ref_mel, '1 d n -> d n') # deal with batch assert infer_batch_size > 0, "infer_batch_size should be greater than 0." - assert ( - min_tokens <= total_mel_len <= max_tokens - ), f"Audio {utt} has duration {total_mel_len*hop_length//target_sample_rate}s out of range [{min_secs}, {max_secs}]." + assert min_tokens <= total_mel_len <= max_tokens, \ + f"Audio {utt} has duration {total_mel_len*hop_length//target_sample_rate}s out of range [{min_secs}, {max_secs}]." bucket_i = math.floor((total_mel_len - min_tokens) / (max_tokens - min_tokens + 1) * num_buckets) utts[bucket_i].append(utt) @@ -332,39 +322,28 @@ def get_inference_prompt( if batch_accum[bucket_i] >= infer_batch_size: # print(f"\n{len(ref_mels[bucket_i][0][0])}\n{ref_mel_lens[bucket_i]}\n{total_mel_lens[bucket_i]}") - prompts_all.append( - ( - utts[bucket_i], - ref_rms_list[bucket_i], - padded_mel_batch(ref_mels[bucket_i]), - ref_mel_lens[bucket_i], - total_mel_lens[bucket_i], - final_text_list[bucket_i], - ) - ) + prompts_all.append(( + utts[bucket_i], + ref_rms_list[bucket_i], + padded_mel_batch(ref_mels[bucket_i]), + ref_mel_lens[bucket_i], + total_mel_lens[bucket_i], + final_text_list[bucket_i] + )) batch_accum[bucket_i] = 0 - ( - utts[bucket_i], - ref_rms_list[bucket_i], - ref_mels[bucket_i], - ref_mel_lens[bucket_i], - total_mel_lens[bucket_i], - final_text_list[bucket_i], - ) = [], [], [], [], [], [] + utts[bucket_i], ref_rms_list[bucket_i], ref_mels[bucket_i], ref_mel_lens[bucket_i], total_mel_lens[bucket_i], final_text_list[bucket_i] = [], [], [], [], [], [] # add residual for bucket_i, bucket_frames in enumerate(batch_accum): if bucket_frames > 0: - prompts_all.append( - ( - utts[bucket_i], - ref_rms_list[bucket_i], - padded_mel_batch(ref_mels[bucket_i]), - ref_mel_lens[bucket_i], - total_mel_lens[bucket_i], - final_text_list[bucket_i], - ) - ) + prompts_all.append(( + utts[bucket_i], + ref_rms_list[bucket_i], + padded_mel_batch(ref_mels[bucket_i]), + ref_mel_lens[bucket_i], + total_mel_lens[bucket_i], + final_text_list[bucket_i] + )) # not only leave easy work for last workers random.seed(666) random.shuffle(prompts_all) @@ -375,7 +354,6 @@ def get_inference_prompt( # get wav_res_ref_text of seed-tts test metalst # https://github.com/BytedanceSpeech/seed-tts-eval - def get_seed_tts_test(metalst, gen_wav_dir, gpus): f = open(metalst) lines = f.readlines() @@ -383,14 +361,14 @@ def get_seed_tts_test(metalst, gen_wav_dir, gpus): test_set_ = [] for line in tqdm(lines): - if len(line.strip().split("|")) == 5: - utt, prompt_text, prompt_wav, gt_text, gt_wav = line.strip().split("|") - elif len(line.strip().split("|")) == 4: - utt, prompt_text, prompt_wav, gt_text = line.strip().split("|") + if len(line.strip().split('|')) == 5: + utt, prompt_text, prompt_wav, gt_text, gt_wav = line.strip().split('|') + elif len(line.strip().split('|')) == 4: + utt, prompt_text, prompt_wav, gt_text = line.strip().split('|') - if not os.path.exists(os.path.join(gen_wav_dir, utt + ".wav")): + if not os.path.exists(os.path.join(gen_wav_dir, utt + '.wav')): continue - gen_wav = os.path.join(gen_wav_dir, utt + ".wav") + gen_wav = os.path.join(gen_wav_dir, utt + '.wav') if not os.path.isabs(prompt_wav): prompt_wav = os.path.join(os.path.dirname(metalst), prompt_wav) @@ -399,69 +377,65 @@ def get_seed_tts_test(metalst, gen_wav_dir, gpus): num_jobs = len(gpus) if num_jobs == 1: return [(gpus[0], test_set_)] - + wav_per_job = len(test_set_) // num_jobs + 1 test_set = [] for i in range(num_jobs): - test_set.append((gpus[i], test_set_[i * wav_per_job : (i + 1) * wav_per_job])) + test_set.append((gpus[i], test_set_[i*wav_per_job:(i+1)*wav_per_job])) return test_set # get librispeech test-clean cross sentence test - -def get_librispeech_test(metalst, gen_wav_dir, gpus, librispeech_test_clean_path, eval_ground_truth=False): +def get_librispeech_test(metalst, gen_wav_dir, gpus, librispeech_test_clean_path, eval_ground_truth = False): f = open(metalst) lines = f.readlines() f.close() test_set_ = [] for line in tqdm(lines): - ref_utt, ref_dur, ref_txt, gen_utt, gen_dur, gen_txt = line.strip().split("\t") + ref_utt, ref_dur, ref_txt, gen_utt, gen_dur, gen_txt = line.strip().split('\t') if eval_ground_truth: - gen_spk_id, gen_chaptr_id, _ = gen_utt.split("-") - gen_wav = os.path.join(librispeech_test_clean_path, gen_spk_id, gen_chaptr_id, gen_utt + ".flac") + gen_spk_id, gen_chaptr_id, _ = gen_utt.split('-') + gen_wav = os.path.join(librispeech_test_clean_path, gen_spk_id, gen_chaptr_id, gen_utt + '.flac') else: - if not os.path.exists(os.path.join(gen_wav_dir, gen_utt + ".wav")): + if not os.path.exists(os.path.join(gen_wav_dir, gen_utt + '.wav')): raise FileNotFoundError(f"Generated wav not found: {gen_utt}") - gen_wav = os.path.join(gen_wav_dir, gen_utt + ".wav") + gen_wav = os.path.join(gen_wav_dir, gen_utt + '.wav') - ref_spk_id, ref_chaptr_id, _ = ref_utt.split("-") - ref_wav = os.path.join(librispeech_test_clean_path, ref_spk_id, ref_chaptr_id, ref_utt + ".flac") + ref_spk_id, ref_chaptr_id, _ = ref_utt.split('-') + ref_wav = os.path.join(librispeech_test_clean_path, ref_spk_id, ref_chaptr_id, ref_utt + '.flac') test_set_.append((gen_wav, ref_wav, gen_txt)) num_jobs = len(gpus) if num_jobs == 1: return [(gpus[0], test_set_)] - + wav_per_job = len(test_set_) // num_jobs + 1 test_set = [] for i in range(num_jobs): - test_set.append((gpus[i], test_set_[i * wav_per_job : (i + 1) * wav_per_job])) + test_set.append((gpus[i], test_set_[i*wav_per_job:(i+1)*wav_per_job])) return test_set # load asr model - -def load_asr_model(lang, ckpt_dir=""): +def load_asr_model(lang, ckpt_dir = ""): if lang == "zh": from funasr import AutoModel - model = AutoModel( - model=os.path.join(ckpt_dir, "paraformer-zh"), - # vad_model = os.path.join(ckpt_dir, "fsmn-vad"), + model = os.path.join(ckpt_dir, "paraformer-zh"), + # vad_model = os.path.join(ckpt_dir, "fsmn-vad"), # punc_model = os.path.join(ckpt_dir, "ct-punc"), - # spk_model = os.path.join(ckpt_dir, "cam++"), + # spk_model = os.path.join(ckpt_dir, "cam++"), disable_update=True, - ) # following seed-tts setting + ) # following seed-tts setting elif lang == "en": from faster_whisper import WhisperModel - model_size = "large-v3" if ckpt_dir == "" else ckpt_dir model = WhisperModel(model_size, device="cuda", compute_type="float16") return model @@ -469,50 +443,44 @@ def load_asr_model(lang, ckpt_dir=""): # WER Evaluation, the way Seed-TTS does - def run_asr_wer(args): rank, lang, test_set, ckpt_dir = args if lang == "zh": import zhconv - torch.cuda.set_device(rank) elif lang == "en": os.environ["CUDA_VISIBLE_DEVICES"] = str(rank) else: - raise NotImplementedError( - "lang support only 'zh' (funasr paraformer-zh), 'en' (faster-whisper-large-v3), for now." - ) - - asr_model = load_asr_model(lang, ckpt_dir=ckpt_dir) + raise NotImplementedError("lang support only 'zh' (funasr paraformer-zh), 'en' (faster-whisper-large-v3), for now.") + asr_model = load_asr_model(lang, ckpt_dir = ckpt_dir) + from zhon.hanzi import punctuation - punctuation_all = punctuation + string.punctuation wers = [] from jiwer import compute_measures - for gen_wav, prompt_wav, truth in tqdm(test_set): if lang == "zh": res = asr_model.generate(input=gen_wav, batch_size_s=300, disable_pbar=True) hypo = res[0]["text"] - hypo = zhconv.convert(hypo, "zh-cn") + hypo = zhconv.convert(hypo, 'zh-cn') elif lang == "en": segments, _ = asr_model.transcribe(gen_wav, beam_size=5, language="en") - hypo = "" + hypo = '' for segment in segments: - hypo = hypo + " " + segment.text + hypo = hypo + ' ' + segment.text # raw_truth = truth # raw_hypo = hypo for x in punctuation_all: - truth = truth.replace(x, "") - hypo = hypo.replace(x, "") + truth = truth.replace(x, '') + hypo = hypo.replace(x, '') - truth = truth.replace(" ", " ") - hypo = hypo.replace(" ", " ") + truth = truth.replace(' ', ' ') + hypo = hypo.replace(' ', ' ') if lang == "zh": truth = " ".join([x for x in truth]) @@ -536,22 +504,22 @@ def run_asr_wer(args): # SIM Evaluation - def run_sim(args): rank, test_set, ckpt_dir = args device = f"cuda:{rank}" - model = ECAPA_TDNN_SMALL(feat_dim=1024, feat_type="wavlm_large", config_path=None) + model = ECAPA_TDNN_SMALL(feat_dim=1024, feat_type='wavlm_large', config_path=None) state_dict = torch.load(ckpt_dir, weights_only=True, map_location=lambda storage, loc: storage) - model.load_state_dict(state_dict["model"], strict=False) + model.load_state_dict(state_dict['model'], strict=False) - use_gpu = True if torch.cuda.is_available() else False + use_gpu=True if torch.cuda.is_available() else False if use_gpu: model = model.cuda(device) model.eval() sim_list = [] for wav1, wav2, truth in tqdm(test_set): + wav1, sr1 = torchaudio.load(wav1) wav2, sr2 = torchaudio.load(wav2) @@ -566,21 +534,20 @@ def run_sim(args): with torch.no_grad(): emb1 = model(wav1) emb2 = model(wav2) - + sim = F.cosine_similarity(emb1, emb2)[0].item() # print(f"VSim score between two audios: {sim:.4f} (-1.0, 1.0).") sim_list.append(sim) - + return sim_list # filter func for dirty data with many repetitions - -def repetition_found(text, length=2, tolerance=10): +def repetition_found(text, length = 2, tolerance = 10): pattern_count = defaultdict(int) for i in range(len(text) - length + 1): - pattern = text[i : i + length] + pattern = text[i:i + length] pattern_count[pattern] += 1 for pattern, count in pattern_count.items(): if count > tolerance: @@ -590,31 +557,24 @@ def repetition_found(text, length=2, tolerance=10): # load model checkpoint for inference - -def load_checkpoint(model, ckpt_path, device, use_ema=True): - if device == "cuda": - model = model.half() +def load_checkpoint(model, ckpt_path, device, use_ema = True): + from ema_pytorch import EMA ckpt_type = ckpt_path.split(".")[-1] if ckpt_type == "safetensors": from safetensors.torch import load_file - - checkpoint = load_file(ckpt_path) + checkpoint = load_file(ckpt_path, device=device) else: - checkpoint = torch.load(ckpt_path, weights_only=True) + checkpoint = torch.load(ckpt_path, weights_only=True, map_location=device) - if use_ema: + if use_ema == True: + ema_model = EMA(model, include_online_model = False).to(device) if ckpt_type == "safetensors": - checkpoint = {"ema_model_state_dict": checkpoint} - checkpoint["model_state_dict"] = { - k.replace("ema_model.", ""): v - for k, v in checkpoint["ema_model_state_dict"].items() - if k not in ["initted", "step"] - } - model.load_state_dict(checkpoint["model_state_dict"]) + ema_model.load_state_dict(checkpoint) + else: + ema_model.load_state_dict(checkpoint['ema_model_state_dict']) + ema_model.copy_params_from_ema_to_model() else: - if ckpt_type == "safetensors": - checkpoint = {"model_state_dict": checkpoint} - model.load_state_dict(checkpoint["model_state_dict"]) - - return model.to(device) + model.load_state_dict(checkpoint['model_state_dict']) + + return model \ No newline at end of file diff --git a/model/utils_infer.py b/model/utils_infer.py deleted file mode 100644 index 75f0cd39e72fb52556ef988bd16bae8652fe4382..0000000000000000000000000000000000000000 --- a/model/utils_infer.py +++ /dev/null @@ -1,357 +0,0 @@ -# A unified script for inference process -# Make adjustments inside functions, and consider both gradio and cli scripts if need to change func output format - -import re -import tempfile - -import numpy as np -import torch -import torchaudio -import tqdm -from pydub import AudioSegment, silence -from transformers import pipeline -from vocos import Vocos - -from model import CFM -from model.utils import ( - load_checkpoint, - get_tokenizer, - convert_char_to_pinyin, -) - - -device = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu" - -vocos = Vocos.from_pretrained("charactr/vocos-mel-24khz") - - -# ----------------------------------------- - -target_sample_rate = 24000 -n_mel_channels = 100 -hop_length = 256 -target_rms = 0.1 -cross_fade_duration = 0.15 -ode_method = "euler" -nfe_step = 32 # 16, 32 -cfg_strength = 2.0 -sway_sampling_coef = -1.0 -speed = 1.0 -fix_duration = None - -# ----------------------------------------- - - -# chunk text into smaller pieces - - -def chunk_text(text, max_chars=135): - """ - Splits the input text into chunks, each with a maximum number of characters. - - Args: - text (str): The text to be split. - max_chars (int): The maximum number of characters per chunk. - - Returns: - List[str]: A list of text chunks. - """ - chunks = [] - current_chunk = "" - # Split the text into sentences based on punctuation followed by whitespace - sentences = re.split(r"(?<=[;:,.!?])\s+|(?<=[;:,。!?])", text) - - for sentence in sentences: - if len(current_chunk.encode("utf-8")) + len(sentence.encode("utf-8")) <= max_chars: - current_chunk += sentence + " " if sentence and len(sentence[-1].encode("utf-8")) == 1 else sentence - else: - if current_chunk: - chunks.append(current_chunk.strip()) - current_chunk = sentence + " " if sentence and len(sentence[-1].encode("utf-8")) == 1 else sentence - - if current_chunk: - chunks.append(current_chunk.strip()) - - return chunks - - -# load vocoder -def load_vocoder(is_local=False, local_path="", device=device): - if is_local: - print(f"Load vocos from local path {local_path}") - vocos = Vocos.from_hparams(f"{local_path}/config.yaml") - state_dict = torch.load(f"{local_path}/pytorch_model.bin", map_location=device) - vocos.load_state_dict(state_dict) - vocos.eval() - else: - print("Download Vocos from huggingface charactr/vocos-mel-24khz") - vocos = Vocos.from_pretrained("charactr/vocos-mel-24khz") - return vocos - - -# load asr pipeline - -asr_pipe = None - - -def initialize_asr_pipeline(device=device): - global asr_pipe - asr_pipe = pipeline( - "automatic-speech-recognition", - model="openai/whisper-large-v3-turbo", - torch_dtype=torch.float16, - device=device, - ) - - -# load model for inference - - -def load_model(model_cls, model_cfg, ckpt_path, vocab_file="", ode_method=ode_method, use_ema=True, device=device): - if vocab_file == "": - vocab_file = "Emilia_ZH_EN" - tokenizer = "pinyin" - else: - tokenizer = "custom" - - print("\nvocab : ", vocab_file) - print("tokenizer : ", tokenizer) - print("model : ", ckpt_path, "\n") - - vocab_char_map, vocab_size = get_tokenizer(vocab_file, tokenizer) - model = CFM( - transformer=model_cls(**model_cfg, text_num_embeds=vocab_size, mel_dim=n_mel_channels), - mel_spec_kwargs=dict( - target_sample_rate=target_sample_rate, - n_mel_channels=n_mel_channels, - hop_length=hop_length, - ), - odeint_kwargs=dict( - method=ode_method, - ), - vocab_char_map=vocab_char_map, - ).to(device) - - model = load_checkpoint(model, ckpt_path, device, use_ema=use_ema) - - return model - - -# preprocess reference audio and text - - -def preprocess_ref_audio_text(ref_audio_orig, ref_text, show_info=print, device=device): - show_info("Converting audio...") - with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f: - aseg = AudioSegment.from_file(ref_audio_orig) - - non_silent_segs = silence.split_on_silence(aseg, min_silence_len=1000, silence_thresh=-50, keep_silence=1000) - non_silent_wave = AudioSegment.silent(duration=0) - for non_silent_seg in non_silent_segs: - non_silent_wave += non_silent_seg - aseg = non_silent_wave - - audio_duration = len(aseg) - if audio_duration > 15000: - show_info("Audio is over 15s, clipping to only first 15s.") - aseg = aseg[:15000] - aseg.export(f.name, format="wav") - ref_audio = f.name - - if not ref_text.strip(): - global asr_pipe - if asr_pipe is None: - initialize_asr_pipeline(device=device) - show_info("No reference text provided, transcribing reference audio...") - ref_text = asr_pipe( - ref_audio, - chunk_length_s=30, - batch_size=128, - generate_kwargs={"task": "transcribe"}, - return_timestamps=False, - )["text"].strip() - show_info("Finished transcription") - else: - show_info("Using custom reference text...") - - # Add the functionality to ensure it ends with ". " - if not ref_text.endswith(". ") and not ref_text.endswith("。"): - if ref_text.endswith("."): - ref_text += " " - else: - ref_text += ". " - - return ref_audio, ref_text - - -# infer process: chunk text -> infer batches [i.e. infer_batch_process()] - - -def infer_process( - ref_audio, - ref_text, - gen_text, - model_obj, - show_info=print, - progress=tqdm, - target_rms=target_rms, - cross_fade_duration=cross_fade_duration, - nfe_step=nfe_step, - cfg_strength=cfg_strength, - sway_sampling_coef=sway_sampling_coef, - speed=speed, - fix_duration=fix_duration, - device=device, -): - # Split the input text into batches - audio, sr = torchaudio.load(ref_audio) - max_chars = int(len(ref_text.encode("utf-8")) / (audio.shape[-1] / sr) * (25 - audio.shape[-1] / sr)) - gen_text_batches = chunk_text(gen_text, max_chars=max_chars) - for i, gen_text in enumerate(gen_text_batches): - print(f"gen_text {i}", gen_text) - - show_info(f"Generating audio in {len(gen_text_batches)} batches...") - return infer_batch_process( - (audio, sr), - ref_text, - gen_text_batches, - model_obj, - progress=progress, - target_rms=target_rms, - cross_fade_duration=cross_fade_duration, - nfe_step=nfe_step, - cfg_strength=cfg_strength, - sway_sampling_coef=sway_sampling_coef, - speed=speed, - fix_duration=fix_duration, - device=device, - ) - - -# infer batches - - -def infer_batch_process( - ref_audio, - ref_text, - gen_text_batches, - model_obj, - progress=tqdm, - target_rms=0.1, - cross_fade_duration=0.15, - nfe_step=32, - cfg_strength=2.0, - sway_sampling_coef=-1, - speed=1, - fix_duration=None, - device=None, -): - audio, sr = ref_audio - if audio.shape[0] > 1: - audio = torch.mean(audio, dim=0, keepdim=True) - - rms = torch.sqrt(torch.mean(torch.square(audio))) - if rms < target_rms: - audio = audio * target_rms / rms - if sr != target_sample_rate: - resampler = torchaudio.transforms.Resample(sr, target_sample_rate) - audio = resampler(audio) - audio = audio.to(device) - - generated_waves = [] - spectrograms = [] - - if len(ref_text[-1].encode("utf-8")) == 1: - ref_text = ref_text + " " - for i, gen_text in enumerate(progress.tqdm(gen_text_batches)): - # Prepare the text - text_list = [ref_text + gen_text] - final_text_list = convert_char_to_pinyin(text_list) - - ref_audio_len = audio.shape[-1] // hop_length - if fix_duration is not None: - duration = int(fix_duration * target_sample_rate / hop_length) - else: - # Calculate duration - ref_text_len = len(ref_text.encode("utf-8")) - gen_text_len = len(gen_text.encode("utf-8")) - duration = ref_audio_len + int(ref_audio_len / ref_text_len * gen_text_len / speed) - - # inference - with torch.inference_mode(): - generated, _ = model_obj.sample( - cond=audio, - text=final_text_list, - duration=duration, - steps=nfe_step, - cfg_strength=cfg_strength, - sway_sampling_coef=sway_sampling_coef, - ) - - generated = generated.to(torch.float32) - generated = generated[:, ref_audio_len:, :] - generated_mel_spec = generated.permute(0, 2, 1) - generated_wave = vocos.decode(generated_mel_spec.cpu()) - if rms < target_rms: - generated_wave = generated_wave * rms / target_rms - - # wav -> numpy - generated_wave = generated_wave.squeeze().cpu().numpy() - - generated_waves.append(generated_wave) - spectrograms.append(generated_mel_spec[0].cpu().numpy()) - - # Combine all generated waves with cross-fading - if cross_fade_duration <= 0: - # Simply concatenate - final_wave = np.concatenate(generated_waves) - else: - final_wave = generated_waves[0] - for i in range(1, len(generated_waves)): - prev_wave = final_wave - next_wave = generated_waves[i] - - # Calculate cross-fade samples, ensuring it does not exceed wave lengths - cross_fade_samples = int(cross_fade_duration * target_sample_rate) - cross_fade_samples = min(cross_fade_samples, len(prev_wave), len(next_wave)) - - if cross_fade_samples <= 0: - # No overlap possible, concatenate - final_wave = np.concatenate([prev_wave, next_wave]) - continue - - # Overlapping parts - prev_overlap = prev_wave[-cross_fade_samples:] - next_overlap = next_wave[:cross_fade_samples] - - # Fade out and fade in - fade_out = np.linspace(1, 0, cross_fade_samples) - fade_in = np.linspace(0, 1, cross_fade_samples) - - # Cross-faded overlap - cross_faded_overlap = prev_overlap * fade_out + next_overlap * fade_in - - # Combine - new_wave = np.concatenate( - [prev_wave[:-cross_fade_samples], cross_faded_overlap, next_wave[cross_fade_samples:]] - ) - - final_wave = new_wave - - # Create a combined spectrogram - combined_spectrogram = np.concatenate(spectrograms, axis=1) - - return final_wave, target_sample_rate, combined_spectrogram - - -# remove silence from generated wav - - -def remove_silence_for_generated_wav(filename): - aseg = AudioSegment.from_file(filename) - non_silent_segs = silence.split_on_silence(aseg, min_silence_len=1000, silence_thresh=-50, keep_silence=500) - non_silent_wave = AudioSegment.silent(duration=0) - for non_silent_seg in non_silent_segs: - non_silent_wave += non_silent_seg - aseg = non_silent_wave - aseg.export(filename, format="wav") diff --git a/packages.txt b/packages.txt new file mode 100644 index 0000000000000000000000000000000000000000..a9f1eea092d5e971b5475b82ee835cec7f196bad --- /dev/null +++ b/packages.txt @@ -0,0 +1 @@ +ffmpeg \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index c7c3a05fb3f6b608abba5d5b17de083429f63945..0000000000000000000000000000000000000000 --- a/pyproject.toml +++ /dev/null @@ -1,62 +0,0 @@ -[build-system] -requires = ["setuptools >= 61.0", "setuptools-scm>=8.0"] -build-backend = "setuptools.build_meta" - -[project] -name = "f5-tts" -version = "0.2.1" -description = "F5-TTS: A Fairytaler that Fakes Fluent and Faithful Speech with Flow Matching" -readme = "README.md" -license = {text = "MIT License"} -classifiers = [ - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3", -] -dependencies = [ - "accelerate>=0.33.0", - "bitsandbytes>0.37.0; platform_machine != 'arm64' and platform_system != 'Darwin'", - "cached_path", - "click", - "datasets", - "ema_pytorch>=0.5.2", - "gradio>=3.45.2", - "hydra-core>=1.3.0", - "jieba", - "librosa", - "matplotlib", - "numpy<=1.26.4", - "pydub", - "pypinyin", - "safetensors", - "soundfile", - "tomli", - "torch>=2.0.0", - "torchaudio>=2.0.0", - "torchdiffeq", - "tqdm>=4.65.0", - "transformers", - "transformers_stream_generator", - "vocos", - "wandb", - "x_transformers>=1.31.14", -] - -[project.optional-dependencies] -eval = [ - "faster_whisper==0.10.1", - "funasr", - "jiwer", - "modelscope", - "zhconv", - "zhon", -] - -[project.urls] -Homepage = "https://github.com/SWivid/F5-TTS" - -[project.scripts] -"f5-tts_infer-cli" = "f5_tts.infer.infer_cli:main" -"f5-tts_infer-gradio" = "f5_tts.infer.infer_gradio:main" -"f5-tts_finetune-cli" = "f5_tts.train.finetune_cli:main" -"f5-tts_finetune-gradio" = "f5_tts.train.finetune_gradio:main" diff --git a/requirements.txt b/requirements.txt index 9bc2b9171c8fd76f604ab2adbc505d0c314fc208..debc498b1031a85c51f88ffa966c768c2f8e86a3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,9 @@ -torch -torchaudio accelerate>=0.33.0 -bitsandbytes>0.37.0 cached_path click datasets +einops>=0.8.0 +einx>=0.3.0 ema_pytorch>=0.5.2 gradio jieba @@ -22,5 +21,3 @@ transformers vocos wandb x_transformers>=1.31.14 -f5_tts @ git+https://huggingface.co/spaces/mrfakename/E2-F5-TTS -detoxify @ git+https://github.com/unitaryai/detoxify \ No newline at end of file diff --git a/ruff.toml b/ruff.toml deleted file mode 100644 index 4c3887643968cf109c507894b69cc41be3a4c430..0000000000000000000000000000000000000000 --- a/ruff.toml +++ /dev/null @@ -1,10 +0,0 @@ -line-length = 120 -target-version = "py310" - -[lint] -# Only ignore variables with names starting with "_". -dummy-variable-rgx = "^_.*$" - -[lint.isort] -force-single-line = true -lines-after-imports = 2 diff --git a/scripts/count_max_epoch.py b/scripts/count_max_epoch.py index 7cd7332dfdc66b1c20bed369aaa6c6bec8c8e0cc..2a4f3e7cf7a4042fa98f167907af9462c01f5398 100644 --- a/scripts/count_max_epoch.py +++ b/scripts/count_max_epoch.py @@ -1,7 +1,6 @@ -"""ADAPTIVE BATCH SIZE""" - -print("Adaptive batch size: using grouping batch sampler, frames_per_gpu fixed fed in") -print(" -> least padding, gather wavs with accumulated frames in a batch\n") +'''ADAPTIVE BATCH SIZE''' +print('Adaptive batch size: using grouping batch sampler, frames_per_gpu fixed fed in') +print(' -> least padding, gather wavs with accumulated frames in a batch\n') # data total_hours = 95282 diff --git a/scripts/count_params_gflops.py b/scripts/count_params_gflops.py index 7fc493a8d5eb3827fa6af3fe55ebcaae4ee626c7..737c6dcefa65d3392cbf5361179119a1612f8ba4 100644 --- a/scripts/count_params_gflops.py +++ b/scripts/count_params_gflops.py @@ -1,15 +1,13 @@ -import sys -import os - +import sys, os sys.path.append(os.getcwd()) -from model import M2_TTS, DiT +from model import M2_TTS, UNetT, DiT, MMDiT import torch import thop -""" ~155M """ +''' ~155M ''' # transformer = UNetT(dim = 768, depth = 20, heads = 12, ff_mult = 4) # transformer = UNetT(dim = 768, depth = 20, heads = 12, ff_mult = 4, text_dim = 512, conv_layers = 4) # transformer = DiT(dim = 768, depth = 18, heads = 12, ff_mult = 2) @@ -17,11 +15,11 @@ import thop # transformer = DiT(dim = 768, depth = 18, heads = 12, ff_mult = 2, text_dim = 512, conv_layers = 4, long_skip_connection = True) # transformer = MMDiT(dim = 512, depth = 16, heads = 16, ff_mult = 2) -""" ~335M """ +''' ~335M ''' # FLOPs: 622.1 G, Params: 333.2 M # transformer = UNetT(dim = 1024, depth = 24, heads = 16, ff_mult = 4) # FLOPs: 363.4 G, Params: 335.8 M -transformer = DiT(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4) +transformer = DiT(dim = 1024, depth = 22, heads = 16, ff_mult = 2, text_dim = 512, conv_layers = 4) model = M2_TTS(transformer=transformer) @@ -32,8 +30,6 @@ duration = 20 frame_length = int(duration * target_sample_rate / hop_length) text_length = 150 -flops, params = thop.profile( - model, inputs=(torch.randn(1, frame_length, n_mel_channels), torch.zeros(1, text_length, dtype=torch.long)) -) +flops, params = thop.profile(model, inputs=(torch.randn(1, frame_length, n_mel_channels), torch.zeros(1, text_length, dtype=torch.long))) print(f"FLOPs: {flops / 1e9} G") print(f"Params: {params / 1e6} M") diff --git a/scripts/eval_infer_batch.py b/scripts/eval_infer_batch.py index 3ca4a2809322454dfbd2c8029a308bcc8416bd86..d13cc20283a9e4ca5dfe4296e0054510034e175e 100644 --- a/scripts/eval_infer_batch.py +++ b/scripts/eval_infer_batch.py @@ -1,6 +1,4 @@ -import sys -import os - +import sys, os sys.path.append(os.getcwd()) import time @@ -11,14 +9,15 @@ import argparse import torch import torchaudio from accelerate import Accelerator +from einops import rearrange from vocos import Vocos from model import CFM, UNetT, DiT from model.utils import ( load_checkpoint, - get_tokenizer, - get_seedtts_testset_metainfo, - get_librispeech_test_clean_metainfo, + get_tokenizer, + get_seedtts_testset_metainfo, + get_librispeech_test_clean_metainfo, get_inference_prompt, ) @@ -40,16 +39,16 @@ tokenizer = "pinyin" parser = argparse.ArgumentParser(description="batch inference") -parser.add_argument("-s", "--seed", default=None, type=int) -parser.add_argument("-d", "--dataset", default="Emilia_ZH_EN") -parser.add_argument("-n", "--expname", required=True) -parser.add_argument("-c", "--ckptstep", default=1200000, type=int) +parser.add_argument('-s', '--seed', default=None, type=int) +parser.add_argument('-d', '--dataset', default="Emilia_ZH_EN") +parser.add_argument('-n', '--expname', required=True) +parser.add_argument('-c', '--ckptstep', default=1200000, type=int) -parser.add_argument("-nfe", "--nfestep", default=32, type=int) -parser.add_argument("-o", "--odemethod", default="euler") -parser.add_argument("-ss", "--swaysampling", default=-1, type=float) +parser.add_argument('-nfe', '--nfestep', default=32, type=int) +parser.add_argument('-o', '--odemethod', default="euler") +parser.add_argument('-ss', '--swaysampling', default=-1, type=float) -parser.add_argument("-t", "--testset", required=True) +parser.add_argument('-t', '--testset', required=True) args = parser.parse_args() @@ -68,26 +67,26 @@ testset = args.testset infer_batch_size = 1 # max frames. 1 for ddp single inference (recommended) -cfg_strength = 2.0 -speed = 1.0 +cfg_strength = 2. +speed = 1. use_truth_duration = False no_ref_audio = False if exp_name == "F5TTS_Base": model_cls = DiT - model_cfg = dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4) + model_cfg = dict(dim = 1024, depth = 22, heads = 16, ff_mult = 2, text_dim = 512, conv_layers = 4) elif exp_name == "E2TTS_Base": model_cls = UNetT - model_cfg = dict(dim=1024, depth=24, heads=16, ff_mult=4) + model_cfg = dict(dim = 1024, depth = 24, heads = 16, ff_mult = 4) if testset == "ls_pc_test_clean": metalst = "data/librispeech_pc_test_clean_cross_sentence.lst" librispeech_test_clean_path = "/LibriSpeech/test-clean" # test-clean path metainfo = get_librispeech_test_clean_metainfo(metalst, librispeech_test_clean_path) - + elif testset == "seedtts_test_zh": metalst = "data/seedtts_testset/zh/meta.lst" metainfo = get_seedtts_testset_metainfo(metalst) @@ -98,16 +97,13 @@ elif testset == "seedtts_test_en": # path to save genereted wavs -if seed is None: - seed = random.randint(-10000, 10000) -output_dir = ( - f"results/{exp_name}_{ckpt_step}/{testset}/" - f"seed{seed}_{ode_method}_nfe{nfe_step}" - f"{f'_ss{sway_sampling_coef}' if sway_sampling_coef else ''}" - f"_cfg{cfg_strength}_speed{speed}" - f"{'_gt-dur' if use_truth_duration else ''}" +if seed is None: seed = random.randint(-10000, 10000) +output_dir = f"results/{exp_name}_{ckpt_step}/{testset}/" \ + f"seed{seed}_{ode_method}_nfe{nfe_step}" \ + f"{f'_ss{sway_sampling_coef}' if sway_sampling_coef else ''}" \ + f"_cfg{cfg_strength}_speed{speed}" \ + f"{'_gt-dur' if use_truth_duration else ''}" \ f"{'_no-ref-audio' if no_ref_audio else ''}" -) # -------------------------------------------------# @@ -115,15 +111,15 @@ output_dir = ( use_ema = True prompts_all = get_inference_prompt( - metainfo, - speed=speed, - tokenizer=tokenizer, - target_sample_rate=target_sample_rate, - n_mel_channels=n_mel_channels, - hop_length=hop_length, - target_rms=target_rms, - use_truth_duration=use_truth_duration, - infer_batch_size=infer_batch_size, + metainfo, + speed = speed, + tokenizer = tokenizer, + target_sample_rate = target_sample_rate, + n_mel_channels = n_mel_channels, + hop_length = hop_length, + target_rms = target_rms, + use_truth_duration = use_truth_duration, + infer_batch_size = infer_batch_size, ) # Vocoder model @@ -142,19 +138,23 @@ vocab_char_map, vocab_size = get_tokenizer(dataset_name, tokenizer) # Model model = CFM( - transformer=model_cls(**model_cfg, text_num_embeds=vocab_size, mel_dim=n_mel_channels), - mel_spec_kwargs=dict( - target_sample_rate=target_sample_rate, - n_mel_channels=n_mel_channels, - hop_length=hop_length, + transformer = model_cls( + **model_cfg, + text_num_embeds = vocab_size, + mel_dim = n_mel_channels ), - odeint_kwargs=dict( - method=ode_method, + mel_spec_kwargs = dict( + target_sample_rate = target_sample_rate, + n_mel_channels = n_mel_channels, + hop_length = hop_length, ), - vocab_char_map=vocab_char_map, + odeint_kwargs = dict( + method = ode_method, + ), + vocab_char_map = vocab_char_map, ).to(device) -model = load_checkpoint(model, ckpt_path, device, use_ema=use_ema) +model = load_checkpoint(model, ckpt_path, device, use_ema = use_ema) if not os.path.exists(output_dir) and accelerator.is_main_process: os.makedirs(output_dir) @@ -164,29 +164,30 @@ accelerator.wait_for_everyone() start = time.time() with accelerator.split_between_processes(prompts_all) as prompts: + for prompt in tqdm(prompts, disable=not accelerator.is_local_main_process): utts, ref_rms_list, ref_mels, ref_mel_lens, total_mel_lens, final_text_list = prompt ref_mels = ref_mels.to(device) - ref_mel_lens = torch.tensor(ref_mel_lens, dtype=torch.long).to(device) - total_mel_lens = torch.tensor(total_mel_lens, dtype=torch.long).to(device) - + ref_mel_lens = torch.tensor(ref_mel_lens, dtype = torch.long).to(device) + total_mel_lens = torch.tensor(total_mel_lens, dtype = torch.long).to(device) + # Inference with torch.inference_mode(): generated, _ = model.sample( - cond=ref_mels, - text=final_text_list, - duration=total_mel_lens, - lens=ref_mel_lens, - steps=nfe_step, - cfg_strength=cfg_strength, - sway_sampling_coef=sway_sampling_coef, - no_ref_audio=no_ref_audio, - seed=seed, + cond = ref_mels, + text = final_text_list, + duration = total_mel_lens, + lens = ref_mel_lens, + steps = nfe_step, + cfg_strength = cfg_strength, + sway_sampling_coef = sway_sampling_coef, + no_ref_audio = no_ref_audio, + seed = seed, ) # Final result for i, gen in enumerate(generated): - gen = gen[ref_mel_lens[i] : total_mel_lens[i], :].unsqueeze(0) - gen_mel_spec = gen.permute(0, 2, 1) + gen = gen[ref_mel_lens[i]:total_mel_lens[i], :].unsqueeze(0) + gen_mel_spec = rearrange(gen, '1 n d -> 1 d n') generated_wave = vocos.decode(gen_mel_spec.cpu()) if ref_rms_list[i] < target_rms: generated_wave = generated_wave * ref_rms_list[i] / target_rms diff --git a/scripts/eval_librispeech_test_clean.py b/scripts/eval_librispeech_test_clean.py index a1ce8b7b36f79392dd2ab91c8909766d70fadf7f..2f5820f7a87913002196d3539b115d3ed3b61f5c 100644 --- a/scripts/eval_librispeech_test_clean.py +++ b/scripts/eval_librispeech_test_clean.py @@ -1,8 +1,6 @@ # Evaluate with Librispeech test-clean, ~3s prompt to generate 4-10s audio (the way of valle/voicebox evaluation) -import sys -import os - +import sys, os sys.path.append(os.getcwd()) import multiprocessing as mp @@ -21,7 +19,7 @@ metalst = "data/librispeech_pc_test_clean_cross_sentence.lst" librispeech_test_clean_path = "/LibriSpeech/test-clean" # test-clean path gen_wav_dir = "PATH_TO_GENERATED" # generated wavs -gpus = [0, 1, 2, 3, 4, 5, 6, 7] +gpus = [0,1,2,3,4,5,6,7] test_set = get_librispeech_test(metalst, gen_wav_dir, gpus, librispeech_test_clean_path) ## In LibriSpeech, some speakers utilized varying voice characteristics for different characters in the book, @@ -48,7 +46,7 @@ if eval_task == "wer": for wers_ in results: wers.extend(wers_) - wer = round(np.mean(wers) * 100, 3) + wer = round(np.mean(wers)*100, 3) print(f"\nTotal {len(wers)} samples") print(f"WER : {wer}%") @@ -64,6 +62,6 @@ if eval_task == "sim": for sim_ in results: sim_list.extend(sim_) - sim = round(sum(sim_list) / len(sim_list), 3) + sim = round(sum(sim_list)/len(sim_list), 3) print(f"\nTotal {len(sim_list)} samples") print(f"SIM : {sim}") diff --git a/scripts/eval_seedtts_testset.py b/scripts/eval_seedtts_testset.py index e70534e11165cc56bb3663dd5205aa792af61934..c50bd501dd7fdf820a1da88aaefc71515d8b0054 100644 --- a/scripts/eval_seedtts_testset.py +++ b/scripts/eval_seedtts_testset.py @@ -1,8 +1,6 @@ # Evaluate with Seed-TTS testset -import sys -import os - +import sys, os sys.path.append(os.getcwd()) import multiprocessing as mp @@ -16,21 +14,21 @@ from model.utils import ( eval_task = "wer" # sim | wer -lang = "zh" # zh | en +lang = "zh" # zh | en metalst = f"data/seedtts_testset/{lang}/meta.lst" # seed-tts testset # gen_wav_dir = f"data/seedtts_testset/{lang}/wavs" # ground truth wavs -gen_wav_dir = "PATH_TO_GENERATED" # generated wavs +gen_wav_dir = f"PATH_TO_GENERATED" # generated wavs # NOTE. paraformer-zh result will be slightly different according to the number of gpus, cuz batchsize is different -# zh 1.254 seems a result of 4 workers wer_seed_tts -gpus = [0, 1, 2, 3, 4, 5, 6, 7] +# zh 1.254 seems a result of 4 workers wer_seed_tts +gpus = [0,1,2,3,4,5,6,7] test_set = get_seed_tts_test(metalst, gen_wav_dir, gpus) local = False if local: # use local custom checkpoint dir if lang == "zh": - asr_ckpt_dir = "../checkpoints/funasr" # paraformer-zh dir under funasr + asr_ckpt_dir = "../checkpoints/funasr" # paraformer-zh dir under funasr elif lang == "en": asr_ckpt_dir = "../checkpoints/Systran/faster-whisper-large-v3" else: @@ -50,7 +48,7 @@ if eval_task == "wer": for wers_ in results: wers.extend(wers_) - wer = round(np.mean(wers) * 100, 3) + wer = round(np.mean(wers)*100, 3) print(f"\nTotal {len(wers)} samples") print(f"WER : {wer}%") @@ -66,6 +64,6 @@ if eval_task == "sim": for sim_ in results: sim_list.extend(sim_) - sim = round(sum(sim_list) / len(sim_list), 3) + sim = round(sum(sim_list)/len(sim_list), 3) print(f"\nTotal {len(sim_list)} samples") print(f"SIM : {sim}") diff --git a/scripts/prepare_csv_wavs.py b/scripts/prepare_csv_wavs.py index 6e56774dcb9cb33f27964c48fbb877eeea08f01a..59dbaf2116050c90d4a600701170a2c55fc2efe8 100644 --- a/scripts/prepare_csv_wavs.py +++ b/scripts/prepare_csv_wavs.py @@ -1,6 +1,4 @@ -import sys -import os - +import sys, os sys.path.append(os.getcwd()) from pathlib import Path @@ -19,11 +17,10 @@ from model.utils import ( PRETRAINED_VOCAB_PATH = Path(__file__).parent.parent / "data/Emilia_ZH_EN_pinyin/vocab.txt" - def is_csv_wavs_format(input_dataset_dir): fpath = Path(input_dataset_dir) metadata = fpath / "metadata.csv" - wavs = fpath / "wavs" + wavs = fpath / 'wavs' return metadata.exists() and metadata.is_file() and wavs.exists() and wavs.is_dir() @@ -49,24 +46,22 @@ def prepare_csv_wavs_dir(input_dir): return sub_result, durations, vocab_set - def get_audio_duration(audio_path): audio, sample_rate = torchaudio.load(audio_path) num_channels = audio.shape[0] return audio.shape[1] / (sample_rate * num_channels) - def read_audio_text_pairs(csv_file_path): audio_text_pairs = [] parent = Path(csv_file_path).parent - with open(csv_file_path, mode="r", newline="", encoding="utf-8") as csvfile: - reader = csv.reader(csvfile, delimiter="|") + with open(csv_file_path, mode='r', newline='', encoding='utf-8') as csvfile: + reader = csv.reader(csvfile, delimiter='|') next(reader) # Skip the header row for row in reader: if len(row) >= 2: audio_file = row[0].strip() # First column: audio file path - text = row[1].strip() # Second column: text + text = row[1].strip() # Second column: text audio_file_path = parent / audio_file audio_text_pairs.append((audio_file_path.as_posix(), text)) @@ -83,12 +78,12 @@ def save_prepped_dataset(out_dir, result, duration_list, text_vocab_set, is_fine # dataset.save_to_disk(f"data/{dataset_name}/raw", max_shard_size="2GB") raw_arrow_path = out_dir / "raw.arrow" with ArrowWriter(path=raw_arrow_path.as_posix(), writer_batch_size=1) as writer: - for line in tqdm(result, desc="Writing to raw.arrow ..."): + for line in tqdm(result, desc=f"Writing to raw.arrow ..."): writer.write(line) # dup a json separately saving duration in case for DynamicBatchSampler ease dur_json_path = out_dir / "duration.json" - with open(dur_json_path.as_posix(), "w", encoding="utf-8") as f: + with open(dur_json_path.as_posix(), 'w', encoding='utf-8') as f: json.dump({"duration": duration_list}, f, ensure_ascii=False) # vocab map, i.e. tokenizer @@ -125,14 +120,13 @@ def cli(): # finetune: python scripts/prepare_csv_wavs.py /path/to/input_dir /path/to/output_dir_pinyin # pretrain: python scripts/prepare_csv_wavs.py /path/to/output_dir_pinyin --pretrain parser = argparse.ArgumentParser(description="Prepare and save dataset.") - parser.add_argument("inp_dir", type=str, help="Input directory containing the data.") - parser.add_argument("out_dir", type=str, help="Output directory to save the prepared data.") - parser.add_argument("--pretrain", action="store_true", help="Enable for new pretrain, otherwise is a fine-tune") + parser.add_argument('inp_dir', type=str, help="Input directory containing the data.") + parser.add_argument('out_dir', type=str, help="Output directory to save the prepared data.") + parser.add_argument('--pretrain', action='store_true', help="Enable for new pretrain, otherwise is a fine-tune") args = parser.parse_args() prepare_and_save_set(args.inp_dir, args.out_dir, is_finetune=not args.pretrain) - if __name__ == "__main__": cli() diff --git a/scripts/prepare_emilia.py b/scripts/prepare_emilia.py index 6461f30ac4904904e397fe57b8cde495976de554..f268e724382c02a86a3233f8ad62ed4acf391793 100644 --- a/scripts/prepare_emilia.py +++ b/scripts/prepare_emilia.py @@ -4,9 +4,7 @@ # generate audio text map for Emilia ZH & EN # evaluate for vocab size -import sys -import os - +import sys, os sys.path.append(os.getcwd()) from pathlib import Path @@ -14,6 +12,7 @@ import json from tqdm import tqdm from concurrent.futures import ProcessPoolExecutor +from datasets import Dataset from datasets.arrow_writer import ArrowWriter from model.utils import ( @@ -22,89 +21,13 @@ from model.utils import ( ) -out_zh = { - "ZH_B00041_S06226", - "ZH_B00042_S09204", - "ZH_B00065_S09430", - "ZH_B00065_S09431", - "ZH_B00066_S09327", - "ZH_B00066_S09328", -} +out_zh = {"ZH_B00041_S06226", "ZH_B00042_S09204", "ZH_B00065_S09430", "ZH_B00065_S09431", "ZH_B00066_S09327", "ZH_B00066_S09328"} zh_filters = ["い", "て"] # seems synthesized audios, or heavily code-switched out_en = { - "EN_B00013_S00913", - "EN_B00042_S00120", - "EN_B00055_S04111", - "EN_B00061_S00693", - "EN_B00061_S01494", - "EN_B00061_S03375", - "EN_B00059_S00092", - "EN_B00111_S04300", - "EN_B00100_S03759", - "EN_B00087_S03811", - "EN_B00059_S00950", - "EN_B00089_S00946", - "EN_B00078_S05127", - "EN_B00070_S04089", - "EN_B00074_S09659", - "EN_B00061_S06983", - "EN_B00061_S07060", - "EN_B00059_S08397", - "EN_B00082_S06192", - "EN_B00091_S01238", - "EN_B00089_S07349", - "EN_B00070_S04343", - "EN_B00061_S02400", - "EN_B00076_S01262", - "EN_B00068_S06467", - "EN_B00076_S02943", - "EN_B00064_S05954", - "EN_B00061_S05386", - "EN_B00066_S06544", - "EN_B00076_S06944", - "EN_B00072_S08620", - "EN_B00076_S07135", - "EN_B00076_S09127", - "EN_B00065_S00497", - "EN_B00059_S06227", - "EN_B00063_S02859", - "EN_B00075_S01547", - "EN_B00061_S08286", - "EN_B00079_S02901", - "EN_B00092_S03643", - "EN_B00096_S08653", - "EN_B00063_S04297", - "EN_B00063_S04614", - "EN_B00079_S04698", - "EN_B00104_S01666", - "EN_B00061_S09504", - "EN_B00061_S09694", - "EN_B00065_S05444", - "EN_B00063_S06860", - "EN_B00065_S05725", - "EN_B00069_S07628", - "EN_B00083_S03875", - "EN_B00071_S07665", - "EN_B00071_S07665", - "EN_B00062_S04187", - "EN_B00065_S09873", - "EN_B00065_S09922", - "EN_B00084_S02463", - "EN_B00067_S05066", - "EN_B00106_S08060", - "EN_B00073_S06399", - "EN_B00073_S09236", - "EN_B00087_S00432", - "EN_B00085_S05618", - "EN_B00064_S01262", - "EN_B00072_S01739", - "EN_B00059_S03913", - "EN_B00069_S04036", - "EN_B00067_S05623", - "EN_B00060_S05389", - "EN_B00060_S07290", - "EN_B00062_S08995", + "EN_B00013_S00913", "EN_B00042_S00120", "EN_B00055_S04111", "EN_B00061_S00693", "EN_B00061_S01494", "EN_B00061_S03375", + + "EN_B00059_S00092", "EN_B00111_S04300", "EN_B00100_S03759", "EN_B00087_S03811", "EN_B00059_S00950", "EN_B00089_S00946", "EN_B00078_S05127", "EN_B00070_S04089", "EN_B00074_S09659", "EN_B00061_S06983", "EN_B00061_S07060", "EN_B00059_S08397", "EN_B00082_S06192", "EN_B00091_S01238", "EN_B00089_S07349", "EN_B00070_S04343", "EN_B00061_S02400", "EN_B00076_S01262", "EN_B00068_S06467", "EN_B00076_S02943", "EN_B00064_S05954", "EN_B00061_S05386", "EN_B00066_S06544", "EN_B00076_S06944", "EN_B00072_S08620", "EN_B00076_S07135", "EN_B00076_S09127", "EN_B00065_S00497", "EN_B00059_S06227", "EN_B00063_S02859", "EN_B00075_S01547", "EN_B00061_S08286", "EN_B00079_S02901", "EN_B00092_S03643", "EN_B00096_S08653", "EN_B00063_S04297", "EN_B00063_S04614", "EN_B00079_S04698", "EN_B00104_S01666", "EN_B00061_S09504", "EN_B00061_S09694", "EN_B00065_S05444", "EN_B00063_S06860", "EN_B00065_S05725", "EN_B00069_S07628", "EN_B00083_S03875", "EN_B00071_S07665", "EN_B00071_S07665", "EN_B00062_S04187", "EN_B00065_S09873", "EN_B00065_S09922", "EN_B00084_S02463", "EN_B00067_S05066", "EN_B00106_S08060", "EN_B00073_S06399", "EN_B00073_S09236", "EN_B00087_S00432", "EN_B00085_S05618", "EN_B00064_S01262", "EN_B00072_S01739", "EN_B00059_S03913", "EN_B00069_S04036", "EN_B00067_S05623", "EN_B00060_S05389", "EN_B00060_S07290", "EN_B00062_S08995", } en_filters = ["ا", "い", "て"] @@ -120,24 +43,18 @@ def deal_with_audio_dir(audio_dir): for line in tqdm(lines, desc=f"{audio_jsonl.stem}"): obj = json.loads(line) text = obj["text"] - if obj["language"] == "zh": + if obj['language'] == "zh": if obj["wav"].split("/")[1] in out_zh or any(f in text for f in zh_filters) or repetition_found(text): bad_case_zh += 1 continue else: - text = text.translate( - str.maketrans({",": ",", "!": "!", "?": "?"}) - ) # not "。" cuz much code-switched - if obj["language"] == "en": - if ( - obj["wav"].split("/")[1] in out_en - or any(f in text for f in en_filters) - or repetition_found(text, length=4) - ): + text = text.translate(str.maketrans({',': ',', '!': '!', '?': '?'})) # not "。" cuz much code-switched + if obj['language'] == "en": + if obj["wav"].split("/")[1] in out_en or any(f in text for f in en_filters) or repetition_found(text, length=4): bad_case_en += 1 continue if tokenizer == "pinyin": - text = convert_char_to_pinyin([text], polyphone=polyphone)[0] + text = convert_char_to_pinyin([text], polyphone = polyphone)[0] duration = obj["duration"] sub_result.append({"audio_path": str(audio_dir.parent / obj["wav"]), "text": text, "duration": duration}) durations.append(duration) @@ -179,11 +96,11 @@ def main(): # dataset = Dataset.from_dict({"audio_path": audio_path_list, "text": text_list, "duration": duration_list}) # oom # dataset.save_to_disk(f"data/{dataset_name}/raw", max_shard_size="2GB") with ArrowWriter(path=f"data/{dataset_name}/raw.arrow") as writer: - for line in tqdm(result, desc="Writing to raw.arrow ..."): + for line in tqdm(result, desc=f"Writing to raw.arrow ..."): writer.write(line) # dup a json separately saving duration in case for DynamicBatchSampler ease - with open(f"data/{dataset_name}/duration.json", "w", encoding="utf-8") as f: + with open(f"data/{dataset_name}/duration.json", 'w', encoding='utf-8') as f: json.dump({"duration": duration_list}, f, ensure_ascii=False) # vocab map, i.e. tokenizer @@ -197,13 +114,12 @@ def main(): print(f"\nFor {dataset_name}, sample count: {len(result)}") print(f"For {dataset_name}, vocab size is: {len(text_vocab_set)}") print(f"For {dataset_name}, total {sum(duration_list)/3600:.2f} hours") - if "ZH" in langs: - print(f"Bad zh transcription case: {total_bad_case_zh}") - if "EN" in langs: - print(f"Bad en transcription case: {total_bad_case_en}\n") + if "ZH" in langs: print(f"Bad zh transcription case: {total_bad_case_zh}") + if "EN" in langs: print(f"Bad en transcription case: {total_bad_case_en}\n") if __name__ == "__main__": + max_workers = 32 tokenizer = "pinyin" # "pinyin" | "char" diff --git a/scripts/prepare_wenetspeech4tts.py b/scripts/prepare_wenetspeech4tts.py index 2763fda980caa11eca2d0e7c8f7d11ee6d4a1cb3..0403ad7f08313ccc25b8903b8f8578c8cddc70cb 100644 --- a/scripts/prepare_wenetspeech4tts.py +++ b/scripts/prepare_wenetspeech4tts.py @@ -1,9 +1,7 @@ # generate audio text map for WenetSpeech4TTS # evaluate for vocab size -import sys -import os - +import sys, os sys.path.append(os.getcwd()) import json @@ -25,7 +23,7 @@ def deal_with_sub_path_files(dataset_path, sub_path): audio_paths, texts, durations = [], [], [] for text_file in tqdm(text_files): - with open(os.path.join(text_dir, text_file), "r", encoding="utf-8") as file: + with open(os.path.join(text_dir, text_file), 'r', encoding='utf-8') as file: first_line = file.readline().split("\t") audio_nm = first_line[0] audio_path = os.path.join(audio_dir, audio_nm + ".wav") @@ -34,7 +32,7 @@ def deal_with_sub_path_files(dataset_path, sub_path): audio_paths.append(audio_path) if tokenizer == "pinyin": - texts.extend(convert_char_to_pinyin([text], polyphone=polyphone)) + texts.extend(convert_char_to_pinyin([text], polyphone = polyphone)) elif tokenizer == "char": texts.append(text) @@ -48,7 +46,7 @@ def main(): assert tokenizer in ["pinyin", "char"] audio_path_list, text_list, duration_list = [], [], [] - + executor = ProcessPoolExecutor(max_workers=max_workers) futures = [] for dataset_path in dataset_paths: @@ -70,10 +68,8 @@ def main(): dataset = Dataset.from_dict({"audio_path": audio_path_list, "text": text_list, "duration": duration_list}) dataset.save_to_disk(f"data/{dataset_name}_{tokenizer}/raw", max_shard_size="2GB") # arrow format - with open(f"data/{dataset_name}_{tokenizer}/duration.json", "w", encoding="utf-8") as f: - json.dump( - {"duration": duration_list}, f, ensure_ascii=False - ) # dup a json separately saving duration in case for DynamicBatchSampler ease + with open(f"data/{dataset_name}_{tokenizer}/duration.json", 'w', encoding='utf-8') as f: + json.dump({"duration": duration_list}, f, ensure_ascii=False) # dup a json separately saving duration in case for DynamicBatchSampler ease print("\nEvaluating vocab size (all characters and symbols / all phonemes) ...") text_vocab_set = set() @@ -89,21 +85,22 @@ def main(): f.write(vocab + "\n") print(f"\nFor {dataset_name}, sample count: {len(text_list)}") print(f"For {dataset_name}, vocab size is: {len(text_vocab_set)}\n") - + if __name__ == "__main__": + max_workers = 32 tokenizer = "pinyin" # "pinyin" | "char" polyphone = True dataset_choice = 1 # 1: Premium, 2: Standard, 3: Basic - dataset_name = ["WenetSpeech4TTS_Premium", "WenetSpeech4TTS_Standard", "WenetSpeech4TTS_Basic"][dataset_choice - 1] + dataset_name = ["WenetSpeech4TTS_Premium", "WenetSpeech4TTS_Standard", "WenetSpeech4TTS_Basic"][dataset_choice-1] dataset_paths = [ "/WenetSpeech4TTS/Basic", "/WenetSpeech4TTS/Standard", "/WenetSpeech4TTS/Premium", - ][-dataset_choice:] + ][-dataset_choice:] print(f"\nChoose Dataset: {dataset_name}\n") main() @@ -112,8 +109,8 @@ if __name__ == "__main__": # WenetSpeech4TTS Basic Standard Premium # samples count 3932473 1941220 407494 # pinyin vocab size 1349 1348 1344 (no polyphone) - # - - 1459 (polyphone) + # - - 1459 (polyphone) # char vocab size 5264 5219 5042 - + # vocab size may be slightly different due to jieba tokenizer and pypinyin (e.g. way of polyphoneme) # please be careful if using pretrained model, make sure the vocab.txt is same diff --git a/speech_edit.py b/speech_edit.py index 82f7cc9b217386e367c265036f361e89f79c501c..991eac4cd2291c4d702bdf8f8a6cb18992761b05 100644 --- a/speech_edit.py +++ b/speech_edit.py @@ -3,13 +3,14 @@ import os import torch import torch.nn.functional as F import torchaudio +from einops import rearrange from vocos import Vocos -from model import CFM, UNetT, DiT +from model import CFM, UNetT, DiT, MMDiT from model.utils import ( load_checkpoint, - get_tokenizer, - convert_char_to_pinyin, + get_tokenizer, + convert_char_to_pinyin, save_spectrogram, ) @@ -35,20 +36,20 @@ exp_name = "F5TTS_Base" # F5TTS_Base | E2TTS_Base ckpt_step = 1200000 nfe_step = 32 # 16, 32 -cfg_strength = 2.0 -ode_method = "euler" # euler | midpoint -sway_sampling_coef = -1.0 -speed = 1.0 +cfg_strength = 2. +ode_method = 'euler' # euler | midpoint +sway_sampling_coef = -1. +speed = 1. if exp_name == "F5TTS_Base": model_cls = DiT - model_cfg = dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4) + model_cfg = dict(dim = 1024, depth = 22, heads = 16, ff_mult = 2, text_dim = 512, conv_layers = 4) elif exp_name == "E2TTS_Base": model_cls = UNetT - model_cfg = dict(dim=1024, depth=24, heads=16, ff_mult=4) + model_cfg = dict(dim = 1024, depth = 24, heads = 16, ff_mult = 4) -ckpt_path = f"ckpts/{exp_name}/model_{ckpt_step}.safetensors" +ckpt_path = f"ckpts/{exp_name}/model_{ckpt_step}.pt" output_dir = "tests" # [leverage https://github.com/MahmoudAshraf97/ctc-forced-aligner to get char level alignment] @@ -62,14 +63,8 @@ output_dir = "tests" audio_to_edit = "tests/ref_audio/test_en_1_ref_short.wav" origin_text = "Some call me nature, others call me mother nature." target_text = "Some call me optimist, others call me realist." -parts_to_edit = [ - [1.42, 2.44], - [4.04, 4.9], -] # stard_ends of "nature" & "mother nature", in seconds -fix_duration = [ - 1.2, - 1, -] # fix duration for "optimist" & "realist", in seconds +parts_to_edit = [[1.42, 2.44], [4.04, 4.9], ] # stard_ends of "nature" & "mother nature", in seconds +fix_duration = [1.2, 1, ] # fix duration for "optimist" & "realist", in seconds # audio_to_edit = "tests/ref_audio/test_zh_1_ref_short.wav" # origin_text = "对,这就是我,万人敬仰的太乙真人。" @@ -92,7 +87,7 @@ if local: vocos = Vocos.from_hparams(f"{vocos_local_path}/config.yaml") state_dict = torch.load(f"{vocos_local_path}/pytorch_model.bin", weights_only=True, map_location=device) vocos.load_state_dict(state_dict) - + vocos.eval() else: vocos = Vocos.from_pretrained("charactr/vocos-mel-24khz") @@ -102,19 +97,23 @@ vocab_char_map, vocab_size = get_tokenizer(dataset_name, tokenizer) # Model model = CFM( - transformer=model_cls(**model_cfg, text_num_embeds=vocab_size, mel_dim=n_mel_channels), - mel_spec_kwargs=dict( - target_sample_rate=target_sample_rate, - n_mel_channels=n_mel_channels, - hop_length=hop_length, + transformer = model_cls( + **model_cfg, + text_num_embeds = vocab_size, + mel_dim = n_mel_channels + ), + mel_spec_kwargs = dict( + target_sample_rate = target_sample_rate, + n_mel_channels = n_mel_channels, + hop_length = hop_length, ), - odeint_kwargs=dict( - method=ode_method, + odeint_kwargs = dict( + method = ode_method, ), - vocab_char_map=vocab_char_map, + vocab_char_map = vocab_char_map, ).to(device) -model = load_checkpoint(model, ckpt_path, device, use_ema=use_ema) +model = load_checkpoint(model, ckpt_path, device, use_ema = use_ema) # Audio audio, sr = torchaudio.load(audio_to_edit) @@ -134,18 +133,14 @@ for part in parts_to_edit: part_dur = end - start if fix_duration is None else fix_duration.pop(0) part_dur = part_dur * target_sample_rate start = start * target_sample_rate - audio_ = torch.cat((audio_, audio[:, round(offset) : round(start)], torch.zeros(1, round(part_dur))), dim=-1) - edit_mask = torch.cat( - ( - edit_mask, - torch.ones(1, round((start - offset) / hop_length), dtype=torch.bool), - torch.zeros(1, round(part_dur / hop_length), dtype=torch.bool), - ), - dim=-1, - ) + audio_ = torch.cat((audio_, audio[:, round(offset):round(start)], torch.zeros(1, round(part_dur))), dim = -1) + edit_mask = torch.cat((edit_mask, + torch.ones(1, round((start - offset) / hop_length), dtype = torch.bool), + torch.zeros(1, round(part_dur / hop_length), dtype = torch.bool) + ), dim = -1) offset = end * target_sample_rate # audio = torch.cat((audio_, audio[:, round(offset):]), dim = -1) -edit_mask = F.pad(edit_mask, (0, audio.shape[-1] // hop_length - edit_mask.shape[-1] + 1), value=True) +edit_mask = F.pad(edit_mask, (0, audio.shape[-1] // hop_length - edit_mask.shape[-1] + 1), value = True) audio = audio.to(device) edit_mask = edit_mask.to(device) @@ -165,25 +160,24 @@ duration = audio.shape[-1] // hop_length # Inference with torch.inference_mode(): generated, trajectory = model.sample( - cond=audio, - text=final_text_list, - duration=duration, - steps=nfe_step, - cfg_strength=cfg_strength, - sway_sampling_coef=sway_sampling_coef, - seed=seed, - edit_mask=edit_mask, + cond = audio, + text = final_text_list, + duration = duration, + steps = nfe_step, + cfg_strength = cfg_strength, + sway_sampling_coef = sway_sampling_coef, + seed = seed, + edit_mask = edit_mask, ) print(f"Generated mel: {generated.shape}") # Final result -generated = generated.to(torch.float32) generated = generated[:, ref_audio_len:, :] -generated_mel_spec = generated.permute(0, 2, 1) +generated_mel_spec = rearrange(generated, '1 n d -> 1 d n') generated_wave = vocos.decode(generated_mel_spec.cpu()) if rms < target_rms: generated_wave = generated_wave * rms / target_rms -save_spectrogram(generated_mel_spec[0].cpu().numpy(), f"{output_dir}/speech_edit_out.png") -torchaudio.save(f"{output_dir}/speech_edit_out.wav", generated_wave, target_sample_rate) +save_spectrogram(generated_mel_spec[0].cpu().numpy(), f"{output_dir}/test_single_edit.png") +torchaudio.save(f"{output_dir}/test_single_edit.wav", generated_wave, target_sample_rate) print(f"Generated wav: {generated_wave.shape}") diff --git a/src/f5_tts/api.py b/src/f5_tts/api.py deleted file mode 100644 index 9798a055645156730fc7cc50bced7421186ee02b..0000000000000000000000000000000000000000 --- a/src/f5_tts/api.py +++ /dev/null @@ -1,166 +0,0 @@ -import random -import sys -from importlib.resources import files - -import soundfile as sf -import tqdm -from cached_path import cached_path - -from f5_tts.infer.utils_infer import ( - hop_length, - infer_process, - load_model, - load_vocoder, - preprocess_ref_audio_text, - remove_silence_for_generated_wav, - save_spectrogram, - transcribe, - target_sample_rate, -) -from f5_tts.model import DiT, UNetT -from f5_tts.model.utils import seed_everything - - -class F5TTS: - def __init__( - self, - model_type="F5-TTS", - ckpt_file="", - vocab_file="", - ode_method="euler", - use_ema=True, - vocoder_name="vocos", - local_path=None, - device=None, - hf_cache_dir=None, - ): - # Initialize parameters - self.final_wave = None - self.target_sample_rate = target_sample_rate - self.hop_length = hop_length - self.seed = -1 - self.mel_spec_type = vocoder_name - - # Set device - if device is not None: - self.device = device - else: - import torch - - self.device = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu" - - # Load models - self.load_vocoder_model(vocoder_name, local_path=local_path, hf_cache_dir=hf_cache_dir) - self.load_ema_model( - model_type, ckpt_file, vocoder_name, vocab_file, ode_method, use_ema, hf_cache_dir=hf_cache_dir - ) - - def load_vocoder_model(self, vocoder_name, local_path=None, hf_cache_dir=None): - self.vocoder = load_vocoder(vocoder_name, local_path is not None, local_path, self.device, hf_cache_dir) - - def load_ema_model(self, model_type, ckpt_file, mel_spec_type, vocab_file, ode_method, use_ema, hf_cache_dir=None): - if model_type == "F5-TTS": - if not ckpt_file: - if mel_spec_type == "vocos": - ckpt_file = str( - cached_path("hf://SWivid/F5-TTS/F5TTS_Base/model_1200000.safetensors", cache_dir=hf_cache_dir) - ) - elif mel_spec_type == "bigvgan": - ckpt_file = str( - cached_path("hf://SWivid/F5-TTS/F5TTS_Base_bigvgan/model_1250000.pt", cache_dir=hf_cache_dir) - ) - model_cfg = dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4) - model_cls = DiT - elif model_type == "E2-TTS": - if not ckpt_file: - ckpt_file = str( - cached_path("hf://SWivid/E2-TTS/E2TTS_Base/model_1200000.safetensors", cache_dir=hf_cache_dir) - ) - model_cfg = dict(dim=1024, depth=24, heads=16, ff_mult=4) - model_cls = UNetT - else: - raise ValueError(f"Unknown model type: {model_type}") - - self.ema_model = load_model( - model_cls, model_cfg, ckpt_file, mel_spec_type, vocab_file, ode_method, use_ema, self.device - ) - - def transcribe(self, ref_audio, language=None): - return transcribe(ref_audio, language) - - def export_wav(self, wav, file_wave, remove_silence=False): - sf.write(file_wave, wav, self.target_sample_rate) - - if remove_silence: - remove_silence_for_generated_wav(file_wave) - - def export_spectrogram(self, spect, file_spect): - save_spectrogram(spect, file_spect) - - def infer( - self, - ref_file, - ref_text, - gen_text, - show_info=print, - progress=tqdm, - target_rms=0.1, - cross_fade_duration=0.15, - sway_sampling_coef=-1, - cfg_strength=2, - nfe_step=32, - speed=1.0, - fix_duration=None, - remove_silence=False, - file_wave=None, - file_spect=None, - seed=-1, - ): - if seed == -1: - seed = random.randint(0, sys.maxsize) - seed_everything(seed) - self.seed = seed - - ref_file, ref_text = preprocess_ref_audio_text(ref_file, ref_text, device=self.device) - - wav, sr, spect = infer_process( - ref_file, - ref_text, - gen_text, - self.ema_model, - self.vocoder, - self.mel_spec_type, - show_info=show_info, - progress=progress, - target_rms=target_rms, - cross_fade_duration=cross_fade_duration, - nfe_step=nfe_step, - cfg_strength=cfg_strength, - sway_sampling_coef=sway_sampling_coef, - speed=speed, - fix_duration=fix_duration, - device=self.device, - ) - - if file_wave is not None: - self.export_wav(wav, file_wave, remove_silence) - - if file_spect is not None: - self.export_spectrogram(spect, file_spect) - - return wav, sr, spect - - -if __name__ == "__main__": - f5tts = F5TTS() - - wav, sr, spect = f5tts.infer( - ref_file=str(files("f5_tts").joinpath("infer/examples/basic/basic_ref_en.wav")), - ref_text="some call me nature, others call me mother nature.", - gen_text="""I don't really care what you call me. I've been a silent spectator, watching species evolve, empires rise and fall. But always remember, I am mighty and enduring. Respect me and I'll nurture you; ignore me and you shall face the consequences.""", - file_wave=str(files("f5_tts").joinpath("../../tests/api_out.wav")), - file_spect=str(files("f5_tts").joinpath("../../tests/api_out.png")), - seed=-1, # random seed = -1 - ) - - print("seed :", f5tts.seed) diff --git a/src/f5_tts/configs/E2TTS_Base_train.yaml b/src/f5_tts/configs/E2TTS_Base_train.yaml deleted file mode 100644 index 0a9730e0e4577a5943caf7ec27b080676c73f050..0000000000000000000000000000000000000000 --- a/src/f5_tts/configs/E2TTS_Base_train.yaml +++ /dev/null @@ -1,44 +0,0 @@ -hydra: - run: - dir: ckpts/${model.name}_${model.mel_spec.mel_spec_type}_${model.tokenizer}_${datasets.name}/${now:%Y-%m-%d}/${now:%H-%M-%S} - -datasets: - name: Emilia_ZH_EN # dataset name - batch_size_per_gpu: 38400 # 8 GPUs, 8 * 38400 = 307200 - batch_size_type: frame # "frame" or "sample" - max_samples: 64 # max sequences per batch if use frame-wise batch_size. we set 32 for small models, 64 for base models - num_workers: 16 - -optim: - epochs: 15 - learning_rate: 7.5e-5 - num_warmup_updates: 20000 # warmup steps - grad_accumulation_steps: 1 # note: updates = steps / grad_accumulation_steps - max_grad_norm: 1.0 # gradient clipping - bnb_optimizer: False # use bnb 8bit AdamW optimizer or not - -model: - name: E2TTS_Base - tokenizer: pinyin - tokenizer_path: None # if tokenizer = 'custom', define the path to the tokenizer you want to use (should be vocab.txt) - arch: - dim: 1024 - depth: 24 - heads: 16 - ff_mult: 4 - mel_spec: - target_sample_rate: 24000 - n_mel_channels: 100 - hop_length: 256 - win_length: 1024 - n_fft: 1024 - mel_spec_type: vocos # 'vocos' or 'bigvgan' - vocoder: - is_local: False # use local offline ckpt or not - local_path: None # local vocoder path - -ckpts: - logger: wandb # wandb | tensorboard | None - save_per_updates: 50000 # save checkpoint per steps - last_per_steps: 5000 # save last checkpoint per steps - save_dir: ckpts/${model.name}_${model.mel_spec.mel_spec_type}_${model.tokenizer}_${datasets.name}/${now:%Y-%m-%d}/${now:%H-%M-%S} \ No newline at end of file diff --git a/src/f5_tts/configs/E2TTS_Small_train.yaml b/src/f5_tts/configs/E2TTS_Small_train.yaml deleted file mode 100644 index 5e98c3395cdf805967ddf5880a9f17e66c7bf481..0000000000000000000000000000000000000000 --- a/src/f5_tts/configs/E2TTS_Small_train.yaml +++ /dev/null @@ -1,44 +0,0 @@ -hydra: - run: - dir: ckpts/${model.name}_${model.mel_spec.mel_spec_type}_${model.tokenizer}_${datasets.name}/${now:%Y-%m-%d}/${now:%H-%M-%S} - -datasets: - name: Emilia_ZH_EN - batch_size_per_gpu: 38400 # 8 GPUs, 8 * 38400 = 307200 - batch_size_type: frame # "frame" or "sample" - max_samples: 64 # max sequences per batch if use frame-wise batch_size. we set 32 for small models, 64 for base models - num_workers: 16 - -optim: - epochs: 15 - learning_rate: 7.5e-5 - num_warmup_updates: 20000 # warmup steps - grad_accumulation_steps: 1 # note: updates = steps / grad_accumulation_steps - max_grad_norm: 1.0 - bnb_optimizer: False - -model: - name: E2TTS_Small - tokenizer: pinyin - tokenizer_path: None # if tokenizer = 'custom', define the path to the tokenizer you want to use (should be vocab.txt) - arch: - dim: 768 - depth: 20 - heads: 12 - ff_mult: 4 - mel_spec: - target_sample_rate: 24000 - n_mel_channels: 100 - hop_length: 256 - win_length: 1024 - n_fft: 1024 - mel_spec_type: vocos # 'vocos' or 'bigvgan' - vocoder: - is_local: False # use local offline ckpt or not - local_path: None # local vocoder path - -ckpts: - logger: wandb # wandb | tensorboard | None - save_per_updates: 50000 # save checkpoint per steps - last_per_steps: 5000 # save last checkpoint per steps - save_dir: ckpts/${model.name}_${model.mel_spec.mel_spec_type}_${model.tokenizer}_${datasets.name}/${now:%Y-%m-%d}/${now:%H-%M-%S} \ No newline at end of file diff --git a/src/f5_tts/configs/F5TTS_Base_train.yaml b/src/f5_tts/configs/F5TTS_Base_train.yaml deleted file mode 100644 index 0490c4f067741f31139323a91b42b0baca53a830..0000000000000000000000000000000000000000 --- a/src/f5_tts/configs/F5TTS_Base_train.yaml +++ /dev/null @@ -1,46 +0,0 @@ -hydra: - run: - dir: ckpts/${model.name}_${model.mel_spec.mel_spec_type}_${model.tokenizer}_${datasets.name}/${now:%Y-%m-%d}/${now:%H-%M-%S} - -datasets: - name: Emilia_ZH_EN # dataset name - batch_size_per_gpu: 38400 # 8 GPUs, 8 * 38400 = 307200 - batch_size_type: frame # "frame" or "sample" - max_samples: 64 # max sequences per batch if use frame-wise batch_size. we set 32 for small models, 64 for base models - num_workers: 16 - -optim: - epochs: 15 - learning_rate: 7.5e-5 - num_warmup_updates: 20000 # warmup steps - grad_accumulation_steps: 1 # note: updates = steps / grad_accumulation_steps - max_grad_norm: 1.0 # gradient clipping - bnb_optimizer: False # use bnb 8bit AdamW optimizer or not - -model: - name: F5TTS_Base # model name - tokenizer: pinyin # tokenizer type - tokenizer_path: None # if tokenizer = 'custom', define the path to the tokenizer you want to use (should be vocab.txt) - arch: - dim: 1024 - depth: 22 - heads: 16 - ff_mult: 2 - text_dim: 512 - conv_layers: 4 - mel_spec: - target_sample_rate: 24000 - n_mel_channels: 100 - hop_length: 256 - win_length: 1024 - n_fft: 1024 - mel_spec_type: vocos # 'vocos' or 'bigvgan' - vocoder: - is_local: False # use local offline ckpt or not - local_path: None # local vocoder path - -ckpts: - logger: wandb # wandb | tensorboard | None - save_per_updates: 50000 # save checkpoint per steps - last_per_steps: 5000 # save last checkpoint per steps - save_dir: ckpts/${model.name}_${model.mel_spec.mel_spec_type}_${model.tokenizer}_${datasets.name}/${now:%Y-%m-%d}/${now:%H-%M-%S} \ No newline at end of file diff --git a/src/f5_tts/configs/F5TTS_Small_train.yaml b/src/f5_tts/configs/F5TTS_Small_train.yaml deleted file mode 100644 index ad7ab4fc389a925f19669caba3261850c3ba0f01..0000000000000000000000000000000000000000 --- a/src/f5_tts/configs/F5TTS_Small_train.yaml +++ /dev/null @@ -1,46 +0,0 @@ -hydra: - run: - dir: ckpts/${model.name}_${model.mel_spec.mel_spec_type}_${model.tokenizer}_${datasets.name}/${now:%Y-%m-%d}/${now:%H-%M-%S} - -datasets: - name: Emilia_ZH_EN - batch_size_per_gpu: 38400 # 8 GPUs, 8 * 38400 = 307200 - batch_size_type: frame # "frame" or "sample" - max_samples: 64 # max sequences per batch if use frame-wise batch_size. we set 32 for small models, 64 for base models - num_workers: 16 - -optim: - epochs: 15 - learning_rate: 7.5e-5 - num_warmup_updates: 20000 # warmup steps - grad_accumulation_steps: 1 # note: updates = steps / grad_accumulation_steps - max_grad_norm: 1.0 # gradient clipping - bnb_optimizer: False # use bnb 8bit AdamW optimizer or not - -model: - name: F5TTS_Small - tokenizer: pinyin - tokenizer_path: None # if tokenizer = 'custom', define the path to the tokenizer you want to use (should be vocab.txt) - arch: - dim: 768 - depth: 18 - heads: 12 - ff_mult: 2 - text_dim: 512 - conv_layers: 4 - mel_spec: - target_sample_rate: 24000 - n_mel_channels: 100 - hop_length: 256 - win_length: 1024 - n_fft: 1024 - mel_spec_type: vocos # 'vocos' or 'bigvgan' - vocoder: - is_local: False # use local offline ckpt or not - local_path: None # local vocoder path - -ckpts: - logger: wandb # wandb | tensorboard | None - save_per_updates: 50000 # save checkpoint per steps - last_per_steps: 5000 # save last checkpoint per steps - save_dir: ckpts/${model.name}_${model.mel_spec.mel_spec_type}_${model.tokenizer}_${datasets.name}/${now:%Y-%m-%d}/${now:%H-%M-%S} \ No newline at end of file diff --git a/src/f5_tts/eval/README.md b/src/f5_tts/eval/README.md deleted file mode 100644 index ff324a1ed266b16f0890faee2776f108ad683fdc..0000000000000000000000000000000000000000 --- a/src/f5_tts/eval/README.md +++ /dev/null @@ -1,49 +0,0 @@ - -# Evaluation - -Install packages for evaluation: - -```bash -pip install -e .[eval] -``` - -## Generating Samples for Evaluation - -### Prepare Test Datasets - -1. *Seed-TTS testset*: Download from [seed-tts-eval](https://github.com/BytedanceSpeech/seed-tts-eval). -2. *LibriSpeech test-clean*: Download from [OpenSLR](http://www.openslr.org/12/). -3. Unzip the downloaded datasets and place them in the `data/` directory. -4. Update the path for *LibriSpeech test-clean* data in `src/f5_tts/eval/eval_infer_batch.py` -5. Our filtered LibriSpeech-PC 4-10s subset: `data/librispeech_pc_test_clean_cross_sentence.lst` - -### Batch Inference for Test Set - -To run batch inference for evaluations, execute the following commands: - -```bash -# batch inference for evaluations -accelerate config # if not set before -bash src/f5_tts/eval/eval_infer_batch.sh -``` - -## Objective Evaluation on Generated Results - -### Download Evaluation Model Checkpoints - -1. Chinese ASR Model: [Paraformer-zh](https://huggingface.co/funasr/paraformer-zh) -2. English ASR Model: [Faster-Whisper](https://huggingface.co/Systran/faster-whisper-large-v3) -3. WavLM Model: Download from [Google Drive](https://drive.google.com/file/d/1-aE1NfzpRCLxA4GUxX9ITI3F9LlbtEGP/view). - -Then update in the following scripts with the paths you put evaluation model ckpts to. - -### Objective Evaluation - -Update the path with your batch-inferenced results, and carry out WER / SIM evaluations: -```bash -# Evaluation for Seed-TTS test set -python src/f5_tts/eval/eval_seedtts_testset.py --gen_wav_dir - -# Evaluation for LibriSpeech-PC test-clean (cross-sentence) -python src/f5_tts/eval/eval_librispeech_test_clean.py --gen_wav_dir --librispeech_test_clean_path -``` \ No newline at end of file diff --git a/src/f5_tts/eval/ecapa_tdnn.py b/src/f5_tts/eval/ecapa_tdnn.py deleted file mode 100644 index 6bc431eb9e2fc6173e6009ef3b0326a40618b1ec..0000000000000000000000000000000000000000 --- a/src/f5_tts/eval/ecapa_tdnn.py +++ /dev/null @@ -1,330 +0,0 @@ -# just for speaker similarity evaluation, third-party code - -# From https://github.com/microsoft/UniSpeech/blob/main/downstreams/speaker_verification/models/ -# part of the code is borrowed from https://github.com/lawlict/ECAPA-TDNN - -import os -import torch -import torch.nn as nn -import torch.nn.functional as F - - -""" Res2Conv1d + BatchNorm1d + ReLU -""" - - -class Res2Conv1dReluBn(nn.Module): - """ - in_channels == out_channels == channels - """ - - def __init__(self, channels, kernel_size=1, stride=1, padding=0, dilation=1, bias=True, scale=4): - super().__init__() - assert channels % scale == 0, "{} % {} != 0".format(channels, scale) - self.scale = scale - self.width = channels // scale - self.nums = scale if scale == 1 else scale - 1 - - self.convs = [] - self.bns = [] - for i in range(self.nums): - self.convs.append(nn.Conv1d(self.width, self.width, kernel_size, stride, padding, dilation, bias=bias)) - self.bns.append(nn.BatchNorm1d(self.width)) - self.convs = nn.ModuleList(self.convs) - self.bns = nn.ModuleList(self.bns) - - def forward(self, x): - out = [] - spx = torch.split(x, self.width, 1) - for i in range(self.nums): - if i == 0: - sp = spx[i] - else: - sp = sp + spx[i] - # Order: conv -> relu -> bn - sp = self.convs[i](sp) - sp = self.bns[i](F.relu(sp)) - out.append(sp) - if self.scale != 1: - out.append(spx[self.nums]) - out = torch.cat(out, dim=1) - - return out - - -""" Conv1d + BatchNorm1d + ReLU -""" - - -class Conv1dReluBn(nn.Module): - def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding=0, dilation=1, bias=True): - super().__init__() - self.conv = nn.Conv1d(in_channels, out_channels, kernel_size, stride, padding, dilation, bias=bias) - self.bn = nn.BatchNorm1d(out_channels) - - def forward(self, x): - return self.bn(F.relu(self.conv(x))) - - -""" The SE connection of 1D case. -""" - - -class SE_Connect(nn.Module): - def __init__(self, channels, se_bottleneck_dim=128): - super().__init__() - self.linear1 = nn.Linear(channels, se_bottleneck_dim) - self.linear2 = nn.Linear(se_bottleneck_dim, channels) - - def forward(self, x): - out = x.mean(dim=2) - out = F.relu(self.linear1(out)) - out = torch.sigmoid(self.linear2(out)) - out = x * out.unsqueeze(2) - - return out - - -""" SE-Res2Block of the ECAPA-TDNN architecture. -""" - -# def SE_Res2Block(channels, kernel_size, stride, padding, dilation, scale): -# return nn.Sequential( -# Conv1dReluBn(channels, 512, kernel_size=1, stride=1, padding=0), -# Res2Conv1dReluBn(512, kernel_size, stride, padding, dilation, scale=scale), -# Conv1dReluBn(512, channels, kernel_size=1, stride=1, padding=0), -# SE_Connect(channels) -# ) - - -class SE_Res2Block(nn.Module): - def __init__(self, in_channels, out_channels, kernel_size, stride, padding, dilation, scale, se_bottleneck_dim): - super().__init__() - self.Conv1dReluBn1 = Conv1dReluBn(in_channels, out_channels, kernel_size=1, stride=1, padding=0) - self.Res2Conv1dReluBn = Res2Conv1dReluBn(out_channels, kernel_size, stride, padding, dilation, scale=scale) - self.Conv1dReluBn2 = Conv1dReluBn(out_channels, out_channels, kernel_size=1, stride=1, padding=0) - self.SE_Connect = SE_Connect(out_channels, se_bottleneck_dim) - - self.shortcut = None - if in_channels != out_channels: - self.shortcut = nn.Conv1d( - in_channels=in_channels, - out_channels=out_channels, - kernel_size=1, - ) - - def forward(self, x): - residual = x - if self.shortcut: - residual = self.shortcut(x) - - x = self.Conv1dReluBn1(x) - x = self.Res2Conv1dReluBn(x) - x = self.Conv1dReluBn2(x) - x = self.SE_Connect(x) - - return x + residual - - -""" Attentive weighted mean and standard deviation pooling. -""" - - -class AttentiveStatsPool(nn.Module): - def __init__(self, in_dim, attention_channels=128, global_context_att=False): - super().__init__() - self.global_context_att = global_context_att - - # Use Conv1d with stride == 1 rather than Linear, then we don't need to transpose inputs. - if global_context_att: - self.linear1 = nn.Conv1d(in_dim * 3, attention_channels, kernel_size=1) # equals W and b in the paper - else: - self.linear1 = nn.Conv1d(in_dim, attention_channels, kernel_size=1) # equals W and b in the paper - self.linear2 = nn.Conv1d(attention_channels, in_dim, kernel_size=1) # equals V and k in the paper - - def forward(self, x): - if self.global_context_att: - context_mean = torch.mean(x, dim=-1, keepdim=True).expand_as(x) - context_std = torch.sqrt(torch.var(x, dim=-1, keepdim=True) + 1e-10).expand_as(x) - x_in = torch.cat((x, context_mean, context_std), dim=1) - else: - x_in = x - - # DON'T use ReLU here! In experiments, I find ReLU hard to converge. - alpha = torch.tanh(self.linear1(x_in)) - # alpha = F.relu(self.linear1(x_in)) - alpha = torch.softmax(self.linear2(alpha), dim=2) - mean = torch.sum(alpha * x, dim=2) - residuals = torch.sum(alpha * (x**2), dim=2) - mean**2 - std = torch.sqrt(residuals.clamp(min=1e-9)) - return torch.cat([mean, std], dim=1) - - -class ECAPA_TDNN(nn.Module): - def __init__( - self, - feat_dim=80, - channels=512, - emb_dim=192, - global_context_att=False, - feat_type="wavlm_large", - sr=16000, - feature_selection="hidden_states", - update_extract=False, - config_path=None, - ): - super().__init__() - - self.feat_type = feat_type - self.feature_selection = feature_selection - self.update_extract = update_extract - self.sr = sr - - torch.hub._validate_not_a_forked_repo = lambda a, b, c: True - try: - local_s3prl_path = os.path.expanduser("~/.cache/torch/hub/s3prl_s3prl_main") - self.feature_extract = torch.hub.load(local_s3prl_path, feat_type, source="local", config_path=config_path) - except: # noqa: E722 - self.feature_extract = torch.hub.load("s3prl/s3prl", feat_type) - - if len(self.feature_extract.model.encoder.layers) == 24 and hasattr( - self.feature_extract.model.encoder.layers[23].self_attn, "fp32_attention" - ): - self.feature_extract.model.encoder.layers[23].self_attn.fp32_attention = False - if len(self.feature_extract.model.encoder.layers) == 24 and hasattr( - self.feature_extract.model.encoder.layers[11].self_attn, "fp32_attention" - ): - self.feature_extract.model.encoder.layers[11].self_attn.fp32_attention = False - - self.feat_num = self.get_feat_num() - self.feature_weight = nn.Parameter(torch.zeros(self.feat_num)) - - if feat_type != "fbank" and feat_type != "mfcc": - freeze_list = ["final_proj", "label_embs_concat", "mask_emb", "project_q", "quantizer"] - for name, param in self.feature_extract.named_parameters(): - for freeze_val in freeze_list: - if freeze_val in name: - param.requires_grad = False - break - - if not self.update_extract: - for param in self.feature_extract.parameters(): - param.requires_grad = False - - self.instance_norm = nn.InstanceNorm1d(feat_dim) - # self.channels = [channels] * 4 + [channels * 3] - self.channels = [channels] * 4 + [1536] - - self.layer1 = Conv1dReluBn(feat_dim, self.channels[0], kernel_size=5, padding=2) - self.layer2 = SE_Res2Block( - self.channels[0], - self.channels[1], - kernel_size=3, - stride=1, - padding=2, - dilation=2, - scale=8, - se_bottleneck_dim=128, - ) - self.layer3 = SE_Res2Block( - self.channels[1], - self.channels[2], - kernel_size=3, - stride=1, - padding=3, - dilation=3, - scale=8, - se_bottleneck_dim=128, - ) - self.layer4 = SE_Res2Block( - self.channels[2], - self.channels[3], - kernel_size=3, - stride=1, - padding=4, - dilation=4, - scale=8, - se_bottleneck_dim=128, - ) - - # self.conv = nn.Conv1d(self.channels[-1], self.channels[-1], kernel_size=1) - cat_channels = channels * 3 - self.conv = nn.Conv1d(cat_channels, self.channels[-1], kernel_size=1) - self.pooling = AttentiveStatsPool( - self.channels[-1], attention_channels=128, global_context_att=global_context_att - ) - self.bn = nn.BatchNorm1d(self.channels[-1] * 2) - self.linear = nn.Linear(self.channels[-1] * 2, emb_dim) - - def get_feat_num(self): - self.feature_extract.eval() - wav = [torch.randn(self.sr).to(next(self.feature_extract.parameters()).device)] - with torch.no_grad(): - features = self.feature_extract(wav) - select_feature = features[self.feature_selection] - if isinstance(select_feature, (list, tuple)): - return len(select_feature) - else: - return 1 - - def get_feat(self, x): - if self.update_extract: - x = self.feature_extract([sample for sample in x]) - else: - with torch.no_grad(): - if self.feat_type == "fbank" or self.feat_type == "mfcc": - x = self.feature_extract(x) + 1e-6 # B x feat_dim x time_len - else: - x = self.feature_extract([sample for sample in x]) - - if self.feat_type == "fbank": - x = x.log() - - if self.feat_type != "fbank" and self.feat_type != "mfcc": - x = x[self.feature_selection] - if isinstance(x, (list, tuple)): - x = torch.stack(x, dim=0) - else: - x = x.unsqueeze(0) - norm_weights = F.softmax(self.feature_weight, dim=-1).unsqueeze(-1).unsqueeze(-1).unsqueeze(-1) - x = (norm_weights * x).sum(dim=0) - x = torch.transpose(x, 1, 2) + 1e-6 - - x = self.instance_norm(x) - return x - - def forward(self, x): - x = self.get_feat(x) - - out1 = self.layer1(x) - out2 = self.layer2(out1) - out3 = self.layer3(out2) - out4 = self.layer4(out3) - - out = torch.cat([out2, out3, out4], dim=1) - out = F.relu(self.conv(out)) - out = self.bn(self.pooling(out)) - out = self.linear(out) - - return out - - -def ECAPA_TDNN_SMALL( - feat_dim, - emb_dim=256, - feat_type="wavlm_large", - sr=16000, - feature_selection="hidden_states", - update_extract=False, - config_path=None, -): - return ECAPA_TDNN( - feat_dim=feat_dim, - channels=512, - emb_dim=emb_dim, - feat_type=feat_type, - sr=sr, - feature_selection=feature_selection, - update_extract=update_extract, - config_path=config_path, - ) diff --git a/src/f5_tts/eval/eval_infer_batch.py b/src/f5_tts/eval/eval_infer_batch.py deleted file mode 100644 index 785880ccd14564b1615b0dca66ed93e66fff2a1f..0000000000000000000000000000000000000000 --- a/src/f5_tts/eval/eval_infer_batch.py +++ /dev/null @@ -1,207 +0,0 @@ -import os -import sys - -sys.path.append(os.getcwd()) - -import argparse -import time -from importlib.resources import files - -import torch -import torchaudio -from accelerate import Accelerator -from tqdm import tqdm - -from f5_tts.eval.utils_eval import ( - get_inference_prompt, - get_librispeech_test_clean_metainfo, - get_seedtts_testset_metainfo, -) -from f5_tts.infer.utils_infer import load_checkpoint, load_vocoder -from f5_tts.model import CFM, DiT, UNetT -from f5_tts.model.utils import get_tokenizer - -accelerator = Accelerator() -device = f"cuda:{accelerator.process_index}" - - -# --------------------- Dataset Settings -------------------- # - -target_sample_rate = 24000 -n_mel_channels = 100 -hop_length = 256 -win_length = 1024 -n_fft = 1024 -target_rms = 0.1 - -rel_path = str(files("f5_tts").joinpath("../../")) - - -def main(): - # ---------------------- infer setting ---------------------- # - - parser = argparse.ArgumentParser(description="batch inference") - - parser.add_argument("-s", "--seed", default=None, type=int) - parser.add_argument("-d", "--dataset", default="Emilia_ZH_EN") - parser.add_argument("-n", "--expname", required=True) - parser.add_argument("-c", "--ckptstep", default=1200000, type=int) - parser.add_argument("-m", "--mel_spec_type", default="vocos", type=str, choices=["bigvgan", "vocos"]) - parser.add_argument("-to", "--tokenizer", default="pinyin", type=str, choices=["pinyin", "char"]) - - parser.add_argument("-nfe", "--nfestep", default=32, type=int) - parser.add_argument("-o", "--odemethod", default="euler") - parser.add_argument("-ss", "--swaysampling", default=-1, type=float) - - parser.add_argument("-t", "--testset", required=True) - - args = parser.parse_args() - - seed = args.seed - dataset_name = args.dataset - exp_name = args.expname - ckpt_step = args.ckptstep - ckpt_path = rel_path + f"/ckpts/{exp_name}/model_{ckpt_step}.pt" - mel_spec_type = args.mel_spec_type - tokenizer = args.tokenizer - - nfe_step = args.nfestep - ode_method = args.odemethod - sway_sampling_coef = args.swaysampling - - testset = args.testset - - infer_batch_size = 1 # max frames. 1 for ddp single inference (recommended) - cfg_strength = 2.0 - speed = 1.0 - use_truth_duration = False - no_ref_audio = False - - if exp_name == "F5TTS_Base": - model_cls = DiT - model_cfg = dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4) - - elif exp_name == "E2TTS_Base": - model_cls = UNetT - model_cfg = dict(dim=1024, depth=24, heads=16, ff_mult=4) - - if testset == "ls_pc_test_clean": - metalst = rel_path + "/data/librispeech_pc_test_clean_cross_sentence.lst" - librispeech_test_clean_path = "/LibriSpeech/test-clean" # test-clean path - metainfo = get_librispeech_test_clean_metainfo(metalst, librispeech_test_clean_path) - - elif testset == "seedtts_test_zh": - metalst = rel_path + "/data/seedtts_testset/zh/meta.lst" - metainfo = get_seedtts_testset_metainfo(metalst) - - elif testset == "seedtts_test_en": - metalst = rel_path + "/data/seedtts_testset/en/meta.lst" - metainfo = get_seedtts_testset_metainfo(metalst) - - # path to save genereted wavs - output_dir = ( - f"{rel_path}/" - f"results/{exp_name}_{ckpt_step}/{testset}/" - f"seed{seed}_{ode_method}_nfe{nfe_step}_{mel_spec_type}" - f"{f'_ss{sway_sampling_coef}' if sway_sampling_coef else ''}" - f"_cfg{cfg_strength}_speed{speed}" - f"{'_gt-dur' if use_truth_duration else ''}" - f"{'_no-ref-audio' if no_ref_audio else ''}" - ) - - # -------------------------------------------------# - - use_ema = True - - prompts_all = get_inference_prompt( - metainfo, - speed=speed, - tokenizer=tokenizer, - target_sample_rate=target_sample_rate, - n_mel_channels=n_mel_channels, - hop_length=hop_length, - mel_spec_type=mel_spec_type, - target_rms=target_rms, - use_truth_duration=use_truth_duration, - infer_batch_size=infer_batch_size, - ) - - # Vocoder model - local = False - if mel_spec_type == "vocos": - vocoder_local_path = "../checkpoints/charactr/vocos-mel-24khz" - elif mel_spec_type == "bigvgan": - vocoder_local_path = "../checkpoints/bigvgan_v2_24khz_100band_256x" - vocoder = load_vocoder(vocoder_name=mel_spec_type, is_local=local, local_path=vocoder_local_path) - - # Tokenizer - vocab_char_map, vocab_size = get_tokenizer(dataset_name, tokenizer) - - # Model - model = CFM( - transformer=model_cls(**model_cfg, text_num_embeds=vocab_size, mel_dim=n_mel_channels), - mel_spec_kwargs=dict( - n_fft=n_fft, - hop_length=hop_length, - win_length=win_length, - n_mel_channels=n_mel_channels, - target_sample_rate=target_sample_rate, - mel_spec_type=mel_spec_type, - ), - odeint_kwargs=dict( - method=ode_method, - ), - vocab_char_map=vocab_char_map, - ).to(device) - - dtype = torch.float32 if mel_spec_type == "bigvgan" else None - model = load_checkpoint(model, ckpt_path, device, dtype=dtype, use_ema=use_ema) - - if not os.path.exists(output_dir) and accelerator.is_main_process: - os.makedirs(output_dir) - - # start batch inference - accelerator.wait_for_everyone() - start = time.time() - - with accelerator.split_between_processes(prompts_all) as prompts: - for prompt in tqdm(prompts, disable=not accelerator.is_local_main_process): - utts, ref_rms_list, ref_mels, ref_mel_lens, total_mel_lens, final_text_list = prompt - ref_mels = ref_mels.to(device) - ref_mel_lens = torch.tensor(ref_mel_lens, dtype=torch.long).to(device) - total_mel_lens = torch.tensor(total_mel_lens, dtype=torch.long).to(device) - - # Inference - with torch.inference_mode(): - generated, _ = model.sample( - cond=ref_mels, - text=final_text_list, - duration=total_mel_lens, - lens=ref_mel_lens, - steps=nfe_step, - cfg_strength=cfg_strength, - sway_sampling_coef=sway_sampling_coef, - no_ref_audio=no_ref_audio, - seed=seed, - ) - # Final result - for i, gen in enumerate(generated): - gen = gen[ref_mel_lens[i] : total_mel_lens[i], :].unsqueeze(0) - gen_mel_spec = gen.permute(0, 2, 1).to(torch.float32) - if mel_spec_type == "vocos": - generated_wave = vocoder.decode(gen_mel_spec).cpu() - elif mel_spec_type == "bigvgan": - generated_wave = vocoder(gen_mel_spec).squeeze(0).cpu() - - if ref_rms_list[i] < target_rms: - generated_wave = generated_wave * ref_rms_list[i] / target_rms - torchaudio.save(f"{output_dir}/{utts[i]}.wav", generated_wave, target_sample_rate) - - accelerator.wait_for_everyone() - if accelerator.is_main_process: - timediff = time.time() - start - print(f"Done batch inference in {timediff / 60 :.2f} minutes.") - - -if __name__ == "__main__": - main() diff --git a/src/f5_tts/eval/eval_infer_batch.sh b/src/f5_tts/eval/eval_infer_batch.sh deleted file mode 100644 index 47361e3ce6d7d2b0ea5305236e9b89580297428c..0000000000000000000000000000000000000000 --- a/src/f5_tts/eval/eval_infer_batch.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -# e.g. F5-TTS, 16 NFE -accelerate launch src/f5_tts/eval/eval_infer_batch.py -s 0 -n "F5TTS_Base" -t "seedtts_test_zh" -nfe 16 -accelerate launch src/f5_tts/eval/eval_infer_batch.py -s 0 -n "F5TTS_Base" -t "seedtts_test_en" -nfe 16 -accelerate launch src/f5_tts/eval/eval_infer_batch.py -s 0 -n "F5TTS_Base" -t "ls_pc_test_clean" -nfe 16 - -# e.g. Vanilla E2 TTS, 32 NFE -accelerate launch src/f5_tts/eval/eval_infer_batch.py -s 0 -n "E2TTS_Base" -t "seedtts_test_zh" -o "midpoint" -ss 0 -accelerate launch src/f5_tts/eval/eval_infer_batch.py -s 0 -n "E2TTS_Base" -t "seedtts_test_en" -o "midpoint" -ss 0 -accelerate launch src/f5_tts/eval/eval_infer_batch.py -s 0 -n "E2TTS_Base" -t "ls_pc_test_clean" -o "midpoint" -ss 0 - -# etc. diff --git a/src/f5_tts/eval/eval_librispeech_test_clean.py b/src/f5_tts/eval/eval_librispeech_test_clean.py deleted file mode 100644 index a5f76e09a24cecdb374e6d04600ba4ba6d6f57f4..0000000000000000000000000000000000000000 --- a/src/f5_tts/eval/eval_librispeech_test_clean.py +++ /dev/null @@ -1,84 +0,0 @@ -# Evaluate with Librispeech test-clean, ~3s prompt to generate 4-10s audio (the way of valle/voicebox evaluation) - -import sys -import os -import argparse - -sys.path.append(os.getcwd()) - -import multiprocessing as mp -from importlib.resources import files - -import numpy as np - -from f5_tts.eval.utils_eval import ( - get_librispeech_test, - run_asr_wer, - run_sim, -) - -rel_path = str(files("f5_tts").joinpath("../../")) - - -def get_args(): - parser = argparse.ArgumentParser() - parser.add_argument("-e", "--eval_task", type=str, default="wer", choices=["sim", "wer"]) - parser.add_argument("-l", "--lang", type=str, default="en") - parser.add_argument("-g", "--gen_wav_dir", type=str, required=True) - parser.add_argument("-p", "--librispeech_test_clean_path", type=str, required=True) - parser.add_argument("-n", "--gpu_nums", type=int, default=8, help="Number of GPUs to use") - parser.add_argument("--local", action="store_true", help="Use local custom checkpoint directory") - return parser.parse_args() - - -def main(): - args = get_args() - eval_task = args.eval_task - lang = args.lang - librispeech_test_clean_path = args.librispeech_test_clean_path # test-clean path - gen_wav_dir = args.gen_wav_dir - metalst = rel_path + "/data/librispeech_pc_test_clean_cross_sentence.lst" - - gpus = list(range(args.gpu_nums)) - test_set = get_librispeech_test(metalst, gen_wav_dir, gpus, librispeech_test_clean_path) - - ## In LibriSpeech, some speakers utilized varying voice characteristics for different characters in the book, - ## leading to a low similarity for the ground truth in some cases. - # test_set = get_librispeech_test(metalst, gen_wav_dir, gpus, librispeech_test_clean_path, eval_ground_truth = True) # eval ground truth - - local = args.local - if local: # use local custom checkpoint dir - asr_ckpt_dir = "../checkpoints/Systran/faster-whisper-large-v3" - else: - asr_ckpt_dir = "" # auto download to cache dir - wavlm_ckpt_dir = "../checkpoints/UniSpeech/wavlm_large_finetune.pth" - - # --------------------------- WER --------------------------- - if eval_task == "wer": - wers = [] - with mp.Pool(processes=len(gpus)) as pool: - args = [(rank, lang, sub_test_set, asr_ckpt_dir) for (rank, sub_test_set) in test_set] - results = pool.map(run_asr_wer, args) - for wers_ in results: - wers.extend(wers_) - - wer = round(np.mean(wers) * 100, 3) - print(f"\nTotal {len(wers)} samples") - print(f"WER : {wer}%") - - # --------------------------- SIM --------------------------- - if eval_task == "sim": - sim_list = [] - with mp.Pool(processes=len(gpus)) as pool: - args = [(rank, sub_test_set, wavlm_ckpt_dir) for (rank, sub_test_set) in test_set] - results = pool.map(run_sim, args) - for sim_ in results: - sim_list.extend(sim_) - - sim = round(sum(sim_list) / len(sim_list), 3) - print(f"\nTotal {len(sim_list)} samples") - print(f"SIM : {sim}") - - -if __name__ == "__main__": - main() diff --git a/src/f5_tts/eval/eval_seedtts_testset.py b/src/f5_tts/eval/eval_seedtts_testset.py deleted file mode 100644 index 5cc198771aa48ac6d456d82f649d0e5691c1246d..0000000000000000000000000000000000000000 --- a/src/f5_tts/eval/eval_seedtts_testset.py +++ /dev/null @@ -1,84 +0,0 @@ -# Evaluate with Seed-TTS testset - -import sys -import os -import argparse - -sys.path.append(os.getcwd()) - -import multiprocessing as mp -from importlib.resources import files - -import numpy as np - -from f5_tts.eval.utils_eval import ( - get_seed_tts_test, - run_asr_wer, - run_sim, -) - -rel_path = str(files("f5_tts").joinpath("../../")) - - -def get_args(): - parser = argparse.ArgumentParser() - parser.add_argument("-e", "--eval_task", type=str, default="wer", choices=["sim", "wer"]) - parser.add_argument("-l", "--lang", type=str, default="en", choices=["zh", "en"]) - parser.add_argument("-g", "--gen_wav_dir", type=str, required=True) - parser.add_argument("-n", "--gpu_nums", type=int, default=8, help="Number of GPUs to use") - parser.add_argument("--local", action="store_true", help="Use local custom checkpoint directory") - return parser.parse_args() - - -def main(): - args = get_args() - eval_task = args.eval_task - lang = args.lang - gen_wav_dir = args.gen_wav_dir - metalst = rel_path + f"/data/seedtts_testset/{lang}/meta.lst" # seed-tts testset - - # NOTE. paraformer-zh result will be slightly different according to the number of gpus, cuz batchsize is different - # zh 1.254 seems a result of 4 workers wer_seed_tts - gpus = list(range(args.gpu_nums)) - test_set = get_seed_tts_test(metalst, gen_wav_dir, gpus) - - local = args.local - if local: # use local custom checkpoint dir - if lang == "zh": - asr_ckpt_dir = "../checkpoints/funasr" # paraformer-zh dir under funasr - elif lang == "en": - asr_ckpt_dir = "../checkpoints/Systran/faster-whisper-large-v3" - else: - asr_ckpt_dir = "" # auto download to cache dir - wavlm_ckpt_dir = "../checkpoints/UniSpeech/wavlm_large_finetune.pth" - - # --------------------------- WER --------------------------- - - if eval_task == "wer": - wers = [] - with mp.Pool(processes=len(gpus)) as pool: - args = [(rank, lang, sub_test_set, asr_ckpt_dir) for (rank, sub_test_set) in test_set] - results = pool.map(run_asr_wer, args) - for wers_ in results: - wers.extend(wers_) - - wer = round(np.mean(wers) * 100, 3) - print(f"\nTotal {len(wers)} samples") - print(f"WER : {wer}%") - - # --------------------------- SIM --------------------------- - if eval_task == "sim": - sim_list = [] - with mp.Pool(processes=len(gpus)) as pool: - args = [(rank, sub_test_set, wavlm_ckpt_dir) for (rank, sub_test_set) in test_set] - results = pool.map(run_sim, args) - for sim_ in results: - sim_list.extend(sim_) - - sim = round(sum(sim_list) / len(sim_list), 3) - print(f"\nTotal {len(sim_list)} samples") - print(f"SIM : {sim}") - - -if __name__ == "__main__": - main() diff --git a/src/f5_tts/eval/utils_eval.py b/src/f5_tts/eval/utils_eval.py deleted file mode 100644 index 00cd97a3c4b1508e9f5dda8a7ae5efabb97910c6..0000000000000000000000000000000000000000 --- a/src/f5_tts/eval/utils_eval.py +++ /dev/null @@ -1,405 +0,0 @@ -import math -import os -import random -import string - -import torch -import torch.nn.functional as F -import torchaudio -from tqdm import tqdm - -from f5_tts.eval.ecapa_tdnn import ECAPA_TDNN_SMALL -from f5_tts.model.modules import MelSpec -from f5_tts.model.utils import convert_char_to_pinyin - - -# seedtts testset metainfo: utt, prompt_text, prompt_wav, gt_text, gt_wav -def get_seedtts_testset_metainfo(metalst): - f = open(metalst) - lines = f.readlines() - f.close() - metainfo = [] - for line in lines: - if len(line.strip().split("|")) == 5: - utt, prompt_text, prompt_wav, gt_text, gt_wav = line.strip().split("|") - elif len(line.strip().split("|")) == 4: - utt, prompt_text, prompt_wav, gt_text = line.strip().split("|") - gt_wav = os.path.join(os.path.dirname(metalst), "wavs", utt + ".wav") - if not os.path.isabs(prompt_wav): - prompt_wav = os.path.join(os.path.dirname(metalst), prompt_wav) - metainfo.append((utt, prompt_text, prompt_wav, gt_text, gt_wav)) - return metainfo - - -# librispeech test-clean metainfo: gen_utt, ref_txt, ref_wav, gen_txt, gen_wav -def get_librispeech_test_clean_metainfo(metalst, librispeech_test_clean_path): - f = open(metalst) - lines = f.readlines() - f.close() - metainfo = [] - for line in lines: - ref_utt, ref_dur, ref_txt, gen_utt, gen_dur, gen_txt = line.strip().split("\t") - - # ref_txt = ref_txt[0] + ref_txt[1:].lower() + '.' # if use librispeech test-clean (no-pc) - ref_spk_id, ref_chaptr_id, _ = ref_utt.split("-") - ref_wav = os.path.join(librispeech_test_clean_path, ref_spk_id, ref_chaptr_id, ref_utt + ".flac") - - # gen_txt = gen_txt[0] + gen_txt[1:].lower() + '.' # if use librispeech test-clean (no-pc) - gen_spk_id, gen_chaptr_id, _ = gen_utt.split("-") - gen_wav = os.path.join(librispeech_test_clean_path, gen_spk_id, gen_chaptr_id, gen_utt + ".flac") - - metainfo.append((gen_utt, ref_txt, ref_wav, " " + gen_txt, gen_wav)) - - return metainfo - - -# padded to max length mel batch -def padded_mel_batch(ref_mels): - max_mel_length = torch.LongTensor([mel.shape[-1] for mel in ref_mels]).amax() - padded_ref_mels = [] - for mel in ref_mels: - padded_ref_mel = F.pad(mel, (0, max_mel_length - mel.shape[-1]), value=0) - padded_ref_mels.append(padded_ref_mel) - padded_ref_mels = torch.stack(padded_ref_mels) - padded_ref_mels = padded_ref_mels.permute(0, 2, 1) - return padded_ref_mels - - -# get prompts from metainfo containing: utt, prompt_text, prompt_wav, gt_text, gt_wav - - -def get_inference_prompt( - metainfo, - speed=1.0, - tokenizer="pinyin", - polyphone=True, - target_sample_rate=24000, - n_fft=1024, - win_length=1024, - n_mel_channels=100, - hop_length=256, - mel_spec_type="vocos", - target_rms=0.1, - use_truth_duration=False, - infer_batch_size=1, - num_buckets=200, - min_secs=3, - max_secs=40, -): - prompts_all = [] - - min_tokens = min_secs * target_sample_rate // hop_length - max_tokens = max_secs * target_sample_rate // hop_length - - batch_accum = [0] * num_buckets - utts, ref_rms_list, ref_mels, ref_mel_lens, total_mel_lens, final_text_list = ( - [[] for _ in range(num_buckets)] for _ in range(6) - ) - - mel_spectrogram = MelSpec( - n_fft=n_fft, - hop_length=hop_length, - win_length=win_length, - n_mel_channels=n_mel_channels, - target_sample_rate=target_sample_rate, - mel_spec_type=mel_spec_type, - ) - - for utt, prompt_text, prompt_wav, gt_text, gt_wav in tqdm(metainfo, desc="Processing prompts..."): - # Audio - ref_audio, ref_sr = torchaudio.load(prompt_wav) - ref_rms = torch.sqrt(torch.mean(torch.square(ref_audio))) - if ref_rms < target_rms: - ref_audio = ref_audio * target_rms / ref_rms - assert ref_audio.shape[-1] > 5000, f"Empty prompt wav: {prompt_wav}, or torchaudio backend issue." - if ref_sr != target_sample_rate: - resampler = torchaudio.transforms.Resample(ref_sr, target_sample_rate) - ref_audio = resampler(ref_audio) - - # Text - if len(prompt_text[-1].encode("utf-8")) == 1: - prompt_text = prompt_text + " " - text = [prompt_text + gt_text] - if tokenizer == "pinyin": - text_list = convert_char_to_pinyin(text, polyphone=polyphone) - else: - text_list = text - - # Duration, mel frame length - ref_mel_len = ref_audio.shape[-1] // hop_length - if use_truth_duration: - gt_audio, gt_sr = torchaudio.load(gt_wav) - if gt_sr != target_sample_rate: - resampler = torchaudio.transforms.Resample(gt_sr, target_sample_rate) - gt_audio = resampler(gt_audio) - total_mel_len = ref_mel_len + int(gt_audio.shape[-1] / hop_length / speed) - - # # test vocoder resynthesis - # ref_audio = gt_audio - else: - ref_text_len = len(prompt_text.encode("utf-8")) - gen_text_len = len(gt_text.encode("utf-8")) - total_mel_len = ref_mel_len + int(ref_mel_len / ref_text_len * gen_text_len / speed) - - # to mel spectrogram - ref_mel = mel_spectrogram(ref_audio) - ref_mel = ref_mel.squeeze(0) - - # deal with batch - assert infer_batch_size > 0, "infer_batch_size should be greater than 0." - assert ( - min_tokens <= total_mel_len <= max_tokens - ), f"Audio {utt} has duration {total_mel_len*hop_length//target_sample_rate}s out of range [{min_secs}, {max_secs}]." - bucket_i = math.floor((total_mel_len - min_tokens) / (max_tokens - min_tokens + 1) * num_buckets) - - utts[bucket_i].append(utt) - ref_rms_list[bucket_i].append(ref_rms) - ref_mels[bucket_i].append(ref_mel) - ref_mel_lens[bucket_i].append(ref_mel_len) - total_mel_lens[bucket_i].append(total_mel_len) - final_text_list[bucket_i].extend(text_list) - - batch_accum[bucket_i] += total_mel_len - - if batch_accum[bucket_i] >= infer_batch_size: - # print(f"\n{len(ref_mels[bucket_i][0][0])}\n{ref_mel_lens[bucket_i]}\n{total_mel_lens[bucket_i]}") - prompts_all.append( - ( - utts[bucket_i], - ref_rms_list[bucket_i], - padded_mel_batch(ref_mels[bucket_i]), - ref_mel_lens[bucket_i], - total_mel_lens[bucket_i], - final_text_list[bucket_i], - ) - ) - batch_accum[bucket_i] = 0 - ( - utts[bucket_i], - ref_rms_list[bucket_i], - ref_mels[bucket_i], - ref_mel_lens[bucket_i], - total_mel_lens[bucket_i], - final_text_list[bucket_i], - ) = [], [], [], [], [], [] - - # add residual - for bucket_i, bucket_frames in enumerate(batch_accum): - if bucket_frames > 0: - prompts_all.append( - ( - utts[bucket_i], - ref_rms_list[bucket_i], - padded_mel_batch(ref_mels[bucket_i]), - ref_mel_lens[bucket_i], - total_mel_lens[bucket_i], - final_text_list[bucket_i], - ) - ) - # not only leave easy work for last workers - random.seed(666) - random.shuffle(prompts_all) - - return prompts_all - - -# get wav_res_ref_text of seed-tts test metalst -# https://github.com/BytedanceSpeech/seed-tts-eval - - -def get_seed_tts_test(metalst, gen_wav_dir, gpus): - f = open(metalst) - lines = f.readlines() - f.close() - - test_set_ = [] - for line in tqdm(lines): - if len(line.strip().split("|")) == 5: - utt, prompt_text, prompt_wav, gt_text, gt_wav = line.strip().split("|") - elif len(line.strip().split("|")) == 4: - utt, prompt_text, prompt_wav, gt_text = line.strip().split("|") - - if not os.path.exists(os.path.join(gen_wav_dir, utt + ".wav")): - continue - gen_wav = os.path.join(gen_wav_dir, utt + ".wav") - if not os.path.isabs(prompt_wav): - prompt_wav = os.path.join(os.path.dirname(metalst), prompt_wav) - - test_set_.append((gen_wav, prompt_wav, gt_text)) - - num_jobs = len(gpus) - if num_jobs == 1: - return [(gpus[0], test_set_)] - - wav_per_job = len(test_set_) // num_jobs + 1 - test_set = [] - for i in range(num_jobs): - test_set.append((gpus[i], test_set_[i * wav_per_job : (i + 1) * wav_per_job])) - - return test_set - - -# get librispeech test-clean cross sentence test - - -def get_librispeech_test(metalst, gen_wav_dir, gpus, librispeech_test_clean_path, eval_ground_truth=False): - f = open(metalst) - lines = f.readlines() - f.close() - - test_set_ = [] - for line in tqdm(lines): - ref_utt, ref_dur, ref_txt, gen_utt, gen_dur, gen_txt = line.strip().split("\t") - - if eval_ground_truth: - gen_spk_id, gen_chaptr_id, _ = gen_utt.split("-") - gen_wav = os.path.join(librispeech_test_clean_path, gen_spk_id, gen_chaptr_id, gen_utt + ".flac") - else: - if not os.path.exists(os.path.join(gen_wav_dir, gen_utt + ".wav")): - raise FileNotFoundError(f"Generated wav not found: {gen_utt}") - gen_wav = os.path.join(gen_wav_dir, gen_utt + ".wav") - - ref_spk_id, ref_chaptr_id, _ = ref_utt.split("-") - ref_wav = os.path.join(librispeech_test_clean_path, ref_spk_id, ref_chaptr_id, ref_utt + ".flac") - - test_set_.append((gen_wav, ref_wav, gen_txt)) - - num_jobs = len(gpus) - if num_jobs == 1: - return [(gpus[0], test_set_)] - - wav_per_job = len(test_set_) // num_jobs + 1 - test_set = [] - for i in range(num_jobs): - test_set.append((gpus[i], test_set_[i * wav_per_job : (i + 1) * wav_per_job])) - - return test_set - - -# load asr model - - -def load_asr_model(lang, ckpt_dir=""): - if lang == "zh": - from funasr import AutoModel - - model = AutoModel( - model=os.path.join(ckpt_dir, "paraformer-zh"), - # vad_model = os.path.join(ckpt_dir, "fsmn-vad"), - # punc_model = os.path.join(ckpt_dir, "ct-punc"), - # spk_model = os.path.join(ckpt_dir, "cam++"), - disable_update=True, - ) # following seed-tts setting - elif lang == "en": - from faster_whisper import WhisperModel - - model_size = "large-v3" if ckpt_dir == "" else ckpt_dir - model = WhisperModel(model_size, device="cuda", compute_type="float16") - return model - - -# WER Evaluation, the way Seed-TTS does - - -def run_asr_wer(args): - rank, lang, test_set, ckpt_dir = args - - if lang == "zh": - import zhconv - - torch.cuda.set_device(rank) - elif lang == "en": - os.environ["CUDA_VISIBLE_DEVICES"] = str(rank) - else: - raise NotImplementedError( - "lang support only 'zh' (funasr paraformer-zh), 'en' (faster-whisper-large-v3), for now." - ) - - asr_model = load_asr_model(lang, ckpt_dir=ckpt_dir) - - from zhon.hanzi import punctuation - - punctuation_all = punctuation + string.punctuation - wers = [] - - from jiwer import compute_measures - - for gen_wav, prompt_wav, truth in tqdm(test_set): - if lang == "zh": - res = asr_model.generate(input=gen_wav, batch_size_s=300, disable_pbar=True) - hypo = res[0]["text"] - hypo = zhconv.convert(hypo, "zh-cn") - elif lang == "en": - segments, _ = asr_model.transcribe(gen_wav, beam_size=5, language="en") - hypo = "" - for segment in segments: - hypo = hypo + " " + segment.text - - # raw_truth = truth - # raw_hypo = hypo - - for x in punctuation_all: - truth = truth.replace(x, "") - hypo = hypo.replace(x, "") - - truth = truth.replace(" ", " ") - hypo = hypo.replace(" ", " ") - - if lang == "zh": - truth = " ".join([x for x in truth]) - hypo = " ".join([x for x in hypo]) - elif lang == "en": - truth = truth.lower() - hypo = hypo.lower() - - measures = compute_measures(truth, hypo) - wer = measures["wer"] - - # ref_list = truth.split(" ") - # subs = measures["substitutions"] / len(ref_list) - # dele = measures["deletions"] / len(ref_list) - # inse = measures["insertions"] / len(ref_list) - - wers.append(wer) - - return wers - - -# SIM Evaluation - - -def run_sim(args): - rank, test_set, ckpt_dir = args - device = f"cuda:{rank}" - - model = ECAPA_TDNN_SMALL(feat_dim=1024, feat_type="wavlm_large", config_path=None) - state_dict = torch.load(ckpt_dir, weights_only=True, map_location=lambda storage, loc: storage) - model.load_state_dict(state_dict["model"], strict=False) - - use_gpu = True if torch.cuda.is_available() else False - if use_gpu: - model = model.cuda(device) - model.eval() - - sim_list = [] - for wav1, wav2, truth in tqdm(test_set): - wav1, sr1 = torchaudio.load(wav1) - wav2, sr2 = torchaudio.load(wav2) - - resample1 = torchaudio.transforms.Resample(orig_freq=sr1, new_freq=16000) - resample2 = torchaudio.transforms.Resample(orig_freq=sr2, new_freq=16000) - wav1 = resample1(wav1) - wav2 = resample2(wav2) - - if use_gpu: - wav1 = wav1.cuda(device) - wav2 = wav2.cuda(device) - with torch.no_grad(): - emb1 = model(wav1) - emb2 = model(wav2) - - sim = F.cosine_similarity(emb1, emb2)[0].item() - # print(f"VSim score between two audios: {sim:.4f} (-1.0, 1.0).") - sim_list.append(sim) - - return sim_list diff --git a/src/f5_tts/infer/README.md b/src/f5_tts/infer/README.md deleted file mode 100644 index cba4eb281ec5d133e2df4d48368513c1e4d25c20..0000000000000000000000000000000000000000 --- a/src/f5_tts/infer/README.md +++ /dev/null @@ -1,191 +0,0 @@ -# Inference - -The pretrained model checkpoints can be reached at [🤗 Hugging Face](https://huggingface.co/SWivid/F5-TTS) and [🤖 Model Scope](https://www.modelscope.cn/models/SWivid/F5-TTS_Emilia-ZH-EN), or will be automatically downloaded when running inference scripts. - -**More checkpoints with whole community efforts can be found in [SHARED.md](SHARED.md), supporting more languages.** - -Currently support **30s for a single** generation, which is the **total length** including both prompt and output audio. However, you can provide `infer_cli` and `infer_gradio` with longer text, will automatically do chunk generation. Long reference audio will be **clip short to ~15s**. - -To avoid possible inference failures, make sure you have seen through the following instructions. - -- Use reference audio <15s and leave some silence (e.g. 1s) at the end. Otherwise there is a risk of truncating in the middle of word, leading to suboptimal generation. -- Uppercased letters will be uttered letter by letter, so use lowercased letters for normal words. -- Add some spaces (blank: " ") or punctuations (e.g. "," ".") to explicitly introduce some pauses. -- Preprocess numbers to Chinese letters if you want to have them read in Chinese, otherwise in English. - - -## Gradio App - -Currently supported features: - -- Basic TTS with Chunk Inference -- Multi-Style / Multi-Speaker Generation -- Voice Chat powered by Qwen2.5-3B-Instruct - -The cli command `f5-tts_infer-gradio` equals to `python src/f5_tts/infer/infer_gradio.py`, which launches a Gradio APP (web interface) for inference. - -The script will load model checkpoints from Huggingface. You can also manually download files and update the path to `load_model()` in `infer_gradio.py`. Currently only load TTS models first, will load ASR model to do transcription if `ref_text` not provided, will load LLM model if use Voice Chat. - -Could also be used as a component for larger application. -```python -import gradio as gr -from f5_tts.infer.infer_gradio import app - -with gr.Blocks() as main_app: - gr.Markdown("# This is an example of using F5-TTS within a bigger Gradio app") - - # ... other Gradio components - - app.render() - -main_app.launch() -``` - - -## CLI Inference - -The cli command `f5-tts_infer-cli` equals to `python src/f5_tts/infer/infer_cli.py`, which is a command line tool for inference. - -The script will load model checkpoints from Huggingface. You can also manually download files and use `--ckpt_file` to specify the model you want to load, or directly update in `infer_cli.py`. - -For change vocab.txt use `--vocab_file` to provide your `vocab.txt` file. - -Basically you can inference with flags: -```bash -# Leave --ref_text "" will have ASR model transcribe (extra GPU memory usage) -f5-tts_infer-cli \ ---model "F5-TTS" \ ---ref_audio "ref_audio.wav" \ ---ref_text "The content, subtitle or transcription of reference audio." \ ---gen_text "Some text you want TTS model generate for you." - -# Choose Vocoder -f5-tts_infer-cli --vocoder_name bigvgan --load_vocoder_from_local --ckpt_file -f5-tts_infer-cli --vocoder_name vocos --load_vocoder_from_local --ckpt_file -``` - -And a `.toml` file would help with more flexible usage. - -```bash -f5-tts_infer-cli -c custom.toml -``` - -For example, you can use `.toml` to pass in variables, refer to `src/f5_tts/infer/examples/basic/basic.toml`: - -```toml -# F5-TTS | E2-TTS -model = "F5-TTS" -ref_audio = "infer/examples/basic/basic_ref_en.wav" -# If an empty "", transcribes the reference audio automatically. -ref_text = "Some call me nature, others call me mother nature." -gen_text = "I don't really care what you call me. I've been a silent spectator, watching species evolve, empires rise and fall. But always remember, I am mighty and enduring." -# File with text to generate. Ignores the text above. -gen_file = "" -remove_silence = false -output_dir = "tests" -``` - -You can also leverage `.toml` file to do multi-style generation, refer to `src/f5_tts/infer/examples/multi/story.toml`. - -```toml -# F5-TTS | E2-TTS -model = "F5-TTS" -ref_audio = "infer/examples/multi/main.flac" -# If an empty "", transcribes the reference audio automatically. -ref_text = "" -gen_text = "" -# File with text to generate. Ignores the text above. -gen_file = "infer/examples/multi/story.txt" -remove_silence = true -output_dir = "tests" - -[voices.town] -ref_audio = "infer/examples/multi/town.flac" -ref_text = "" - -[voices.country] -ref_audio = "infer/examples/multi/country.flac" -ref_text = "" -``` -You should mark the voice with `[main]` `[town]` `[country]` whenever you want to change voice, refer to `src/f5_tts/infer/examples/multi/story.txt`. - -## Speech Editing - -To test speech editing capabilities, use the following command: - -```bash -python src/f5_tts/infer/speech_edit.py -``` - -## Socket Realtime Client - -To communicate with socket server you need to run -```bash -python src/f5_tts/socket_server.py -``` - -
-Then create client to communicate - -``` python -import socket -import numpy as np -import asyncio -import pyaudio - -async def listen_to_voice(text, server_ip='localhost', server_port=9999): - client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - client_socket.connect((server_ip, server_port)) - - async def play_audio_stream(): - buffer = b'' - p = pyaudio.PyAudio() - stream = p.open(format=pyaudio.paFloat32, - channels=1, - rate=24000, # Ensure this matches the server's sampling rate - output=True, - frames_per_buffer=2048) - - try: - while True: - chunk = await asyncio.get_event_loop().run_in_executor(None, client_socket.recv, 1024) - if not chunk: # End of stream - break - if b"END_OF_AUDIO" in chunk: - buffer += chunk.replace(b"END_OF_AUDIO", b"") - if buffer: - audio_array = np.frombuffer(buffer, dtype=np.float32).copy() # Make a writable copy - stream.write(audio_array.tobytes()) - break - buffer += chunk - if len(buffer) >= 4096: - audio_array = np.frombuffer(buffer[:4096], dtype=np.float32).copy() # Make a writable copy - stream.write(audio_array.tobytes()) - buffer = buffer[4096:] - finally: - stream.stop_stream() - stream.close() - p.terminate() - - try: - # Send only the text to the server - await asyncio.get_event_loop().run_in_executor(None, client_socket.sendall, text.encode('utf-8')) - await play_audio_stream() - print("Audio playback finished.") - - except Exception as e: - print(f"Error in listen_to_voice: {e}") - - finally: - client_socket.close() - -# Example usage: Replace this with your actual server IP and port -async def main(): - await listen_to_voice("my name is jenny..", server_ip='localhost', server_port=9998) - -# Run the main async function -asyncio.run(main()) -``` - -
- diff --git a/src/f5_tts/infer/SHARED.md b/src/f5_tts/infer/SHARED.md deleted file mode 100644 index e29b9d69f997a3d486c16e8a778d17f0676c99c2..0000000000000000000000000000000000000000 --- a/src/f5_tts/infer/SHARED.md +++ /dev/null @@ -1,74 +0,0 @@ - -# Shared Model Cards - - -### **Prerequisites of using** -- This document is serving as a quick lookup table for the community training/finetuning result, with various language support. -- The models in this repository are open source and are based on voluntary contributions from contributors. -- The use of models must be conditioned on respect for the respective creators. The convenience brought comes from their efforts. - - -### **Welcome to share here** -- Have a pretrained/finetuned result: model checkpoint (pruned best to facilitate inference, i.e. leave only `ema_model_state_dict`) and corresponding vocab file (for tokenization). -- Host a public [huggingface model repository](https://huggingface.co/new) and upload the model related files. -- Make a pull request adding a model card to the current page, i.e. `src\f5_tts\infer\SHARED.md`. - - -### Supported Languages -- [Multilingual](#multilingual) - - [F5-TTS Base @ pretrain @ zh \& en](#f5-tts-base--pretrain--zh--en) -- [Mandarin](#mandarin) -- [Japanese](#japanese) - - [F5-TTS Base @ pretrain/finetune @ ja](#f5-tts-base--pretrainfinetune--ja) -- [English](#english) -- [French](#french) - - [French LibriVox @ finetune @ fr](#french-librivox--finetune--fr) - - -## Multilingual - -#### F5-TTS Base @ pretrain @ zh & en -|Model|🤗Hugging Face|Data (Hours)|Model License| -|:---:|:------------:|:-----------:|:-------------:| -|F5-TTS Base|[ckpt & vocab](https://huggingface.co/SWivid/F5-TTS/tree/main/F5TTS_Base)|[Emilia 95K zh&en](https://huggingface.co/datasets/amphion/Emilia-Dataset/tree/fc71e07)|cc-by-nc-4.0| - -```bash -MODEL_CKPT: hf://SWivid/F5-TTS/F5TTS_Base/model_1200000.safetensors -VOCAB_FILE: hf://SWivid/F5-TTS/F5TTS_Base/vocab.txt -``` - -*Other infos, e.g. Author info, Github repo, Link to some sampled results, Usage instruction, Tutorial (Blog, Video, etc.) ...* - - -## Mandarin - -## Japanese - -#### F5-TTS Base @ pretrain/finetune @ ja -|Model|🤗Hugging Face|Data (Hours)|Model License| -|:---:|:------------:|:-----------:|:-------------:| -|F5-TTS Base|[ckpt & vocab](https://huggingface.co/Jmica/F5TTS/tree/main/JA_8500000)|[Emilia 1.7k JA](https://huggingface.co/datasets/amphion/Emilia-Dataset/tree/fc71e07) & [Galgame Dataset 5.4k](https://huggingface.co/datasets/OOPPEENN/Galgame_Dataset)|cc-by-nc-4.0| - -```bash -MODEL_CKPT: hf://Jmica/F5TTS/JA_8500000/model_8499660.pt -VOCAB_FILE: hf://Jmica/F5TTS/JA_8500000/vocab_updated.txt -``` - -## English - - -## French - -#### French LibriVox @ finetune @ fr -|Model|🤗Hugging Face|Data (Hours)|Model License| -|:---:|:------------:|:-----------:|:-------------:| -|F5-TTS French|[ckpt & vocab](https://huggingface.co/RASPIAUDIO/F5-French-MixedSpeakers-reduced)|[LibriVox](https://librivox.org/)|cc-by-nc-4.0| - -```bash -MODEL_CKPT: hf://RASPIAUDIO/F5-French-MixedSpeakers-reduced/model_last_reduced.pt -VOCAB_FILE: hf://RASPIAUDIO/F5-French-MixedSpeakers-reduced/vocab.txt -``` - -- [Online Inference with Hugging Face Space](https://huggingface.co/spaces/RASPIAUDIO/f5-tts_french). -- [Tutorial video to train a new language model](https://www.youtube.com/watch?v=UO4usaOojys). -- [Discussion about this training can be found here](https://github.com/SWivid/F5-TTS/issues/434). diff --git a/src/f5_tts/infer/examples/basic/basic.toml b/src/f5_tts/infer/examples/basic/basic.toml deleted file mode 100644 index 4c594c7b8836d58673aac32210d153de3ba29efb..0000000000000000000000000000000000000000 --- a/src/f5_tts/infer/examples/basic/basic.toml +++ /dev/null @@ -1,11 +0,0 @@ -# F5-TTS | E2-TTS -model = "F5-TTS" -ref_audio = "infer/examples/basic/basic_ref_en.wav" -# If an empty "", transcribes the reference audio automatically. -ref_text = "Some call me nature, others call me mother nature." -gen_text = "I don't really care what you call me. I've been a silent spectator, watching species evolve, empires rise and fall. But always remember, I am mighty and enduring." -# File with text to generate. Ignores the text above. -gen_file = "" -remove_silence = false -output_dir = "tests" -output_file = "infer_cli_out.wav" diff --git a/src/f5_tts/infer/examples/basic/basic_ref_en.wav b/src/f5_tts/infer/examples/basic/basic_ref_en.wav deleted file mode 100644 index 3c593c3cfe1528432e29f355bb8fd9ec1dd9847c..0000000000000000000000000000000000000000 Binary files a/src/f5_tts/infer/examples/basic/basic_ref_en.wav and /dev/null differ diff --git a/src/f5_tts/infer/examples/basic/basic_ref_zh.wav b/src/f5_tts/infer/examples/basic/basic_ref_zh.wav deleted file mode 100644 index 8cc055ede333a6778b7cdd5f7665a5db0e87ecd7..0000000000000000000000000000000000000000 Binary files a/src/f5_tts/infer/examples/basic/basic_ref_zh.wav and /dev/null differ diff --git a/src/f5_tts/infer/examples/multi/country.flac b/src/f5_tts/infer/examples/multi/country.flac deleted file mode 100644 index ad6985b710ec754b0d40e79be6cc3563b32abf15..0000000000000000000000000000000000000000 Binary files a/src/f5_tts/infer/examples/multi/country.flac and /dev/null differ diff --git a/src/f5_tts/infer/examples/multi/main.flac b/src/f5_tts/infer/examples/multi/main.flac deleted file mode 100644 index 671aded6b10fc6f10d27d6b0764a109f0e7fadca..0000000000000000000000000000000000000000 Binary files a/src/f5_tts/infer/examples/multi/main.flac and /dev/null differ diff --git a/src/f5_tts/infer/examples/multi/story.toml b/src/f5_tts/infer/examples/multi/story.toml deleted file mode 100644 index c6370629fd6c4e59b4ae14c845d540bb62d88038..0000000000000000000000000000000000000000 --- a/src/f5_tts/infer/examples/multi/story.toml +++ /dev/null @@ -1,19 +0,0 @@ -# F5-TTS | E2-TTS -model = "F5-TTS" -ref_audio = "infer/examples/multi/main.flac" -# If an empty "", transcribes the reference audio automatically. -ref_text = "" -gen_text = "" -# File with text to generate. Ignores the text above. -gen_file = "infer/examples/multi/story.txt" -remove_silence = true -output_dir = "tests" - -[voices.town] -ref_audio = "infer/examples/multi/town.flac" -ref_text = "" - -[voices.country] -ref_audio = "infer/examples/multi/country.flac" -ref_text = "" - diff --git a/src/f5_tts/infer/examples/multi/story.txt b/src/f5_tts/infer/examples/multi/story.txt deleted file mode 100644 index bda1f2ba1b967d2e63fdaac3b987fcb54574d76f..0000000000000000000000000000000000000000 --- a/src/f5_tts/infer/examples/multi/story.txt +++ /dev/null @@ -1 +0,0 @@ -A Town Mouse and a Country Mouse were acquaintances, and the Country Mouse one day invited his friend to come and see him at his home in the fields. The Town Mouse came, and they sat down to a dinner of barleycorns and roots, the latter of which had a distinctly earthy flavour. The fare was not much to the taste of the guest, and presently he broke out with [town] “My poor dear friend, you live here no better than the ants. Now, you should just see how I fare! My larder is a regular horn of plenty. You must come and stay with me, and I promise you you shall live on the fat of the land.” [main] So when he returned to town he took the Country Mouse with him, and showed him into a larder containing flour and oatmeal and figs and honey and dates. The Country Mouse had never seen anything like it, and sat down to enjoy the luxuries his friend provided: but before they had well begun, the door of the larder opened and someone came in. The two Mice scampered off and hid themselves in a narrow and exceedingly uncomfortable hole. Presently, when all was quiet, they ventured out again; but someone else came in, and off they scuttled again. This was too much for the visitor. [country] “Goodbye,” [main] said he, [country] “I’m off. You live in the lap of luxury, I can see, but you are surrounded by dangers; whereas at home I can enjoy my simple dinner of roots and corn in peace.” \ No newline at end of file diff --git a/src/f5_tts/infer/examples/multi/town.flac b/src/f5_tts/infer/examples/multi/town.flac deleted file mode 100644 index 39c258582ccbedc48b82c988e7808c114a682292..0000000000000000000000000000000000000000 Binary files a/src/f5_tts/infer/examples/multi/town.flac and /dev/null differ diff --git a/src/f5_tts/infer/examples/vocab.txt b/src/f5_tts/infer/examples/vocab.txt deleted file mode 100644 index a30a90c12e1ab38b95c97770d5c5cd1d03c392e2..0000000000000000000000000000000000000000 --- a/src/f5_tts/infer/examples/vocab.txt +++ /dev/null @@ -1,2545 +0,0 @@ - -! -" -# -$ -% -& -' -( -) -* -+ -, -- -. -/ -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -: -; -= -> -? -@ -A -B -C -D -E -F -G -H -I -J -K -L -M -N -O -P -Q -R -S -T -U -V -W -X -Y -Z -[ -\ -] -_ -a -a1 -ai1 -ai2 -ai3 -ai4 -an1 -an3 -an4 -ang1 -ang2 -ang4 -ao1 -ao2 -ao3 -ao4 -b -ba -ba1 -ba2 -ba3 -ba4 -bai1 -bai2 -bai3 -bai4 -ban1 -ban2 -ban3 -ban4 -bang1 -bang2 -bang3 -bang4 -bao1 -bao2 -bao3 -bao4 -bei -bei1 -bei2 -bei3 -bei4 -ben1 -ben2 -ben3 -ben4 -beng -beng1 -beng2 -beng3 -beng4 -bi1 -bi2 -bi3 -bi4 -bian1 -bian2 -bian3 -bian4 -biao1 -biao2 -biao3 -bie1 -bie2 -bie3 -bie4 -bin1 -bin4 -bing1 -bing2 -bing3 -bing4 -bo -bo1 -bo2 -bo3 -bo4 -bu2 -bu3 -bu4 -c -ca1 -cai1 -cai2 -cai3 -cai4 -can1 -can2 -can3 -can4 -cang1 -cang2 -cao1 -cao2 -cao3 -ce4 -cen1 -cen2 -ceng1 -ceng2 -ceng4 -cha1 -cha2 -cha3 -cha4 -chai1 -chai2 -chan1 -chan2 -chan3 -chan4 -chang1 -chang2 -chang3 -chang4 -chao1 -chao2 -chao3 -che1 -che2 -che3 -che4 -chen1 -chen2 -chen3 -chen4 -cheng1 -cheng2 -cheng3 -cheng4 -chi1 -chi2 -chi3 -chi4 -chong1 -chong2 -chong3 -chong4 -chou1 -chou2 -chou3 -chou4 -chu1 -chu2 -chu3 -chu4 -chua1 -chuai1 -chuai2 -chuai3 -chuai4 -chuan1 -chuan2 -chuan3 -chuan4 -chuang1 -chuang2 -chuang3 -chuang4 -chui1 -chui2 -chun1 -chun2 -chun3 -chuo1 -chuo4 -ci1 -ci2 -ci3 -ci4 -cong1 -cong2 -cou4 -cu1 -cu4 -cuan1 -cuan2 -cuan4 -cui1 -cui3 -cui4 -cun1 -cun2 -cun4 -cuo1 -cuo2 -cuo4 -d -da -da1 -da2 -da3 -da4 -dai1 -dai2 -dai3 -dai4 -dan1 -dan2 -dan3 -dan4 -dang1 -dang2 -dang3 -dang4 -dao1 -dao2 -dao3 -dao4 -de -de1 -de2 -dei3 -den4 -deng1 -deng2 -deng3 -deng4 -di1 -di2 -di3 -di4 -dia3 -dian1 -dian2 -dian3 -dian4 -diao1 -diao3 -diao4 -die1 -die2 -die4 -ding1 -ding2 -ding3 -ding4 -diu1 -dong1 -dong3 -dong4 -dou1 -dou2 -dou3 -dou4 -du1 -du2 -du3 -du4 -duan1 -duan2 -duan3 -duan4 -dui1 -dui4 -dun1 -dun3 -dun4 -duo1 -duo2 -duo3 -duo4 -e -e1 -e2 -e3 -e4 -ei2 -en1 -en4 -er -er2 -er3 -er4 -f -fa1 -fa2 -fa3 -fa4 -fan1 -fan2 -fan3 -fan4 -fang1 -fang2 -fang3 -fang4 -fei1 -fei2 -fei3 -fei4 -fen1 -fen2 -fen3 -fen4 -feng1 -feng2 -feng3 -feng4 -fo2 -fou2 -fou3 -fu1 -fu2 -fu3 -fu4 -g -ga1 -ga2 -ga3 -ga4 -gai1 -gai2 -gai3 -gai4 -gan1 -gan2 -gan3 -gan4 -gang1 -gang2 -gang3 -gang4 -gao1 -gao2 -gao3 -gao4 -ge1 -ge2 -ge3 -ge4 -gei2 -gei3 -gen1 -gen2 -gen3 -gen4 -geng1 -geng3 -geng4 -gong1 -gong3 -gong4 -gou1 -gou2 -gou3 -gou4 -gu -gu1 -gu2 -gu3 -gu4 -gua1 -gua2 -gua3 -gua4 -guai1 -guai2 -guai3 -guai4 -guan1 -guan2 -guan3 -guan4 -guang1 -guang2 -guang3 -guang4 -gui1 -gui2 -gui3 -gui4 -gun3 -gun4 -guo1 -guo2 -guo3 -guo4 -h -ha1 -ha2 -ha3 -hai1 -hai2 -hai3 -hai4 -han1 -han2 -han3 -han4 -hang1 -hang2 -hang4 -hao1 -hao2 -hao3 -hao4 -he1 -he2 -he4 -hei1 -hen2 -hen3 -hen4 -heng1 -heng2 -heng4 -hong1 -hong2 -hong3 -hong4 -hou1 -hou2 -hou3 -hou4 -hu1 -hu2 -hu3 -hu4 -hua1 -hua2 -hua4 -huai2 -huai4 -huan1 -huan2 -huan3 -huan4 -huang1 -huang2 -huang3 -huang4 -hui1 -hui2 -hui3 -hui4 -hun1 -hun2 -hun4 -huo -huo1 -huo2 -huo3 -huo4 -i -j -ji1 -ji2 -ji3 -ji4 -jia -jia1 -jia2 -jia3 -jia4 -jian1 -jian2 -jian3 -jian4 -jiang1 -jiang2 -jiang3 -jiang4 -jiao1 -jiao2 -jiao3 -jiao4 -jie1 -jie2 -jie3 -jie4 -jin1 -jin2 -jin3 -jin4 -jing1 -jing2 -jing3 -jing4 -jiong3 -jiu1 -jiu2 -jiu3 -jiu4 -ju1 -ju2 -ju3 -ju4 -juan1 -juan2 -juan3 -juan4 -jue1 -jue2 -jue4 -jun1 -jun4 -k -ka1 -ka2 -ka3 -kai1 -kai2 -kai3 -kai4 -kan1 -kan2 -kan3 -kan4 -kang1 -kang2 -kang4 -kao1 -kao2 -kao3 -kao4 -ke1 -ke2 -ke3 -ke4 -ken3 -keng1 -kong1 -kong3 -kong4 -kou1 -kou2 -kou3 -kou4 -ku1 -ku2 -ku3 -ku4 -kua1 -kua3 -kua4 -kuai3 -kuai4 -kuan1 -kuan2 -kuan3 -kuang1 -kuang2 -kuang4 -kui1 -kui2 -kui3 -kui4 -kun1 -kun3 -kun4 -kuo4 -l -la -la1 -la2 -la3 -la4 -lai2 -lai4 -lan2 -lan3 -lan4 -lang1 -lang2 -lang3 -lang4 -lao1 -lao2 -lao3 -lao4 -le -le1 -le4 -lei -lei1 -lei2 -lei3 -lei4 -leng1 -leng2 -leng3 -leng4 -li -li1 -li2 -li3 -li4 -lia3 -lian2 -lian3 -lian4 -liang2 -liang3 -liang4 -liao1 -liao2 -liao3 -liao4 -lie1 -lie2 -lie3 -lie4 -lin1 -lin2 -lin3 -lin4 -ling2 -ling3 -ling4 -liu1 -liu2 -liu3 -liu4 -long1 -long2 -long3 -long4 -lou1 -lou2 -lou3 -lou4 -lu1 -lu2 -lu3 -lu4 -luan2 -luan3 -luan4 -lun1 -lun2 -lun4 -luo1 -luo2 -luo3 -luo4 -lv2 -lv3 -lv4 -lve3 -lve4 -m -ma -ma1 -ma2 -ma3 -ma4 -mai2 -mai3 -mai4 -man1 -man2 -man3 -man4 -mang2 -mang3 -mao1 -mao2 -mao3 -mao4 -me -mei2 -mei3 -mei4 -men -men1 -men2 -men4 -meng -meng1 -meng2 -meng3 -meng4 -mi1 -mi2 -mi3 -mi4 -mian2 -mian3 -mian4 -miao1 -miao2 -miao3 -miao4 -mie1 -mie4 -min2 -min3 -ming2 -ming3 -ming4 -miu4 -mo1 -mo2 -mo3 -mo4 -mou1 -mou2 -mou3 -mu2 -mu3 -mu4 -n -n2 -na1 -na2 -na3 -na4 -nai2 -nai3 -nai4 -nan1 -nan2 -nan3 -nan4 -nang1 -nang2 -nang3 -nao1 -nao2 -nao3 -nao4 -ne -ne2 -ne4 -nei3 -nei4 -nen4 -neng2 -ni1 -ni2 -ni3 -ni4 -nian1 -nian2 -nian3 -nian4 -niang2 -niang4 -niao2 -niao3 -niao4 -nie1 -nie4 -nin2 -ning2 -ning3 -ning4 -niu1 -niu2 -niu3 -niu4 -nong2 -nong4 -nou4 -nu2 -nu3 -nu4 -nuan3 -nuo2 -nuo4 -nv2 -nv3 -nve4 -o -o1 -o2 -ou1 -ou2 -ou3 -ou4 -p -pa1 -pa2 -pa4 -pai1 -pai2 -pai3 -pai4 -pan1 -pan2 -pan4 -pang1 -pang2 -pang4 -pao1 -pao2 -pao3 -pao4 -pei1 -pei2 -pei4 -pen1 -pen2 -pen4 -peng1 -peng2 -peng3 -peng4 -pi1 -pi2 -pi3 -pi4 -pian1 -pian2 -pian4 -piao1 -piao2 -piao3 -piao4 -pie1 -pie2 -pie3 -pin1 -pin2 -pin3 -pin4 -ping1 -ping2 -po1 -po2 -po3 -po4 -pou1 -pu1 -pu2 -pu3 -pu4 -q -qi1 -qi2 -qi3 -qi4 -qia1 -qia3 -qia4 -qian1 -qian2 -qian3 -qian4 -qiang1 -qiang2 -qiang3 -qiang4 -qiao1 -qiao2 -qiao3 -qiao4 -qie1 -qie2 -qie3 -qie4 -qin1 -qin2 -qin3 -qin4 -qing1 -qing2 -qing3 -qing4 -qiong1 -qiong2 -qiu1 -qiu2 -qiu3 -qu1 -qu2 -qu3 -qu4 -quan1 -quan2 -quan3 -quan4 -que1 -que2 -que4 -qun2 -r -ran2 -ran3 -rang1 -rang2 -rang3 -rang4 -rao2 -rao3 -rao4 -re2 -re3 -re4 -ren2 -ren3 -ren4 -reng1 -reng2 -ri4 -rong1 -rong2 -rong3 -rou2 -rou4 -ru2 -ru3 -ru4 -ruan2 -ruan3 -rui3 -rui4 -run4 -ruo4 -s -sa1 -sa2 -sa3 -sa4 -sai1 -sai4 -san1 -san2 -san3 -san4 -sang1 -sang3 -sang4 -sao1 -sao2 -sao3 -sao4 -se4 -sen1 -seng1 -sha1 -sha2 -sha3 -sha4 -shai1 -shai2 -shai3 -shai4 -shan1 -shan3 -shan4 -shang -shang1 -shang3 -shang4 -shao1 -shao2 -shao3 -shao4 -she1 -she2 -she3 -she4 -shei2 -shen1 -shen2 -shen3 -shen4 -sheng1 -sheng2 -sheng3 -sheng4 -shi -shi1 -shi2 -shi3 -shi4 -shou1 -shou2 -shou3 -shou4 -shu1 -shu2 -shu3 -shu4 -shua1 -shua2 -shua3 -shua4 -shuai1 -shuai3 -shuai4 -shuan1 -shuan4 -shuang1 -shuang3 -shui2 -shui3 -shui4 -shun3 -shun4 -shuo1 -shuo4 -si1 -si2 -si3 -si4 -song1 -song3 -song4 -sou1 -sou3 -sou4 -su1 -su2 -su4 -suan1 -suan4 -sui1 -sui2 -sui3 -sui4 -sun1 -sun3 -suo -suo1 -suo2 -suo3 -t -ta1 -ta2 -ta3 -ta4 -tai1 -tai2 -tai4 -tan1 -tan2 -tan3 -tan4 -tang1 -tang2 -tang3 -tang4 -tao1 -tao2 -tao3 -tao4 -te4 -teng2 -ti1 -ti2 -ti3 -ti4 -tian1 -tian2 -tian3 -tiao1 -tiao2 -tiao3 -tiao4 -tie1 -tie2 -tie3 -tie4 -ting1 -ting2 -ting3 -tong1 -tong2 -tong3 -tong4 -tou -tou1 -tou2 -tou4 -tu1 -tu2 -tu3 -tu4 -tuan1 -tuan2 -tui1 -tui2 -tui3 -tui4 -tun1 -tun2 -tun4 -tuo1 -tuo2 -tuo3 -tuo4 -u -v -w -wa -wa1 -wa2 -wa3 -wa4 -wai1 -wai3 -wai4 -wan1 -wan2 -wan3 -wan4 -wang1 -wang2 -wang3 -wang4 -wei1 -wei2 -wei3 -wei4 -wen1 -wen2 -wen3 -wen4 -weng1 -weng4 -wo1 -wo2 -wo3 -wo4 -wu1 -wu2 -wu3 -wu4 -x -xi1 -xi2 -xi3 -xi4 -xia1 -xia2 -xia4 -xian1 -xian2 -xian3 -xian4 -xiang1 -xiang2 -xiang3 -xiang4 -xiao1 -xiao2 -xiao3 -xiao4 -xie1 -xie2 -xie3 -xie4 -xin1 -xin2 -xin4 -xing1 -xing2 -xing3 -xing4 -xiong1 -xiong2 -xiu1 -xiu3 -xiu4 -xu -xu1 -xu2 -xu3 -xu4 -xuan1 -xuan2 -xuan3 -xuan4 -xue1 -xue2 -xue3 -xue4 -xun1 -xun2 -xun4 -y -ya -ya1 -ya2 -ya3 -ya4 -yan1 -yan2 -yan3 -yan4 -yang1 -yang2 -yang3 -yang4 -yao1 -yao2 -yao3 -yao4 -ye1 -ye2 -ye3 -ye4 -yi -yi1 -yi2 -yi3 -yi4 -yin1 -yin2 -yin3 -yin4 -ying1 -ying2 -ying3 -ying4 -yo1 -yong1 -yong2 -yong3 -yong4 -you1 -you2 -you3 -you4 -yu1 -yu2 -yu3 -yu4 -yuan1 -yuan2 -yuan3 -yuan4 -yue1 -yue4 -yun1 -yun2 -yun3 -yun4 -z -za1 -za2 -za3 -zai1 -zai3 -zai4 -zan1 -zan2 -zan3 -zan4 -zang1 -zang4 -zao1 -zao2 -zao3 -zao4 -ze2 -ze4 -zei2 -zen3 -zeng1 -zeng4 -zha1 -zha2 -zha3 -zha4 -zhai1 -zhai2 -zhai3 -zhai4 -zhan1 -zhan2 -zhan3 -zhan4 -zhang1 -zhang2 -zhang3 -zhang4 -zhao1 -zhao2 -zhao3 -zhao4 -zhe -zhe1 -zhe2 -zhe3 -zhe4 -zhen1 -zhen2 -zhen3 -zhen4 -zheng1 -zheng2 -zheng3 -zheng4 -zhi1 -zhi2 -zhi3 -zhi4 -zhong1 -zhong2 -zhong3 -zhong4 -zhou1 -zhou2 -zhou3 -zhou4 -zhu1 -zhu2 -zhu3 -zhu4 -zhua1 -zhua2 -zhua3 -zhuai1 -zhuai3 -zhuai4 -zhuan1 -zhuan2 -zhuan3 -zhuan4 -zhuang1 -zhuang4 -zhui1 -zhui4 -zhun1 -zhun2 -zhun3 -zhuo1 -zhuo2 -zi -zi1 -zi2 -zi3 -zi4 -zong1 -zong2 -zong3 -zong4 -zou1 -zou2 -zou3 -zou4 -zu1 -zu2 -zu3 -zuan1 -zuan3 -zuan4 -zui2 -zui3 -zui4 -zun1 -zuo -zuo1 -zuo2 -zuo3 -zuo4 -{ -~ -¡ -¢ -£ -¥ -§ -¨ -© -« -® -¯ -° -± -² -³ -´ -µ -· -¹ -º -» -¼ -½ -¾ -¿ -À -Á - -à -Ä -Å -Æ -Ç -È -É -Ê -Í -Î -Ñ -Ó -Ö -× -Ø -Ú -Ü -Ý -Þ -ß -à -á -â -ã -ä -å -æ -ç -è -é -ê -ë -ì -í -î -ï -ð -ñ -ò -ó -ô -õ -ö -ø -ù -ú -û -ü -ý -Ā -ā -ă -ą -ć -Č -č -Đ -đ -ē -ė -ę -ě -ĝ -ğ -ħ -ī -į -İ -ı -Ł -ł -ń -ņ -ň -ŋ -Ō -ō -ő -œ -ř -Ś -ś -Ş -ş -Š -š -Ť -ť -ũ -ū -ź -Ż -ż -Ž -ž -ơ -ư -ǎ -ǐ -ǒ -ǔ -ǚ -ș -ț -ɑ -ɔ -ɕ -ə -ɛ -ɜ -ɡ -ɣ -ɪ -ɫ -ɴ -ɹ -ɾ -ʃ -ʊ -ʌ -ʒ -ʔ -ʰ -ʷ -ʻ -ʾ -ʿ -ˈ -ː -˙ -˜ -ˢ -́ -̅ -Α -Β -Δ -Ε -Θ -Κ -Λ -Μ -Ξ -Π -Σ -Τ -Φ -Χ -Ψ -Ω -ά -έ -ή -ί -α -β -γ -δ -ε -ζ -η -θ -ι -κ -λ -μ -ν -ξ -ο -π -ρ -ς -σ -τ -υ -φ -χ -ψ -ω -ϊ -ό -ύ -ώ -ϕ -ϵ -Ё -А -Б -В -Г -Д -Е -Ж -З -И -Й -К -Л -М -Н -О -П -Р -С -Т -У -Ф -Х -Ц -Ч -Ш -Щ -Ы -Ь -Э -Ю -Я -а -б -в -г -д -е -ж -з -и -й -к -л -м -н -о -п -р -с -т -у -ф -х -ц -ч -ш -щ -ъ -ы -ь -э -ю -я -ё -і -ְ -ִ -ֵ -ֶ -ַ -ָ -ֹ -ּ -־ -ׁ -א -ב -ג -ד -ה -ו -ז -ח -ט -י -כ -ל -ם -מ -ן -נ -ס -ע -פ -ק -ר -ש -ת -أ -ب -ة -ت -ج -ح -د -ر -ز -س -ص -ط -ع -ق -ك -ل -م -ن -ه -و -ي -َ -ُ -ِ -ْ -ก -ข -ง -จ -ต -ท -น -ป -ย -ร -ว -ส -ห -อ -ฮ -ั -า -ี -ึ -โ -ใ -ไ -่ -้ -์ -ḍ -Ḥ -ḥ -ṁ -ṃ -ṅ -ṇ -Ṛ -ṛ -Ṣ -ṣ -Ṭ -ṭ -ạ -ả -Ấ -ấ -ầ -ậ -ắ -ằ -ẻ -ẽ -ế -ề -ể -ễ -ệ -ị -ọ -ỏ -ố -ồ -ộ -ớ -ờ -ở -ụ -ủ -ứ -ữ -ἀ -ἁ -Ἀ -ἐ -ἔ -ἰ -ἱ -ὀ -ὁ -ὐ -ὲ -ὸ -ᾶ -᾽ -ῆ -ῇ -ῶ -‎ -‑ -‒ -– -— -― -‖ -† -‡ -• -… -‧ -‬ -′ -″ -⁄ -⁡ -⁰ -⁴ -⁵ -⁶ -⁷ -⁸ -⁹ -₁ -₂ -₃ -€ -₱ -₹ -₽ -℃ -ℏ -ℓ -№ -ℝ -™ -⅓ -⅔ -⅛ -→ -∂ -∈ -∑ -− -∗ -√ -∞ -∫ -≈ -≠ -≡ -≤ -≥ -⋅ -⋯ -█ -♪ -⟨ -⟩ -、 -。 -《 -》 -「 -」 -【 -】 -あ -う -え -お -か -が -き -ぎ -く -ぐ -け -げ -こ -ご -さ -し -じ -す -ず -せ -ぜ -そ -ぞ -た -だ -ち -っ -つ -で -と -ど -な -に -ね -の -は -ば -ひ -ぶ -へ -べ -ま -み -む -め -も -ゃ -や -ゆ -ょ -よ -ら -り -る -れ -ろ -わ -を -ん -ァ -ア -ィ -イ -ウ -ェ -エ -オ -カ -ガ -キ -ク -ケ -ゲ -コ -ゴ -サ -ザ -シ -ジ -ス -ズ -セ -ゾ -タ -ダ -チ -ッ -ツ -テ -デ -ト -ド -ナ -ニ -ネ -ノ -バ -パ -ビ -ピ -フ -プ -ヘ -ベ -ペ -ホ -ボ -ポ -マ -ミ -ム -メ -モ -ャ -ヤ -ュ -ユ -ョ -ヨ -ラ -リ -ル -レ -ロ -ワ -ン -・ -ー -ㄋ -ㄍ -ㄎ -ㄏ -ㄓ -ㄕ -ㄚ -ㄜ -ㄟ -ㄤ -ㄥ -ㄧ -ㄱ -ㄴ -ㄷ -ㄹ -ㅁ -ㅂ -ㅅ -ㅈ -ㅍ -ㅎ -ㅏ -ㅓ -ㅗ -ㅜ -ㅡ -ㅣ -㗎 -가 -각 -간 -갈 -감 -갑 -갓 -갔 -강 -같 -개 -거 -건 -걸 -겁 -것 -겉 -게 -겠 -겨 -결 -겼 -경 -계 -고 -곤 -골 -곱 -공 -과 -관 -광 -교 -구 -국 -굴 -귀 -귄 -그 -근 -글 -금 -기 -긴 -길 -까 -깍 -깔 -깜 -깨 -께 -꼬 -꼭 -꽃 -꾸 -꿔 -끔 -끗 -끝 -끼 -나 -난 -날 -남 -납 -내 -냐 -냥 -너 -넘 -넣 -네 -녁 -년 -녕 -노 -녹 -놀 -누 -눈 -느 -는 -늘 -니 -님 -닙 -다 -닥 -단 -달 -닭 -당 -대 -더 -덕 -던 -덥 -데 -도 -독 -동 -돼 -됐 -되 -된 -될 -두 -둑 -둥 -드 -들 -등 -디 -따 -딱 -딸 -땅 -때 -떤 -떨 -떻 -또 -똑 -뚱 -뛰 -뜻 -띠 -라 -락 -란 -람 -랍 -랑 -래 -랜 -러 -런 -럼 -렇 -레 -려 -력 -렵 -렸 -로 -록 -롬 -루 -르 -른 -를 -름 -릉 -리 -릴 -림 -마 -막 -만 -많 -말 -맑 -맙 -맛 -매 -머 -먹 -멍 -메 -면 -명 -몇 -모 -목 -몸 -못 -무 -문 -물 -뭐 -뭘 -미 -민 -밌 -밑 -바 -박 -밖 -반 -받 -발 -밤 -밥 -방 -배 -백 -밸 -뱀 -버 -번 -벌 -벚 -베 -벼 -벽 -별 -병 -보 -복 -본 -볼 -봐 -봤 -부 -분 -불 -비 -빔 -빛 -빠 -빨 -뼈 -뽀 -뿅 -쁘 -사 -산 -살 -삼 -샀 -상 -새 -색 -생 -서 -선 -설 -섭 -섰 -성 -세 -셔 -션 -셨 -소 -속 -손 -송 -수 -숙 -순 -술 -숫 -숭 -숲 -쉬 -쉽 -스 -슨 -습 -슷 -시 -식 -신 -실 -싫 -심 -십 -싶 -싸 -써 -쓰 -쓴 -씌 -씨 -씩 -씬 -아 -악 -안 -않 -알 -야 -약 -얀 -양 -얘 -어 -언 -얼 -엄 -업 -없 -었 -엉 -에 -여 -역 -연 -염 -엽 -영 -옆 -예 -옛 -오 -온 -올 -옷 -옹 -와 -왔 -왜 -요 -욕 -용 -우 -운 -울 -웃 -워 -원 -월 -웠 -위 -윙 -유 -육 -윤 -으 -은 -을 -음 -응 -의 -이 -익 -인 -일 -읽 -임 -입 -있 -자 -작 -잔 -잖 -잘 -잡 -잤 -장 -재 -저 -전 -점 -정 -제 -져 -졌 -조 -족 -좀 -종 -좋 -죠 -주 -준 -줄 -중 -줘 -즈 -즐 -즘 -지 -진 -집 -짜 -짝 -쩌 -쪼 -쪽 -쫌 -쭈 -쯔 -찌 -찍 -차 -착 -찾 -책 -처 -천 -철 -체 -쳐 -쳤 -초 -촌 -추 -출 -춤 -춥 -춰 -치 -친 -칠 -침 -칩 -칼 -커 -켓 -코 -콩 -쿠 -퀴 -크 -큰 -큽 -키 -킨 -타 -태 -터 -턴 -털 -테 -토 -통 -투 -트 -특 -튼 -틀 -티 -팀 -파 -팔 -패 -페 -펜 -펭 -평 -포 -폭 -표 -품 -풍 -프 -플 -피 -필 -하 -학 -한 -할 -함 -합 -항 -해 -햇 -했 -행 -허 -험 -형 -혜 -호 -혼 -홀 -화 -회 -획 -후 -휴 -흐 -흔 -희 -히 -힘 -ﷺ -ﷻ -! -, -? -� -𠮶 diff --git a/src/f5_tts/infer/infer_cli.py b/src/f5_tts/infer/infer_cli.py deleted file mode 100644 index abf6ecefb3b052db53bd2101d92890006ff7b7cb..0000000000000000000000000000000000000000 --- a/src/f5_tts/infer/infer_cli.py +++ /dev/null @@ -1,226 +0,0 @@ -import argparse -import codecs -import os -import re -from importlib.resources import files -from pathlib import Path - -import numpy as np -import soundfile as sf -import tomli -from cached_path import cached_path - -from f5_tts.infer.utils_infer import ( - infer_process, - load_model, - load_vocoder, - preprocess_ref_audio_text, - remove_silence_for_generated_wav, -) -from f5_tts.model import DiT, UNetT - -parser = argparse.ArgumentParser( - prog="python3 infer-cli.py", - description="Commandline interface for E2/F5 TTS with Advanced Batch Processing.", - epilog="Specify options above to override one or more settings from config.", -) -parser.add_argument( - "-c", - "--config", - help="Configuration file. Default=infer/examples/basic/basic.toml", - default=os.path.join(files("f5_tts").joinpath("infer/examples/basic"), "basic.toml"), -) -parser.add_argument( - "-m", - "--model", - help="F5-TTS | E2-TTS", -) -parser.add_argument( - "-p", - "--ckpt_file", - help="The Checkpoint .pt", -) -parser.add_argument( - "-v", - "--vocab_file", - help="The vocab .txt", -) -parser.add_argument("-r", "--ref_audio", type=str, help="Reference audio file < 15 seconds.") -parser.add_argument("-s", "--ref_text", type=str, default="666", help="Subtitle for the reference audio.") -parser.add_argument( - "-t", - "--gen_text", - type=str, - help="Text to generate.", -) -parser.add_argument( - "-f", - "--gen_file", - type=str, - help="File with text to generate. Ignores --gen_text", -) -parser.add_argument( - "-o", - "--output_dir", - type=str, - help="Path to output folder..", -) -parser.add_argument( - "-w", - "--output_file", - type=str, - help="Filename of output file..", -) -parser.add_argument( - "--remove_silence", - help="Remove silence.", -) -parser.add_argument("--vocoder_name", type=str, default="vocos", choices=["vocos", "bigvgan"], help="vocoder name") -parser.add_argument( - "--load_vocoder_from_local", - action="store_true", - help="load vocoder from local. Default: ../checkpoints/charactr/vocos-mel-24khz", -) -parser.add_argument( - "--speed", - type=float, - default=1.0, - help="Adjust the speed of the audio generation (default: 1.0)", -) -args = parser.parse_args() - -config = tomli.load(open(args.config, "rb")) - -ref_audio = args.ref_audio if args.ref_audio else config["ref_audio"] -ref_text = args.ref_text if args.ref_text != "666" else config["ref_text"] -gen_text = args.gen_text if args.gen_text else config["gen_text"] -gen_file = args.gen_file if args.gen_file else config["gen_file"] - -# patches for pip pkg user -if "infer/examples/" in ref_audio: - ref_audio = str(files("f5_tts").joinpath(f"{ref_audio}")) -if "infer/examples/" in gen_file: - gen_file = str(files("f5_tts").joinpath(f"{gen_file}")) -if "voices" in config: - for voice in config["voices"]: - voice_ref_audio = config["voices"][voice]["ref_audio"] - if "infer/examples/" in voice_ref_audio: - config["voices"][voice]["ref_audio"] = str(files("f5_tts").joinpath(f"{voice_ref_audio}")) - -if gen_file: - gen_text = codecs.open(gen_file, "r", "utf-8").read() -output_dir = args.output_dir if args.output_dir else config["output_dir"] -output_file = args.output_file if args.output_file else config["output_file"] -model = args.model if args.model else config["model"] -ckpt_file = args.ckpt_file if args.ckpt_file else "" -vocab_file = args.vocab_file if args.vocab_file else "" -remove_silence = args.remove_silence if args.remove_silence else config["remove_silence"] -speed = args.speed - -wave_path = Path(output_dir) / output_file -# spectrogram_path = Path(output_dir) / "infer_cli_out.png" - -vocoder_name = args.vocoder_name -mel_spec_type = args.vocoder_name -if vocoder_name == "vocos": - vocoder_local_path = "../checkpoints/vocos-mel-24khz" -elif vocoder_name == "bigvgan": - vocoder_local_path = "../checkpoints/bigvgan_v2_24khz_100band_256x" - -vocoder = load_vocoder(vocoder_name=mel_spec_type, is_local=args.load_vocoder_from_local, local_path=vocoder_local_path) - - -# load models -if model == "F5-TTS": - model_cls = DiT - model_cfg = dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4) - if ckpt_file == "": - if vocoder_name == "vocos": - repo_name = "F5-TTS" - exp_name = "F5TTS_Base" - ckpt_step = 1200000 - ckpt_file = str(cached_path(f"hf://SWivid/{repo_name}/{exp_name}/model_{ckpt_step}.safetensors")) - # ckpt_file = f"ckpts/{exp_name}/model_{ckpt_step}.pt" # .pt | .safetensors; local path - elif vocoder_name == "bigvgan": - repo_name = "F5-TTS" - exp_name = "F5TTS_Base_bigvgan" - ckpt_step = 1250000 - ckpt_file = str(cached_path(f"hf://SWivid/{repo_name}/{exp_name}/model_{ckpt_step}.pt")) - -elif model == "E2-TTS": - assert vocoder_name == "vocos", "E2-TTS only supports vocoder vocos" - model_cls = UNetT - model_cfg = dict(dim=1024, depth=24, heads=16, ff_mult=4) - if ckpt_file == "": - repo_name = "E2-TTS" - exp_name = "E2TTS_Base" - ckpt_step = 1200000 - ckpt_file = str(cached_path(f"hf://SWivid/{repo_name}/{exp_name}/model_{ckpt_step}.safetensors")) - # ckpt_file = f"ckpts/{exp_name}/model_{ckpt_step}.pt" # .pt | .safetensors; local path - - -print(f"Using {model}...") -ema_model = load_model(model_cls, model_cfg, ckpt_file, mel_spec_type=mel_spec_type, vocab_file=vocab_file) - - -def main_process(ref_audio, ref_text, text_gen, model_obj, mel_spec_type, remove_silence, speed): - main_voice = {"ref_audio": ref_audio, "ref_text": ref_text} - if "voices" not in config: - voices = {"main": main_voice} - else: - voices = config["voices"] - voices["main"] = main_voice - for voice in voices: - voices[voice]["ref_audio"], voices[voice]["ref_text"] = preprocess_ref_audio_text( - voices[voice]["ref_audio"], voices[voice]["ref_text"] - ) - print("Voice:", voice) - print("Ref_audio:", voices[voice]["ref_audio"]) - print("Ref_text:", voices[voice]["ref_text"]) - - generated_audio_segments = [] - reg1 = r"(?=\[\w+\])" - chunks = re.split(reg1, text_gen) - reg2 = r"\[(\w+)\]" - for text in chunks: - if not text.strip(): - continue - match = re.match(reg2, text) - if match: - voice = match[1] - else: - print("No voice tag found, using main.") - voice = "main" - if voice not in voices: - print(f"Voice {voice} not found, using main.") - voice = "main" - text = re.sub(reg2, "", text) - gen_text = text.strip() - ref_audio = voices[voice]["ref_audio"] - ref_text = voices[voice]["ref_text"] - print(f"Voice: {voice}") - audio, final_sample_rate, spectragram = infer_process( - ref_audio, ref_text, gen_text, model_obj, vocoder, mel_spec_type=mel_spec_type, speed=speed - ) - generated_audio_segments.append(audio) - - if generated_audio_segments: - final_wave = np.concatenate(generated_audio_segments) - - if not os.path.exists(output_dir): - os.makedirs(output_dir) - - with open(wave_path, "wb") as f: - sf.write(f.name, final_wave, final_sample_rate) - # Remove silence - if remove_silence: - remove_silence_for_generated_wav(f.name) - print(f.name) - - -def main(): - main_process(ref_audio, ref_text, gen_text, ema_model, mel_spec_type, remove_silence, speed) - - -if __name__ == "__main__": - main() diff --git a/src/f5_tts/infer/speech_edit.py b/src/f5_tts/infer/speech_edit.py deleted file mode 100644 index fc6505c733cd3f339fc88e5dc7f660927b646e0a..0000000000000000000000000000000000000000 --- a/src/f5_tts/infer/speech_edit.py +++ /dev/null @@ -1,193 +0,0 @@ -import os - -os.environ["PYTOCH_ENABLE_MPS_FALLBACK"] = "1" # for MPS device compatibility - -import torch -import torch.nn.functional as F -import torchaudio - -from f5_tts.infer.utils_infer import load_checkpoint, load_vocoder, save_spectrogram -from f5_tts.model import CFM, DiT, UNetT -from f5_tts.model.utils import convert_char_to_pinyin, get_tokenizer - -device = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu" - - -# --------------------- Dataset Settings -------------------- # - -target_sample_rate = 24000 -n_mel_channels = 100 -hop_length = 256 -win_length = 1024 -n_fft = 1024 -mel_spec_type = "vocos" # 'vocos' or 'bigvgan' -target_rms = 0.1 - -tokenizer = "pinyin" -dataset_name = "Emilia_ZH_EN" - - -# ---------------------- infer setting ---------------------- # - -seed = None # int | None - -exp_name = "F5TTS_Base" # F5TTS_Base | E2TTS_Base -ckpt_step = 1200000 - -nfe_step = 32 # 16, 32 -cfg_strength = 2.0 -ode_method = "euler" # euler | midpoint -sway_sampling_coef = -1.0 -speed = 1.0 - -if exp_name == "F5TTS_Base": - model_cls = DiT - model_cfg = dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4) - -elif exp_name == "E2TTS_Base": - model_cls = UNetT - model_cfg = dict(dim=1024, depth=24, heads=16, ff_mult=4) - -ckpt_path = f"ckpts/{exp_name}/model_{ckpt_step}.safetensors" -output_dir = "tests" - -# [leverage https://github.com/MahmoudAshraf97/ctc-forced-aligner to get char level alignment] -# pip install git+https://github.com/MahmoudAshraf97/ctc-forced-aligner.git -# [write the origin_text into a file, e.g. tests/test_edit.txt] -# ctc-forced-aligner --audio_path "src/f5_tts/infer/examples/basic/basic_ref_en.wav" --text_path "tests/test_edit.txt" --language "zho" --romanize --split_size "char" -# [result will be saved at same path of audio file] -# [--language "zho" for Chinese, "eng" for English] -# [if local ckpt, set --alignment_model "../checkpoints/mms-300m-1130-forced-aligner"] - -audio_to_edit = "src/f5_tts/infer/examples/basic/basic_ref_en.wav" -origin_text = "Some call me nature, others call me mother nature." -target_text = "Some call me optimist, others call me realist." -parts_to_edit = [ - [1.42, 2.44], - [4.04, 4.9], -] # stard_ends of "nature" & "mother nature", in seconds -fix_duration = [ - 1.2, - 1, -] # fix duration for "optimist" & "realist", in seconds - -# audio_to_edit = "src/f5_tts/infer/examples/basic/basic_ref_zh.wav" -# origin_text = "对,这就是我,万人敬仰的太乙真人。" -# target_text = "对,那就是你,万人敬仰的太白金星。" -# parts_to_edit = [[0.84, 1.4], [1.92, 2.4], [4.26, 6.26], ] -# fix_duration = None # use origin text duration - - -# -------------------------------------------------# - -use_ema = True - -if not os.path.exists(output_dir): - os.makedirs(output_dir) - -# Vocoder model -local = False -if mel_spec_type == "vocos": - vocoder_local_path = "../checkpoints/charactr/vocos-mel-24khz" -elif mel_spec_type == "bigvgan": - vocoder_local_path = "../checkpoints/bigvgan_v2_24khz_100band_256x" -vocoder = load_vocoder(vocoder_name=mel_spec_type, is_local=local, local_path=vocoder_local_path) - -# Tokenizer -vocab_char_map, vocab_size = get_tokenizer(dataset_name, tokenizer) - -# Model -model = CFM( - transformer=model_cls(**model_cfg, text_num_embeds=vocab_size, mel_dim=n_mel_channels), - mel_spec_kwargs=dict( - n_fft=n_fft, - hop_length=hop_length, - win_length=win_length, - n_mel_channels=n_mel_channels, - target_sample_rate=target_sample_rate, - mel_spec_type=mel_spec_type, - ), - odeint_kwargs=dict( - method=ode_method, - ), - vocab_char_map=vocab_char_map, -).to(device) - -dtype = torch.float32 if mel_spec_type == "bigvgan" else None -model = load_checkpoint(model, ckpt_path, device, dtype=dtype, use_ema=use_ema) - -# Audio -audio, sr = torchaudio.load(audio_to_edit) -if audio.shape[0] > 1: - audio = torch.mean(audio, dim=0, keepdim=True) -rms = torch.sqrt(torch.mean(torch.square(audio))) -if rms < target_rms: - audio = audio * target_rms / rms -if sr != target_sample_rate: - resampler = torchaudio.transforms.Resample(sr, target_sample_rate) - audio = resampler(audio) -offset = 0 -audio_ = torch.zeros(1, 0) -edit_mask = torch.zeros(1, 0, dtype=torch.bool) -for part in parts_to_edit: - start, end = part - part_dur = end - start if fix_duration is None else fix_duration.pop(0) - part_dur = part_dur * target_sample_rate - start = start * target_sample_rate - audio_ = torch.cat((audio_, audio[:, round(offset) : round(start)], torch.zeros(1, round(part_dur))), dim=-1) - edit_mask = torch.cat( - ( - edit_mask, - torch.ones(1, round((start - offset) / hop_length), dtype=torch.bool), - torch.zeros(1, round(part_dur / hop_length), dtype=torch.bool), - ), - dim=-1, - ) - offset = end * target_sample_rate -# audio = torch.cat((audio_, audio[:, round(offset):]), dim = -1) -edit_mask = F.pad(edit_mask, (0, audio.shape[-1] // hop_length - edit_mask.shape[-1] + 1), value=True) -audio = audio.to(device) -edit_mask = edit_mask.to(device) - -# Text -text_list = [target_text] -if tokenizer == "pinyin": - final_text_list = convert_char_to_pinyin(text_list) -else: - final_text_list = [text_list] -print(f"text : {text_list}") -print(f"pinyin: {final_text_list}") - -# Duration -ref_audio_len = 0 -duration = audio.shape[-1] // hop_length - -# Inference -with torch.inference_mode(): - generated, trajectory = model.sample( - cond=audio, - text=final_text_list, - duration=duration, - steps=nfe_step, - cfg_strength=cfg_strength, - sway_sampling_coef=sway_sampling_coef, - seed=seed, - edit_mask=edit_mask, - ) - print(f"Generated mel: {generated.shape}") - - # Final result - generated = generated.to(torch.float32) - generated = generated[:, ref_audio_len:, :] - gen_mel_spec = generated.permute(0, 2, 1) - if mel_spec_type == "vocos": - generated_wave = vocoder.decode(gen_mel_spec).cpu() - elif mel_spec_type == "bigvgan": - generated_wave = vocoder(gen_mel_spec).squeeze(0).cpu() - - if rms < target_rms: - generated_wave = generated_wave * rms / target_rms - - save_spectrogram(gen_mel_spec[0].cpu().numpy(), f"{output_dir}/speech_edit_out.png") - torchaudio.save(f"{output_dir}/speech_edit_out.wav", generated_wave, target_sample_rate) - print(f"Generated wav: {generated_wave.shape}") diff --git a/src/f5_tts/infer/utils_infer.py b/src/f5_tts/infer/utils_infer.py deleted file mode 100644 index 42ffe57b91da9b6b972fd13226f4fe1869ae649e..0000000000000000000000000000000000000000 --- a/src/f5_tts/infer/utils_infer.py +++ /dev/null @@ -1,538 +0,0 @@ -# A unified script for inference process -# Make adjustments inside functions, and consider both gradio and cli scripts if need to change func output format -import os -import sys - -os.environ["PYTOCH_ENABLE_MPS_FALLBACK"] = "1" # for MPS device compatibility -sys.path.append(f"../../{os.path.dirname(os.path.abspath(__file__))}/third_party/BigVGAN/") - -import hashlib -import re -import tempfile -from importlib.resources import files - -import matplotlib - -matplotlib.use("Agg") - -import matplotlib.pylab as plt -import numpy as np -import torch -import torchaudio -import tqdm -from huggingface_hub import snapshot_download, hf_hub_download -from pydub import AudioSegment, silence -from transformers import pipeline -from vocos import Vocos - -from f5_tts.model import CFM -from f5_tts.model.utils import ( - get_tokenizer, - convert_char_to_pinyin, -) - -_ref_audio_cache = {} - -device = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu" - -# ----------------------------------------- - -target_sample_rate = 24000 -n_mel_channels = 100 -hop_length = 256 -win_length = 1024 -n_fft = 1024 -mel_spec_type = "vocos" -target_rms = 0.1 -cross_fade_duration = 0.15 -ode_method = "euler" -nfe_step = 32 # 16, 32 -cfg_strength = 2.0 -sway_sampling_coef = -1.0 -speed = 1.0 -fix_duration = None - -# ----------------------------------------- - - -# chunk text into smaller pieces - - -def chunk_text(text, max_chars=135): - """ - Splits the input text into chunks, each with a maximum number of characters. - - Args: - text (str): The text to be split. - max_chars (int): The maximum number of characters per chunk. - - Returns: - List[str]: A list of text chunks. - """ - chunks = [] - current_chunk = "" - # Split the text into sentences based on punctuation followed by whitespace - sentences = re.split(r"(?<=[;:,.!?])\s+|(?<=[;:,。!?])", text) - - for sentence in sentences: - if len(current_chunk.encode("utf-8")) + len(sentence.encode("utf-8")) <= max_chars: - current_chunk += sentence + " " if sentence and len(sentence[-1].encode("utf-8")) == 1 else sentence - else: - if current_chunk: - chunks.append(current_chunk.strip()) - current_chunk = sentence + " " if sentence and len(sentence[-1].encode("utf-8")) == 1 else sentence - - if current_chunk: - chunks.append(current_chunk.strip()) - - return chunks - - -# load vocoder -def load_vocoder(vocoder_name="vocos", is_local=False, local_path="", device=device, hf_cache_dir=None): - if vocoder_name == "vocos": - # vocoder = Vocos.from_pretrained("charactr/vocos-mel-24khz").to(device) - if is_local: - print(f"Load vocos from local path {local_path}") - config_path = f"{local_path}/config.yaml" - model_path = f"{local_path}/pytorch_model.bin" - else: - print("Download Vocos from huggingface charactr/vocos-mel-24khz") - repo_id = "charactr/vocos-mel-24khz" - config_path = hf_hub_download(repo_id=repo_id, cache_dir=hf_cache_dir, filename="config.yaml") - model_path = hf_hub_download(repo_id=repo_id, cache_dir=hf_cache_dir, filename="pytorch_model.bin") - vocoder = Vocos.from_hparams(config_path) - state_dict = torch.load(model_path, map_location="cpu", weights_only=True) - from vocos.feature_extractors import EncodecFeatures - - if isinstance(vocoder.feature_extractor, EncodecFeatures): - encodec_parameters = { - "feature_extractor.encodec." + key: value - for key, value in vocoder.feature_extractor.encodec.state_dict().items() - } - state_dict.update(encodec_parameters) - vocoder.load_state_dict(state_dict) - vocoder = vocoder.eval().to(device) - elif vocoder_name == "bigvgan": - try: - from third_party.BigVGAN import bigvgan - except ImportError: - print("You need to follow the README to init submodule and change the BigVGAN source code.") - if is_local: - """download from https://huggingface.co/nvidia/bigvgan_v2_24khz_100band_256x/tree/main""" - vocoder = bigvgan.BigVGAN.from_pretrained(local_path, use_cuda_kernel=False) - else: - local_path = snapshot_download(repo_id="nvidia/bigvgan_v2_24khz_100band_256x", cache_dir=hf_cache_dir) - vocoder = bigvgan.BigVGAN.from_pretrained(local_path, use_cuda_kernel=False) - - vocoder.remove_weight_norm() - vocoder = vocoder.eval().to(device) - return vocoder - - -# load asr pipeline - -asr_pipe = None - - -def initialize_asr_pipeline(device: str = device, dtype=None): - if dtype is None: - dtype = ( - torch.float16 if "cuda" in device and torch.cuda.get_device_properties(device).major >= 6 else torch.float32 - ) - global asr_pipe - asr_pipe = pipeline( - "automatic-speech-recognition", - model="openai/whisper-large-v3-turbo", - torch_dtype=dtype, - device=device, - ) - - -# transcribe - - -def transcribe(ref_audio, language=None): - global asr_pipe - if asr_pipe is None: - initialize_asr_pipeline(device=device) - return asr_pipe( - ref_audio, - chunk_length_s=30, - batch_size=128, - generate_kwargs={"task": "transcribe", "language": language} if language else {"task": "transcribe"}, - return_timestamps=False, - )["text"].strip() - - -# load model checkpoint for inference - - -def load_checkpoint(model, ckpt_path, device: str, dtype=None, use_ema=True): - if dtype is None: - dtype = ( - torch.float16 if "cuda" in device and torch.cuda.get_device_properties(device).major >= 6 else torch.float32 - ) - model = model.to(dtype) - - ckpt_type = ckpt_path.split(".")[-1] - if ckpt_type == "safetensors": - from safetensors.torch import load_file - - checkpoint = load_file(ckpt_path, device=device) - else: - checkpoint = torch.load(ckpt_path, map_location=device, weights_only=True) - - if use_ema: - if ckpt_type == "safetensors": - checkpoint = {"ema_model_state_dict": checkpoint} - checkpoint["model_state_dict"] = { - k.replace("ema_model.", ""): v - for k, v in checkpoint["ema_model_state_dict"].items() - if k not in ["initted", "step"] - } - - # patch for backward compatibility, 305e3ea - for key in ["mel_spec.mel_stft.mel_scale.fb", "mel_spec.mel_stft.spectrogram.window"]: - if key in checkpoint["model_state_dict"]: - del checkpoint["model_state_dict"][key] - - model.load_state_dict(checkpoint["model_state_dict"]) - else: - if ckpt_type == "safetensors": - checkpoint = {"model_state_dict": checkpoint} - model.load_state_dict(checkpoint["model_state_dict"]) - - del checkpoint - torch.cuda.empty_cache() - - return model.to(device) - - -# load model for inference - - -def load_model( - model_cls, - model_cfg, - ckpt_path, - mel_spec_type=mel_spec_type, - vocab_file="", - ode_method=ode_method, - use_ema=True, - device=device, -): - if vocab_file == "": - vocab_file = str(files("f5_tts").joinpath("infer/examples/vocab.txt")) - tokenizer = "custom" - - print("\nvocab : ", vocab_file) - print("token : ", tokenizer) - print("model : ", ckpt_path, "\n") - - vocab_char_map, vocab_size = get_tokenizer(vocab_file, tokenizer) - model = CFM( - transformer=model_cls(**model_cfg, text_num_embeds=vocab_size, mel_dim=n_mel_channels), - mel_spec_kwargs=dict( - n_fft=n_fft, - hop_length=hop_length, - win_length=win_length, - n_mel_channels=n_mel_channels, - target_sample_rate=target_sample_rate, - mel_spec_type=mel_spec_type, - ), - odeint_kwargs=dict( - method=ode_method, - ), - vocab_char_map=vocab_char_map, - ).to(device) - - dtype = torch.float32 if mel_spec_type == "bigvgan" else None - model = load_checkpoint(model, ckpt_path, device, dtype=dtype, use_ema=use_ema) - - return model - - -def remove_silence_edges(audio, silence_threshold=-42): - # Remove silence from the start - non_silent_start_idx = silence.detect_leading_silence(audio, silence_threshold=silence_threshold) - audio = audio[non_silent_start_idx:] - - # Remove silence from the end - non_silent_end_duration = audio.duration_seconds - for ms in reversed(audio): - if ms.dBFS > silence_threshold: - break - non_silent_end_duration -= 0.001 - trimmed_audio = audio[: int(non_silent_end_duration * 1000)] - - return trimmed_audio - - -# preprocess reference audio and text - - -def preprocess_ref_audio_text(ref_audio_orig, ref_text, clip_short=True, show_info=print, device=device): - show_info("Converting audio...") - with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f: - aseg = AudioSegment.from_file(ref_audio_orig) - - if clip_short: - # 1. try to find long silence for clipping - non_silent_segs = silence.split_on_silence( - aseg, min_silence_len=1000, silence_thresh=-50, keep_silence=1000, seek_step=10 - ) - non_silent_wave = AudioSegment.silent(duration=0) - for non_silent_seg in non_silent_segs: - if len(non_silent_wave) > 6000 and len(non_silent_wave + non_silent_seg) > 15000: - show_info("Audio is over 15s, clipping short. (1)") - break - non_silent_wave += non_silent_seg - - # 2. try to find short silence for clipping if 1. failed - if len(non_silent_wave) > 15000: - non_silent_segs = silence.split_on_silence( - aseg, min_silence_len=100, silence_thresh=-40, keep_silence=1000, seek_step=10 - ) - non_silent_wave = AudioSegment.silent(duration=0) - for non_silent_seg in non_silent_segs: - if len(non_silent_wave) > 6000 and len(non_silent_wave + non_silent_seg) > 15000: - show_info("Audio is over 15s, clipping short. (2)") - break - non_silent_wave += non_silent_seg - - aseg = non_silent_wave - - # 3. if no proper silence found for clipping - if len(aseg) > 15000: - aseg = aseg[:15000] - show_info("Audio is over 15s, clipping short. (3)") - - aseg = remove_silence_edges(aseg) + AudioSegment.silent(duration=50) - aseg.export(f.name, format="wav") - ref_audio = f.name - - # Compute a hash of the reference audio file - with open(ref_audio, "rb") as audio_file: - audio_data = audio_file.read() - audio_hash = hashlib.md5(audio_data).hexdigest() - - if not ref_text.strip(): - global _ref_audio_cache - if audio_hash in _ref_audio_cache: - # Use cached asr transcription - show_info("Using cached reference text...") - ref_text = _ref_audio_cache[audio_hash] - else: - show_info("No reference text provided, transcribing reference audio...") - ref_text = transcribe(ref_audio) - # Cache the transcribed text (not caching custom ref_text, enabling users to do manual tweak) - _ref_audio_cache[audio_hash] = ref_text - else: - show_info("Using custom reference text...") - - # Ensure ref_text ends with a proper sentence-ending punctuation - if not ref_text.endswith(". ") and not ref_text.endswith("。"): - if ref_text.endswith("."): - ref_text += " " - else: - ref_text += ". " - - print("ref_text ", ref_text) - - return ref_audio, ref_text - - -# infer process: chunk text -> infer batches [i.e. infer_batch_process()] - - -def infer_process( - ref_audio, - ref_text, - gen_text, - model_obj, - vocoder, - mel_spec_type=mel_spec_type, - show_info=print, - progress=tqdm, - target_rms=target_rms, - cross_fade_duration=cross_fade_duration, - nfe_step=nfe_step, - cfg_strength=cfg_strength, - sway_sampling_coef=sway_sampling_coef, - speed=speed, - fix_duration=fix_duration, - device=device, -): - # Split the input text into batches - audio, sr = torchaudio.load(ref_audio) - max_chars = int(len(ref_text.encode("utf-8")) / (audio.shape[-1] / sr) * (25 - audio.shape[-1] / sr)) - gen_text_batches = chunk_text(gen_text, max_chars=max_chars) - for i, gen_text in enumerate(gen_text_batches): - print(f"gen_text {i}", gen_text) - - show_info(f"Generating audio in {len(gen_text_batches)} batches...") - return infer_batch_process( - (audio, sr), - ref_text, - gen_text_batches, - model_obj, - vocoder, - mel_spec_type=mel_spec_type, - progress=progress, - target_rms=target_rms, - cross_fade_duration=cross_fade_duration, - nfe_step=nfe_step, - cfg_strength=cfg_strength, - sway_sampling_coef=sway_sampling_coef, - speed=speed, - fix_duration=fix_duration, - device=device, - ) - - -# infer batches - - -def infer_batch_process( - ref_audio, - ref_text, - gen_text_batches, - model_obj, - vocoder, - mel_spec_type="vocos", - progress=tqdm, - target_rms=0.1, - cross_fade_duration=0.15, - nfe_step=32, - cfg_strength=2.0, - sway_sampling_coef=-1, - speed=1, - fix_duration=None, - device=None, -): - audio, sr = ref_audio - if audio.shape[0] > 1: - audio = torch.mean(audio, dim=0, keepdim=True) - - rms = torch.sqrt(torch.mean(torch.square(audio))) - if rms < target_rms: - audio = audio * target_rms / rms - if sr != target_sample_rate: - resampler = torchaudio.transforms.Resample(sr, target_sample_rate) - audio = resampler(audio) - audio = audio.to(device) - - generated_waves = [] - spectrograms = [] - - if len(ref_text[-1].encode("utf-8")) == 1: - ref_text = ref_text + " " - for i, gen_text in enumerate(progress.tqdm(gen_text_batches)): - # Prepare the text - text_list = [ref_text + gen_text] - final_text_list = convert_char_to_pinyin(text_list) - - ref_audio_len = audio.shape[-1] // hop_length - if fix_duration is not None: - duration = int(fix_duration * target_sample_rate / hop_length) - else: - # Calculate duration - ref_text_len = len(ref_text.encode("utf-8")) - gen_text_len = len(gen_text.encode("utf-8")) - duration = ref_audio_len + int(ref_audio_len / ref_text_len * gen_text_len / speed) - - # inference - with torch.inference_mode(): - generated, _ = model_obj.sample( - cond=audio, - text=final_text_list, - duration=duration, - steps=nfe_step, - cfg_strength=cfg_strength, - sway_sampling_coef=sway_sampling_coef, - ) - - generated = generated.to(torch.float32) - generated = generated[:, ref_audio_len:, :] - generated_mel_spec = generated.permute(0, 2, 1) - if mel_spec_type == "vocos": - generated_wave = vocoder.decode(generated_mel_spec) - elif mel_spec_type == "bigvgan": - generated_wave = vocoder(generated_mel_spec) - if rms < target_rms: - generated_wave = generated_wave * rms / target_rms - - # wav -> numpy - generated_wave = generated_wave.squeeze().cpu().numpy() - - generated_waves.append(generated_wave) - spectrograms.append(generated_mel_spec[0].cpu().numpy()) - - # Combine all generated waves with cross-fading - if cross_fade_duration <= 0: - # Simply concatenate - final_wave = np.concatenate(generated_waves) - else: - final_wave = generated_waves[0] - for i in range(1, len(generated_waves)): - prev_wave = final_wave - next_wave = generated_waves[i] - - # Calculate cross-fade samples, ensuring it does not exceed wave lengths - cross_fade_samples = int(cross_fade_duration * target_sample_rate) - cross_fade_samples = min(cross_fade_samples, len(prev_wave), len(next_wave)) - - if cross_fade_samples <= 0: - # No overlap possible, concatenate - final_wave = np.concatenate([prev_wave, next_wave]) - continue - - # Overlapping parts - prev_overlap = prev_wave[-cross_fade_samples:] - next_overlap = next_wave[:cross_fade_samples] - - # Fade out and fade in - fade_out = np.linspace(1, 0, cross_fade_samples) - fade_in = np.linspace(0, 1, cross_fade_samples) - - # Cross-faded overlap - cross_faded_overlap = prev_overlap * fade_out + next_overlap * fade_in - - # Combine - new_wave = np.concatenate( - [prev_wave[:-cross_fade_samples], cross_faded_overlap, next_wave[cross_fade_samples:]] - ) - - final_wave = new_wave - - # Create a combined spectrogram - combined_spectrogram = np.concatenate(spectrograms, axis=1) - - return final_wave, target_sample_rate, combined_spectrogram - - -# remove silence from generated wav - - -def remove_silence_for_generated_wav(filename): - aseg = AudioSegment.from_file(filename) - non_silent_segs = silence.split_on_silence( - aseg, min_silence_len=1000, silence_thresh=-50, keep_silence=500, seek_step=10 - ) - non_silent_wave = AudioSegment.silent(duration=0) - for non_silent_seg in non_silent_segs: - non_silent_wave += non_silent_seg - aseg = non_silent_wave - aseg.export(filename, format="wav") - - -# save spectrogram - - -def save_spectrogram(spectrogram, path): - plt.figure(figsize=(12, 4)) - plt.imshow(spectrogram, origin="lower", aspect="auto") - plt.colorbar() - plt.savefig(path) - plt.close() diff --git a/src/f5_tts/model/__init__.py b/src/f5_tts/model/__init__.py deleted file mode 100644 index 59cf691c9f73f357dd17b43faf08d549dcbb9550..0000000000000000000000000000000000000000 --- a/src/f5_tts/model/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -from f5_tts.model.cfm import CFM - -from f5_tts.model.backbones.unett import UNetT -from f5_tts.model.backbones.dit import DiT -from f5_tts.model.backbones.mmdit import MMDiT - -from f5_tts.model.trainer import Trainer - - -__all__ = ["CFM", "UNetT", "DiT", "MMDiT", "Trainer"] diff --git a/src/f5_tts/model/backbones/README.md b/src/f5_tts/model/backbones/README.md deleted file mode 100644 index 155671e16fbf128a243ece9033cefd47b957af88..0000000000000000000000000000000000000000 --- a/src/f5_tts/model/backbones/README.md +++ /dev/null @@ -1,20 +0,0 @@ -## Backbones quick introduction - - -### unett.py -- flat unet transformer -- structure same as in e2-tts & voicebox paper except using rotary pos emb -- update: allow possible abs pos emb & convnextv2 blocks for embedded text before concat - -### dit.py -- adaln-zero dit -- embedded timestep as condition -- concatted noised_input + masked_cond + embedded_text, linear proj in -- possible abs pos emb & convnextv2 blocks for embedded text before concat -- possible long skip connection (first layer to last layer) - -### mmdit.py -- sd3 structure -- timestep as condition -- left stream: text embedded and applied a abs pos emb -- right stream: masked_cond & noised_input concatted and with same conv pos emb as unett diff --git a/src/f5_tts/model/backbones/dit.py b/src/f5_tts/model/backbones/dit.py deleted file mode 100644 index 391752a448dae390a0cb3e1d234caf6aaaa3122c..0000000000000000000000000000000000000000 --- a/src/f5_tts/model/backbones/dit.py +++ /dev/null @@ -1,163 +0,0 @@ -""" -ein notation: -b - batch -n - sequence -nt - text sequence -nw - raw wave length -d - dimension -""" - -from __future__ import annotations - -import torch -from torch import nn -import torch.nn.functional as F - -from x_transformers.x_transformers import RotaryEmbedding - -from f5_tts.model.modules import ( - TimestepEmbedding, - ConvNeXtV2Block, - ConvPositionEmbedding, - DiTBlock, - AdaLayerNormZero_Final, - precompute_freqs_cis, - get_pos_embed_indices, -) - - -# Text embedding - - -class TextEmbedding(nn.Module): - def __init__(self, text_num_embeds, text_dim, conv_layers=0, conv_mult=2): - super().__init__() - self.text_embed = nn.Embedding(text_num_embeds + 1, text_dim) # use 0 as filler token - - if conv_layers > 0: - self.extra_modeling = True - self.precompute_max_pos = 4096 # ~44s of 24khz audio - self.register_buffer("freqs_cis", precompute_freqs_cis(text_dim, self.precompute_max_pos), persistent=False) - self.text_blocks = nn.Sequential( - *[ConvNeXtV2Block(text_dim, text_dim * conv_mult) for _ in range(conv_layers)] - ) - else: - self.extra_modeling = False - - def forward(self, text: int["b nt"], seq_len, drop_text=False): # noqa: F722 - text = text + 1 # use 0 as filler token. preprocess of batch pad -1, see list_str_to_idx() - text = text[:, :seq_len] # curtail if character tokens are more than the mel spec tokens - batch, text_len = text.shape[0], text.shape[1] - text = F.pad(text, (0, seq_len - text_len), value=0) - - if drop_text: # cfg for text - text = torch.zeros_like(text) - - text = self.text_embed(text) # b n -> b n d - - # possible extra modeling - if self.extra_modeling: - # sinus pos emb - batch_start = torch.zeros((batch,), dtype=torch.long) - pos_idx = get_pos_embed_indices(batch_start, seq_len, max_pos=self.precompute_max_pos) - text_pos_embed = self.freqs_cis[pos_idx] - text = text + text_pos_embed - - # convnextv2 blocks - text = self.text_blocks(text) - - return text - - -# noised input audio and context mixing embedding - - -class InputEmbedding(nn.Module): - def __init__(self, mel_dim, text_dim, out_dim): - super().__init__() - self.proj = nn.Linear(mel_dim * 2 + text_dim, out_dim) - self.conv_pos_embed = ConvPositionEmbedding(dim=out_dim) - - def forward(self, x: float["b n d"], cond: float["b n d"], text_embed: float["b n d"], drop_audio_cond=False): # noqa: F722 - if drop_audio_cond: # cfg for cond audio - cond = torch.zeros_like(cond) - - x = self.proj(torch.cat((x, cond, text_embed), dim=-1)) - x = self.conv_pos_embed(x) + x - return x - - -# Transformer backbone using DiT blocks - - -class DiT(nn.Module): - def __init__( - self, - *, - dim, - depth=8, - heads=8, - dim_head=64, - dropout=0.1, - ff_mult=4, - mel_dim=100, - text_num_embeds=256, - text_dim=None, - conv_layers=0, - long_skip_connection=False, - ): - super().__init__() - - self.time_embed = TimestepEmbedding(dim) - if text_dim is None: - text_dim = mel_dim - self.text_embed = TextEmbedding(text_num_embeds, text_dim, conv_layers=conv_layers) - self.input_embed = InputEmbedding(mel_dim, text_dim, dim) - - self.rotary_embed = RotaryEmbedding(dim_head) - - self.dim = dim - self.depth = depth - - self.transformer_blocks = nn.ModuleList( - [DiTBlock(dim=dim, heads=heads, dim_head=dim_head, ff_mult=ff_mult, dropout=dropout) for _ in range(depth)] - ) - self.long_skip_connection = nn.Linear(dim * 2, dim, bias=False) if long_skip_connection else None - - self.norm_out = AdaLayerNormZero_Final(dim) # final modulation - self.proj_out = nn.Linear(dim, mel_dim) - - def forward( - self, - x: float["b n d"], # nosied input audio # noqa: F722 - cond: float["b n d"], # masked cond audio # noqa: F722 - text: int["b nt"], # text # noqa: F722 - time: float["b"] | float[""], # time step # noqa: F821 F722 - drop_audio_cond, # cfg for cond audio - drop_text, # cfg for text - mask: bool["b n"] | None = None, # noqa: F722 - ): - batch, seq_len = x.shape[0], x.shape[1] - if time.ndim == 0: - time = time.repeat(batch) - - # t: conditioning time, c: context (text + masked cond audio), x: noised input audio - t = self.time_embed(time) - text_embed = self.text_embed(text, seq_len, drop_text=drop_text) - x = self.input_embed(x, cond, text_embed, drop_audio_cond=drop_audio_cond) - - rope = self.rotary_embed.forward_from_seq_len(seq_len) - - if self.long_skip_connection is not None: - residual = x - - for block in self.transformer_blocks: - x = block(x, t, mask=mask, rope=rope) - - if self.long_skip_connection is not None: - x = self.long_skip_connection(torch.cat((x, residual), dim=-1)) - - x = self.norm_out(x, t) - output = self.proj_out(x) - - return output diff --git a/src/f5_tts/model/backbones/mmdit.py b/src/f5_tts/model/backbones/mmdit.py deleted file mode 100644 index 64c7ef18e1195631f3917af95ca7c8ac12462bf8..0000000000000000000000000000000000000000 --- a/src/f5_tts/model/backbones/mmdit.py +++ /dev/null @@ -1,146 +0,0 @@ -""" -ein notation: -b - batch -n - sequence -nt - text sequence -nw - raw wave length -d - dimension -""" - -from __future__ import annotations - -import torch -from torch import nn - -from x_transformers.x_transformers import RotaryEmbedding - -from f5_tts.model.modules import ( - TimestepEmbedding, - ConvPositionEmbedding, - MMDiTBlock, - AdaLayerNormZero_Final, - precompute_freqs_cis, - get_pos_embed_indices, -) - - -# text embedding - - -class TextEmbedding(nn.Module): - def __init__(self, out_dim, text_num_embeds): - super().__init__() - self.text_embed = nn.Embedding(text_num_embeds + 1, out_dim) # will use 0 as filler token - - self.precompute_max_pos = 1024 - self.register_buffer("freqs_cis", precompute_freqs_cis(out_dim, self.precompute_max_pos), persistent=False) - - def forward(self, text: int["b nt"], drop_text=False) -> int["b nt d"]: # noqa: F722 - text = text + 1 - if drop_text: - text = torch.zeros_like(text) - text = self.text_embed(text) - - # sinus pos emb - batch_start = torch.zeros((text.shape[0],), dtype=torch.long) - batch_text_len = text.shape[1] - pos_idx = get_pos_embed_indices(batch_start, batch_text_len, max_pos=self.precompute_max_pos) - text_pos_embed = self.freqs_cis[pos_idx] - - text = text + text_pos_embed - - return text - - -# noised input & masked cond audio embedding - - -class AudioEmbedding(nn.Module): - def __init__(self, in_dim, out_dim): - super().__init__() - self.linear = nn.Linear(2 * in_dim, out_dim) - self.conv_pos_embed = ConvPositionEmbedding(out_dim) - - def forward(self, x: float["b n d"], cond: float["b n d"], drop_audio_cond=False): # noqa: F722 - if drop_audio_cond: - cond = torch.zeros_like(cond) - x = torch.cat((x, cond), dim=-1) - x = self.linear(x) - x = self.conv_pos_embed(x) + x - return x - - -# Transformer backbone using MM-DiT blocks - - -class MMDiT(nn.Module): - def __init__( - self, - *, - dim, - depth=8, - heads=8, - dim_head=64, - dropout=0.1, - ff_mult=4, - text_num_embeds=256, - mel_dim=100, - ): - super().__init__() - - self.time_embed = TimestepEmbedding(dim) - self.text_embed = TextEmbedding(dim, text_num_embeds) - self.audio_embed = AudioEmbedding(mel_dim, dim) - - self.rotary_embed = RotaryEmbedding(dim_head) - - self.dim = dim - self.depth = depth - - self.transformer_blocks = nn.ModuleList( - [ - MMDiTBlock( - dim=dim, - heads=heads, - dim_head=dim_head, - dropout=dropout, - ff_mult=ff_mult, - context_pre_only=i == depth - 1, - ) - for i in range(depth) - ] - ) - self.norm_out = AdaLayerNormZero_Final(dim) # final modulation - self.proj_out = nn.Linear(dim, mel_dim) - - def forward( - self, - x: float["b n d"], # nosied input audio # noqa: F722 - cond: float["b n d"], # masked cond audio # noqa: F722 - text: int["b nt"], # text # noqa: F722 - time: float["b"] | float[""], # time step # noqa: F821 F722 - drop_audio_cond, # cfg for cond audio - drop_text, # cfg for text - mask: bool["b n"] | None = None, # noqa: F722 - ): - batch = x.shape[0] - if time.ndim == 0: - time = time.repeat(batch) - - # t: conditioning (time), c: context (text + masked cond audio), x: noised input audio - t = self.time_embed(time) - c = self.text_embed(text, drop_text=drop_text) - x = self.audio_embed(x, cond, drop_audio_cond=drop_audio_cond) - - seq_len = x.shape[1] - text_len = text.shape[1] - rope_audio = self.rotary_embed.forward_from_seq_len(seq_len) - rope_text = self.rotary_embed.forward_from_seq_len(text_len) - - for block in self.transformer_blocks: - c, x = block(x, c, t, mask=mask, rope=rope_audio, c_rope=rope_text) - - x = self.norm_out(x, t) - output = self.proj_out(x) - - return output diff --git a/src/f5_tts/model/backbones/unett.py b/src/f5_tts/model/backbones/unett.py deleted file mode 100644 index acf649a52448e87a34a2af4bc14051caaba74c86..0000000000000000000000000000000000000000 --- a/src/f5_tts/model/backbones/unett.py +++ /dev/null @@ -1,219 +0,0 @@ -""" -ein notation: -b - batch -n - sequence -nt - text sequence -nw - raw wave length -d - dimension -""" - -from __future__ import annotations -from typing import Literal - -import torch -from torch import nn -import torch.nn.functional as F - -from x_transformers import RMSNorm -from x_transformers.x_transformers import RotaryEmbedding - -from f5_tts.model.modules import ( - TimestepEmbedding, - ConvNeXtV2Block, - ConvPositionEmbedding, - Attention, - AttnProcessor, - FeedForward, - precompute_freqs_cis, - get_pos_embed_indices, -) - - -# Text embedding - - -class TextEmbedding(nn.Module): - def __init__(self, text_num_embeds, text_dim, conv_layers=0, conv_mult=2): - super().__init__() - self.text_embed = nn.Embedding(text_num_embeds + 1, text_dim) # use 0 as filler token - - if conv_layers > 0: - self.extra_modeling = True - self.precompute_max_pos = 4096 # ~44s of 24khz audio - self.register_buffer("freqs_cis", precompute_freqs_cis(text_dim, self.precompute_max_pos), persistent=False) - self.text_blocks = nn.Sequential( - *[ConvNeXtV2Block(text_dim, text_dim * conv_mult) for _ in range(conv_layers)] - ) - else: - self.extra_modeling = False - - def forward(self, text: int["b nt"], seq_len, drop_text=False): # noqa: F722 - text = text + 1 # use 0 as filler token. preprocess of batch pad -1, see list_str_to_idx() - text = text[:, :seq_len] # curtail if character tokens are more than the mel spec tokens - batch, text_len = text.shape[0], text.shape[1] - text = F.pad(text, (0, seq_len - text_len), value=0) - - if drop_text: # cfg for text - text = torch.zeros_like(text) - - text = self.text_embed(text) # b n -> b n d - - # possible extra modeling - if self.extra_modeling: - # sinus pos emb - batch_start = torch.zeros((batch,), dtype=torch.long) - pos_idx = get_pos_embed_indices(batch_start, seq_len, max_pos=self.precompute_max_pos) - text_pos_embed = self.freqs_cis[pos_idx] - text = text + text_pos_embed - - # convnextv2 blocks - text = self.text_blocks(text) - - return text - - -# noised input audio and context mixing embedding - - -class InputEmbedding(nn.Module): - def __init__(self, mel_dim, text_dim, out_dim): - super().__init__() - self.proj = nn.Linear(mel_dim * 2 + text_dim, out_dim) - self.conv_pos_embed = ConvPositionEmbedding(dim=out_dim) - - def forward(self, x: float["b n d"], cond: float["b n d"], text_embed: float["b n d"], drop_audio_cond=False): # noqa: F722 - if drop_audio_cond: # cfg for cond audio - cond = torch.zeros_like(cond) - - x = self.proj(torch.cat((x, cond, text_embed), dim=-1)) - x = self.conv_pos_embed(x) + x - return x - - -# Flat UNet Transformer backbone - - -class UNetT(nn.Module): - def __init__( - self, - *, - dim, - depth=8, - heads=8, - dim_head=64, - dropout=0.1, - ff_mult=4, - mel_dim=100, - text_num_embeds=256, - text_dim=None, - conv_layers=0, - skip_connect_type: Literal["add", "concat", "none"] = "concat", - ): - super().__init__() - assert depth % 2 == 0, "UNet-Transformer's depth should be even." - - self.time_embed = TimestepEmbedding(dim) - if text_dim is None: - text_dim = mel_dim - self.text_embed = TextEmbedding(text_num_embeds, text_dim, conv_layers=conv_layers) - self.input_embed = InputEmbedding(mel_dim, text_dim, dim) - - self.rotary_embed = RotaryEmbedding(dim_head) - - # transformer layers & skip connections - - self.dim = dim - self.skip_connect_type = skip_connect_type - needs_skip_proj = skip_connect_type == "concat" - - self.depth = depth - self.layers = nn.ModuleList([]) - - for idx in range(depth): - is_later_half = idx >= (depth // 2) - - attn_norm = RMSNorm(dim) - attn = Attention( - processor=AttnProcessor(), - dim=dim, - heads=heads, - dim_head=dim_head, - dropout=dropout, - ) - - ff_norm = RMSNorm(dim) - ff = FeedForward(dim=dim, mult=ff_mult, dropout=dropout, approximate="tanh") - - skip_proj = nn.Linear(dim * 2, dim, bias=False) if needs_skip_proj and is_later_half else None - - self.layers.append( - nn.ModuleList( - [ - skip_proj, - attn_norm, - attn, - ff_norm, - ff, - ] - ) - ) - - self.norm_out = RMSNorm(dim) - self.proj_out = nn.Linear(dim, mel_dim) - - def forward( - self, - x: float["b n d"], # nosied input audio # noqa: F722 - cond: float["b n d"], # masked cond audio # noqa: F722 - text: int["b nt"], # text # noqa: F722 - time: float["b"] | float[""], # time step # noqa: F821 F722 - drop_audio_cond, # cfg for cond audio - drop_text, # cfg for text - mask: bool["b n"] | None = None, # noqa: F722 - ): - batch, seq_len = x.shape[0], x.shape[1] - if time.ndim == 0: - time = time.repeat(batch) - - # t: conditioning time, c: context (text + masked cond audio), x: noised input audio - t = self.time_embed(time) - text_embed = self.text_embed(text, seq_len, drop_text=drop_text) - x = self.input_embed(x, cond, text_embed, drop_audio_cond=drop_audio_cond) - - # postfix time t to input x, [b n d] -> [b n+1 d] - x = torch.cat([t.unsqueeze(1), x], dim=1) # pack t to x - if mask is not None: - mask = F.pad(mask, (1, 0), value=1) - - rope = self.rotary_embed.forward_from_seq_len(seq_len + 1) - - # flat unet transformer - skip_connect_type = self.skip_connect_type - skips = [] - for idx, (maybe_skip_proj, attn_norm, attn, ff_norm, ff) in enumerate(self.layers): - layer = idx + 1 - - # skip connection logic - is_first_half = layer <= (self.depth // 2) - is_later_half = not is_first_half - - if is_first_half: - skips.append(x) - - if is_later_half: - skip = skips.pop() - if skip_connect_type == "concat": - x = torch.cat((x, skip), dim=-1) - x = maybe_skip_proj(x) - elif skip_connect_type == "add": - x = x + skip - - # attention and feedforward blocks - x = attn(attn_norm(x), rope=rope, mask=mask) + x - x = ff(ff_norm(x)) + x - - assert len(skips) == 0 - - x = self.norm_out(x)[:, 1:, :] # unpack t from x - - return self.proj_out(x) diff --git a/src/f5_tts/model/cfm.py b/src/f5_tts/model/cfm.py deleted file mode 100644 index 9ae675c980889a67f7082fbd6998ec6c1b0f9251..0000000000000000000000000000000000000000 --- a/src/f5_tts/model/cfm.py +++ /dev/null @@ -1,285 +0,0 @@ -""" -ein notation: -b - batch -n - sequence -nt - text sequence -nw - raw wave length -d - dimension -""" - -from __future__ import annotations - -from random import random -from typing import Callable - -import torch -import torch.nn.functional as F -from torch import nn -from torch.nn.utils.rnn import pad_sequence -from torchdiffeq import odeint - -from f5_tts.model.modules import MelSpec -from f5_tts.model.utils import ( - default, - exists, - lens_to_mask, - list_str_to_idx, - list_str_to_tensor, - mask_from_frac_lengths, -) - - -class CFM(nn.Module): - def __init__( - self, - transformer: nn.Module, - sigma=0.0, - odeint_kwargs: dict = dict( - # atol = 1e-5, - # rtol = 1e-5, - method="euler" # 'midpoint' - ), - audio_drop_prob=0.3, - cond_drop_prob=0.2, - num_channels=None, - mel_spec_module: nn.Module | None = None, - mel_spec_kwargs: dict = dict(), - frac_lengths_mask: tuple[float, float] = (0.7, 1.0), - vocab_char_map: dict[str:int] | None = None, - ): - super().__init__() - - self.frac_lengths_mask = frac_lengths_mask - - # mel spec - self.mel_spec = default(mel_spec_module, MelSpec(**mel_spec_kwargs)) - num_channels = default(num_channels, self.mel_spec.n_mel_channels) - self.num_channels = num_channels - - # classifier-free guidance - self.audio_drop_prob = audio_drop_prob - self.cond_drop_prob = cond_drop_prob - - # transformer - self.transformer = transformer - dim = transformer.dim - self.dim = dim - - # conditional flow related - self.sigma = sigma - - # sampling related - self.odeint_kwargs = odeint_kwargs - - # vocab map for tokenization - self.vocab_char_map = vocab_char_map - - @property - def device(self): - return next(self.parameters()).device - - @torch.no_grad() - def sample( - self, - cond: float["b n d"] | float["b nw"], # noqa: F722 - text: int["b nt"] | list[str], # noqa: F722 - duration: int | int["b"], # noqa: F821 - *, - lens: int["b"] | None = None, # noqa: F821 - steps=32, - cfg_strength=1.0, - sway_sampling_coef=None, - seed: int | None = None, - max_duration=4096, - vocoder: Callable[[float["b d n"]], float["b nw"]] | None = None, # noqa: F722 - no_ref_audio=False, - duplicate_test=False, - t_inter=0.1, - edit_mask=None, - ): - self.eval() - # raw wave - - if cond.ndim == 2: - cond = self.mel_spec(cond) - cond = cond.permute(0, 2, 1) - assert cond.shape[-1] == self.num_channels - - cond = cond.to(next(self.parameters()).dtype) - - batch, cond_seq_len, device = *cond.shape[:2], cond.device - if not exists(lens): - lens = torch.full((batch,), cond_seq_len, device=device, dtype=torch.long) - - # text - - if isinstance(text, list): - if exists(self.vocab_char_map): - text = list_str_to_idx(text, self.vocab_char_map).to(device) - else: - text = list_str_to_tensor(text).to(device) - assert text.shape[0] == batch - - if exists(text): - text_lens = (text != -1).sum(dim=-1) - lens = torch.maximum(text_lens, lens) # make sure lengths are at least those of the text characters - - # duration - - cond_mask = lens_to_mask(lens) - if edit_mask is not None: - cond_mask = cond_mask & edit_mask - - if isinstance(duration, int): - duration = torch.full((batch,), duration, device=device, dtype=torch.long) - - duration = torch.maximum(lens + 1, duration) # just add one token so something is generated - duration = duration.clamp(max=max_duration) - max_duration = duration.amax() - - # duplicate test corner for inner time step oberservation - if duplicate_test: - test_cond = F.pad(cond, (0, 0, cond_seq_len, max_duration - 2 * cond_seq_len), value=0.0) - - cond = F.pad(cond, (0, 0, 0, max_duration - cond_seq_len), value=0.0) - cond_mask = F.pad(cond_mask, (0, max_duration - cond_mask.shape[-1]), value=False) - cond_mask = cond_mask.unsqueeze(-1) - step_cond = torch.where( - cond_mask, cond, torch.zeros_like(cond) - ) # allow direct control (cut cond audio) with lens passed in - - if batch > 1: - mask = lens_to_mask(duration) - else: # save memory and speed up, as single inference need no mask currently - mask = None - - # test for no ref audio - if no_ref_audio: - cond = torch.zeros_like(cond) - - # neural ode - - def fn(t, x): - # at each step, conditioning is fixed - # step_cond = torch.where(cond_mask, cond, torch.zeros_like(cond)) - - # predict flow - pred = self.transformer( - x=x, cond=step_cond, text=text, time=t, mask=mask, drop_audio_cond=False, drop_text=False - ) - if cfg_strength < 1e-5: - return pred - - null_pred = self.transformer( - x=x, cond=step_cond, text=text, time=t, mask=mask, drop_audio_cond=True, drop_text=True - ) - return pred + (pred - null_pred) * cfg_strength - - # noise input - # to make sure batch inference result is same with different batch size, and for sure single inference - # still some difference maybe due to convolutional layers - y0 = [] - for dur in duration: - if exists(seed): - torch.manual_seed(seed) - y0.append(torch.randn(dur, self.num_channels, device=self.device, dtype=step_cond.dtype)) - y0 = pad_sequence(y0, padding_value=0, batch_first=True) - - t_start = 0 - - # duplicate test corner for inner time step oberservation - if duplicate_test: - t_start = t_inter - y0 = (1 - t_start) * y0 + t_start * test_cond - steps = int(steps * (1 - t_start)) - - t = torch.linspace(t_start, 1, steps + 1, device=self.device, dtype=step_cond.dtype) - if sway_sampling_coef is not None: - t = t + sway_sampling_coef * (torch.cos(torch.pi / 2 * t) - 1 + t) - - trajectory = odeint(fn, y0, t, **self.odeint_kwargs) - - sampled = trajectory[-1] - out = sampled - out = torch.where(cond_mask, cond, out) - - if exists(vocoder): - out = out.permute(0, 2, 1) - out = vocoder(out) - - return out, trajectory - - def forward( - self, - inp: float["b n d"] | float["b nw"], # mel or raw wave # noqa: F722 - text: int["b nt"] | list[str], # noqa: F722 - *, - lens: int["b"] | None = None, # noqa: F821 - noise_scheduler: str | None = None, - ): - # handle raw wave - if inp.ndim == 2: - inp = self.mel_spec(inp) - inp = inp.permute(0, 2, 1) - assert inp.shape[-1] == self.num_channels - - batch, seq_len, dtype, device, _σ1 = *inp.shape[:2], inp.dtype, self.device, self.sigma - - # handle text as string - if isinstance(text, list): - if exists(self.vocab_char_map): - text = list_str_to_idx(text, self.vocab_char_map).to(device) - else: - text = list_str_to_tensor(text).to(device) - assert text.shape[0] == batch - - # lens and mask - if not exists(lens): - lens = torch.full((batch,), seq_len, device=device) - - mask = lens_to_mask(lens, length=seq_len) # useless here, as collate_fn will pad to max length in batch - - # get a random span to mask out for training conditionally - frac_lengths = torch.zeros((batch,), device=self.device).float().uniform_(*self.frac_lengths_mask) - rand_span_mask = mask_from_frac_lengths(lens, frac_lengths) - - if exists(mask): - rand_span_mask &= mask - - # mel is x1 - x1 = inp - - # x0 is gaussian noise - x0 = torch.randn_like(x1) - - # time step - time = torch.rand((batch,), dtype=dtype, device=self.device) - # TODO. noise_scheduler - - # sample xt (φ_t(x) in the paper) - t = time.unsqueeze(-1).unsqueeze(-1) - φ = (1 - t) * x0 + t * x1 - flow = x1 - x0 - - # only predict what is within the random mask span for infilling - cond = torch.where(rand_span_mask[..., None], torch.zeros_like(x1), x1) - - # transformer and cfg training with a drop rate - drop_audio_cond = random() < self.audio_drop_prob # p_drop in voicebox paper - if random() < self.cond_drop_prob: # p_uncond in voicebox paper - drop_audio_cond = True - drop_text = True - else: - drop_text = False - - # if want rigourously mask out padding, record in collate_fn in dataset.py, and pass in here - # adding mask will use more memory, thus also need to adjust batchsampler with scaled down threshold for long sequences - pred = self.transformer( - x=φ, cond=cond, text=text, time=time, drop_audio_cond=drop_audio_cond, drop_text=drop_text - ) - - # flow matching loss - loss = F.mse_loss(pred, flow, reduction="none") - loss = loss[rand_span_mask] - - return loss.mean(), cond, pred diff --git a/src/f5_tts/model/dataset.py b/src/f5_tts/model/dataset.py deleted file mode 100644 index 10cfd2ba122d4614fd39b849109ce1bdce816595..0000000000000000000000000000000000000000 --- a/src/f5_tts/model/dataset.py +++ /dev/null @@ -1,319 +0,0 @@ -import json -import random -from importlib.resources import files - -import torch -import torch.nn.functional as F -import torchaudio -from datasets import Dataset as Dataset_ -from datasets import load_from_disk -from torch import nn -from torch.utils.data import Dataset, Sampler -from tqdm import tqdm - -from f5_tts.model.modules import MelSpec -from f5_tts.model.utils import default - - -class HFDataset(Dataset): - def __init__( - self, - hf_dataset: Dataset, - target_sample_rate=24_000, - n_mel_channels=100, - hop_length=256, - n_fft=1024, - win_length=1024, - mel_spec_type="vocos", - ): - self.data = hf_dataset - self.target_sample_rate = target_sample_rate - self.hop_length = hop_length - - self.mel_spectrogram = MelSpec( - n_fft=n_fft, - hop_length=hop_length, - win_length=win_length, - n_mel_channels=n_mel_channels, - target_sample_rate=target_sample_rate, - mel_spec_type=mel_spec_type, - ) - - def get_frame_len(self, index): - row = self.data[index] - audio = row["audio"]["array"] - sample_rate = row["audio"]["sampling_rate"] - return audio.shape[-1] / sample_rate * self.target_sample_rate / self.hop_length - - def __len__(self): - return len(self.data) - - def __getitem__(self, index): - row = self.data[index] - audio = row["audio"]["array"] - - # logger.info(f"Audio shape: {audio.shape}") - - sample_rate = row["audio"]["sampling_rate"] - duration = audio.shape[-1] / sample_rate - - if duration > 30 or duration < 0.3: - return self.__getitem__((index + 1) % len(self.data)) - - audio_tensor = torch.from_numpy(audio).float() - - if sample_rate != self.target_sample_rate: - resampler = torchaudio.transforms.Resample(sample_rate, self.target_sample_rate) - audio_tensor = resampler(audio_tensor) - - audio_tensor = audio_tensor.unsqueeze(0) # 't -> 1 t') - - mel_spec = self.mel_spectrogram(audio_tensor) - - mel_spec = mel_spec.squeeze(0) # '1 d t -> d t' - - text = row["text"] - - return dict( - mel_spec=mel_spec, - text=text, - ) - - -class CustomDataset(Dataset): - def __init__( - self, - custom_dataset: Dataset, - durations=None, - target_sample_rate=24_000, - hop_length=256, - n_mel_channels=100, - n_fft=1024, - win_length=1024, - mel_spec_type="vocos", - preprocessed_mel=False, - mel_spec_module: nn.Module | None = None, - ): - self.data = custom_dataset - self.durations = durations - self.target_sample_rate = target_sample_rate - self.hop_length = hop_length - self.n_fft = n_fft - self.win_length = win_length - self.mel_spec_type = mel_spec_type - self.preprocessed_mel = preprocessed_mel - - if not preprocessed_mel: - self.mel_spectrogram = default( - mel_spec_module, - MelSpec( - n_fft=n_fft, - hop_length=hop_length, - win_length=win_length, - n_mel_channels=n_mel_channels, - target_sample_rate=target_sample_rate, - mel_spec_type=mel_spec_type, - ), - ) - - def get_frame_len(self, index): - if ( - self.durations is not None - ): # Please make sure the separately provided durations are correct, otherwise 99.99% OOM - return self.durations[index] * self.target_sample_rate / self.hop_length - return self.data[index]["duration"] * self.target_sample_rate / self.hop_length - - def __len__(self): - return len(self.data) - - def __getitem__(self, index): - while True: - row = self.data[index] - audio_path = row["audio_path"] - text = row["text"] - duration = row["duration"] - - # filter by given length - if 0.3 <= duration <= 30: - break # valid - - index = (index + 1) % len(self.data) - - if self.preprocessed_mel: - mel_spec = torch.tensor(row["mel_spec"]) - else: - audio, source_sample_rate = torchaudio.load(audio_path) - - # make sure mono input - if audio.shape[0] > 1: - audio = torch.mean(audio, dim=0, keepdim=True) - - # resample if necessary - if source_sample_rate != self.target_sample_rate: - resampler = torchaudio.transforms.Resample(source_sample_rate, self.target_sample_rate) - audio = resampler(audio) - - # to mel spectrogram - mel_spec = self.mel_spectrogram(audio) - mel_spec = mel_spec.squeeze(0) # '1 d t -> d t' - - return { - "mel_spec": mel_spec, - "text": text, - } - - -# Dynamic Batch Sampler -class DynamicBatchSampler(Sampler[list[int]]): - """Extension of Sampler that will do the following: - 1. Change the batch size (essentially number of sequences) - in a batch to ensure that the total number of frames are less - than a certain threshold. - 2. Make sure the padding efficiency in the batch is high. - """ - - def __init__( - self, sampler: Sampler[int], frames_threshold: int, max_samples=0, random_seed=None, drop_last: bool = False - ): - self.sampler = sampler - self.frames_threshold = frames_threshold - self.max_samples = max_samples - - indices, batches = [], [] - data_source = self.sampler.data_source - - for idx in tqdm( - self.sampler, desc="Sorting with sampler... if slow, check whether dataset is provided with duration" - ): - indices.append((idx, data_source.get_frame_len(idx))) - indices.sort(key=lambda elem: elem[1]) - - batch = [] - batch_frames = 0 - for idx, frame_len in tqdm( - indices, desc=f"Creating dynamic batches with {frames_threshold} audio frames per gpu" - ): - if batch_frames + frame_len <= self.frames_threshold and (max_samples == 0 or len(batch) < max_samples): - batch.append(idx) - batch_frames += frame_len - else: - if len(batch) > 0: - batches.append(batch) - if frame_len <= self.frames_threshold: - batch = [idx] - batch_frames = frame_len - else: - batch = [] - batch_frames = 0 - - if not drop_last and len(batch) > 0: - batches.append(batch) - - del indices - - # if want to have different batches between epochs, may just set a seed and log it in ckpt - # cuz during multi-gpu training, although the batch on per gpu not change between epochs, the formed general minibatch is different - # e.g. for epoch n, use (random_seed + n) - random.seed(random_seed) - random.shuffle(batches) - - self.batches = batches - - def __iter__(self): - return iter(self.batches) - - def __len__(self): - return len(self.batches) - - -# Load dataset - - -def load_dataset( - dataset_name: str, - tokenizer: str = "pinyin", - dataset_type: str = "CustomDataset", - audio_type: str = "raw", - mel_spec_module: nn.Module | None = None, - mel_spec_kwargs: dict = dict(), -) -> CustomDataset | HFDataset: - """ - dataset_type - "CustomDataset" if you want to use tokenizer name and default data path to load for train_dataset - - "CustomDatasetPath" if you just want to pass the full path to a preprocessed dataset without relying on tokenizer - """ - - print("Loading dataset ...") - - if dataset_type == "CustomDataset": - rel_data_path = str(files("f5_tts").joinpath(f"../../data/{dataset_name}_{tokenizer}")) - if audio_type == "raw": - try: - train_dataset = load_from_disk(f"{rel_data_path}/raw") - except: # noqa: E722 - train_dataset = Dataset_.from_file(f"{rel_data_path}/raw.arrow") - preprocessed_mel = False - elif audio_type == "mel": - train_dataset = Dataset_.from_file(f"{rel_data_path}/mel.arrow") - preprocessed_mel = True - with open(f"{rel_data_path}/duration.json", "r", encoding="utf-8") as f: - data_dict = json.load(f) - durations = data_dict["duration"] - train_dataset = CustomDataset( - train_dataset, - durations=durations, - preprocessed_mel=preprocessed_mel, - mel_spec_module=mel_spec_module, - **mel_spec_kwargs, - ) - - elif dataset_type == "CustomDatasetPath": - try: - train_dataset = load_from_disk(f"{dataset_name}/raw") - except: # noqa: E722 - train_dataset = Dataset_.from_file(f"{dataset_name}/raw.arrow") - - with open(f"{dataset_name}/duration.json", "r", encoding="utf-8") as f: - data_dict = json.load(f) - durations = data_dict["duration"] - train_dataset = CustomDataset( - train_dataset, durations=durations, preprocessed_mel=preprocessed_mel, **mel_spec_kwargs - ) - - elif dataset_type == "HFDataset": - print( - "Should manually modify the path of huggingface dataset to your need.\n" - + "May also the corresponding script cuz different dataset may have different format." - ) - pre, post = dataset_name.split("_") - train_dataset = HFDataset( - load_dataset(f"{pre}/{pre}", split=f"train.{post}", cache_dir=str(files("f5_tts").joinpath("../../data"))), - ) - - return train_dataset - - -# collation - - -def collate_fn(batch): - mel_specs = [item["mel_spec"].squeeze(0) for item in batch] - mel_lengths = torch.LongTensor([spec.shape[-1] for spec in mel_specs]) - max_mel_length = mel_lengths.amax() - - padded_mel_specs = [] - for spec in mel_specs: # TODO. maybe records mask for attention here - padding = (0, max_mel_length - spec.size(-1)) - padded_spec = F.pad(spec, padding, value=0) - padded_mel_specs.append(padded_spec) - - mel_specs = torch.stack(padded_mel_specs) - - text = [item["text"] for item in batch] - text_lengths = torch.LongTensor([len(item) for item in text]) - - return dict( - mel=mel_specs, - mel_lengths=mel_lengths, - text=text, - text_lengths=text_lengths, - ) diff --git a/src/f5_tts/model/modules.py b/src/f5_tts/model/modules.py deleted file mode 100644 index bf67fffb1dabf456d4cc804380d42358fe0ca79f..0000000000000000000000000000000000000000 --- a/src/f5_tts/model/modules.py +++ /dev/null @@ -1,658 +0,0 @@ -""" -ein notation: -b - batch -n - sequence -nt - text sequence -nw - raw wave length -d - dimension -""" - -from __future__ import annotations - -import math -from typing import Optional - -import torch -import torch.nn.functional as F -import torchaudio -from librosa.filters import mel as librosa_mel_fn -from torch import nn -from x_transformers.x_transformers import apply_rotary_pos_emb - - -# raw wav to mel spec - - -mel_basis_cache = {} -hann_window_cache = {} - - -def get_bigvgan_mel_spectrogram( - waveform, - n_fft=1024, - n_mel_channels=100, - target_sample_rate=24000, - hop_length=256, - win_length=1024, - fmin=0, - fmax=None, - center=False, -): # Copy from https://github.com/NVIDIA/BigVGAN/tree/main - device = waveform.device - key = f"{n_fft}_{n_mel_channels}_{target_sample_rate}_{hop_length}_{win_length}_{fmin}_{fmax}_{device}" - - if key not in mel_basis_cache: - mel = librosa_mel_fn(sr=target_sample_rate, n_fft=n_fft, n_mels=n_mel_channels, fmin=fmin, fmax=fmax) - mel_basis_cache[key] = torch.from_numpy(mel).float().to(device) # TODO: why they need .float()? - hann_window_cache[key] = torch.hann_window(win_length).to(device) - - mel_basis = mel_basis_cache[key] - hann_window = hann_window_cache[key] - - padding = (n_fft - hop_length) // 2 - waveform = torch.nn.functional.pad(waveform.unsqueeze(1), (padding, padding), mode="reflect").squeeze(1) - - spec = torch.stft( - waveform, - n_fft, - hop_length=hop_length, - win_length=win_length, - window=hann_window, - center=center, - pad_mode="reflect", - normalized=False, - onesided=True, - return_complex=True, - ) - spec = torch.sqrt(torch.view_as_real(spec).pow(2).sum(-1) + 1e-9) - - mel_spec = torch.matmul(mel_basis, spec) - mel_spec = torch.log(torch.clamp(mel_spec, min=1e-5)) - - return mel_spec - - -def get_vocos_mel_spectrogram( - waveform, - n_fft=1024, - n_mel_channels=100, - target_sample_rate=24000, - hop_length=256, - win_length=1024, -): - mel_stft = torchaudio.transforms.MelSpectrogram( - sample_rate=target_sample_rate, - n_fft=n_fft, - win_length=win_length, - hop_length=hop_length, - n_mels=n_mel_channels, - power=1, - center=True, - normalized=False, - norm=None, - ).to(waveform.device) - if len(waveform.shape) == 3: - waveform = waveform.squeeze(1) # 'b 1 nw -> b nw' - - assert len(waveform.shape) == 2 - - mel = mel_stft(waveform) - mel = mel.clamp(min=1e-5).log() - return mel - - -class MelSpec(nn.Module): - def __init__( - self, - n_fft=1024, - hop_length=256, - win_length=1024, - n_mel_channels=100, - target_sample_rate=24_000, - mel_spec_type="vocos", - ): - super().__init__() - assert mel_spec_type in ["vocos", "bigvgan"], print("We only support two extract mel backend: vocos or bigvgan") - - self.n_fft = n_fft - self.hop_length = hop_length - self.win_length = win_length - self.n_mel_channels = n_mel_channels - self.target_sample_rate = target_sample_rate - - if mel_spec_type == "vocos": - self.extractor = get_vocos_mel_spectrogram - elif mel_spec_type == "bigvgan": - self.extractor = get_bigvgan_mel_spectrogram - - self.register_buffer("dummy", torch.tensor(0), persistent=False) - - def forward(self, wav): - if self.dummy.device != wav.device: - self.to(wav.device) - - mel = self.extractor( - waveform=wav, - n_fft=self.n_fft, - n_mel_channels=self.n_mel_channels, - target_sample_rate=self.target_sample_rate, - hop_length=self.hop_length, - win_length=self.win_length, - ) - - return mel - - -# sinusoidal position embedding - - -class SinusPositionEmbedding(nn.Module): - def __init__(self, dim): - super().__init__() - self.dim = dim - - def forward(self, x, scale=1000): - device = x.device - half_dim = self.dim // 2 - emb = math.log(10000) / (half_dim - 1) - emb = torch.exp(torch.arange(half_dim, device=device).float() * -emb) - emb = scale * x.unsqueeze(1) * emb.unsqueeze(0) - emb = torch.cat((emb.sin(), emb.cos()), dim=-1) - return emb - - -# convolutional position embedding - - -class ConvPositionEmbedding(nn.Module): - def __init__(self, dim, kernel_size=31, groups=16): - super().__init__() - assert kernel_size % 2 != 0 - self.conv1d = nn.Sequential( - nn.Conv1d(dim, dim, kernel_size, groups=groups, padding=kernel_size // 2), - nn.Mish(), - nn.Conv1d(dim, dim, kernel_size, groups=groups, padding=kernel_size // 2), - nn.Mish(), - ) - - def forward(self, x: float["b n d"], mask: bool["b n"] | None = None): # noqa: F722 - if mask is not None: - mask = mask[..., None] - x = x.masked_fill(~mask, 0.0) - - x = x.permute(0, 2, 1) - x = self.conv1d(x) - out = x.permute(0, 2, 1) - - if mask is not None: - out = out.masked_fill(~mask, 0.0) - - return out - - -# rotary positional embedding related - - -def precompute_freqs_cis(dim: int, end: int, theta: float = 10000.0, theta_rescale_factor=1.0): - # proposed by reddit user bloc97, to rescale rotary embeddings to longer sequence length without fine-tuning - # has some connection to NTK literature - # https://www.reddit.com/r/LocalLLaMA/comments/14lz7j5/ntkaware_scaled_rope_allows_llama_models_to_have/ - # https://github.com/lucidrains/rotary-embedding-torch/blob/main/rotary_embedding_torch/rotary_embedding_torch.py - theta *= theta_rescale_factor ** (dim / (dim - 2)) - freqs = 1.0 / (theta ** (torch.arange(0, dim, 2)[: (dim // 2)].float() / dim)) - t = torch.arange(end, device=freqs.device) # type: ignore - freqs = torch.outer(t, freqs).float() # type: ignore - freqs_cos = torch.cos(freqs) # real part - freqs_sin = torch.sin(freqs) # imaginary part - return torch.cat([freqs_cos, freqs_sin], dim=-1) - - -def get_pos_embed_indices(start, length, max_pos, scale=1.0): - # length = length if isinstance(length, int) else length.max() - scale = scale * torch.ones_like(start, dtype=torch.float32) # in case scale is a scalar - pos = ( - start.unsqueeze(1) - + (torch.arange(length, device=start.device, dtype=torch.float32).unsqueeze(0) * scale.unsqueeze(1)).long() - ) - # avoid extra long error. - pos = torch.where(pos < max_pos, pos, max_pos - 1) - return pos - - -# Global Response Normalization layer (Instance Normalization ?) - - -class GRN(nn.Module): - def __init__(self, dim): - super().__init__() - self.gamma = nn.Parameter(torch.zeros(1, 1, dim)) - self.beta = nn.Parameter(torch.zeros(1, 1, dim)) - - def forward(self, x): - Gx = torch.norm(x, p=2, dim=1, keepdim=True) - Nx = Gx / (Gx.mean(dim=-1, keepdim=True) + 1e-6) - return self.gamma * (x * Nx) + self.beta + x - - -# ConvNeXt-V2 Block https://github.com/facebookresearch/ConvNeXt-V2/blob/main/models/convnextv2.py -# ref: https://github.com/bfs18/e2_tts/blob/main/rfwave/modules.py#L108 - - -class ConvNeXtV2Block(nn.Module): - def __init__( - self, - dim: int, - intermediate_dim: int, - dilation: int = 1, - ): - super().__init__() - padding = (dilation * (7 - 1)) // 2 - self.dwconv = nn.Conv1d( - dim, dim, kernel_size=7, padding=padding, groups=dim, dilation=dilation - ) # depthwise conv - self.norm = nn.LayerNorm(dim, eps=1e-6) - self.pwconv1 = nn.Linear(dim, intermediate_dim) # pointwise/1x1 convs, implemented with linear layers - self.act = nn.GELU() - self.grn = GRN(intermediate_dim) - self.pwconv2 = nn.Linear(intermediate_dim, dim) - - def forward(self, x: torch.Tensor) -> torch.Tensor: - residual = x - x = x.transpose(1, 2) # b n d -> b d n - x = self.dwconv(x) - x = x.transpose(1, 2) # b d n -> b n d - x = self.norm(x) - x = self.pwconv1(x) - x = self.act(x) - x = self.grn(x) - x = self.pwconv2(x) - return residual + x - - -# AdaLayerNormZero -# return with modulated x for attn input, and params for later mlp modulation - - -class AdaLayerNormZero(nn.Module): - def __init__(self, dim): - super().__init__() - - self.silu = nn.SiLU() - self.linear = nn.Linear(dim, dim * 6) - - self.norm = nn.LayerNorm(dim, elementwise_affine=False, eps=1e-6) - - def forward(self, x, emb=None): - emb = self.linear(self.silu(emb)) - shift_msa, scale_msa, gate_msa, shift_mlp, scale_mlp, gate_mlp = torch.chunk(emb, 6, dim=1) - - x = self.norm(x) * (1 + scale_msa[:, None]) + shift_msa[:, None] - return x, gate_msa, shift_mlp, scale_mlp, gate_mlp - - -# AdaLayerNormZero for final layer -# return only with modulated x for attn input, cuz no more mlp modulation - - -class AdaLayerNormZero_Final(nn.Module): - def __init__(self, dim): - super().__init__() - - self.silu = nn.SiLU() - self.linear = nn.Linear(dim, dim * 2) - - self.norm = nn.LayerNorm(dim, elementwise_affine=False, eps=1e-6) - - def forward(self, x, emb): - emb = self.linear(self.silu(emb)) - scale, shift = torch.chunk(emb, 2, dim=1) - - x = self.norm(x) * (1 + scale)[:, None, :] + shift[:, None, :] - return x - - -# FeedForward - - -class FeedForward(nn.Module): - def __init__(self, dim, dim_out=None, mult=4, dropout=0.0, approximate: str = "none"): - super().__init__() - inner_dim = int(dim * mult) - dim_out = dim_out if dim_out is not None else dim - - activation = nn.GELU(approximate=approximate) - project_in = nn.Sequential(nn.Linear(dim, inner_dim), activation) - self.ff = nn.Sequential(project_in, nn.Dropout(dropout), nn.Linear(inner_dim, dim_out)) - - def forward(self, x): - return self.ff(x) - - -# Attention with possible joint part -# modified from diffusers/src/diffusers/models/attention_processor.py - - -class Attention(nn.Module): - def __init__( - self, - processor: JointAttnProcessor | AttnProcessor, - dim: int, - heads: int = 8, - dim_head: int = 64, - dropout: float = 0.0, - context_dim: Optional[int] = None, # if not None -> joint attention - context_pre_only=None, - ): - super().__init__() - - if not hasattr(F, "scaled_dot_product_attention"): - raise ImportError("Attention equires PyTorch 2.0, to use it, please upgrade PyTorch to 2.0.") - - self.processor = processor - - self.dim = dim - self.heads = heads - self.inner_dim = dim_head * heads - self.dropout = dropout - - self.context_dim = context_dim - self.context_pre_only = context_pre_only - - self.to_q = nn.Linear(dim, self.inner_dim) - self.to_k = nn.Linear(dim, self.inner_dim) - self.to_v = nn.Linear(dim, self.inner_dim) - - if self.context_dim is not None: - self.to_k_c = nn.Linear(context_dim, self.inner_dim) - self.to_v_c = nn.Linear(context_dim, self.inner_dim) - if self.context_pre_only is not None: - self.to_q_c = nn.Linear(context_dim, self.inner_dim) - - self.to_out = nn.ModuleList([]) - self.to_out.append(nn.Linear(self.inner_dim, dim)) - self.to_out.append(nn.Dropout(dropout)) - - if self.context_pre_only is not None and not self.context_pre_only: - self.to_out_c = nn.Linear(self.inner_dim, dim) - - def forward( - self, - x: float["b n d"], # noised input x # noqa: F722 - c: float["b n d"] = None, # context c # noqa: F722 - mask: bool["b n"] | None = None, # noqa: F722 - rope=None, # rotary position embedding for x - c_rope=None, # rotary position embedding for c - ) -> torch.Tensor: - if c is not None: - return self.processor(self, x, c=c, mask=mask, rope=rope, c_rope=c_rope) - else: - return self.processor(self, x, mask=mask, rope=rope) - - -# Attention processor - - -class AttnProcessor: - def __init__(self): - pass - - def __call__( - self, - attn: Attention, - x: float["b n d"], # noised input x # noqa: F722 - mask: bool["b n"] | None = None, # noqa: F722 - rope=None, # rotary position embedding - ) -> torch.FloatTensor: - batch_size = x.shape[0] - - # `sample` projections. - query = attn.to_q(x) - key = attn.to_k(x) - value = attn.to_v(x) - - # apply rotary position embedding - if rope is not None: - freqs, xpos_scale = rope - q_xpos_scale, k_xpos_scale = (xpos_scale, xpos_scale**-1.0) if xpos_scale is not None else (1.0, 1.0) - - query = apply_rotary_pos_emb(query, freqs, q_xpos_scale) - key = apply_rotary_pos_emb(key, freqs, k_xpos_scale) - - # attention - inner_dim = key.shape[-1] - head_dim = inner_dim // attn.heads - query = query.view(batch_size, -1, attn.heads, head_dim).transpose(1, 2) - key = key.view(batch_size, -1, attn.heads, head_dim).transpose(1, 2) - value = value.view(batch_size, -1, attn.heads, head_dim).transpose(1, 2) - - # mask. e.g. inference got a batch with different target durations, mask out the padding - if mask is not None: - attn_mask = mask - attn_mask = attn_mask.unsqueeze(1).unsqueeze(1) # 'b n -> b 1 1 n' - attn_mask = attn_mask.expand(batch_size, attn.heads, query.shape[-2], key.shape[-2]) - else: - attn_mask = None - - x = F.scaled_dot_product_attention(query, key, value, attn_mask=attn_mask, dropout_p=0.0, is_causal=False) - x = x.transpose(1, 2).reshape(batch_size, -1, attn.heads * head_dim) - x = x.to(query.dtype) - - # linear proj - x = attn.to_out[0](x) - # dropout - x = attn.to_out[1](x) - - if mask is not None: - mask = mask.unsqueeze(-1) - x = x.masked_fill(~mask, 0.0) - - return x - - -# Joint Attention processor for MM-DiT -# modified from diffusers/src/diffusers/models/attention_processor.py - - -class JointAttnProcessor: - def __init__(self): - pass - - def __call__( - self, - attn: Attention, - x: float["b n d"], # noised input x # noqa: F722 - c: float["b nt d"] = None, # context c, here text # noqa: F722 - mask: bool["b n"] | None = None, # noqa: F722 - rope=None, # rotary position embedding for x - c_rope=None, # rotary position embedding for c - ) -> torch.FloatTensor: - residual = x - - batch_size = c.shape[0] - - # `sample` projections. - query = attn.to_q(x) - key = attn.to_k(x) - value = attn.to_v(x) - - # `context` projections. - c_query = attn.to_q_c(c) - c_key = attn.to_k_c(c) - c_value = attn.to_v_c(c) - - # apply rope for context and noised input independently - if rope is not None: - freqs, xpos_scale = rope - q_xpos_scale, k_xpos_scale = (xpos_scale, xpos_scale**-1.0) if xpos_scale is not None else (1.0, 1.0) - query = apply_rotary_pos_emb(query, freqs, q_xpos_scale) - key = apply_rotary_pos_emb(key, freqs, k_xpos_scale) - if c_rope is not None: - freqs, xpos_scale = c_rope - q_xpos_scale, k_xpos_scale = (xpos_scale, xpos_scale**-1.0) if xpos_scale is not None else (1.0, 1.0) - c_query = apply_rotary_pos_emb(c_query, freqs, q_xpos_scale) - c_key = apply_rotary_pos_emb(c_key, freqs, k_xpos_scale) - - # attention - query = torch.cat([query, c_query], dim=1) - key = torch.cat([key, c_key], dim=1) - value = torch.cat([value, c_value], dim=1) - - inner_dim = key.shape[-1] - head_dim = inner_dim // attn.heads - query = query.view(batch_size, -1, attn.heads, head_dim).transpose(1, 2) - key = key.view(batch_size, -1, attn.heads, head_dim).transpose(1, 2) - value = value.view(batch_size, -1, attn.heads, head_dim).transpose(1, 2) - - # mask. e.g. inference got a batch with different target durations, mask out the padding - if mask is not None: - attn_mask = F.pad(mask, (0, c.shape[1]), value=True) # no mask for c (text) - attn_mask = attn_mask.unsqueeze(1).unsqueeze(1) # 'b n -> b 1 1 n' - attn_mask = attn_mask.expand(batch_size, attn.heads, query.shape[-2], key.shape[-2]) - else: - attn_mask = None - - x = F.scaled_dot_product_attention(query, key, value, attn_mask=attn_mask, dropout_p=0.0, is_causal=False) - x = x.transpose(1, 2).reshape(batch_size, -1, attn.heads * head_dim) - x = x.to(query.dtype) - - # Split the attention outputs. - x, c = ( - x[:, : residual.shape[1]], - x[:, residual.shape[1] :], - ) - - # linear proj - x = attn.to_out[0](x) - # dropout - x = attn.to_out[1](x) - if not attn.context_pre_only: - c = attn.to_out_c(c) - - if mask is not None: - mask = mask.unsqueeze(-1) - x = x.masked_fill(~mask, 0.0) - # c = c.masked_fill(~mask, 0.) # no mask for c (text) - - return x, c - - -# DiT Block - - -class DiTBlock(nn.Module): - def __init__(self, dim, heads, dim_head, ff_mult=4, dropout=0.1): - super().__init__() - - self.attn_norm = AdaLayerNormZero(dim) - self.attn = Attention( - processor=AttnProcessor(), - dim=dim, - heads=heads, - dim_head=dim_head, - dropout=dropout, - ) - - self.ff_norm = nn.LayerNorm(dim, elementwise_affine=False, eps=1e-6) - self.ff = FeedForward(dim=dim, mult=ff_mult, dropout=dropout, approximate="tanh") - - def forward(self, x, t, mask=None, rope=None): # x: noised input, t: time embedding - # pre-norm & modulation for attention input - norm, gate_msa, shift_mlp, scale_mlp, gate_mlp = self.attn_norm(x, emb=t) - - # attention - attn_output = self.attn(x=norm, mask=mask, rope=rope) - - # process attention output for input x - x = x + gate_msa.unsqueeze(1) * attn_output - - norm = self.ff_norm(x) * (1 + scale_mlp[:, None]) + shift_mlp[:, None] - ff_output = self.ff(norm) - x = x + gate_mlp.unsqueeze(1) * ff_output - - return x - - -# MMDiT Block https://arxiv.org/abs/2403.03206 - - -class MMDiTBlock(nn.Module): - r""" - modified from diffusers/src/diffusers/models/attention.py - - notes. - _c: context related. text, cond, etc. (left part in sd3 fig2.b) - _x: noised input related. (right part) - context_pre_only: last layer only do prenorm + modulation cuz no more ffn - """ - - def __init__(self, dim, heads, dim_head, ff_mult=4, dropout=0.1, context_pre_only=False): - super().__init__() - - self.context_pre_only = context_pre_only - - self.attn_norm_c = AdaLayerNormZero_Final(dim) if context_pre_only else AdaLayerNormZero(dim) - self.attn_norm_x = AdaLayerNormZero(dim) - self.attn = Attention( - processor=JointAttnProcessor(), - dim=dim, - heads=heads, - dim_head=dim_head, - dropout=dropout, - context_dim=dim, - context_pre_only=context_pre_only, - ) - - if not context_pre_only: - self.ff_norm_c = nn.LayerNorm(dim, elementwise_affine=False, eps=1e-6) - self.ff_c = FeedForward(dim=dim, mult=ff_mult, dropout=dropout, approximate="tanh") - else: - self.ff_norm_c = None - self.ff_c = None - self.ff_norm_x = nn.LayerNorm(dim, elementwise_affine=False, eps=1e-6) - self.ff_x = FeedForward(dim=dim, mult=ff_mult, dropout=dropout, approximate="tanh") - - def forward(self, x, c, t, mask=None, rope=None, c_rope=None): # x: noised input, c: context, t: time embedding - # pre-norm & modulation for attention input - if self.context_pre_only: - norm_c = self.attn_norm_c(c, t) - else: - norm_c, c_gate_msa, c_shift_mlp, c_scale_mlp, c_gate_mlp = self.attn_norm_c(c, emb=t) - norm_x, x_gate_msa, x_shift_mlp, x_scale_mlp, x_gate_mlp = self.attn_norm_x(x, emb=t) - - # attention - x_attn_output, c_attn_output = self.attn(x=norm_x, c=norm_c, mask=mask, rope=rope, c_rope=c_rope) - - # process attention output for context c - if self.context_pre_only: - c = None - else: # if not last layer - c = c + c_gate_msa.unsqueeze(1) * c_attn_output - - norm_c = self.ff_norm_c(c) * (1 + c_scale_mlp[:, None]) + c_shift_mlp[:, None] - c_ff_output = self.ff_c(norm_c) - c = c + c_gate_mlp.unsqueeze(1) * c_ff_output - - # process attention output for input x - x = x + x_gate_msa.unsqueeze(1) * x_attn_output - - norm_x = self.ff_norm_x(x) * (1 + x_scale_mlp[:, None]) + x_shift_mlp[:, None] - x_ff_output = self.ff_x(norm_x) - x = x + x_gate_mlp.unsqueeze(1) * x_ff_output - - return c, x - - -# time step conditioning embedding - - -class TimestepEmbedding(nn.Module): - def __init__(self, dim, freq_embed_dim=256): - super().__init__() - self.time_embed = SinusPositionEmbedding(freq_embed_dim) - self.time_mlp = nn.Sequential(nn.Linear(freq_embed_dim, dim), nn.SiLU(), nn.Linear(dim, dim)) - - def forward(self, timestep: float["b"]): # noqa: F821 - time_hidden = self.time_embed(timestep) - time_hidden = time_hidden.to(timestep.dtype) - time = self.time_mlp(time_hidden) # b d - return time diff --git a/src/f5_tts/model/trainer.py b/src/f5_tts/model/trainer.py deleted file mode 100644 index 0825b0240d80ae2e195dd43c535a1e9f28e48406..0000000000000000000000000000000000000000 --- a/src/f5_tts/model/trainer.py +++ /dev/null @@ -1,366 +0,0 @@ -from __future__ import annotations - -import gc -import os - -import torch -import torchaudio -import wandb -from accelerate import Accelerator -from accelerate.utils import DistributedDataParallelKwargs -from ema_pytorch import EMA -from torch.optim import AdamW -from torch.optim.lr_scheduler import LinearLR, SequentialLR -from torch.utils.data import DataLoader, Dataset, SequentialSampler -from tqdm import tqdm - -from f5_tts.model import CFM -from f5_tts.model.dataset import DynamicBatchSampler, collate_fn -from f5_tts.model.utils import default, exists - -# trainer - - -class Trainer: - def __init__( - self, - model: CFM, - epochs, - learning_rate, - num_warmup_updates=20000, - save_per_updates=1000, - checkpoint_path=None, - batch_size=32, - batch_size_type: str = "sample", - max_samples=32, - grad_accumulation_steps=1, - max_grad_norm=1.0, - noise_scheduler: str | None = None, - duration_predictor: torch.nn.Module | None = None, - logger: str | None = "wandb", # "wandb" | "tensorboard" | None - wandb_project="test_e2-tts", - wandb_run_name="test_run", - wandb_resume_id: str = None, - log_samples: bool = False, - last_per_steps=None, - accelerate_kwargs: dict = dict(), - ema_kwargs: dict = dict(), - bnb_optimizer: bool = False, - mel_spec_type: str = "vocos", # "vocos" | "bigvgan" - is_local_vocoder: bool = False, # use local path vocoder - local_vocoder_path: str = "", # local vocoder path - ): - ddp_kwargs = DistributedDataParallelKwargs(find_unused_parameters=True) - - if logger == "wandb" and not wandb.api.api_key: - logger = None - print(f"Using logger: {logger}") - self.log_samples = log_samples - - self.accelerator = Accelerator( - log_with=logger if logger == "wandb" else None, - kwargs_handlers=[ddp_kwargs], - gradient_accumulation_steps=grad_accumulation_steps, - **accelerate_kwargs, - ) - - self.logger = logger - if self.logger == "wandb": - if exists(wandb_resume_id): - init_kwargs = {"wandb": {"resume": "allow", "name": wandb_run_name, "id": wandb_resume_id}} - else: - init_kwargs = {"wandb": {"resume": "allow", "name": wandb_run_name}} - - self.accelerator.init_trackers( - project_name=wandb_project, - init_kwargs=init_kwargs, - config={ - "epochs": epochs, - "learning_rate": learning_rate, - "num_warmup_updates": num_warmup_updates, - "batch_size": batch_size, - "batch_size_type": batch_size_type, - "max_samples": max_samples, - "grad_accumulation_steps": grad_accumulation_steps, - "max_grad_norm": max_grad_norm, - "gpus": self.accelerator.num_processes, - "noise_scheduler": noise_scheduler, - }, - ) - - elif self.logger == "tensorboard": - from torch.utils.tensorboard import SummaryWriter - - self.writer = SummaryWriter(log_dir=f"runs/{wandb_run_name}") - - self.model = model - - if self.is_main: - self.ema_model = EMA(model, include_online_model=False, **ema_kwargs) - self.ema_model.to(self.accelerator.device) - - self.epochs = epochs - self.num_warmup_updates = num_warmup_updates - self.save_per_updates = save_per_updates - self.last_per_steps = default(last_per_steps, save_per_updates * grad_accumulation_steps) - self.checkpoint_path = default(checkpoint_path, "ckpts/test_e2-tts") - - self.batch_size = batch_size - self.batch_size_type = batch_size_type - self.max_samples = max_samples - self.grad_accumulation_steps = grad_accumulation_steps - self.max_grad_norm = max_grad_norm - - # mel vocoder config - self.vocoder_name = mel_spec_type - self.is_local_vocoder = is_local_vocoder - self.local_vocoder_path = local_vocoder_path - - self.noise_scheduler = noise_scheduler - - self.duration_predictor = duration_predictor - - if bnb_optimizer: - import bitsandbytes as bnb - - self.optimizer = bnb.optim.AdamW8bit(model.parameters(), lr=learning_rate) - else: - self.optimizer = AdamW(model.parameters(), lr=learning_rate) - self.model, self.optimizer = self.accelerator.prepare(self.model, self.optimizer) - - @property - def is_main(self): - return self.accelerator.is_main_process - - def save_checkpoint(self, step, last=False): - self.accelerator.wait_for_everyone() - if self.is_main: - checkpoint = dict( - model_state_dict=self.accelerator.unwrap_model(self.model).state_dict(), - optimizer_state_dict=self.accelerator.unwrap_model(self.optimizer).state_dict(), - ema_model_state_dict=self.ema_model.state_dict(), - scheduler_state_dict=self.scheduler.state_dict(), - step=step, - ) - if not os.path.exists(self.checkpoint_path): - os.makedirs(self.checkpoint_path) - if last: - self.accelerator.save(checkpoint, f"{self.checkpoint_path}/model_last.pt") - print(f"Saved last checkpoint at step {step}") - else: - self.accelerator.save(checkpoint, f"{self.checkpoint_path}/model_{step}.pt") - - def load_checkpoint(self): - if ( - not exists(self.checkpoint_path) - or not os.path.exists(self.checkpoint_path) - or not any(filename.endswith(".pt") for filename in os.listdir(self.checkpoint_path)) - ): - return 0 - - self.accelerator.wait_for_everyone() - if "model_last.pt" in os.listdir(self.checkpoint_path): - latest_checkpoint = "model_last.pt" - else: - latest_checkpoint = sorted( - [f for f in os.listdir(self.checkpoint_path) if f.endswith(".pt")], - key=lambda x: int("".join(filter(str.isdigit, x))), - )[-1] - # checkpoint = torch.load(f"{self.checkpoint_path}/{latest_checkpoint}", map_location=self.accelerator.device) # rather use accelerator.load_state ಥ_ಥ - checkpoint = torch.load(f"{self.checkpoint_path}/{latest_checkpoint}", weights_only=True, map_location="cpu") - - # patch for backward compatibility, 305e3ea - for key in ["ema_model.mel_spec.mel_stft.mel_scale.fb", "ema_model.mel_spec.mel_stft.spectrogram.window"]: - if key in checkpoint["ema_model_state_dict"]: - del checkpoint["ema_model_state_dict"][key] - - if self.is_main: - self.ema_model.load_state_dict(checkpoint["ema_model_state_dict"]) - - if "step" in checkpoint: - # patch for backward compatibility, 305e3ea - for key in ["mel_spec.mel_stft.mel_scale.fb", "mel_spec.mel_stft.spectrogram.window"]: - if key in checkpoint["model_state_dict"]: - del checkpoint["model_state_dict"][key] - - self.accelerator.unwrap_model(self.model).load_state_dict(checkpoint["model_state_dict"]) - self.accelerator.unwrap_model(self.optimizer).load_state_dict(checkpoint["optimizer_state_dict"]) - if self.scheduler: - self.scheduler.load_state_dict(checkpoint["scheduler_state_dict"]) - step = checkpoint["step"] - else: - checkpoint["model_state_dict"] = { - k.replace("ema_model.", ""): v - for k, v in checkpoint["ema_model_state_dict"].items() - if k not in ["initted", "step"] - } - self.accelerator.unwrap_model(self.model).load_state_dict(checkpoint["model_state_dict"]) - step = 0 - - del checkpoint - gc.collect() - return step - - def train(self, train_dataset: Dataset, num_workers=16, resumable_with_seed: int = None): - if self.log_samples: - from f5_tts.infer.utils_infer import cfg_strength, load_vocoder, nfe_step, sway_sampling_coef - - vocoder = load_vocoder( - vocoder_name=self.vocoder_name, is_local=self.is_local_vocoder, local_path=self.local_vocoder_path - ) - target_sample_rate = self.accelerator.unwrap_model(self.model).mel_spec.target_sample_rate - log_samples_path = f"{self.checkpoint_path}/samples" - os.makedirs(log_samples_path, exist_ok=True) - - if exists(resumable_with_seed): - generator = torch.Generator() - generator.manual_seed(resumable_with_seed) - else: - generator = None - - if self.batch_size_type == "sample": - train_dataloader = DataLoader( - train_dataset, - collate_fn=collate_fn, - num_workers=num_workers, - pin_memory=True, - persistent_workers=True, - batch_size=self.batch_size, - shuffle=True, - generator=generator, - ) - elif self.batch_size_type == "frame": - self.accelerator.even_batches = False - sampler = SequentialSampler(train_dataset) - batch_sampler = DynamicBatchSampler( - sampler, self.batch_size, max_samples=self.max_samples, random_seed=resumable_with_seed, drop_last=False - ) - train_dataloader = DataLoader( - train_dataset, - collate_fn=collate_fn, - num_workers=num_workers, - pin_memory=True, - persistent_workers=True, - batch_sampler=batch_sampler, - ) - else: - raise ValueError(f"batch_size_type must be either 'sample' or 'frame', but received {self.batch_size_type}") - - # accelerator.prepare() dispatches batches to devices; - # which means the length of dataloader calculated before, should consider the number of devices - warmup_steps = ( - self.num_warmup_updates * self.accelerator.num_processes - ) # consider a fixed warmup steps while using accelerate multi-gpu ddp - # otherwise by default with split_batches=False, warmup steps change with num_processes - total_steps = len(train_dataloader) * self.epochs / self.grad_accumulation_steps - decay_steps = total_steps - warmup_steps - warmup_scheduler = LinearLR(self.optimizer, start_factor=1e-8, end_factor=1.0, total_iters=warmup_steps) - decay_scheduler = LinearLR(self.optimizer, start_factor=1.0, end_factor=1e-8, total_iters=decay_steps) - self.scheduler = SequentialLR( - self.optimizer, schedulers=[warmup_scheduler, decay_scheduler], milestones=[warmup_steps] - ) - train_dataloader, self.scheduler = self.accelerator.prepare( - train_dataloader, self.scheduler - ) # actual steps = 1 gpu steps / gpus - start_step = self.load_checkpoint() - global_step = start_step - - if exists(resumable_with_seed): - orig_epoch_step = len(train_dataloader) - skipped_epoch = int(start_step // orig_epoch_step) - skipped_batch = start_step % orig_epoch_step - skipped_dataloader = self.accelerator.skip_first_batches(train_dataloader, num_batches=skipped_batch) - else: - skipped_epoch = 0 - - for epoch in range(skipped_epoch, self.epochs): - self.model.train() - if exists(resumable_with_seed) and epoch == skipped_epoch: - progress_bar = tqdm( - skipped_dataloader, - desc=f"Epoch {epoch+1}/{self.epochs}", - unit="step", - disable=not self.accelerator.is_local_main_process, - initial=skipped_batch, - total=orig_epoch_step, - ) - else: - progress_bar = tqdm( - train_dataloader, - desc=f"Epoch {epoch+1}/{self.epochs}", - unit="step", - disable=not self.accelerator.is_local_main_process, - ) - - for batch in progress_bar: - with self.accelerator.accumulate(self.model): - text_inputs = batch["text"] - mel_spec = batch["mel"].permute(0, 2, 1) - mel_lengths = batch["mel_lengths"] - - # TODO. add duration predictor training - if self.duration_predictor is not None and self.accelerator.is_local_main_process: - dur_loss = self.duration_predictor(mel_spec, lens=batch.get("durations")) - self.accelerator.log({"duration loss": dur_loss.item()}, step=global_step) - - loss, cond, pred = self.model( - mel_spec, text=text_inputs, lens=mel_lengths, noise_scheduler=self.noise_scheduler - ) - self.accelerator.backward(loss) - - if self.max_grad_norm > 0 and self.accelerator.sync_gradients: - self.accelerator.clip_grad_norm_(self.model.parameters(), self.max_grad_norm) - - self.optimizer.step() - self.scheduler.step() - self.optimizer.zero_grad() - - if self.is_main: - self.ema_model.update() - - global_step += 1 - - if self.accelerator.is_local_main_process: - self.accelerator.log({"loss": loss.item(), "lr": self.scheduler.get_last_lr()[0]}, step=global_step) - if self.logger == "tensorboard": - self.writer.add_scalar("loss", loss.item(), global_step) - self.writer.add_scalar("lr", self.scheduler.get_last_lr()[0], global_step) - - progress_bar.set_postfix(step=str(global_step), loss=loss.item()) - - if global_step % (self.save_per_updates * self.grad_accumulation_steps) == 0: - self.save_checkpoint(global_step) - - if self.log_samples and self.accelerator.is_local_main_process: - ref_audio_len = mel_lengths[0] - infer_text = [ - text_inputs[0] + ([" "] if isinstance(text_inputs[0], list) else " ") + text_inputs[0] - ] - with torch.inference_mode(): - generated, _ = self.accelerator.unwrap_model(self.model).sample( - cond=mel_spec[0][:ref_audio_len].unsqueeze(0), - text=infer_text, - duration=ref_audio_len * 2, - steps=nfe_step, - cfg_strength=cfg_strength, - sway_sampling_coef=sway_sampling_coef, - ) - generated = generated.to(torch.float32) - gen_mel_spec = generated[:, ref_audio_len:, :].permute(0, 2, 1).to(self.accelerator.device) - ref_mel_spec = batch["mel"][0].unsqueeze(0) - if self.vocoder_name == "vocos": - gen_audio = vocoder.decode(gen_mel_spec).cpu() - ref_audio = vocoder.decode(ref_mel_spec).cpu() - elif self.vocoder_name == "bigvgan": - gen_audio = vocoder(gen_mel_spec).squeeze(0).cpu() - ref_audio = vocoder(ref_mel_spec).squeeze(0).cpu() - - torchaudio.save(f"{log_samples_path}/step_{global_step}_gen.wav", gen_audio, target_sample_rate) - torchaudio.save(f"{log_samples_path}/step_{global_step}_ref.wav", ref_audio, target_sample_rate) - - if global_step % self.last_per_steps == 0: - self.save_checkpoint(global_step, last=True) - - self.save_checkpoint(global_step, last=True) - - self.accelerator.end_training() diff --git a/src/f5_tts/model/utils.py b/src/f5_tts/model/utils.py deleted file mode 100644 index 76cfa4d0dd9df6924b74a04c971c8529d493cb6e..0000000000000000000000000000000000000000 --- a/src/f5_tts/model/utils.py +++ /dev/null @@ -1,185 +0,0 @@ -from __future__ import annotations - -import os -import random -from collections import defaultdict -from importlib.resources import files - -import torch -from torch.nn.utils.rnn import pad_sequence - -import jieba -from pypinyin import lazy_pinyin, Style - - -# seed everything - - -def seed_everything(seed=0): - random.seed(seed) - os.environ["PYTHONHASHSEED"] = str(seed) - torch.manual_seed(seed) - torch.cuda.manual_seed(seed) - torch.cuda.manual_seed_all(seed) - torch.backends.cudnn.deterministic = True - torch.backends.cudnn.benchmark = False - - -# helpers - - -def exists(v): - return v is not None - - -def default(v, d): - return v if exists(v) else d - - -# tensor helpers - - -def lens_to_mask(t: int["b"], length: int | None = None) -> bool["b n"]: # noqa: F722 F821 - if not exists(length): - length = t.amax() - - seq = torch.arange(length, device=t.device) - return seq[None, :] < t[:, None] - - -def mask_from_start_end_indices(seq_len: int["b"], start: int["b"], end: int["b"]): # noqa: F722 F821 - max_seq_len = seq_len.max().item() - seq = torch.arange(max_seq_len, device=start.device).long() - start_mask = seq[None, :] >= start[:, None] - end_mask = seq[None, :] < end[:, None] - return start_mask & end_mask - - -def mask_from_frac_lengths(seq_len: int["b"], frac_lengths: float["b"]): # noqa: F722 F821 - lengths = (frac_lengths * seq_len).long() - max_start = seq_len - lengths - - rand = torch.rand_like(frac_lengths) - start = (max_start * rand).long().clamp(min=0) - end = start + lengths - - return mask_from_start_end_indices(seq_len, start, end) - - -def maybe_masked_mean(t: float["b n d"], mask: bool["b n"] = None) -> float["b d"]: # noqa: F722 - if not exists(mask): - return t.mean(dim=1) - - t = torch.where(mask[:, :, None], t, torch.tensor(0.0, device=t.device)) - num = t.sum(dim=1) - den = mask.float().sum(dim=1) - - return num / den.clamp(min=1.0) - - -# simple utf-8 tokenizer, since paper went character based -def list_str_to_tensor(text: list[str], padding_value=-1) -> int["b nt"]: # noqa: F722 - list_tensors = [torch.tensor([*bytes(t, "UTF-8")]) for t in text] # ByT5 style - text = pad_sequence(list_tensors, padding_value=padding_value, batch_first=True) - return text - - -# char tokenizer, based on custom dataset's extracted .txt file -def list_str_to_idx( - text: list[str] | list[list[str]], - vocab_char_map: dict[str, int], # {char: idx} - padding_value=-1, -) -> int["b nt"]: # noqa: F722 - list_idx_tensors = [torch.tensor([vocab_char_map.get(c, 0) for c in t]) for t in text] # pinyin or char style - text = pad_sequence(list_idx_tensors, padding_value=padding_value, batch_first=True) - return text - - -# Get tokenizer - - -def get_tokenizer(dataset_name, tokenizer: str = "pinyin"): - """ - tokenizer - "pinyin" do g2p for only chinese characters, need .txt vocab_file - - "char" for char-wise tokenizer, need .txt vocab_file - - "byte" for utf-8 tokenizer - - "custom" if you're directly passing in a path to the vocab.txt you want to use - vocab_size - if use "pinyin", all available pinyin types, common alphabets (also those with accent) and symbols - - if use "char", derived from unfiltered character & symbol counts of custom dataset - - if use "byte", set to 256 (unicode byte range) - """ - if tokenizer in ["pinyin", "char"]: - tokenizer_path = os.path.join(files("f5_tts").joinpath("../../data"), f"{dataset_name}_{tokenizer}/vocab.txt") - with open(tokenizer_path, "r", encoding="utf-8") as f: - vocab_char_map = {} - for i, char in enumerate(f): - vocab_char_map[char[:-1]] = i - vocab_size = len(vocab_char_map) - assert vocab_char_map[" "] == 0, "make sure space is of idx 0 in vocab.txt, cuz 0 is used for unknown char" - - elif tokenizer == "byte": - vocab_char_map = None - vocab_size = 256 - - elif tokenizer == "custom": - with open(dataset_name, "r", encoding="utf-8") as f: - vocab_char_map = {} - for i, char in enumerate(f): - vocab_char_map[char[:-1]] = i - vocab_size = len(vocab_char_map) - - return vocab_char_map, vocab_size - - -# convert char to pinyin - - -def convert_char_to_pinyin(text_list, polyphone=True): - final_text_list = [] - god_knows_why_en_testset_contains_zh_quote = str.maketrans( - {"“": '"', "”": '"', "‘": "'", "’": "'"} - ) # in case librispeech (orig no-pc) test-clean - custom_trans = str.maketrans({";": ","}) # add custom trans here, to address oov - for text in text_list: - char_list = [] - text = text.translate(god_knows_why_en_testset_contains_zh_quote) - text = text.translate(custom_trans) - for seg in jieba.cut(text): - seg_byte_len = len(bytes(seg, "UTF-8")) - if seg_byte_len == len(seg): # if pure alphabets and symbols - if char_list and seg_byte_len > 1 and char_list[-1] not in " :'\"": - char_list.append(" ") - char_list.extend(seg) - elif polyphone and seg_byte_len == 3 * len(seg): # if pure chinese characters - seg = lazy_pinyin(seg, style=Style.TONE3, tone_sandhi=True) - for c in seg: - if c not in "。,、;:?!《》【】—…": - char_list.append(" ") - char_list.append(c) - else: # if mixed chinese characters, alphabets and symbols - for c in seg: - if ord(c) < 256: - char_list.extend(c) - else: - if c not in "。,、;:?!《》【】—…": - char_list.append(" ") - char_list.extend(lazy_pinyin(c, style=Style.TONE3, tone_sandhi=True)) - else: # if is zh punc - char_list.append(c) - final_text_list.append(char_list) - - return final_text_list - - -# filter func for dirty data with many repetitions - - -def repetition_found(text, length=2, tolerance=10): - pattern_count = defaultdict(int) - for i in range(len(text) - length + 1): - pattern = text[i : i + length] - pattern_count[pattern] += 1 - for pattern, count in pattern_count.items(): - if count > tolerance: - return True - return False diff --git a/src/f5_tts/scripts/count_max_epoch.py b/src/f5_tts/scripts/count_max_epoch.py deleted file mode 100644 index 7cd7332dfdc66b1c20bed369aaa6c6bec8c8e0cc..0000000000000000000000000000000000000000 --- a/src/f5_tts/scripts/count_max_epoch.py +++ /dev/null @@ -1,33 +0,0 @@ -"""ADAPTIVE BATCH SIZE""" - -print("Adaptive batch size: using grouping batch sampler, frames_per_gpu fixed fed in") -print(" -> least padding, gather wavs with accumulated frames in a batch\n") - -# data -total_hours = 95282 -mel_hop_length = 256 -mel_sampling_rate = 24000 - -# target -wanted_max_updates = 1000000 - -# train params -gpus = 8 -frames_per_gpu = 38400 # 8 * 38400 = 307200 -grad_accum = 1 - -# intermediate -mini_batch_frames = frames_per_gpu * grad_accum * gpus -mini_batch_hours = mini_batch_frames * mel_hop_length / mel_sampling_rate / 3600 -updates_per_epoch = total_hours / mini_batch_hours -steps_per_epoch = updates_per_epoch * grad_accum - -# result -epochs = wanted_max_updates / updates_per_epoch -print(f"epochs should be set to: {epochs:.0f} ({epochs/grad_accum:.1f} x gd_acum {grad_accum})") -print(f"progress_bar should show approx. 0/{updates_per_epoch:.0f} updates") -print(f" or approx. 0/{steps_per_epoch:.0f} steps") - -# others -print(f"total {total_hours:.0f} hours") -print(f"mini-batch of {mini_batch_frames:.0f} frames, {mini_batch_hours:.2f} hours per mini-batch") diff --git a/src/f5_tts/scripts/count_params_gflops.py b/src/f5_tts/scripts/count_params_gflops.py deleted file mode 100644 index 05d7ced0176260081f79c1e57abdebd79c362315..0000000000000000000000000000000000000000 --- a/src/f5_tts/scripts/count_params_gflops.py +++ /dev/null @@ -1,39 +0,0 @@ -import sys -import os - -sys.path.append(os.getcwd()) - -from f5_tts.model import CFM, DiT - -import torch -import thop - - -""" ~155M """ -# transformer = UNetT(dim = 768, depth = 20, heads = 12, ff_mult = 4) -# transformer = UNetT(dim = 768, depth = 20, heads = 12, ff_mult = 4, text_dim = 512, conv_layers = 4) -# transformer = DiT(dim = 768, depth = 18, heads = 12, ff_mult = 2) -# transformer = DiT(dim = 768, depth = 18, heads = 12, ff_mult = 2, text_dim = 512, conv_layers = 4) -# transformer = DiT(dim = 768, depth = 18, heads = 12, ff_mult = 2, text_dim = 512, conv_layers = 4, long_skip_connection = True) -# transformer = MMDiT(dim = 512, depth = 16, heads = 16, ff_mult = 2) - -""" ~335M """ -# FLOPs: 622.1 G, Params: 333.2 M -# transformer = UNetT(dim = 1024, depth = 24, heads = 16, ff_mult = 4) -# FLOPs: 363.4 G, Params: 335.8 M -transformer = DiT(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4) - - -model = CFM(transformer=transformer) -target_sample_rate = 24000 -n_mel_channels = 100 -hop_length = 256 -duration = 20 -frame_length = int(duration * target_sample_rate / hop_length) -text_length = 150 - -flops, params = thop.profile( - model, inputs=(torch.randn(1, frame_length, n_mel_channels), torch.zeros(1, text_length, dtype=torch.long)) -) -print(f"FLOPs: {flops / 1e9} G") -print(f"Params: {params / 1e6} M") diff --git a/src/f5_tts/socket_server.py b/src/f5_tts/socket_server.py deleted file mode 100644 index ba8b739c78ed0a97c4bb57ca8e2ccb23c9b50d30..0000000000000000000000000000000000000000 --- a/src/f5_tts/socket_server.py +++ /dev/null @@ -1,159 +0,0 @@ -import socket -import struct -import torch -import torchaudio -from threading import Thread - - -import gc -import traceback - - -from infer.utils_infer import infer_batch_process, preprocess_ref_audio_text, load_vocoder, load_model -from model.backbones.dit import DiT - - -class TTSStreamingProcessor: - def __init__(self, ckpt_file, vocab_file, ref_audio, ref_text, device=None, dtype=torch.float32): - self.device = device or ("cuda" if torch.cuda.is_available() else "cpu") - - # Load the model using the provided checkpoint and vocab files - self.model = load_model( - model_cls=DiT, - model_cfg=dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4), - ckpt_path=ckpt_file, - mel_spec_type="vocos", # or "bigvgan" depending on vocoder - vocab_file=vocab_file, - ode_method="euler", - use_ema=True, - device=self.device, - ).to(self.device, dtype=dtype) - - # Load the vocoder - self.vocoder = load_vocoder(is_local=False) - - # Set sampling rate for streaming - self.sampling_rate = 24000 # Consistency with client - - # Set reference audio and text - self.ref_audio = ref_audio - self.ref_text = ref_text - - # Warm up the model - self._warm_up() - - def _warm_up(self): - """Warm up the model with a dummy input to ensure it's ready for real-time processing.""" - print("Warming up the model...") - ref_audio, ref_text = preprocess_ref_audio_text(self.ref_audio, self.ref_text) - audio, sr = torchaudio.load(ref_audio) - gen_text = "Warm-up text for the model." - - # Pass the vocoder as an argument here - infer_batch_process((audio, sr), ref_text, [gen_text], self.model, self.vocoder, device=self.device) - print("Warm-up completed.") - - def generate_stream(self, text, play_steps_in_s=0.5): - """Generate audio in chunks and yield them in real-time.""" - # Preprocess the reference audio and text - ref_audio, ref_text = preprocess_ref_audio_text(self.ref_audio, self.ref_text) - - # Load reference audio - audio, sr = torchaudio.load(ref_audio) - - # Run inference for the input text - audio_chunk, final_sample_rate, _ = infer_batch_process( - (audio, sr), - ref_text, - [text], - self.model, - self.vocoder, - device=self.device, # Pass vocoder here - ) - - # Break the generated audio into chunks and send them - chunk_size = int(final_sample_rate * play_steps_in_s) - - if len(audio_chunk) < chunk_size: - packed_audio = struct.pack(f"{len(audio_chunk)}f", *audio_chunk) - yield packed_audio - return - - for i in range(0, len(audio_chunk), chunk_size): - chunk = audio_chunk[i : i + chunk_size] - - # Check if it's the final chunk - if i + chunk_size >= len(audio_chunk): - chunk = audio_chunk[i:] - - # Send the chunk if it is not empty - if len(chunk) > 0: - packed_audio = struct.pack(f"{len(chunk)}f", *chunk) - yield packed_audio - - -def handle_client(client_socket, processor): - try: - while True: - # Receive data from the client - data = client_socket.recv(1024).decode("utf-8") - if not data: - break - - try: - # The client sends the text input - text = data.strip() - - # Generate and stream audio chunks - for audio_chunk in processor.generate_stream(text): - client_socket.sendall(audio_chunk) - - # Send end-of-audio signal - client_socket.sendall(b"END_OF_AUDIO") - - except Exception as inner_e: - print(f"Error during processing: {inner_e}") - traceback.print_exc() # Print the full traceback to diagnose the issue - break - - except Exception as e: - print(f"Error handling client: {e}") - traceback.print_exc() - finally: - client_socket.close() - - -def start_server(host, port, processor): - server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - server.bind((host, port)) - server.listen(5) - print(f"Server listening on {host}:{port}") - - while True: - client_socket, addr = server.accept() - print(f"Accepted connection from {addr}") - client_handler = Thread(target=handle_client, args=(client_socket, processor)) - client_handler.start() - - -if __name__ == "__main__": - try: - # Load the model and vocoder using the provided files - ckpt_file = "" # pointing your checkpoint "ckpts/model/model_1096.pt" - vocab_file = "" # Add vocab file path if needed - ref_audio = "" # add ref audio"./tests/ref_audio/reference.wav" - ref_text = "" - - # Initialize the processor with the model and vocoder - processor = TTSStreamingProcessor( - ckpt_file=ckpt_file, - vocab_file=vocab_file, - ref_audio=ref_audio, - ref_text=ref_text, - dtype=torch.float32, - ) - - # Start the server - start_server("0.0.0.0", 9998, processor) - except KeyboardInterrupt: - gc.collect() diff --git a/src/f5_tts/train/README.md b/src/f5_tts/train/README.md deleted file mode 100644 index 90d7c85c641c575f6adab86bc96417737d2dd417..0000000000000000000000000000000000000000 --- a/src/f5_tts/train/README.md +++ /dev/null @@ -1,77 +0,0 @@ -# Training - -## Prepare Dataset - -Example data processing scripts, and you may tailor your own one along with a Dataset class in `src/f5_tts/model/dataset.py`. - -### 1. Some specific Datasets preparing scripts -Download corresponding dataset first, and fill in the path in scripts. - -```bash -# Prepare the Emilia dataset -python src/f5_tts/train/datasets/prepare_emilia.py - -# Prepare the Wenetspeech4TTS dataset -python src/f5_tts/train/datasets/prepare_wenetspeech4tts.py - -# Prepare the LibriTTS dataset -python src/f5_tts/train/datasets/prepare_libritts.py - -# Prepare the LJSpeech dataset -python src/f5_tts/train/datasets/prepare_ljspeech.py -``` - -### 2. Create custom dataset with metadata.csv -Use guidance see [#57 here](https://github.com/SWivid/F5-TTS/discussions/57#discussioncomment-10959029). - -```bash -python src/f5_tts/train/datasets/prepare_csv_wavs.py -``` - -## Training & Finetuning - -Once your datasets are prepared, you can start the training process. - -### 1. Training script used for pretrained model - -```bash -# setup accelerate config, e.g. use multi-gpu ddp, fp16 -# will be to: ~/.cache/huggingface/accelerate/default_config.yaml -accelerate config - -# .yaml files are under src/f5_tts/configs directory -accelerate launch src/f5_tts/train/train.py --config-name F5TTS_Base_train.yaml -``` - -### 2. Finetuning practice -Discussion board for Finetuning [#57](https://github.com/SWivid/F5-TTS/discussions/57). - -Gradio UI training/finetuning with `src/f5_tts/train/finetune_gradio.py` see [#143](https://github.com/SWivid/F5-TTS/discussions/143). - -### 3. Wandb Logging - -The `wandb/` dir will be created under path you run training/finetuning scripts. - -By default, the training script does NOT use logging (assuming you didn't manually log in using `wandb login`). - -To turn on wandb logging, you can either: - -1. Manually login with `wandb login`: Learn more [here](https://docs.wandb.ai/ref/cli/wandb-login) -2. Automatically login programmatically by setting an environment variable: Get an API KEY at https://wandb.ai/site/ and set the environment variable as follows: - -On Mac & Linux: - -``` -export WANDB_API_KEY= -``` - -On Windows: - -``` -set WANDB_API_KEY= -``` -Moreover, if you couldn't access Wandb and want to log metrics offline, you can the environment variable as follows: - -``` -export WANDB_MODE=offline -``` diff --git a/src/f5_tts/train/datasets/prepare_csv_wavs.py b/src/f5_tts/train/datasets/prepare_csv_wavs.py deleted file mode 100644 index dd51ef0982af2307dbadc32798705572a0691997..0000000000000000000000000000000000000000 --- a/src/f5_tts/train/datasets/prepare_csv_wavs.py +++ /dev/null @@ -1,139 +0,0 @@ -import os -import sys - -sys.path.append(os.getcwd()) - -import argparse -import csv -import json -import shutil -from importlib.resources import files -from pathlib import Path - -import torchaudio -from tqdm import tqdm -from datasets.arrow_writer import ArrowWriter - -from f5_tts.model.utils import ( - convert_char_to_pinyin, -) - - -PRETRAINED_VOCAB_PATH = files("f5_tts").joinpath("../../data/Emilia_ZH_EN_pinyin/vocab.txt") - - -def is_csv_wavs_format(input_dataset_dir): - fpath = Path(input_dataset_dir) - metadata = fpath / "metadata.csv" - wavs = fpath / "wavs" - return metadata.exists() and metadata.is_file() and wavs.exists() and wavs.is_dir() - - -def prepare_csv_wavs_dir(input_dir): - assert is_csv_wavs_format(input_dir), f"not csv_wavs format: {input_dir}" - input_dir = Path(input_dir) - metadata_path = input_dir / "metadata.csv" - audio_path_text_pairs = read_audio_text_pairs(metadata_path.as_posix()) - - sub_result, durations = [], [] - vocab_set = set() - polyphone = True - for audio_path, text in audio_path_text_pairs: - if not Path(audio_path).exists(): - print(f"audio {audio_path} not found, skipping") - continue - audio_duration = get_audio_duration(audio_path) - # assume tokenizer = "pinyin" ("pinyin" | "char") - text = convert_char_to_pinyin([text], polyphone=polyphone)[0] - sub_result.append({"audio_path": audio_path, "text": text, "duration": audio_duration}) - durations.append(audio_duration) - vocab_set.update(list(text)) - - return sub_result, durations, vocab_set - - -def get_audio_duration(audio_path): - audio, sample_rate = torchaudio.load(audio_path) - return audio.shape[1] / sample_rate - - -def read_audio_text_pairs(csv_file_path): - audio_text_pairs = [] - - parent = Path(csv_file_path).parent - with open(csv_file_path, mode="r", newline="", encoding="utf-8-sig") as csvfile: - reader = csv.reader(csvfile, delimiter="|") - next(reader) # Skip the header row - for row in reader: - if len(row) >= 2: - audio_file = row[0].strip() # First column: audio file path - text = row[1].strip() # Second column: text - audio_file_path = parent / audio_file - audio_text_pairs.append((audio_file_path.as_posix(), text)) - - return audio_text_pairs - - -def save_prepped_dataset(out_dir, result, duration_list, text_vocab_set, is_finetune): - out_dir = Path(out_dir) - # save preprocessed dataset to disk - out_dir.mkdir(exist_ok=True, parents=True) - print(f"\nSaving to {out_dir} ...") - - # dataset = Dataset.from_dict({"audio_path": audio_path_list, "text": text_list, "duration": duration_list}) # oom - # dataset.save_to_disk(f"{out_dir}/raw", max_shard_size="2GB") - raw_arrow_path = out_dir / "raw.arrow" - with ArrowWriter(path=raw_arrow_path.as_posix(), writer_batch_size=1) as writer: - for line in tqdm(result, desc="Writing to raw.arrow ..."): - writer.write(line) - - # dup a json separately saving duration in case for DynamicBatchSampler ease - dur_json_path = out_dir / "duration.json" - with open(dur_json_path.as_posix(), "w", encoding="utf-8") as f: - json.dump({"duration": duration_list}, f, ensure_ascii=False) - - # vocab map, i.e. tokenizer - # add alphabets and symbols (optional, if plan to ft on de/fr etc.) - # if tokenizer == "pinyin": - # text_vocab_set.update([chr(i) for i in range(32, 127)] + [chr(i) for i in range(192, 256)]) - voca_out_path = out_dir / "vocab.txt" - with open(voca_out_path.as_posix(), "w") as f: - for vocab in sorted(text_vocab_set): - f.write(vocab + "\n") - - if is_finetune: - file_vocab_finetune = PRETRAINED_VOCAB_PATH.as_posix() - shutil.copy2(file_vocab_finetune, voca_out_path) - else: - with open(voca_out_path, "w") as f: - for vocab in sorted(text_vocab_set): - f.write(vocab + "\n") - - dataset_name = out_dir.stem - print(f"\nFor {dataset_name}, sample count: {len(result)}") - print(f"For {dataset_name}, vocab size is: {len(text_vocab_set)}") - print(f"For {dataset_name}, total {sum(duration_list)/3600:.2f} hours") - - -def prepare_and_save_set(inp_dir, out_dir, is_finetune: bool = True): - if is_finetune: - assert PRETRAINED_VOCAB_PATH.exists(), f"pretrained vocab.txt not found: {PRETRAINED_VOCAB_PATH}" - sub_result, durations, vocab_set = prepare_csv_wavs_dir(inp_dir) - save_prepped_dataset(out_dir, sub_result, durations, vocab_set, is_finetune) - - -def cli(): - # finetune: python scripts/prepare_csv_wavs.py /path/to/input_dir /path/to/output_dir_pinyin - # pretrain: python scripts/prepare_csv_wavs.py /path/to/output_dir_pinyin --pretrain - parser = argparse.ArgumentParser(description="Prepare and save dataset.") - parser.add_argument("inp_dir", type=str, help="Input directory containing the data.") - parser.add_argument("out_dir", type=str, help="Output directory to save the prepared data.") - parser.add_argument("--pretrain", action="store_true", help="Enable for new pretrain, otherwise is a fine-tune") - - args = parser.parse_args() - - prepare_and_save_set(args.inp_dir, args.out_dir, is_finetune=not args.pretrain) - - -if __name__ == "__main__": - cli() diff --git a/src/f5_tts/train/datasets/prepare_emilia.py b/src/f5_tts/train/datasets/prepare_emilia.py deleted file mode 100644 index d9b276afa68d671cee69f45cc16d2b12cd0859a4..0000000000000000000000000000000000000000 --- a/src/f5_tts/train/datasets/prepare_emilia.py +++ /dev/null @@ -1,230 +0,0 @@ -# Emilia Dataset: https://huggingface.co/datasets/amphion/Emilia-Dataset/tree/fc71e07 -# if use updated new version, i.e. WebDataset, feel free to modify / draft your own script - -# generate audio text map for Emilia ZH & EN -# evaluate for vocab size - -import os -import sys - -sys.path.append(os.getcwd()) - -import json -from concurrent.futures import ProcessPoolExecutor -from importlib.resources import files -from pathlib import Path -from tqdm import tqdm - -from datasets.arrow_writer import ArrowWriter - -from f5_tts.model.utils import ( - repetition_found, - convert_char_to_pinyin, -) - - -out_zh = { - "ZH_B00041_S06226", - "ZH_B00042_S09204", - "ZH_B00065_S09430", - "ZH_B00065_S09431", - "ZH_B00066_S09327", - "ZH_B00066_S09328", -} -zh_filters = ["い", "て"] -# seems synthesized audios, or heavily code-switched -out_en = { - "EN_B00013_S00913", - "EN_B00042_S00120", - "EN_B00055_S04111", - "EN_B00061_S00693", - "EN_B00061_S01494", - "EN_B00061_S03375", - "EN_B00059_S00092", - "EN_B00111_S04300", - "EN_B00100_S03759", - "EN_B00087_S03811", - "EN_B00059_S00950", - "EN_B00089_S00946", - "EN_B00078_S05127", - "EN_B00070_S04089", - "EN_B00074_S09659", - "EN_B00061_S06983", - "EN_B00061_S07060", - "EN_B00059_S08397", - "EN_B00082_S06192", - "EN_B00091_S01238", - "EN_B00089_S07349", - "EN_B00070_S04343", - "EN_B00061_S02400", - "EN_B00076_S01262", - "EN_B00068_S06467", - "EN_B00076_S02943", - "EN_B00064_S05954", - "EN_B00061_S05386", - "EN_B00066_S06544", - "EN_B00076_S06944", - "EN_B00072_S08620", - "EN_B00076_S07135", - "EN_B00076_S09127", - "EN_B00065_S00497", - "EN_B00059_S06227", - "EN_B00063_S02859", - "EN_B00075_S01547", - "EN_B00061_S08286", - "EN_B00079_S02901", - "EN_B00092_S03643", - "EN_B00096_S08653", - "EN_B00063_S04297", - "EN_B00063_S04614", - "EN_B00079_S04698", - "EN_B00104_S01666", - "EN_B00061_S09504", - "EN_B00061_S09694", - "EN_B00065_S05444", - "EN_B00063_S06860", - "EN_B00065_S05725", - "EN_B00069_S07628", - "EN_B00083_S03875", - "EN_B00071_S07665", - "EN_B00071_S07665", - "EN_B00062_S04187", - "EN_B00065_S09873", - "EN_B00065_S09922", - "EN_B00084_S02463", - "EN_B00067_S05066", - "EN_B00106_S08060", - "EN_B00073_S06399", - "EN_B00073_S09236", - "EN_B00087_S00432", - "EN_B00085_S05618", - "EN_B00064_S01262", - "EN_B00072_S01739", - "EN_B00059_S03913", - "EN_B00069_S04036", - "EN_B00067_S05623", - "EN_B00060_S05389", - "EN_B00060_S07290", - "EN_B00062_S08995", -} -en_filters = ["ا", "い", "て"] - - -def deal_with_audio_dir(audio_dir): - audio_jsonl = audio_dir.with_suffix(".jsonl") - sub_result, durations = [], [] - vocab_set = set() - bad_case_zh = 0 - bad_case_en = 0 - with open(audio_jsonl, "r") as f: - lines = f.readlines() - for line in tqdm(lines, desc=f"{audio_jsonl.stem}"): - obj = json.loads(line) - text = obj["text"] - if obj["language"] == "zh": - if obj["wav"].split("/")[1] in out_zh or any(f in text for f in zh_filters) or repetition_found(text): - bad_case_zh += 1 - continue - else: - text = text.translate( - str.maketrans({",": ",", "!": "!", "?": "?"}) - ) # not "。" cuz much code-switched - if obj["language"] == "en": - if ( - obj["wav"].split("/")[1] in out_en - or any(f in text for f in en_filters) - or repetition_found(text, length=4) - ): - bad_case_en += 1 - continue - if tokenizer == "pinyin": - text = convert_char_to_pinyin([text], polyphone=polyphone)[0] - duration = obj["duration"] - sub_result.append({"audio_path": str(audio_dir.parent / obj["wav"]), "text": text, "duration": duration}) - durations.append(duration) - vocab_set.update(list(text)) - return sub_result, durations, vocab_set, bad_case_zh, bad_case_en - - -def main(): - assert tokenizer in ["pinyin", "char"] - result = [] - duration_list = [] - text_vocab_set = set() - total_bad_case_zh = 0 - total_bad_case_en = 0 - - # process raw data - executor = ProcessPoolExecutor(max_workers=max_workers) - futures = [] - for lang in langs: - dataset_path = Path(os.path.join(dataset_dir, lang)) - [ - futures.append(executor.submit(deal_with_audio_dir, audio_dir)) - for audio_dir in dataset_path.iterdir() - if audio_dir.is_dir() - ] - for futures in tqdm(futures, total=len(futures)): - sub_result, durations, vocab_set, bad_case_zh, bad_case_en = futures.result() - result.extend(sub_result) - duration_list.extend(durations) - text_vocab_set.update(vocab_set) - total_bad_case_zh += bad_case_zh - total_bad_case_en += bad_case_en - executor.shutdown() - - # save preprocessed dataset to disk - if not os.path.exists(f"{save_dir}"): - os.makedirs(f"{save_dir}") - print(f"\nSaving to {save_dir} ...") - - # dataset = Dataset.from_dict({"audio_path": audio_path_list, "text": text_list, "duration": duration_list}) # oom - # dataset.save_to_disk(f"{save_dir}/raw", max_shard_size="2GB") - with ArrowWriter(path=f"{save_dir}/raw.arrow") as writer: - for line in tqdm(result, desc="Writing to raw.arrow ..."): - writer.write(line) - - # dup a json separately saving duration in case for DynamicBatchSampler ease - with open(f"{save_dir}/duration.json", "w", encoding="utf-8") as f: - json.dump({"duration": duration_list}, f, ensure_ascii=False) - - # vocab map, i.e. tokenizer - # add alphabets and symbols (optional, if plan to ft on de/fr etc.) - # if tokenizer == "pinyin": - # text_vocab_set.update([chr(i) for i in range(32, 127)] + [chr(i) for i in range(192, 256)]) - with open(f"{save_dir}/vocab.txt", "w") as f: - for vocab in sorted(text_vocab_set): - f.write(vocab + "\n") - - print(f"\nFor {dataset_name}, sample count: {len(result)}") - print(f"For {dataset_name}, vocab size is: {len(text_vocab_set)}") - print(f"For {dataset_name}, total {sum(duration_list)/3600:.2f} hours") - if "ZH" in langs: - print(f"Bad zh transcription case: {total_bad_case_zh}") - if "EN" in langs: - print(f"Bad en transcription case: {total_bad_case_en}\n") - - -if __name__ == "__main__": - max_workers = 32 - - tokenizer = "pinyin" # "pinyin" | "char" - polyphone = True - - langs = ["ZH", "EN"] - dataset_dir = "/Emilia_Dataset/raw" - dataset_name = f"Emilia_{'_'.join(langs)}_{tokenizer}" - save_dir = str(files("f5_tts").joinpath("../../")) + f"/data/{dataset_name}" - print(f"\nPrepare for {dataset_name}, will save to {save_dir}\n") - - main() - - # Emilia ZH & EN - # samples count 37837916 (after removal) - # pinyin vocab size 2543 (polyphone) - # total duration 95281.87 (hours) - # bad zh asr cnt 230435 (samples) - # bad eh asr cnt 37217 (samples) - - # vocab size may be slightly different due to jieba tokenizer and pypinyin (e.g. way of polyphoneme) - # please be careful if using pretrained model, make sure the vocab.txt is same diff --git a/src/f5_tts/train/datasets/prepare_libritts.py b/src/f5_tts/train/datasets/prepare_libritts.py deleted file mode 100644 index 2a35dd97980154500be715b41a41d6acae15361f..0000000000000000000000000000000000000000 --- a/src/f5_tts/train/datasets/prepare_libritts.py +++ /dev/null @@ -1,92 +0,0 @@ -import os -import sys - -sys.path.append(os.getcwd()) - -import json -from concurrent.futures import ProcessPoolExecutor -from importlib.resources import files -from pathlib import Path -from tqdm import tqdm -import soundfile as sf -from datasets.arrow_writer import ArrowWriter - - -def deal_with_audio_dir(audio_dir): - sub_result, durations = [], [] - vocab_set = set() - audio_lists = list(audio_dir.rglob("*.wav")) - - for line in audio_lists: - text_path = line.with_suffix(".normalized.txt") - text = open(text_path, "r").read().strip() - duration = sf.info(line).duration - if duration < 0.4 or duration > 30: - continue - sub_result.append({"audio_path": str(line), "text": text, "duration": duration}) - durations.append(duration) - vocab_set.update(list(text)) - return sub_result, durations, vocab_set - - -def main(): - result = [] - duration_list = [] - text_vocab_set = set() - - # process raw data - executor = ProcessPoolExecutor(max_workers=max_workers) - futures = [] - - for subset in tqdm(SUB_SET): - dataset_path = Path(os.path.join(dataset_dir, subset)) - [ - futures.append(executor.submit(deal_with_audio_dir, audio_dir)) - for audio_dir in dataset_path.iterdir() - if audio_dir.is_dir() - ] - for future in tqdm(futures, total=len(futures)): - sub_result, durations, vocab_set = future.result() - result.extend(sub_result) - duration_list.extend(durations) - text_vocab_set.update(vocab_set) - executor.shutdown() - - # save preprocessed dataset to disk - if not os.path.exists(f"{save_dir}"): - os.makedirs(f"{save_dir}") - print(f"\nSaving to {save_dir} ...") - - with ArrowWriter(path=f"{save_dir}/raw.arrow") as writer: - for line in tqdm(result, desc="Writing to raw.arrow ..."): - writer.write(line) - - # dup a json separately saving duration in case for DynamicBatchSampler ease - with open(f"{save_dir}/duration.json", "w", encoding="utf-8") as f: - json.dump({"duration": duration_list}, f, ensure_ascii=False) - - # vocab map, i.e. tokenizer - with open(f"{save_dir}/vocab.txt", "w") as f: - for vocab in sorted(text_vocab_set): - f.write(vocab + "\n") - - print(f"\nFor {dataset_name}, sample count: {len(result)}") - print(f"For {dataset_name}, vocab size is: {len(text_vocab_set)}") - print(f"For {dataset_name}, total {sum(duration_list)/3600:.2f} hours") - - -if __name__ == "__main__": - max_workers = 36 - - tokenizer = "char" # "pinyin" | "char" - - SUB_SET = ["train-clean-100", "train-clean-360", "train-other-500"] - dataset_dir = "/LibriTTS" - dataset_name = f"LibriTTS_{'_'.join(SUB_SET)}_{tokenizer}".replace("train-clean-", "").replace("train-other-", "") - save_dir = str(files("f5_tts").joinpath("../../")) + f"/data/{dataset_name}" - print(f"\nPrepare for {dataset_name}, will save to {save_dir}\n") - main() - - # For LibriTTS_100_360_500_char, sample count: 354218 - # For LibriTTS_100_360_500_char, vocab size is: 78 - # For LibriTTS_100_360_500_char, total 554.09 hours diff --git a/src/f5_tts/train/datasets/prepare_ljspeech.py b/src/f5_tts/train/datasets/prepare_ljspeech.py deleted file mode 100644 index 19a5b2a90e562570da9a0bcb65f19590acdee941..0000000000000000000000000000000000000000 --- a/src/f5_tts/train/datasets/prepare_ljspeech.py +++ /dev/null @@ -1,65 +0,0 @@ -import os -import sys - -sys.path.append(os.getcwd()) - -import json -from importlib.resources import files -from pathlib import Path -from tqdm import tqdm -import soundfile as sf -from datasets.arrow_writer import ArrowWriter - - -def main(): - result = [] - duration_list = [] - text_vocab_set = set() - - with open(meta_info, "r") as f: - lines = f.readlines() - for line in tqdm(lines): - uttr, text, norm_text = line.split("|") - norm_text = norm_text.strip() - wav_path = Path(dataset_dir) / "wavs" / f"{uttr}.wav" - duration = sf.info(wav_path).duration - if duration < 0.4 or duration > 30: - continue - result.append({"audio_path": str(wav_path), "text": norm_text, "duration": duration}) - duration_list.append(duration) - text_vocab_set.update(list(norm_text)) - - # save preprocessed dataset to disk - if not os.path.exists(f"{save_dir}"): - os.makedirs(f"{save_dir}") - print(f"\nSaving to {save_dir} ...") - - with ArrowWriter(path=f"{save_dir}/raw.arrow") as writer: - for line in tqdm(result, desc="Writing to raw.arrow ..."): - writer.write(line) - - # dup a json separately saving duration in case for DynamicBatchSampler ease - with open(f"{save_dir}/duration.json", "w", encoding="utf-8") as f: - json.dump({"duration": duration_list}, f, ensure_ascii=False) - - # vocab map, i.e. tokenizer - # add alphabets and symbols (optional, if plan to ft on de/fr etc.) - with open(f"{save_dir}/vocab.txt", "w") as f: - for vocab in sorted(text_vocab_set): - f.write(vocab + "\n") - - print(f"\nFor {dataset_name}, sample count: {len(result)}") - print(f"For {dataset_name}, vocab size is: {len(text_vocab_set)}") - print(f"For {dataset_name}, total {sum(duration_list)/3600:.2f} hours") - - -if __name__ == "__main__": - tokenizer = "char" # "pinyin" | "char" - - dataset_dir = "/LJSpeech-1.1" - dataset_name = f"LJSpeech_{tokenizer}" - meta_info = os.path.join(dataset_dir, "metadata.csv") - save_dir = str(files("f5_tts").joinpath("../../")) + f"/data/{dataset_name}" - print(f"\nPrepare for {dataset_name}, will save to {save_dir}\n") - - main() diff --git a/src/f5_tts/train/datasets/prepare_wenetspeech4tts.py b/src/f5_tts/train/datasets/prepare_wenetspeech4tts.py deleted file mode 100644 index bbcdc4818c9fd87e99a37708251e6d83a7013480..0000000000000000000000000000000000000000 --- a/src/f5_tts/train/datasets/prepare_wenetspeech4tts.py +++ /dev/null @@ -1,125 +0,0 @@ -# generate audio text map for WenetSpeech4TTS -# evaluate for vocab size - -import os -import sys - -sys.path.append(os.getcwd()) - -import json -from concurrent.futures import ProcessPoolExecutor -from importlib.resources import files -from tqdm import tqdm - -import torchaudio -from datasets import Dataset - -from f5_tts.model.utils import convert_char_to_pinyin - - -def deal_with_sub_path_files(dataset_path, sub_path): - print(f"Dealing with: {sub_path}") - - text_dir = os.path.join(dataset_path, sub_path, "txts") - audio_dir = os.path.join(dataset_path, sub_path, "wavs") - text_files = os.listdir(text_dir) - - audio_paths, texts, durations = [], [], [] - for text_file in tqdm(text_files): - with open(os.path.join(text_dir, text_file), "r", encoding="utf-8") as file: - first_line = file.readline().split("\t") - audio_nm = first_line[0] - audio_path = os.path.join(audio_dir, audio_nm + ".wav") - text = first_line[1].strip() - - audio_paths.append(audio_path) - - if tokenizer == "pinyin": - texts.extend(convert_char_to_pinyin([text], polyphone=polyphone)) - elif tokenizer == "char": - texts.append(text) - - audio, sample_rate = torchaudio.load(audio_path) - durations.append(audio.shape[-1] / sample_rate) - - return audio_paths, texts, durations - - -def main(): - assert tokenizer in ["pinyin", "char"] - - audio_path_list, text_list, duration_list = [], [], [] - - executor = ProcessPoolExecutor(max_workers=max_workers) - futures = [] - for dataset_path in dataset_paths: - sub_items = os.listdir(dataset_path) - sub_paths = [item for item in sub_items if os.path.isdir(os.path.join(dataset_path, item))] - for sub_path in sub_paths: - futures.append(executor.submit(deal_with_sub_path_files, dataset_path, sub_path)) - for future in tqdm(futures, total=len(futures)): - audio_paths, texts, durations = future.result() - audio_path_list.extend(audio_paths) - text_list.extend(texts) - duration_list.extend(durations) - executor.shutdown() - - if not os.path.exists("data"): - os.makedirs("data") - - print(f"\nSaving to {save_dir} ...") - dataset = Dataset.from_dict({"audio_path": audio_path_list, "text": text_list, "duration": duration_list}) - dataset.save_to_disk(f"{save_dir}/raw", max_shard_size="2GB") # arrow format - - with open(f"{save_dir}/duration.json", "w", encoding="utf-8") as f: - json.dump( - {"duration": duration_list}, f, ensure_ascii=False - ) # dup a json separately saving duration in case for DynamicBatchSampler ease - - print("\nEvaluating vocab size (all characters and symbols / all phonemes) ...") - text_vocab_set = set() - for text in tqdm(text_list): - text_vocab_set.update(list(text)) - - # add alphabets and symbols (optional, if plan to ft on de/fr etc.) - if tokenizer == "pinyin": - text_vocab_set.update([chr(i) for i in range(32, 127)] + [chr(i) for i in range(192, 256)]) - - with open(f"{save_dir}/vocab.txt", "w") as f: - for vocab in sorted(text_vocab_set): - f.write(vocab + "\n") - print(f"\nFor {dataset_name}, sample count: {len(text_list)}") - print(f"For {dataset_name}, vocab size is: {len(text_vocab_set)}\n") - - -if __name__ == "__main__": - max_workers = 32 - - tokenizer = "pinyin" # "pinyin" | "char" - polyphone = True - dataset_choice = 1 # 1: Premium, 2: Standard, 3: Basic - - dataset_name = ( - ["WenetSpeech4TTS_Premium", "WenetSpeech4TTS_Standard", "WenetSpeech4TTS_Basic"][dataset_choice - 1] - + "_" - + tokenizer - ) - dataset_paths = [ - "/WenetSpeech4TTS/Basic", - "/WenetSpeech4TTS/Standard", - "/WenetSpeech4TTS/Premium", - ][-dataset_choice:] - save_dir = str(files("f5_tts").joinpath("../../")) + f"/data/{dataset_name}" - print(f"\nChoose Dataset: {dataset_name}, will save to {save_dir}\n") - - main() - - # Results (if adding alphabets with accents and symbols): - # WenetSpeech4TTS Basic Standard Premium - # samples count 3932473 1941220 407494 - # pinyin vocab size 1349 1348 1344 (no polyphone) - # - - 1459 (polyphone) - # char vocab size 5264 5219 5042 - - # vocab size may be slightly different due to jieba tokenizer and pypinyin (e.g. way of polyphoneme) - # please be careful if using pretrained model, make sure the vocab.txt is same diff --git a/src/f5_tts/train/finetune_cli.py b/src/f5_tts/train/finetune_cli.py deleted file mode 100644 index 187fd68af92a651958a4b62fd9581d1acc954cef..0000000000000000000000000000000000000000 --- a/src/f5_tts/train/finetune_cli.py +++ /dev/null @@ -1,174 +0,0 @@ -import argparse -import os -import shutil - -from cached_path import cached_path -from f5_tts.model import CFM, UNetT, DiT, Trainer -from f5_tts.model.utils import get_tokenizer -from f5_tts.model.dataset import load_dataset -from importlib.resources import files - - -# -------------------------- Dataset Settings --------------------------- # -target_sample_rate = 24000 -n_mel_channels = 100 -hop_length = 256 -win_length = 1024 -n_fft = 1024 -mel_spec_type = "vocos" # 'vocos' or 'bigvgan' - - -# -------------------------- Argument Parsing --------------------------- # -def parse_args(): - # batch_size_per_gpu = 1000 settting for gpu 8GB - # batch_size_per_gpu = 1600 settting for gpu 12GB - # batch_size_per_gpu = 2000 settting for gpu 16GB - # batch_size_per_gpu = 3200 settting for gpu 24GB - - # num_warmup_updates = 300 for 5000 sample about 10 hours - - # change save_per_updates , last_per_steps change this value what you need , - - parser = argparse.ArgumentParser(description="Train CFM Model") - - parser.add_argument( - "--exp_name", type=str, default="F5TTS_Base", choices=["F5TTS_Base", "E2TTS_Base"], help="Experiment name" - ) - parser.add_argument("--dataset_name", type=str, default="Emilia_ZH_EN", help="Name of the dataset to use") - parser.add_argument("--learning_rate", type=float, default=1e-5, help="Learning rate for training") - parser.add_argument("--batch_size_per_gpu", type=int, default=3200, help="Batch size per GPU") - parser.add_argument( - "--batch_size_type", type=str, default="frame", choices=["frame", "sample"], help="Batch size type" - ) - parser.add_argument("--max_samples", type=int, default=64, help="Max sequences per batch") - parser.add_argument("--grad_accumulation_steps", type=int, default=1, help="Gradient accumulation steps") - parser.add_argument("--max_grad_norm", type=float, default=1.0, help="Max gradient norm for clipping") - parser.add_argument("--epochs", type=int, default=100, help="Number of training epochs") - parser.add_argument("--num_warmup_updates", type=int, default=300, help="Warmup steps") - parser.add_argument("--save_per_updates", type=int, default=10000, help="Save checkpoint every X steps") - parser.add_argument("--last_per_steps", type=int, default=50000, help="Save last checkpoint every X steps") - parser.add_argument("--finetune", type=bool, default=True, help="Use Finetune") - parser.add_argument("--pretrain", type=str, default=None, help="the path to the checkpoint") - parser.add_argument( - "--tokenizer", type=str, default="pinyin", choices=["pinyin", "char", "custom"], help="Tokenizer type" - ) - parser.add_argument( - "--tokenizer_path", - type=str, - default=None, - help="Path to custom tokenizer vocab file (only used if tokenizer = 'custom')", - ) - parser.add_argument( - "--log_samples", - type=bool, - default=False, - help="Log inferenced samples per ckpt save steps", - ) - parser.add_argument("--logger", type=str, default=None, choices=["wandb", "tensorboard"], help="logger") - parser.add_argument( - "--bnb_optimizer", - type=bool, - default=False, - help="Use 8-bit Adam optimizer from bitsandbytes", - ) - - return parser.parse_args() - - -# -------------------------- Training Settings -------------------------- # - - -def main(): - args = parse_args() - - checkpoint_path = str(files("f5_tts").joinpath(f"../../ckpts/{args.dataset_name}")) - - # Model parameters based on experiment name - if args.exp_name == "F5TTS_Base": - wandb_resume_id = None - model_cls = DiT - model_cfg = dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4) - if args.finetune: - if args.pretrain is None: - ckpt_path = str(cached_path("hf://SWivid/F5-TTS/F5TTS_Base/model_1200000.pt")) - else: - ckpt_path = args.pretrain - elif args.exp_name == "E2TTS_Base": - wandb_resume_id = None - model_cls = UNetT - model_cfg = dict(dim=1024, depth=24, heads=16, ff_mult=4) - if args.finetune: - if args.pretrain is None: - ckpt_path = str(cached_path("hf://SWivid/E2-TTS/E2TTS_Base/model_1200000.pt")) - else: - ckpt_path = args.pretrain - - if args.finetune: - if not os.path.isdir(checkpoint_path): - os.makedirs(checkpoint_path, exist_ok=True) - - file_checkpoint = os.path.join(checkpoint_path, os.path.basename(ckpt_path)) - if not os.path.isfile(file_checkpoint): - shutil.copy2(ckpt_path, file_checkpoint) - print("copy checkpoint for finetune") - - # Use the tokenizer and tokenizer_path provided in the command line arguments - tokenizer = args.tokenizer - if tokenizer == "custom": - if not args.tokenizer_path: - raise ValueError("Custom tokenizer selected, but no tokenizer_path provided.") - tokenizer_path = args.tokenizer_path - else: - tokenizer_path = args.dataset_name - - vocab_char_map, vocab_size = get_tokenizer(tokenizer_path, tokenizer) - - print("\nvocab : ", vocab_size) - print("\nvocoder : ", mel_spec_type) - - mel_spec_kwargs = dict( - n_fft=n_fft, - hop_length=hop_length, - win_length=win_length, - n_mel_channels=n_mel_channels, - target_sample_rate=target_sample_rate, - mel_spec_type=mel_spec_type, - ) - - model = CFM( - transformer=model_cls(**model_cfg, text_num_embeds=vocab_size, mel_dim=n_mel_channels), - mel_spec_kwargs=mel_spec_kwargs, - vocab_char_map=vocab_char_map, - ) - - trainer = Trainer( - model, - args.epochs, - args.learning_rate, - num_warmup_updates=args.num_warmup_updates, - save_per_updates=args.save_per_updates, - checkpoint_path=checkpoint_path, - batch_size=args.batch_size_per_gpu, - batch_size_type=args.batch_size_type, - max_samples=args.max_samples, - grad_accumulation_steps=args.grad_accumulation_steps, - max_grad_norm=args.max_grad_norm, - logger=args.logger, - wandb_project=args.dataset_name, - wandb_run_name=args.exp_name, - wandb_resume_id=wandb_resume_id, - log_samples=args.log_samples, - last_per_steps=args.last_per_steps, - bnb_optimizer=args.bnb_optimizer, - ) - - train_dataset = load_dataset(args.dataset_name, tokenizer, mel_spec_kwargs=mel_spec_kwargs) - - trainer.train( - train_dataset, - resumable_with_seed=666, # seed for shuffling dataset - ) - - -if __name__ == "__main__": - main() diff --git a/src/f5_tts/train/finetune_gradio.py b/src/f5_tts/train/finetune_gradio.py deleted file mode 100644 index 0cfcfd97862bf4dea511b1e6ae1270a82e95d67c..0000000000000000000000000000000000000000 --- a/src/f5_tts/train/finetune_gradio.py +++ /dev/null @@ -1,1846 +0,0 @@ -import threading -import queue -import re - -import gc -import json -import os -import platform -import psutil -import random -import signal -import shutil -import subprocess -import sys -import tempfile -import time -from glob import glob - -import click -import gradio as gr -import librosa -import numpy as np -import torch -import torchaudio -from datasets import Dataset as Dataset_ -from datasets.arrow_writer import ArrowWriter -from safetensors.torch import save_file -from scipy.io import wavfile -from cached_path import cached_path -from f5_tts.api import F5TTS -from f5_tts.model.utils import convert_char_to_pinyin -from f5_tts.infer.utils_infer import transcribe -from importlib.resources import files - - -training_process = None -system = platform.system() -python_executable = sys.executable or "python" -tts_api = None -last_checkpoint = "" -last_device = "" -last_ema = None - - -path_data = str(files("f5_tts").joinpath("../../data")) -path_project_ckpts = str(files("f5_tts").joinpath("../../ckpts")) -file_train = str(files("f5_tts").joinpath("train/finetune_cli.py")) - -device = "cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu" - - -# Save settings from a JSON file -def save_settings( - project_name, - exp_name, - learning_rate, - batch_size_per_gpu, - batch_size_type, - max_samples, - grad_accumulation_steps, - max_grad_norm, - epochs, - num_warmup_updates, - save_per_updates, - last_per_steps, - finetune, - file_checkpoint_train, - tokenizer_type, - tokenizer_file, - mixed_precision, - logger, - ch_8bit_adam, -): - path_project = os.path.join(path_project_ckpts, project_name) - os.makedirs(path_project, exist_ok=True) - file_setting = os.path.join(path_project, "setting.json") - - settings = { - "exp_name": exp_name, - "learning_rate": learning_rate, - "batch_size_per_gpu": batch_size_per_gpu, - "batch_size_type": batch_size_type, - "max_samples": max_samples, - "grad_accumulation_steps": grad_accumulation_steps, - "max_grad_norm": max_grad_norm, - "epochs": epochs, - "num_warmup_updates": num_warmup_updates, - "save_per_updates": save_per_updates, - "last_per_steps": last_per_steps, - "finetune": finetune, - "file_checkpoint_train": file_checkpoint_train, - "tokenizer_type": tokenizer_type, - "tokenizer_file": tokenizer_file, - "mixed_precision": mixed_precision, - "logger": logger, - "bnb_optimizer": ch_8bit_adam, - } - with open(file_setting, "w") as f: - json.dump(settings, f, indent=4) - return "Settings saved!" - - -# Load settings from a JSON file -def load_settings(project_name): - project_name = project_name.replace("_pinyin", "").replace("_char", "") - path_project = os.path.join(path_project_ckpts, project_name) - file_setting = os.path.join(path_project, "setting.json") - - if not os.path.isfile(file_setting): - settings = { - "exp_name": "F5TTS_Base", - "learning_rate": 1e-05, - "batch_size_per_gpu": 1000, - "batch_size_type": "frame", - "max_samples": 64, - "grad_accumulation_steps": 1, - "max_grad_norm": 1, - "epochs": 100, - "num_warmup_updates": 2, - "save_per_updates": 300, - "last_per_steps": 100, - "finetune": True, - "file_checkpoint_train": "", - "tokenizer_type": "pinyin", - "tokenizer_file": "", - "mixed_precision": "none", - "logger": "wandb", - "bnb_optimizer": False, - } - return ( - settings["exp_name"], - settings["learning_rate"], - settings["batch_size_per_gpu"], - settings["batch_size_type"], - settings["max_samples"], - settings["grad_accumulation_steps"], - settings["max_grad_norm"], - settings["epochs"], - settings["num_warmup_updates"], - settings["save_per_updates"], - settings["last_per_steps"], - settings["finetune"], - settings["file_checkpoint_train"], - settings["tokenizer_type"], - settings["tokenizer_file"], - settings["mixed_precision"], - settings["logger"], - settings["bnb_optimizer"], - ) - - with open(file_setting, "r") as f: - settings = json.load(f) - if "logger" not in settings: - settings["logger"] = "wandb" - if "bnb_optimizer" not in settings: - settings["bnb_optimizer"] = False - return ( - settings["exp_name"], - settings["learning_rate"], - settings["batch_size_per_gpu"], - settings["batch_size_type"], - settings["max_samples"], - settings["grad_accumulation_steps"], - settings["max_grad_norm"], - settings["epochs"], - settings["num_warmup_updates"], - settings["save_per_updates"], - settings["last_per_steps"], - settings["finetune"], - settings["file_checkpoint_train"], - settings["tokenizer_type"], - settings["tokenizer_file"], - settings["mixed_precision"], - settings["logger"], - settings["bnb_optimizer"], - ) - - -# Load metadata -def get_audio_duration(audio_path): - """Calculate the duration mono of an audio file.""" - audio, sample_rate = torchaudio.load(audio_path) - return audio.shape[1] / sample_rate - - -def clear_text(text): - """Clean and prepare text by lowering the case and stripping whitespace.""" - return text.lower().strip() - - -def get_rms( - y, - frame_length=2048, - hop_length=512, - pad_mode="constant", -): # https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/slicer2.py - padding = (int(frame_length // 2), int(frame_length // 2)) - y = np.pad(y, padding, mode=pad_mode) - - axis = -1 - # put our new within-frame axis at the end for now - out_strides = y.strides + tuple([y.strides[axis]]) - # Reduce the shape on the framing axis - x_shape_trimmed = list(y.shape) - x_shape_trimmed[axis] -= frame_length - 1 - out_shape = tuple(x_shape_trimmed) + tuple([frame_length]) - xw = np.lib.stride_tricks.as_strided(y, shape=out_shape, strides=out_strides) - if axis < 0: - target_axis = axis - 1 - else: - target_axis = axis + 1 - xw = np.moveaxis(xw, -1, target_axis) - # Downsample along the target axis - slices = [slice(None)] * xw.ndim - slices[axis] = slice(0, None, hop_length) - x = xw[tuple(slices)] - - # Calculate power - power = np.mean(np.abs(x) ** 2, axis=-2, keepdims=True) - - return np.sqrt(power) - - -class Slicer: # https://github.com/RVC-Boss/GPT-SoVITS/blob/main/tools/slicer2.py - def __init__( - self, - sr: int, - threshold: float = -40.0, - min_length: int = 2000, - min_interval: int = 300, - hop_size: int = 20, - max_sil_kept: int = 2000, - ): - if not min_length >= min_interval >= hop_size: - raise ValueError("The following condition must be satisfied: min_length >= min_interval >= hop_size") - if not max_sil_kept >= hop_size: - raise ValueError("The following condition must be satisfied: max_sil_kept >= hop_size") - min_interval = sr * min_interval / 1000 - self.threshold = 10 ** (threshold / 20.0) - self.hop_size = round(sr * hop_size / 1000) - self.win_size = min(round(min_interval), 4 * self.hop_size) - self.min_length = round(sr * min_length / 1000 / self.hop_size) - self.min_interval = round(min_interval / self.hop_size) - self.max_sil_kept = round(sr * max_sil_kept / 1000 / self.hop_size) - - def _apply_slice(self, waveform, begin, end): - if len(waveform.shape) > 1: - return waveform[:, begin * self.hop_size : min(waveform.shape[1], end * self.hop_size)] - else: - return waveform[begin * self.hop_size : min(waveform.shape[0], end * self.hop_size)] - - # @timeit - def slice(self, waveform): - if len(waveform.shape) > 1: - samples = waveform.mean(axis=0) - else: - samples = waveform - if samples.shape[0] <= self.min_length: - return [waveform] - rms_list = get_rms(y=samples, frame_length=self.win_size, hop_length=self.hop_size).squeeze(0) - sil_tags = [] - silence_start = None - clip_start = 0 - for i, rms in enumerate(rms_list): - # Keep looping while frame is silent. - if rms < self.threshold: - # Record start of silent frames. - if silence_start is None: - silence_start = i - continue - # Keep looping while frame is not silent and silence start has not been recorded. - if silence_start is None: - continue - # Clear recorded silence start if interval is not enough or clip is too short - is_leading_silence = silence_start == 0 and i > self.max_sil_kept - need_slice_middle = i - silence_start >= self.min_interval and i - clip_start >= self.min_length - if not is_leading_silence and not need_slice_middle: - silence_start = None - continue - # Need slicing. Record the range of silent frames to be removed. - if i - silence_start <= self.max_sil_kept: - pos = rms_list[silence_start : i + 1].argmin() + silence_start - if silence_start == 0: - sil_tags.append((0, pos)) - else: - sil_tags.append((pos, pos)) - clip_start = pos - elif i - silence_start <= self.max_sil_kept * 2: - pos = rms_list[i - self.max_sil_kept : silence_start + self.max_sil_kept + 1].argmin() - pos += i - self.max_sil_kept - pos_l = rms_list[silence_start : silence_start + self.max_sil_kept + 1].argmin() + silence_start - pos_r = rms_list[i - self.max_sil_kept : i + 1].argmin() + i - self.max_sil_kept - if silence_start == 0: - sil_tags.append((0, pos_r)) - clip_start = pos_r - else: - sil_tags.append((min(pos_l, pos), max(pos_r, pos))) - clip_start = max(pos_r, pos) - else: - pos_l = rms_list[silence_start : silence_start + self.max_sil_kept + 1].argmin() + silence_start - pos_r = rms_list[i - self.max_sil_kept : i + 1].argmin() + i - self.max_sil_kept - if silence_start == 0: - sil_tags.append((0, pos_r)) - else: - sil_tags.append((pos_l, pos_r)) - clip_start = pos_r - silence_start = None - # Deal with trailing silence. - total_frames = rms_list.shape[0] - if silence_start is not None and total_frames - silence_start >= self.min_interval: - silence_end = min(total_frames, silence_start + self.max_sil_kept) - pos = rms_list[silence_start : silence_end + 1].argmin() + silence_start - sil_tags.append((pos, total_frames + 1)) - # Apply and return slices. - ####音频+起始时间+终止时间 - if len(sil_tags) == 0: - return [[waveform, 0, int(total_frames * self.hop_size)]] - else: - chunks = [] - if sil_tags[0][0] > 0: - chunks.append([self._apply_slice(waveform, 0, sil_tags[0][0]), 0, int(sil_tags[0][0] * self.hop_size)]) - for i in range(len(sil_tags) - 1): - chunks.append( - [ - self._apply_slice(waveform, sil_tags[i][1], sil_tags[i + 1][0]), - int(sil_tags[i][1] * self.hop_size), - int(sil_tags[i + 1][0] * self.hop_size), - ] - ) - if sil_tags[-1][1] < total_frames: - chunks.append( - [ - self._apply_slice(waveform, sil_tags[-1][1], total_frames), - int(sil_tags[-1][1] * self.hop_size), - int(total_frames * self.hop_size), - ] - ) - return chunks - - -# terminal -def terminate_process_tree(pid, including_parent=True): - try: - parent = psutil.Process(pid) - except psutil.NoSuchProcess: - # Process already terminated - return - - children = parent.children(recursive=True) - for child in children: - try: - os.kill(child.pid, signal.SIGTERM) # or signal.SIGKILL - except OSError: - pass - if including_parent: - try: - os.kill(parent.pid, signal.SIGTERM) # or signal.SIGKILL - except OSError: - pass - - -def terminate_process(pid): - if system == "Windows": - cmd = f"taskkill /t /f /pid {pid}" - os.system(cmd) - else: - terminate_process_tree(pid) - - -def start_training( - dataset_name="", - exp_name="F5TTS_Base", - learning_rate=1e-4, - batch_size_per_gpu=400, - batch_size_type="frame", - max_samples=64, - grad_accumulation_steps=1, - max_grad_norm=1.0, - epochs=11, - num_warmup_updates=200, - save_per_updates=400, - last_per_steps=800, - finetune=True, - file_checkpoint_train="", - tokenizer_type="pinyin", - tokenizer_file="", - mixed_precision="fp16", - stream=False, - logger="wandb", - ch_8bit_adam=False, -): - global training_process, tts_api, stop_signal - - if tts_api is not None: - if tts_api is not None: - del tts_api - - gc.collect() - torch.cuda.empty_cache() - tts_api = None - - path_project = os.path.join(path_data, dataset_name) - - if not os.path.isdir(path_project): - yield ( - f"There is not project with name {dataset_name}", - gr.update(interactive=True), - gr.update(interactive=False), - ) - return - - file_raw = os.path.join(path_project, "raw.arrow") - if not os.path.isfile(file_raw): - yield f"There is no file {file_raw}", gr.update(interactive=True), gr.update(interactive=False) - return - - # Check if a training process is already running - if training_process is not None: - return "Train run already!", gr.update(interactive=False), gr.update(interactive=True) - - yield "start train", gr.update(interactive=False), gr.update(interactive=False) - - # Command to run the training script with the specified arguments - - if tokenizer_file == "": - if dataset_name.endswith("_pinyin"): - tokenizer_type = "pinyin" - elif dataset_name.endswith("_char"): - tokenizer_type = "char" - else: - tokenizer_type = "custom" - - dataset_name = dataset_name.replace("_pinyin", "").replace("_char", "") - - if mixed_precision != "none": - fp16 = f"--mixed_precision={mixed_precision}" - else: - fp16 = "" - - cmd = ( - f"accelerate launch {fp16} {file_train} --exp_name {exp_name} " - f"--learning_rate {learning_rate} " - f"--batch_size_per_gpu {batch_size_per_gpu} " - f"--batch_size_type {batch_size_type} " - f"--max_samples {max_samples} " - f"--grad_accumulation_steps {grad_accumulation_steps} " - f"--max_grad_norm {max_grad_norm} " - f"--epochs {epochs} " - f"--num_warmup_updates {num_warmup_updates} " - f"--save_per_updates {save_per_updates} " - f"--last_per_steps {last_per_steps} " - f"--dataset_name {dataset_name}" - ) - - cmd += f" --finetune {finetune}" - - if file_checkpoint_train != "": - cmd += f" --pretrain {file_checkpoint_train}" - - if tokenizer_file != "": - cmd += f" --tokenizer_path {tokenizer_file}" - - cmd += f" --tokenizer {tokenizer_type} " - - cmd += f" --log_samples True --logger {logger} " - - if ch_8bit_adam: - cmd += " --bnb_optimizer True " - - print("run command : \n" + cmd + "\n") - - save_settings( - dataset_name, - exp_name, - learning_rate, - batch_size_per_gpu, - batch_size_type, - max_samples, - grad_accumulation_steps, - max_grad_norm, - epochs, - num_warmup_updates, - save_per_updates, - last_per_steps, - finetune, - file_checkpoint_train, - tokenizer_type, - tokenizer_file, - mixed_precision, - logger, - ch_8bit_adam, - ) - - try: - if not stream: - # Start the training process - training_process = subprocess.Popen(cmd, shell=True) - - time.sleep(5) - yield "train start", gr.update(interactive=False), gr.update(interactive=True) - - # Wait for the training process to finish - training_process.wait() - else: - - def stream_output(pipe, output_queue): - try: - for line in iter(pipe.readline, ""): - output_queue.put(line) - except Exception as e: - output_queue.put(f"Error reading pipe: {str(e)}") - finally: - pipe.close() - - env = os.environ.copy() - env["PYTHONUNBUFFERED"] = "1" - - training_process = subprocess.Popen( - cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, bufsize=1, env=env - ) - yield "Training started...", gr.update(interactive=False), gr.update(interactive=True) - - stdout_queue = queue.Queue() - stderr_queue = queue.Queue() - - stdout_thread = threading.Thread(target=stream_output, args=(training_process.stdout, stdout_queue)) - stderr_thread = threading.Thread(target=stream_output, args=(training_process.stderr, stderr_queue)) - stdout_thread.daemon = True - stderr_thread.daemon = True - stdout_thread.start() - stderr_thread.start() - stop_signal = False - while True: - if stop_signal: - training_process.terminate() - time.sleep(0.5) - if training_process.poll() is None: - training_process.kill() - yield "Training stopped by user.", gr.update(interactive=True), gr.update(interactive=False) - break - - process_status = training_process.poll() - - # Handle stdout - try: - while True: - output = stdout_queue.get_nowait() - print(output, end="") - match = re.search( - r"Epoch (\d+)/(\d+):\s+(\d+)%\|.*\[(\d+:\d+)<.*?loss=(\d+\.\d+), step=(\d+)", output - ) - if match: - current_epoch = match.group(1) - total_epochs = match.group(2) - percent_complete = match.group(3) - elapsed_time = match.group(4) - loss = match.group(5) - current_step = match.group(6) - message = ( - f"Epoch: {current_epoch}/{total_epochs}, " - f"Progress: {percent_complete}%, " - f"Elapsed Time: {elapsed_time}, " - f"Loss: {loss}, " - f"Step: {current_step}" - ) - yield message, gr.update(interactive=False), gr.update(interactive=True) - elif output.strip(): - yield output, gr.update(interactive=False), gr.update(interactive=True) - except queue.Empty: - pass - - # Handle stderr - try: - while True: - error_output = stderr_queue.get_nowait() - print(error_output, end="") - if error_output.strip(): - yield f"{error_output.strip()}", gr.update(interactive=False), gr.update(interactive=True) - except queue.Empty: - pass - - if process_status is not None and stdout_queue.empty() and stderr_queue.empty(): - if process_status != 0: - yield ( - f"Process crashed with exit code {process_status}!", - gr.update(interactive=False), - gr.update(interactive=True), - ) - else: - yield "Training complete!", gr.update(interactive=False), gr.update(interactive=True) - break - - # Small sleep to prevent CPU thrashing - time.sleep(0.1) - - # Clean up - training_process.stdout.close() - training_process.stderr.close() - training_process.wait() - - time.sleep(1) - - if training_process is None: - text_info = "train stop" - else: - text_info = "train complete !" - - except Exception as e: # Catch all exceptions - # Ensure that we reset the training process variable in case of an error - text_info = f"An error occurred: {str(e)}" - - training_process = None - - yield text_info, gr.update(interactive=True), gr.update(interactive=False) - - -def stop_training(): - global training_process, stop_signal - - if training_process is None: - return "Train not run !", gr.update(interactive=True), gr.update(interactive=False) - terminate_process_tree(training_process.pid) - # training_process = None - stop_signal = True - return "train stop", gr.update(interactive=True), gr.update(interactive=False) - - -def get_list_projects(): - project_list = [] - for folder in os.listdir(path_data): - path_folder = os.path.join(path_data, folder) - if not os.path.isdir(path_folder): - continue - folder = folder.lower() - if folder == "emilia_zh_en_pinyin": - continue - project_list.append(folder) - - projects_selelect = None if not project_list else project_list[-1] - - return project_list, projects_selelect - - -def create_data_project(name, tokenizer_type): - name += "_" + tokenizer_type - os.makedirs(os.path.join(path_data, name), exist_ok=True) - os.makedirs(os.path.join(path_data, name, "dataset"), exist_ok=True) - project_list, projects_selelect = get_list_projects() - return gr.update(choices=project_list, value=name) - - -def transcribe_all(name_project, audio_files, language, user=False, progress=gr.Progress()): - path_project = os.path.join(path_data, name_project) - path_dataset = os.path.join(path_project, "dataset") - path_project_wavs = os.path.join(path_project, "wavs") - file_metadata = os.path.join(path_project, "metadata.csv") - - if not user: - if audio_files is None: - return "You need to load an audio file." - - if os.path.isdir(path_project_wavs): - shutil.rmtree(path_project_wavs) - - if os.path.isfile(file_metadata): - os.remove(file_metadata) - - os.makedirs(path_project_wavs, exist_ok=True) - - if user: - file_audios = [ - file - for format in ("*.wav", "*.ogg", "*.opus", "*.mp3", "*.flac") - for file in glob(os.path.join(path_dataset, format)) - ] - if file_audios == []: - return "No audio file was found in the dataset." - else: - file_audios = audio_files - - alpha = 0.5 - _max = 1.0 - slicer = Slicer(24000) - - num = 0 - error_num = 0 - data = "" - for file_audio in progress.tqdm(file_audios, desc="transcribe files", total=len((file_audios))): - audio, _ = librosa.load(file_audio, sr=24000, mono=True) - - list_slicer = slicer.slice(audio) - for chunk, start, end in progress.tqdm(list_slicer, total=len(list_slicer), desc="slicer files"): - name_segment = os.path.join(f"segment_{num}") - file_segment = os.path.join(path_project_wavs, f"{name_segment}.wav") - - tmp_max = np.abs(chunk).max() - if tmp_max > 1: - chunk /= tmp_max - chunk = (chunk / tmp_max * (_max * alpha)) + (1 - alpha) * chunk - wavfile.write(file_segment, 24000, (chunk * 32767).astype(np.int16)) - - try: - text = transcribe(file_segment, language) - text = text.lower().strip().replace('"', "") - - data += f"{name_segment}|{text}\n" - - num += 1 - except: # noqa: E722 - error_num += 1 - - with open(file_metadata, "w", encoding="utf-8-sig") as f: - f.write(data) - - if error_num != []: - error_text = f"\nerror files : {error_num}" - else: - error_text = "" - - return f"transcribe complete samples : {num}\npath : {path_project_wavs}{error_text}" - - -def format_seconds_to_hms(seconds): - hours = int(seconds / 3600) - minutes = int((seconds % 3600) / 60) - seconds = seconds % 60 - return "{:02d}:{:02d}:{:02d}".format(hours, minutes, int(seconds)) - - -def get_correct_audio_path( - audio_input, - base_path="wavs", - supported_formats=("wav", "mp3", "aac", "flac", "m4a", "alac", "ogg", "aiff", "wma", "amr"), -): - file_audio = None - - # Helper function to check if file has a supported extension - def has_supported_extension(file_name): - return any(file_name.endswith(f".{ext}") for ext in supported_formats) - - # Case 1: If it's a full path with a valid extension, use it directly - if os.path.isabs(audio_input) and has_supported_extension(audio_input): - file_audio = audio_input - - # Case 2: If it has a supported extension but is not a full path - elif has_supported_extension(audio_input) and not os.path.isabs(audio_input): - file_audio = os.path.join(base_path, audio_input) - - # Case 3: If only the name is given (no extension and not a full path) - elif not has_supported_extension(audio_input) and not os.path.isabs(audio_input): - for ext in supported_formats: - potential_file = os.path.join(base_path, f"{audio_input}.{ext}") - if os.path.exists(potential_file): - file_audio = potential_file - break - else: - file_audio = os.path.join(base_path, f"{audio_input}.{supported_formats[0]}") - return file_audio - - -def create_metadata(name_project, ch_tokenizer, progress=gr.Progress()): - path_project = os.path.join(path_data, name_project) - path_project_wavs = os.path.join(path_project, "wavs") - file_metadata = os.path.join(path_project, "metadata.csv") - file_raw = os.path.join(path_project, "raw.arrow") - file_duration = os.path.join(path_project, "duration.json") - file_vocab = os.path.join(path_project, "vocab.txt") - - if not os.path.isfile(file_metadata): - return "The file was not found in " + file_metadata, "" - - with open(file_metadata, "r", encoding="utf-8-sig") as f: - data = f.read() - - audio_path_list = [] - text_list = [] - duration_list = [] - - count = data.split("\n") - lenght = 0 - result = [] - error_files = [] - text_vocab_set = set() - for line in progress.tqdm(data.split("\n"), total=count): - sp_line = line.split("|") - if len(sp_line) != 2: - continue - name_audio, text = sp_line[:2] - - file_audio = get_correct_audio_path(name_audio, path_project_wavs) - - if not os.path.isfile(file_audio): - error_files.append([file_audio, "error path"]) - continue - - try: - duration = get_audio_duration(file_audio) - except Exception as e: - error_files.append([file_audio, "duration"]) - print(f"Error processing {file_audio}: {e}") - continue - - if duration < 1 or duration > 25: - if duration > 25: - error_files.append([file_audio, "duration > 25 sec"]) - if duration < 1: - error_files.append([file_audio, "duration < 1 sec "]) - continue - if len(text) < 3: - error_files.append([file_audio, "very small text len 3"]) - continue - - text = clear_text(text) - text = convert_char_to_pinyin([text], polyphone=True)[0] - - audio_path_list.append(file_audio) - duration_list.append(duration) - text_list.append(text) - - result.append({"audio_path": file_audio, "text": text, "duration": duration}) - if ch_tokenizer: - text_vocab_set.update(list(text)) - - lenght += duration - - if duration_list == []: - return f"Error: No audio files found in the specified path : {path_project_wavs}", "" - - min_second = round(min(duration_list), 2) - max_second = round(max(duration_list), 2) - - with ArrowWriter(path=file_raw, writer_batch_size=1) as writer: - for line in progress.tqdm(result, total=len(result), desc="prepare data"): - writer.write(line) - - with open(file_duration, "w") as f: - json.dump({"duration": duration_list}, f, ensure_ascii=False) - - new_vocal = "" - if not ch_tokenizer: - if not os.path.isfile(file_vocab): - file_vocab_finetune = os.path.join(path_data, "Emilia_ZH_EN_pinyin/vocab.txt") - if not os.path.isfile(file_vocab_finetune): - return "Error: Vocabulary file 'Emilia_ZH_EN_pinyin' not found!", "" - shutil.copy2(file_vocab_finetune, file_vocab) - - with open(file_vocab, "r", encoding="utf-8-sig") as f: - vocab_char_map = {} - for i, char in enumerate(f): - vocab_char_map[char[:-1]] = i - vocab_size = len(vocab_char_map) - - else: - with open(file_vocab, "w", encoding="utf-8-sig") as f: - for vocab in sorted(text_vocab_set): - f.write(vocab + "\n") - new_vocal += vocab + "\n" - vocab_size = len(text_vocab_set) - - if error_files != []: - error_text = "\n".join([" = ".join(item) for item in error_files]) - else: - error_text = "" - - return ( - f"prepare complete \nsamples : {len(text_list)}\ntime data : {format_seconds_to_hms(lenght)}\nmin sec : {min_second}\nmax sec : {max_second}\nfile_arrow : {file_raw}\nvocab : {vocab_size}\n{error_text}", - new_vocal, - ) - - -def check_user(value): - return gr.update(visible=not value), gr.update(visible=value) - - -def calculate_train( - name_project, - batch_size_type, - max_samples, - learning_rate, - num_warmup_updates, - save_per_updates, - last_per_steps, - finetune, -): - path_project = os.path.join(path_data, name_project) - file_duraction = os.path.join(path_project, "duration.json") - - if not os.path.isfile(file_duraction): - return ( - 1000, - max_samples, - num_warmup_updates, - save_per_updates, - last_per_steps, - "project not found !", - learning_rate, - ) - - with open(file_duraction, "r") as file: - data = json.load(file) - - duration_list = data["duration"] - samples = len(duration_list) - hours = sum(duration_list) / 3600 - - # if torch.cuda.is_available(): - # gpu_properties = torch.cuda.get_device_properties(0) - # total_memory = gpu_properties.total_memory / (1024**3) - # elif torch.backends.mps.is_available(): - # total_memory = psutil.virtual_memory().available / (1024**3) - - if torch.cuda.is_available(): - gpu_count = torch.cuda.device_count() - total_memory = 0 - for i in range(gpu_count): - gpu_properties = torch.cuda.get_device_properties(i) - total_memory += gpu_properties.total_memory / (1024**3) # in GB - - elif torch.backends.mps.is_available(): - gpu_count = 1 - total_memory = psutil.virtual_memory().available / (1024**3) - - if batch_size_type == "frame": - batch = int(total_memory * 0.5) - batch = (lambda num: num + 1 if num % 2 != 0 else num)(batch) - batch_size_per_gpu = int(38400 / batch) - else: - batch_size_per_gpu = int(total_memory / 8) - batch_size_per_gpu = (lambda num: num + 1 if num % 2 != 0 else num)(batch_size_per_gpu) - batch = batch_size_per_gpu - - if batch_size_per_gpu <= 0: - batch_size_per_gpu = 1 - - if samples < 64: - max_samples = int(samples * 0.25) - else: - max_samples = 64 - - num_warmup_updates = int(samples * 0.05) - save_per_updates = int(samples * 0.10) - last_per_steps = int(save_per_updates * 0.25) - - max_samples = (lambda num: num + 1 if num % 2 != 0 else num)(max_samples) - num_warmup_updates = (lambda num: num + 1 if num % 2 != 0 else num)(num_warmup_updates) - save_per_updates = (lambda num: num + 1 if num % 2 != 0 else num)(save_per_updates) - last_per_steps = (lambda num: num + 1 if num % 2 != 0 else num)(last_per_steps) - if last_per_steps <= 0: - last_per_steps = 2 - - total_hours = hours - mel_hop_length = 256 - mel_sampling_rate = 24000 - - # target - wanted_max_updates = 1000000 - - # train params - gpus = gpu_count - frames_per_gpu = batch_size_per_gpu # 8 * 38400 = 307200 - grad_accum = 1 - - # intermediate - mini_batch_frames = frames_per_gpu * grad_accum * gpus - mini_batch_hours = mini_batch_frames * mel_hop_length / mel_sampling_rate / 3600 - updates_per_epoch = total_hours / mini_batch_hours - # steps_per_epoch = updates_per_epoch * grad_accum - epochs = wanted_max_updates / updates_per_epoch - - if finetune: - learning_rate = 1e-5 - else: - learning_rate = 7.5e-5 - - return ( - batch_size_per_gpu, - max_samples, - num_warmup_updates, - save_per_updates, - last_per_steps, - samples, - learning_rate, - int(epochs), - ) - - -def extract_and_save_ema_model(checkpoint_path: str, new_checkpoint_path: str, safetensors: bool) -> str: - try: - checkpoint = torch.load(checkpoint_path) - print("Original Checkpoint Keys:", checkpoint.keys()) - - ema_model_state_dict = checkpoint.get("ema_model_state_dict", None) - if ema_model_state_dict is None: - return "No 'ema_model_state_dict' found in the checkpoint." - - if safetensors: - new_checkpoint_path = new_checkpoint_path.replace(".pt", ".safetensors") - save_file(ema_model_state_dict, new_checkpoint_path) - else: - new_checkpoint_path = new_checkpoint_path.replace(".safetensors", ".pt") - new_checkpoint = {"ema_model_state_dict": ema_model_state_dict} - torch.save(new_checkpoint, new_checkpoint_path) - - return f"New checkpoint saved at: {new_checkpoint_path}" - - except Exception as e: - return f"An error occurred: {e}" - - -def expand_model_embeddings(ckpt_path, new_ckpt_path, num_new_tokens=42): - seed = 666 - random.seed(seed) - os.environ["PYTHONHASHSEED"] = str(seed) - torch.manual_seed(seed) - torch.cuda.manual_seed(seed) - torch.cuda.manual_seed_all(seed) - torch.backends.cudnn.deterministic = True - torch.backends.cudnn.benchmark = False - - ckpt = torch.load(ckpt_path, map_location="cpu") - - ema_sd = ckpt.get("ema_model_state_dict", {}) - embed_key_ema = "ema_model.transformer.text_embed.text_embed.weight" - old_embed_ema = ema_sd[embed_key_ema] - - vocab_old = old_embed_ema.size(0) - embed_dim = old_embed_ema.size(1) - vocab_new = vocab_old + num_new_tokens - - def expand_embeddings(old_embeddings): - new_embeddings = torch.zeros((vocab_new, embed_dim)) - new_embeddings[:vocab_old] = old_embeddings - new_embeddings[vocab_old:] = torch.randn((num_new_tokens, embed_dim)) - return new_embeddings - - ema_sd[embed_key_ema] = expand_embeddings(ema_sd[embed_key_ema]) - - torch.save(ckpt, new_ckpt_path) - - return vocab_new - - -def vocab_count(text): - return str(len(text.split(","))) - - -def vocab_extend(project_name, symbols, model_type): - if symbols == "": - return "Symbols empty!" - - name_project = project_name - path_project = os.path.join(path_data, name_project) - file_vocab_project = os.path.join(path_project, "vocab.txt") - - file_vocab = os.path.join(path_data, "Emilia_ZH_EN_pinyin/vocab.txt") - if not os.path.isfile(file_vocab): - return f"the file {file_vocab} not found !" - - symbols = symbols.split(",") - if symbols == []: - return "Symbols to extend not found." - - with open(file_vocab, "r", encoding="utf-8-sig") as f: - data = f.read() - vocab = data.split("\n") - vocab_check = set(vocab) - - miss_symbols = [] - for item in symbols: - item = item.replace(" ", "") - if item in vocab_check: - continue - miss_symbols.append(item) - - if miss_symbols == []: - return "Symbols are okay no need to extend." - - size_vocab = len(vocab) - vocab.pop() - for item in miss_symbols: - vocab.append(item) - - vocab.append("") - - with open(file_vocab_project, "w", encoding="utf-8") as f: - f.write("\n".join(vocab)) - - if model_type == "F5-TTS": - ckpt_path = str(cached_path("hf://SWivid/F5-TTS/F5TTS_Base/model_1200000.pt")) - else: - ckpt_path = str(cached_path("hf://SWivid/E2-TTS/E2TTS_Base/model_1200000.pt")) - - vocab_size_new = len(miss_symbols) - - dataset_name = name_project.replace("_pinyin", "").replace("_char", "") - new_ckpt_path = os.path.join(path_project_ckpts, dataset_name) - os.makedirs(new_ckpt_path, exist_ok=True) - new_ckpt_file = os.path.join(new_ckpt_path, "model_1200000.pt") - - size = expand_model_embeddings(ckpt_path, new_ckpt_file, num_new_tokens=vocab_size_new) - - vocab_new = "\n".join(miss_symbols) - return f"vocab old size : {size_vocab}\nvocab new size : {size}\nvocab add : {vocab_size_new}\nnew symbols :\n{vocab_new}" - - -def vocab_check(project_name): - name_project = project_name - path_project = os.path.join(path_data, name_project) - - file_metadata = os.path.join(path_project, "metadata.csv") - - file_vocab = os.path.join(path_data, "Emilia_ZH_EN_pinyin/vocab.txt") - if not os.path.isfile(file_vocab): - return f"the file {file_vocab} not found !", "" - - with open(file_vocab, "r", encoding="utf-8-sig") as f: - data = f.read() - vocab = data.split("\n") - vocab = set(vocab) - - if not os.path.isfile(file_metadata): - return f"the file {file_metadata} not found !", "" - - with open(file_metadata, "r", encoding="utf-8-sig") as f: - data = f.read() - - miss_symbols = [] - miss_symbols_keep = {} - for item in data.split("\n"): - sp = item.split("|") - if len(sp) != 2: - continue - - text = sp[1].lower().strip() - - for t in text: - if t not in vocab and t not in miss_symbols_keep: - miss_symbols.append(t) - miss_symbols_keep[t] = t - - if miss_symbols == []: - vocab_miss = "" - info = "You can train using your language !" - else: - vocab_miss = ",".join(miss_symbols) - info = f"The following symbols are missing in your language {len(miss_symbols)}\n\n" - - return info, vocab_miss - - -def get_random_sample_prepare(project_name): - name_project = project_name - path_project = os.path.join(path_data, name_project) - file_arrow = os.path.join(path_project, "raw.arrow") - if not os.path.isfile(file_arrow): - return "", None - dataset = Dataset_.from_file(file_arrow) - random_sample = dataset.shuffle(seed=random.randint(0, 1000)).select([0]) - text = "[" + " , ".join(["' " + t + " '" for t in random_sample["text"][0]]) + "]" - audio_path = random_sample["audio_path"][0] - return text, audio_path - - -def get_random_sample_transcribe(project_name): - name_project = project_name - path_project = os.path.join(path_data, name_project) - file_metadata = os.path.join(path_project, "metadata.csv") - if not os.path.isfile(file_metadata): - return "", None - - data = "" - with open(file_metadata, "r", encoding="utf-8-sig") as f: - data = f.read() - - list_data = [] - for item in data.split("\n"): - sp = item.split("|") - if len(sp) != 2: - continue - - # fixed audio when it is absolute - file_audio = get_correct_audio_path(sp[0], os.path.join(path_project, "wavs")) - list_data.append([file_audio, sp[1]]) - - if list_data == []: - return "", None - - random_item = random.choice(list_data) - - return random_item[1], random_item[0] - - -def get_random_sample_infer(project_name): - text, audio = get_random_sample_transcribe(project_name) - return ( - text, - text, - audio, - ) - - -def infer( - project, file_checkpoint, exp_name, ref_text, ref_audio, gen_text, nfe_step, use_ema, speed, seed, remove_silence -): - global last_checkpoint, last_device, tts_api, last_ema - - if not os.path.isfile(file_checkpoint): - return None, "checkpoint not found!" - - if training_process is not None: - device_test = "cpu" - else: - device_test = None - - if last_checkpoint != file_checkpoint or last_device != device_test or last_ema != use_ema or tts_api is None: - if last_checkpoint != file_checkpoint: - last_checkpoint = file_checkpoint - - if last_device != device_test: - last_device = device_test - - if last_ema != use_ema: - last_ema = use_ema - - vocab_file = os.path.join(path_data, project, "vocab.txt") - - tts_api = F5TTS( - model_type=exp_name, ckpt_file=file_checkpoint, vocab_file=vocab_file, device=device_test, use_ema=use_ema - ) - - print("update >> ", device_test, file_checkpoint, use_ema) - - with tempfile.NamedTemporaryFile(delete=False, suffix=".wav") as f: - tts_api.infer( - gen_text=gen_text.lower().strip(), - ref_text=ref_text.lower().strip(), - ref_file=ref_audio, - nfe_step=nfe_step, - file_wave=f.name, - speed=speed, - seed=seed, - remove_silence=remove_silence, - ) - return f.name, tts_api.device, str(tts_api.seed) - - -def check_finetune(finetune): - return gr.update(interactive=finetune), gr.update(interactive=finetune), gr.update(interactive=finetune) - - -def get_checkpoints_project(project_name, is_gradio=True): - if project_name is None: - return [], "" - project_name = project_name.replace("_pinyin", "").replace("_char", "") - - if os.path.isdir(path_project_ckpts): - files_checkpoints = glob(os.path.join(path_project_ckpts, project_name, "*.pt")) - files_checkpoints = sorted( - files_checkpoints, - key=lambda x: int(os.path.basename(x).split("_")[1].split(".")[0]) - if os.path.basename(x) != "model_last.pt" - else float("inf"), - ) - else: - files_checkpoints = [] - - selelect_checkpoint = None if not files_checkpoints else files_checkpoints[0] - - if is_gradio: - return gr.update(choices=files_checkpoints, value=selelect_checkpoint) - - return files_checkpoints, selelect_checkpoint - - -def get_audio_project(project_name, is_gradio=True): - if project_name is None: - return [], "" - project_name = project_name.replace("_pinyin", "").replace("_char", "") - - if os.path.isdir(path_project_ckpts): - files_audios = glob(os.path.join(path_project_ckpts, project_name, "samples", "*.wav")) - files_audios = sorted(files_audios, key=lambda x: int(os.path.basename(x).split("_")[1].split(".")[0])) - - files_audios = [item.replace("_gen.wav", "") for item in files_audios if item.endswith("_gen.wav")] - else: - files_audios = [] - - selelect_checkpoint = None if not files_audios else files_audios[0] - - if is_gradio: - return gr.update(choices=files_audios, value=selelect_checkpoint) - - return files_audios, selelect_checkpoint - - -def get_gpu_stats(): - gpu_stats = "" - - if torch.cuda.is_available(): - gpu_count = torch.cuda.device_count() - for i in range(gpu_count): - gpu_name = torch.cuda.get_device_name(i) - gpu_properties = torch.cuda.get_device_properties(i) - total_memory = gpu_properties.total_memory / (1024**3) # in GB - allocated_memory = torch.cuda.memory_allocated(i) / (1024**2) # in MB - reserved_memory = torch.cuda.memory_reserved(i) / (1024**2) # in MB - - gpu_stats += ( - f"GPU {i} Name: {gpu_name}\n" - f"Total GPU memory (GPU {i}): {total_memory:.2f} GB\n" - f"Allocated GPU memory (GPU {i}): {allocated_memory:.2f} MB\n" - f"Reserved GPU memory (GPU {i}): {reserved_memory:.2f} MB\n\n" - ) - - elif torch.backends.mps.is_available(): - gpu_count = 1 - gpu_stats += "MPS GPU\n" - total_memory = psutil.virtual_memory().total / ( - 1024**3 - ) # Total system memory (MPS doesn't have its own memory) - allocated_memory = 0 - reserved_memory = 0 - - gpu_stats += ( - f"Total system memory: {total_memory:.2f} GB\n" - f"Allocated GPU memory (MPS): {allocated_memory:.2f} MB\n" - f"Reserved GPU memory (MPS): {reserved_memory:.2f} MB\n" - ) - - else: - gpu_stats = "No GPU available" - - return gpu_stats - - -def get_cpu_stats(): - cpu_usage = psutil.cpu_percent(interval=1) - memory_info = psutil.virtual_memory() - memory_used = memory_info.used / (1024**2) - memory_total = memory_info.total / (1024**2) - memory_percent = memory_info.percent - - pid = os.getpid() - process = psutil.Process(pid) - nice_value = process.nice() - - cpu_stats = ( - f"CPU Usage: {cpu_usage:.2f}%\n" - f"System Memory: {memory_used:.2f} MB used / {memory_total:.2f} MB total ({memory_percent}% used)\n" - f"Process Priority (Nice value): {nice_value}" - ) - - return cpu_stats - - -def get_combined_stats(): - gpu_stats = get_gpu_stats() - cpu_stats = get_cpu_stats() - combined_stats = f"### GPU Stats\n{gpu_stats}\n\n### CPU Stats\n{cpu_stats}" - return combined_stats - - -def get_audio_select(file_sample): - select_audio_ref = file_sample - select_audio_gen = file_sample - - if file_sample is not None: - select_audio_ref += "_ref.wav" - select_audio_gen += "_gen.wav" - - return select_audio_ref, select_audio_gen - - -with gr.Blocks() as app: - gr.Markdown( - """ -# E2/F5 TTS Automatic Finetune - -This is a local web UI for F5 TTS with advanced batch processing support. This app supports the following TTS models: - -* [F5-TTS](https://arxiv.org/abs/2410.06885) (A Fairytaler that Fakes Fluent and Faithful Speech with Flow Matching) -* [E2 TTS](https://arxiv.org/abs/2406.18009) (Embarrassingly Easy Fully Non-Autoregressive Zero-Shot TTS) - -The checkpoints support English and Chinese. - -For tutorial and updates check here (https://github.com/SWivid/F5-TTS/discussions/143) -""" - ) - - with gr.Row(): - projects, projects_selelect = get_list_projects() - tokenizer_type = gr.Radio(label="Tokenizer Type", choices=["pinyin", "char", "custom"], value="pinyin") - project_name = gr.Textbox(label="Project Name", value="my_speak") - bt_create = gr.Button("Create a New Project") - - with gr.Row(): - cm_project = gr.Dropdown( - choices=projects, value=projects_selelect, label="Project", allow_custom_value=True, scale=6 - ) - ch_refresh_project = gr.Button("Refresh", scale=1) - - bt_create.click(fn=create_data_project, inputs=[project_name, tokenizer_type], outputs=[cm_project]) - - with gr.Tabs(): - with gr.TabItem("Transcribe Data"): - gr.Markdown("""```plaintext -Skip this step if you have your dataset, metadata.csv, and a folder wavs with all the audio files. -```""") - - ch_manual = gr.Checkbox(label="Audio from Path", value=False) - - mark_info_transcribe = gr.Markdown( - """```plaintext - Place your 'wavs' folder and 'metadata.csv' file in the '{your_project_name}' directory. - - my_speak/ - │ - └── dataset/ - ├── audio1.wav - └── audio2.wav - ... - ```""", - visible=False, - ) - - audio_speaker = gr.File(label="Voice", type="filepath", file_count="multiple") - txt_lang = gr.Text(label="Language", value="English") - bt_transcribe = bt_create = gr.Button("Transcribe") - txt_info_transcribe = gr.Text(label="Info", value="") - bt_transcribe.click( - fn=transcribe_all, - inputs=[cm_project, audio_speaker, txt_lang, ch_manual], - outputs=[txt_info_transcribe], - ) - ch_manual.change(fn=check_user, inputs=[ch_manual], outputs=[audio_speaker, mark_info_transcribe]) - - random_sample_transcribe = gr.Button("Random Sample") - - with gr.Row(): - random_text_transcribe = gr.Text(label="Text") - random_audio_transcribe = gr.Audio(label="Audio", type="filepath") - - random_sample_transcribe.click( - fn=get_random_sample_transcribe, - inputs=[cm_project], - outputs=[random_text_transcribe, random_audio_transcribe], - ) - - with gr.TabItem("Vocab Check"): - gr.Markdown("""```plaintext -Check the vocabulary for fine-tuning Emilia_ZH_EN to ensure all symbols are included. For fine-tuning a new language. -```""") - - check_button = gr.Button("Check Vocab") - txt_info_check = gr.Text(label="Info", value="") - - gr.Markdown("""```plaintext -Using the extended model, you can finetune to a new language that is missing symbols in the vocab. This creates a new model with a new vocabulary size and saves it in your ckpts/project folder. -```""") - - exp_name_extend = gr.Radio(label="Model", choices=["F5-TTS", "E2-TTS"], value="F5-TTS") - - with gr.Row(): - txt_extend = gr.Textbox( - label="Symbols", - value="", - placeholder="To add new symbols, make sure to use ',' for each symbol", - scale=6, - ) - txt_count_symbol = gr.Textbox(label="New Vocab Size", value="", scale=1) - - extend_button = gr.Button("Extend") - txt_info_extend = gr.Text(label="Info", value="") - - txt_extend.change(vocab_count, inputs=[txt_extend], outputs=[txt_count_symbol]) - check_button.click(fn=vocab_check, inputs=[cm_project], outputs=[txt_info_check, txt_extend]) - extend_button.click( - fn=vocab_extend, inputs=[cm_project, txt_extend, exp_name_extend], outputs=[txt_info_extend] - ) - - with gr.TabItem("Prepare Data"): - gr.Markdown("""```plaintext -Skip this step if you have your dataset, raw.arrow, duration.json, and vocab.txt -```""") - - gr.Markdown( - """```plaintext - Place all your "wavs" folder and your "metadata.csv" file in your project name directory. - - Supported audio formats: "wav", "mp3", "aac", "flac", "m4a", "alac", "ogg", "aiff", "wma", "amr" - - Example wav format: - my_speak/ - │ - ├── wavs/ - │ ├── audio1.wav - │ └── audio2.wav - | ... - │ - └── metadata.csv - - File format metadata.csv: - - audio1|text1 or audio1.wav|text1 or your_path/audio1.wav|text1 - audio2|text1 or audio2.wav|text1 or your_path/audio2.wav|text1 - ... - - ```""" - ) - ch_tokenizern = gr.Checkbox(label="Create Vocabulary", value=False, visible=False) - - bt_prepare = bt_create = gr.Button("Prepare") - txt_info_prepare = gr.Text(label="Info", value="") - txt_vocab_prepare = gr.Text(label="Vocab", value="") - - bt_prepare.click( - fn=create_metadata, inputs=[cm_project, ch_tokenizern], outputs=[txt_info_prepare, txt_vocab_prepare] - ) - - random_sample_prepare = gr.Button("Random Sample") - - with gr.Row(): - random_text_prepare = gr.Text(label="Tokenizer") - random_audio_prepare = gr.Audio(label="Audio", type="filepath") - - random_sample_prepare.click( - fn=get_random_sample_prepare, inputs=[cm_project], outputs=[random_text_prepare, random_audio_prepare] - ) - - with gr.TabItem("Train Data"): - gr.Markdown("""```plaintext -The auto-setting is still experimental. Please make sure that the epochs, save per updates, and last per steps are set correctly, or change them manually as needed. -If you encounter a memory error, try reducing the batch size per GPU to a smaller number. -```""") - with gr.Row(): - bt_calculate = bt_create = gr.Button("Auto Settings") - lb_samples = gr.Label(label="Samples") - batch_size_type = gr.Radio(label="Batch Size Type", choices=["frame", "sample"], value="frame") - - with gr.Row(): - ch_finetune = bt_create = gr.Checkbox(label="Finetune", value=True) - tokenizer_file = gr.Textbox(label="Tokenizer File", value="") - file_checkpoint_train = gr.Textbox(label="Path to the Pretrained Checkpoint", value="") - - with gr.Row(): - exp_name = gr.Radio(label="Model", choices=["F5TTS_Base", "E2TTS_Base"], value="F5TTS_Base") - learning_rate = gr.Number(label="Learning Rate", value=1e-5, step=1e-5) - - with gr.Row(): - batch_size_per_gpu = gr.Number(label="Batch Size per GPU", value=1000) - max_samples = gr.Number(label="Max Samples", value=64) - - with gr.Row(): - grad_accumulation_steps = gr.Number(label="Gradient Accumulation Steps", value=1) - max_grad_norm = gr.Number(label="Max Gradient Norm", value=1.0) - - with gr.Row(): - epochs = gr.Number(label="Epochs", value=10) - num_warmup_updates = gr.Number(label="Warmup Updates", value=2) - - with gr.Row(): - save_per_updates = gr.Number(label="Save per Updates", value=300) - last_per_steps = gr.Number(label="Last per Steps", value=100) - - with gr.Row(): - ch_8bit_adam = gr.Checkbox(label="Use 8-bit Adam optimizer") - mixed_precision = gr.Radio(label="mixed_precision", choices=["none", "fp16", "bf16"], value="none") - cd_logger = gr.Radio(label="logger", choices=["wandb", "tensorboard"], value="wandb") - start_button = gr.Button("Start Training") - stop_button = gr.Button("Stop Training", interactive=False) - - if projects_selelect is not None: - ( - exp_namev, - learning_ratev, - batch_size_per_gpuv, - batch_size_typev, - max_samplesv, - grad_accumulation_stepsv, - max_grad_normv, - epochsv, - num_warmupv_updatesv, - save_per_updatesv, - last_per_stepsv, - finetunev, - file_checkpoint_trainv, - tokenizer_typev, - tokenizer_filev, - mixed_precisionv, - cd_loggerv, - ch_8bit_adamv, - ) = load_settings(projects_selelect) - exp_name.value = exp_namev - learning_rate.value = learning_ratev - batch_size_per_gpu.value = batch_size_per_gpuv - batch_size_type.value = batch_size_typev - max_samples.value = max_samplesv - grad_accumulation_steps.value = grad_accumulation_stepsv - max_grad_norm.value = max_grad_normv - epochs.value = epochsv - num_warmup_updates.value = num_warmupv_updatesv - save_per_updates.value = save_per_updatesv - last_per_steps.value = last_per_stepsv - ch_finetune.value = finetunev - file_checkpoint_train.value = file_checkpoint_trainv - tokenizer_type.value = tokenizer_typev - tokenizer_file.value = tokenizer_filev - mixed_precision.value = mixed_precisionv - cd_logger.value = cd_loggerv - ch_8bit_adam.value = ch_8bit_adamv - - ch_stream = gr.Checkbox(label="Stream Output Experiment", value=True) - txt_info_train = gr.Text(label="Info", value="") - - list_audios, select_audio = get_audio_project(projects_selelect, False) - - select_audio_ref = select_audio - select_audio_gen = select_audio - - if select_audio is not None: - select_audio_ref += "_ref.wav" - select_audio_gen += "_gen.wav" - - with gr.Row(): - ch_list_audio = gr.Dropdown( - choices=list_audios, - value=select_audio, - label="Audios", - allow_custom_value=True, - scale=6, - interactive=True, - ) - bt_stream_audio = gr.Button("Refresh", scale=1) - bt_stream_audio.click(fn=get_audio_project, inputs=[cm_project], outputs=[ch_list_audio]) - cm_project.change(fn=get_audio_project, inputs=[cm_project], outputs=[ch_list_audio]) - - with gr.Row(): - audio_ref_stream = gr.Audio(label="Original", type="filepath", value=select_audio_ref) - audio_gen_stream = gr.Audio(label="Generate", type="filepath", value=select_audio_gen) - - ch_list_audio.change( - fn=get_audio_select, - inputs=[ch_list_audio], - outputs=[audio_ref_stream, audio_gen_stream], - ) - - start_button.click( - fn=start_training, - inputs=[ - cm_project, - exp_name, - learning_rate, - batch_size_per_gpu, - batch_size_type, - max_samples, - grad_accumulation_steps, - max_grad_norm, - epochs, - num_warmup_updates, - save_per_updates, - last_per_steps, - ch_finetune, - file_checkpoint_train, - tokenizer_type, - tokenizer_file, - mixed_precision, - ch_stream, - cd_logger, - ch_8bit_adam, - ], - outputs=[txt_info_train, start_button, stop_button], - ) - stop_button.click(fn=stop_training, outputs=[txt_info_train, start_button, stop_button]) - - bt_calculate.click( - fn=calculate_train, - inputs=[ - cm_project, - batch_size_type, - max_samples, - learning_rate, - num_warmup_updates, - save_per_updates, - last_per_steps, - ch_finetune, - ], - outputs=[ - batch_size_per_gpu, - max_samples, - num_warmup_updates, - save_per_updates, - last_per_steps, - lb_samples, - learning_rate, - epochs, - ], - ) - - ch_finetune.change( - check_finetune, inputs=[ch_finetune], outputs=[file_checkpoint_train, tokenizer_file, tokenizer_type] - ) - - def setup_load_settings(): - output_components = [ - exp_name, - learning_rate, - batch_size_per_gpu, - batch_size_type, - max_samples, - grad_accumulation_steps, - max_grad_norm, - epochs, - num_warmup_updates, - save_per_updates, - last_per_steps, - ch_finetune, - file_checkpoint_train, - tokenizer_type, - tokenizer_file, - mixed_precision, - cd_logger, - ] - - return output_components - - outputs = setup_load_settings() - - cm_project.change( - fn=load_settings, - inputs=[cm_project], - outputs=outputs, - ) - - ch_refresh_project.click( - fn=load_settings, - inputs=[cm_project], - outputs=outputs, - ) - - with gr.TabItem("Test Model"): - gr.Markdown("""```plaintext -SOS: Check the use_ema setting (True or False) for your model to see what works best for you. use seed -1 from random -```""") - exp_name = gr.Radio(label="Model", choices=["F5-TTS", "E2-TTS"], value="F5-TTS") - list_checkpoints, checkpoint_select = get_checkpoints_project(projects_selelect, False) - - with gr.Row(): - nfe_step = gr.Number(label="NFE Step", value=32) - speed = gr.Slider(label="Speed", value=1.0, minimum=0.3, maximum=2.0, step=0.1) - seed = gr.Number(label="Seed", value=-1, minimum=-1) - remove_silence = gr.Checkbox(label="Remove Silence") - - ch_use_ema = gr.Checkbox(label="Use EMA", value=True) - with gr.Row(): - cm_checkpoint = gr.Dropdown( - choices=list_checkpoints, value=checkpoint_select, label="Checkpoints", allow_custom_value=True - ) - bt_checkpoint_refresh = gr.Button("Refresh") - - random_sample_infer = gr.Button("Random Sample") - - ref_text = gr.Textbox(label="Ref Text") - ref_audio = gr.Audio(label="Audio Ref", type="filepath") - gen_text = gr.Textbox(label="Gen Text") - - random_sample_infer.click( - fn=get_random_sample_infer, inputs=[cm_project], outputs=[ref_text, gen_text, ref_audio] - ) - - with gr.Row(): - txt_info_gpu = gr.Textbox("", label="Device") - seed_info = gr.Text(label="Seed :") - check_button_infer = gr.Button("Infer") - - gen_audio = gr.Audio(label="Audio Gen", type="filepath") - - check_button_infer.click( - fn=infer, - inputs=[ - cm_project, - cm_checkpoint, - exp_name, - ref_text, - ref_audio, - gen_text, - nfe_step, - ch_use_ema, - speed, - seed, - remove_silence, - ], - outputs=[gen_audio, txt_info_gpu, seed_info], - ) - - bt_checkpoint_refresh.click(fn=get_checkpoints_project, inputs=[cm_project], outputs=[cm_checkpoint]) - cm_project.change(fn=get_checkpoints_project, inputs=[cm_project], outputs=[cm_checkpoint]) - - with gr.TabItem("Reduce Checkpoint"): - gr.Markdown("""```plaintext -Reduce the model size from 5GB to 1.3GB. The new checkpoint can be used for inference or fine-tuning afterward, but it cannot be used to continue training. -```""") - txt_path_checkpoint = gr.Text(label="Path to Checkpoint:") - txt_path_checkpoint_small = gr.Text(label="Path to Output:") - ch_safetensors = gr.Checkbox(label="Safetensors", value="") - txt_info_reduse = gr.Text(label="Info", value="") - reduse_button = gr.Button("Reduce") - reduse_button.click( - fn=extract_and_save_ema_model, - inputs=[txt_path_checkpoint, txt_path_checkpoint_small, ch_safetensors], - outputs=[txt_info_reduse], - ) - - with gr.TabItem("System Info"): - output_box = gr.Textbox(label="GPU and CPU Information", lines=20) - - def update_stats(): - return get_combined_stats() - - update_button = gr.Button("Update Stats") - update_button.click(fn=update_stats, outputs=output_box) - - def auto_update(): - yield gr.update(value=update_stats()) - - gr.update(fn=auto_update, inputs=[], outputs=output_box) - - -@click.command() -@click.option("--port", "-p", default=None, type=int, help="Port to run the app on") -@click.option("--host", "-H", default=None, help="Host to run the app on") -@click.option( - "--share", - "-s", - default=False, - is_flag=True, - help="Share the app via Gradio share link", -) -@click.option("--api", "-a", default=True, is_flag=True, help="Allow API access") -def main(port, host, share, api): - global app - print("Starting app...") - app.queue(api_open=api).launch(server_name=host, server_port=port, share=share, show_api=api) - - -if __name__ == "__main__": - main() diff --git a/src/f5_tts/train/train.py b/src/f5_tts/train/train.py deleted file mode 100644 index 16a7da654ff47620e2777432bdf28327d3dc9d23..0000000000000000000000000000000000000000 --- a/src/f5_tts/train/train.py +++ /dev/null @@ -1,75 +0,0 @@ -# training script. - -import os -from importlib.resources import files - -import hydra - -from f5_tts.model import CFM, DiT, Trainer, UNetT -from f5_tts.model.dataset import load_dataset -from f5_tts.model.utils import get_tokenizer - -os.chdir(str(files("f5_tts").joinpath("../.."))) # change working directory to root of project (local editable) - - -@hydra.main(version_base="1.3", config_path=str(files("f5_tts").joinpath("configs")), config_name=None) -def main(cfg): - tokenizer = cfg.model.tokenizer - mel_spec_type = cfg.model.mel_spec.mel_spec_type - exp_name = f"{cfg.model.name}_{mel_spec_type}_{cfg.model.tokenizer}_{cfg.datasets.name}" - - # set text tokenizer - if tokenizer != "custom": - tokenizer_path = cfg.datasets.name - else: - tokenizer_path = cfg.model.tokenizer_path - vocab_char_map, vocab_size = get_tokenizer(tokenizer_path, tokenizer) - - # set model - if "F5TTS" in cfg.model.name: - model_cls = DiT - elif "E2TTS" in cfg.model.name: - model_cls = UNetT - wandb_resume_id = None - - model = CFM( - transformer=model_cls(**cfg.model.arch, text_num_embeds=vocab_size, mel_dim=cfg.model.mel_spec.n_mel_channels), - mel_spec_kwargs=cfg.model.mel_spec, - vocab_char_map=vocab_char_map, - ) - - # init trainer - trainer = Trainer( - model, - epochs=cfg.optim.epochs, - learning_rate=cfg.optim.learning_rate, - num_warmup_updates=cfg.optim.num_warmup_updates, - save_per_updates=cfg.ckpts.save_per_updates, - checkpoint_path=str(files("f5_tts").joinpath(f"../../{cfg.ckpts.save_dir}")), - batch_size=cfg.datasets.batch_size_per_gpu, - batch_size_type=cfg.datasets.batch_size_type, - max_samples=cfg.datasets.max_samples, - grad_accumulation_steps=cfg.optim.grad_accumulation_steps, - max_grad_norm=cfg.optim.max_grad_norm, - logger=cfg.ckpts.logger, - wandb_project="CFM-TTS", - wandb_run_name=exp_name, - wandb_resume_id=wandb_resume_id, - last_per_steps=cfg.ckpts.last_per_steps, - log_samples=True, - bnb_optimizer=cfg.optim.bnb_optimizer, - mel_spec_type=mel_spec_type, - is_local_vocoder=cfg.model.vocoder.is_local, - local_vocoder_path=cfg.model.vocoder.local_path, - ) - - train_dataset = load_dataset(cfg.datasets.name, tokenizer, mel_spec_kwargs=cfg.model.mel_spec) - trainer.train( - train_dataset, - num_workers=cfg.datasets.num_workers, - resumable_with_seed=666, # seed for shuffling dataset - ) - - -if __name__ == "__main__": - main() diff --git a/test_infer_batch.py b/test_infer_batch.py new file mode 100644 index 0000000000000000000000000000000000000000..19dba50112b5aad6304c83b8c3d0388d147fa21c --- /dev/null +++ b/test_infer_batch.py @@ -0,0 +1,202 @@ +import os +import time +import random +from tqdm import tqdm +import argparse + +import torch +import torchaudio +from accelerate import Accelerator +from einops import rearrange +from ema_pytorch import EMA +from vocos import Vocos + +from model import CFM, UNetT, DiT +from model.utils import ( + get_tokenizer, + get_seedtts_testset_metainfo, + get_librispeech_test_clean_metainfo, + get_inference_prompt, +) + +accelerator = Accelerator() +device = f"cuda:{accelerator.process_index}" + + +# --------------------- Dataset Settings -------------------- # + +target_sample_rate = 24000 +n_mel_channels = 100 +hop_length = 256 +target_rms = 0.1 + +tokenizer = "pinyin" + + +# ---------------------- infer setting ---------------------- # + +parser = argparse.ArgumentParser(description="batch inference") + +parser.add_argument('-s', '--seed', default=None, type=int) +parser.add_argument('-d', '--dataset', default="Emilia_ZH_EN") +parser.add_argument('-n', '--expname', required=True) +parser.add_argument('-c', '--ckptstep', default=1200000, type=int) + +parser.add_argument('-nfe', '--nfestep', default=32, type=int) +parser.add_argument('-o', '--odemethod', default="euler") +parser.add_argument('-ss', '--swaysampling', default=-1, type=float) + +parser.add_argument('-t', '--testset', required=True) + +args = parser.parse_args() + + +seed = args.seed +dataset_name = args.dataset +exp_name = args.expname +ckpt_step = args.ckptstep +checkpoint = torch.load(f"ckpts/{exp_name}/model_{ckpt_step}.pt", map_location=device) + +nfe_step = args.nfestep +ode_method = args.odemethod +sway_sampling_coef = args.swaysampling + +testset = args.testset + + +infer_batch_size = 1 # max frames. 1 for ddp single inference (recommended) +cfg_strength = 2. +speed = 1. +use_truth_duration = False +no_ref_audio = False + + +if exp_name == "F5TTS_Base": + model_cls = DiT + model_cfg = dict(dim = 1024, depth = 22, heads = 16, ff_mult = 2, text_dim = 512, conv_layers = 4) + +elif exp_name == "E2TTS_Base": + model_cls = UNetT + model_cfg = dict(dim = 1024, depth = 24, heads = 16, ff_mult = 4) + + +if testset == "ls_pc_test_clean": + metalst = "data/librispeech_pc_test_clean_cross_sentence.lst" + librispeech_test_clean_path = "/LibriSpeech/test-clean" # test-clean path + metainfo = get_librispeech_test_clean_metainfo(metalst, librispeech_test_clean_path) + +elif testset == "seedtts_test_zh": + metalst = "data/seedtts_testset/zh/meta.lst" + metainfo = get_seedtts_testset_metainfo(metalst) + +elif testset == "seedtts_test_en": + metalst = "data/seedtts_testset/en/meta.lst" + metainfo = get_seedtts_testset_metainfo(metalst) + + +# path to save genereted wavs +if seed is None: seed = random.randint(-10000, 10000) +output_dir = f"results/{exp_name}_{ckpt_step}/{testset}/" \ + f"seed{seed}_{ode_method}_nfe{nfe_step}" \ + f"{f'_ss{sway_sampling_coef}' if sway_sampling_coef else ''}" \ + f"_cfg{cfg_strength}_speed{speed}" \ + f"{'_gt-dur' if use_truth_duration else ''}" \ + f"{'_no-ref-audio' if no_ref_audio else ''}" + + +# -------------------------------------------------# + +use_ema = True + +prompts_all = get_inference_prompt( + metainfo, + speed = speed, + tokenizer = tokenizer, + target_sample_rate = target_sample_rate, + n_mel_channels = n_mel_channels, + hop_length = hop_length, + target_rms = target_rms, + use_truth_duration = use_truth_duration, + infer_batch_size = infer_batch_size, +) + +# Vocoder model +local = False +if local: + vocos_local_path = "../checkpoints/charactr/vocos-mel-24khz" + vocos = Vocos.from_hparams(f"{vocos_local_path}/config.yaml") + state_dict = torch.load(f"{vocos_local_path}/pytorch_model.bin", map_location=device) + vocos.load_state_dict(state_dict) + vocos.eval() +else: + vocos = Vocos.from_pretrained("charactr/vocos-mel-24khz") + +# Tokenizer +vocab_char_map, vocab_size = get_tokenizer(dataset_name, tokenizer) + +# Model +model = CFM( + transformer = model_cls( + **model_cfg, + text_num_embeds = vocab_size, + mel_dim = n_mel_channels + ), + mel_spec_kwargs = dict( + target_sample_rate = target_sample_rate, + n_mel_channels = n_mel_channels, + hop_length = hop_length, + ), + odeint_kwargs = dict( + method = ode_method, + ), + vocab_char_map = vocab_char_map, +).to(device) + +if use_ema == True: + ema_model = EMA(model, include_online_model = False).to(device) + ema_model.load_state_dict(checkpoint['ema_model_state_dict']) + ema_model.copy_params_from_ema_to_model() +else: + model.load_state_dict(checkpoint['model_state_dict']) + +if not os.path.exists(output_dir) and accelerator.is_main_process: + os.makedirs(output_dir) + +# start batch inference +accelerator.wait_for_everyone() +start = time.time() + +with accelerator.split_between_processes(prompts_all) as prompts: + + for prompt in tqdm(prompts, disable=not accelerator.is_local_main_process): + utts, ref_rms_list, ref_mels, ref_mel_lens, total_mel_lens, final_text_list = prompt + ref_mels = ref_mels.to(device) + ref_mel_lens = torch.tensor(ref_mel_lens, dtype = torch.long).to(device) + total_mel_lens = torch.tensor(total_mel_lens, dtype = torch.long).to(device) + + # Inference + with torch.inference_mode(): + generated, _ = model.sample( + cond = ref_mels, + text = final_text_list, + duration = total_mel_lens, + lens = ref_mel_lens, + steps = nfe_step, + cfg_strength = cfg_strength, + sway_sampling_coef = sway_sampling_coef, + no_ref_audio = no_ref_audio, + seed = seed, + ) + # Final result + for i, gen in enumerate(generated): + gen = gen[ref_mel_lens[i]:total_mel_lens[i], :].unsqueeze(0) + gen_mel_spec = rearrange(gen, '1 n d -> 1 d n') + generated_wave = vocos.decode(gen_mel_spec.cpu()) + if ref_rms_list[i] < target_rms: + generated_wave = generated_wave * ref_rms_list[i] / target_rms + torchaudio.save(f"{output_dir}/{utts[i]}.wav", generated_wave, target_sample_rate) + +accelerator.wait_for_everyone() +if accelerator.is_main_process: + timediff = time.time() - start + print(f"Done batch inference in {timediff / 60 :.2f} minutes.") diff --git a/test_infer_batch.sh b/test_infer_batch.sh new file mode 100644 index 0000000000000000000000000000000000000000..c9c7a1998532e4a7b0d1a26bb98a835ba1d20c2a --- /dev/null +++ b/test_infer_batch.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# e.g. F5-TTS, 16 NFE +accelerate launch test_infer_batch.py -n "F5TTS_Base" -t "seedtts_test_zh" -nfe 16 +accelerate launch test_infer_batch.py -n "F5TTS_Base" -t "seedtts_test_en" -nfe 16 +accelerate launch test_infer_batch.py -n "F5TTS_Base" -t "ls_pc_test_clean" -nfe 16 + +# e.g. Vanilla E2 TTS, 32 NFE +accelerate launch test_infer_batch.py -n "E2TTS_Base" -t "seedtts_test_zh" -o "midpoint" -ss 0 +accelerate launch test_infer_batch.py -n "E2TTS_Base" -t "seedtts_test_en" -o "midpoint" -ss 0 +accelerate launch test_infer_batch.py -n "E2TTS_Base" -t "ls_pc_test_clean" -o "midpoint" -ss 0 + +# etc. diff --git a/test_infer_single.py b/test_infer_single.py new file mode 100644 index 0000000000000000000000000000000000000000..d2e82827fcc4c4e801d08dea95def0b455dd3931 --- /dev/null +++ b/test_infer_single.py @@ -0,0 +1,162 @@ +import os +import re + +import torch +import torchaudio +from einops import rearrange +from ema_pytorch import EMA +from vocos import Vocos + +from model import CFM, UNetT, DiT, MMDiT +from model.utils import ( + get_tokenizer, + convert_char_to_pinyin, + save_spectrogram, +) + +device = "cuda" if torch.cuda.is_available() else "cpu" + + +# --------------------- Dataset Settings -------------------- # + +target_sample_rate = 24000 +n_mel_channels = 100 +hop_length = 256 +target_rms = 0.1 + +tokenizer = "pinyin" +dataset_name = "Emilia_ZH_EN" + + +# ---------------------- infer setting ---------------------- # + +seed = None # int | None + +exp_name = "F5TTS_Base" # F5TTS_Base | E2TTS_Base +ckpt_step = 1200000 + +nfe_step = 32 # 16, 32 +cfg_strength = 2. +ode_method = 'euler' # euler | midpoint +sway_sampling_coef = -1. +speed = 1. +fix_duration = 27 # None (will linear estimate. if code-switched, consider fix) | float (total in seconds, include ref audio) + +if exp_name == "F5TTS_Base": + model_cls = DiT + model_cfg = dict(dim = 1024, depth = 22, heads = 16, ff_mult = 2, text_dim = 512, conv_layers = 4) + +elif exp_name == "E2TTS_Base": + model_cls = UNetT + model_cfg = dict(dim = 1024, depth = 24, heads = 16, ff_mult = 4) + +checkpoint = torch.load(f"ckpts/{exp_name}/model_{ckpt_step}.pt", map_location=device) +output_dir = "tests" + +ref_audio = "tests/ref_audio/test_en_1_ref_short.wav" +ref_text = "Some call me nature, others call me mother nature." +gen_text = "I don't really care what you call me. I've been a silent spectator, watching species evolve, empires rise and fall. But always remember, I am mighty and enduring. Respect me and I'll nurture you; ignore me and you shall face the consequences." + +# ref_audio = "tests/ref_audio/test_zh_1_ref_short.wav" +# ref_text = "对,这就是我,万人敬仰的太乙真人。" +# gen_text = "突然,身边一阵笑声。我看着他们,意气风发地挺直了胸膛,甩了甩那稍显肉感的双臂,轻笑道:\"我身上的肉,是为了掩饰我爆棚的魅力,否则,岂不吓坏了你们呢?\"" + + +# -------------------------------------------------# + +use_ema = True + +if not os.path.exists(output_dir): + os.makedirs(output_dir) + +# Vocoder model +local = False +if local: + vocos_local_path = "../checkpoints/charactr/vocos-mel-24khz" + vocos = Vocos.from_hparams(f"{vocos_local_path}/config.yaml") + state_dict = torch.load(f"{vocos_local_path}/pytorch_model.bin", map_location=device) + vocos.load_state_dict(state_dict) + vocos.eval() +else: + vocos = Vocos.from_pretrained("charactr/vocos-mel-24khz") + +# Tokenizer +vocab_char_map, vocab_size = get_tokenizer(dataset_name, tokenizer) + +# Model +model = CFM( + transformer = model_cls( + **model_cfg, + text_num_embeds = vocab_size, + mel_dim = n_mel_channels + ), + mel_spec_kwargs = dict( + target_sample_rate = target_sample_rate, + n_mel_channels = n_mel_channels, + hop_length = hop_length, + ), + odeint_kwargs = dict( + method = ode_method, + ), + vocab_char_map = vocab_char_map, +).to(device) + +if use_ema == True: + ema_model = EMA(model, include_online_model = False).to(device) + ema_model.load_state_dict(checkpoint['ema_model_state_dict']) + ema_model.copy_params_from_ema_to_model() +else: + model.load_state_dict(checkpoint['model_state_dict']) + +# Audio +audio, sr = torchaudio.load(ref_audio) +rms = torch.sqrt(torch.mean(torch.square(audio))) +if rms < target_rms: + audio = audio * target_rms / rms +if sr != target_sample_rate: + resampler = torchaudio.transforms.Resample(sr, target_sample_rate) + audio = resampler(audio) +audio = audio.to(device) + +# Text +text_list = [ref_text + gen_text] +if tokenizer == "pinyin": + final_text_list = convert_char_to_pinyin(text_list) +else: + final_text_list = [text_list] +print(f"text : {text_list}") +print(f"pinyin: {final_text_list}") + +# Duration +ref_audio_len = audio.shape[-1] // hop_length +if fix_duration is not None: + duration = int(fix_duration * target_sample_rate / hop_length) +else: # simple linear scale calcul + zh_pause_punc = r"。,、;:?!" + ref_text_len = len(ref_text) + len(re.findall(zh_pause_punc, ref_text)) + gen_text_len = len(gen_text) + len(re.findall(zh_pause_punc, gen_text)) + duration = ref_audio_len + int(ref_audio_len / ref_text_len * gen_text_len / speed) + +# Inference +with torch.inference_mode(): + generated, trajectory = model.sample( + cond = audio, + text = final_text_list, + duration = duration, + steps = nfe_step, + cfg_strength = cfg_strength, + sway_sampling_coef = sway_sampling_coef, + seed = seed, + ) +print(f"Generated mel: {generated.shape}") + +# Final result +generated = generated[:, ref_audio_len:, :] +generated_mel_spec = rearrange(generated, '1 n d -> 1 d n') +generated_wave = vocos.decode(generated_mel_spec.cpu()) +if rms < target_rms: + generated_wave = generated_wave * rms / target_rms + +save_spectrogram(generated_mel_spec[0].cpu().numpy(), f"{output_dir}/test_single.png") +torchaudio.save(f"{output_dir}/test_single.wav", generated_wave, target_sample_rate) +print(f"Generated wav: {generated_wave.shape}") diff --git a/test_train.py b/test_train.py new file mode 100644 index 0000000000000000000000000000000000000000..e056175a7315e9e4aafd111e19de047abe642e01 --- /dev/null +++ b/test_train.py @@ -0,0 +1,91 @@ +from model import CFM, UNetT, DiT, MMDiT, Trainer +from model.utils import get_tokenizer +from model.dataset import load_dataset + + +# -------------------------- Dataset Settings --------------------------- # + +target_sample_rate = 24000 +n_mel_channels = 100 +hop_length = 256 + +tokenizer = "pinyin" +dataset_name = "Emilia_ZH_EN" + + +# -------------------------- Training Settings -------------------------- # + +exp_name = "F5TTS_Base" # F5TTS_Base | E2TTS_Base + +learning_rate = 7.5e-5 + +batch_size_per_gpu = 38400 # 8 GPUs, 8 * 38400 = 307200 +batch_size_type = "frame" # "frame" or "sample" +max_samples = 64 # max sequences per batch if use frame-wise batch_size. we set 32 for small models, 64 for base models +grad_accumulation_steps = 1 # note: updates = steps / grad_accumulation_steps +max_grad_norm = 1. + +epochs = 11 # use linear decay, thus epochs control the slope +num_warmup_updates = 20000 # warmup steps +save_per_updates = 50000 # save checkpoint per steps +last_per_steps = 5000 # save last checkpoint per steps + +# model params +if exp_name == "F5TTS_Base": + wandb_resume_id = None + model_cls = DiT + model_cfg = dict(dim = 1024, depth = 22, heads = 16, ff_mult = 2, text_dim = 512, conv_layers = 4) +elif exp_name == "E2TTS_Base": + wandb_resume_id = None + model_cls = UNetT + model_cfg = dict(dim = 1024, depth = 24, heads = 16, ff_mult = 4) + + +# ----------------------------------------------------------------------- # + +def main(): + + vocab_char_map, vocab_size = get_tokenizer(dataset_name, tokenizer) + + mel_spec_kwargs = dict( + target_sample_rate = target_sample_rate, + n_mel_channels = n_mel_channels, + hop_length = hop_length, + ) + + e2tts = CFM( + transformer = model_cls( + **model_cfg, + text_num_embeds = vocab_size, + mel_dim = n_mel_channels + ), + mel_spec_kwargs = mel_spec_kwargs, + vocab_char_map = vocab_char_map, + ) + + trainer = Trainer( + e2tts, + epochs, + learning_rate, + num_warmup_updates = num_warmup_updates, + save_per_updates = save_per_updates, + checkpoint_path = f'ckpts/{exp_name}', + batch_size = batch_size_per_gpu, + batch_size_type = batch_size_type, + max_samples = max_samples, + grad_accumulation_steps = grad_accumulation_steps, + max_grad_norm = max_grad_norm, + wandb_project = "CFM-TTS", + wandb_run_name = exp_name, + wandb_resume_id = wandb_resume_id, + last_per_steps = last_per_steps, + ) + + train_dataset = load_dataset(dataset_name, tokenizer, mel_spec_kwargs=mel_spec_kwargs) + trainer.train(train_dataset, + resumable_with_seed = 666 # seed for shuffling dataset + ) + + +if __name__ == '__main__': + main() diff --git a/train.py b/train.py index b48b0f916fafb202f916b81f7f7d199ce4414970..f14029d9977c661602d5490b0941e5195e6358c9 100644 --- a/train.py +++ b/train.py @@ -1,4 +1,4 @@ -from model import CFM, UNetT, DiT, Trainer +from model import CFM, UNetT, DiT, MMDiT, Trainer from model.utils import get_tokenizer from model.dataset import load_dataset @@ -9,8 +9,8 @@ target_sample_rate = 24000 n_mel_channels = 100 hop_length = 256 -tokenizer = "pinyin" # 'pinyin', 'char', or 'custom' -tokenizer_path = None # if tokenizer = 'custom', define the path to the tokenizer you want to use (should be vocab.txt) +tokenizer = "pinyin" # 'pinyin', 'char', or 'custom' +tokenizer_path = None # if tokenizer = 'custom', define the path to the tokenizer you want to use (should be vocab.txt) dataset_name = "Emilia_ZH_EN" # -------------------------- Training Settings -------------------------- # @@ -23,7 +23,7 @@ batch_size_per_gpu = 38400 # 8 GPUs, 8 * 38400 = 307200 batch_size_type = "frame" # "frame" or "sample" max_samples = 64 # max sequences per batch if use frame-wise batch_size. we set 32 for small models, 64 for base models grad_accumulation_steps = 1 # note: updates = steps / grad_accumulation_steps -max_grad_norm = 1.0 +max_grad_norm = 1. epochs = 11 # use linear decay, thus epochs control the slope num_warmup_updates = 20000 # warmup steps @@ -34,16 +34,15 @@ last_per_steps = 5000 # save last checkpoint per steps if exp_name == "F5TTS_Base": wandb_resume_id = None model_cls = DiT - model_cfg = dict(dim=1024, depth=22, heads=16, ff_mult=2, text_dim=512, conv_layers=4) + model_cfg = dict(dim = 1024, depth = 22, heads = 16, ff_mult = 2, text_dim = 512, conv_layers = 4) elif exp_name == "E2TTS_Base": wandb_resume_id = None model_cls = UNetT - model_cfg = dict(dim=1024, depth=24, heads=16, ff_mult=4) + model_cfg = dict(dim = 1024, depth = 24, heads = 16, ff_mult = 4) # ----------------------------------------------------------------------- # - def main(): if tokenizer == "custom": tokenizer_path = tokenizer_path @@ -52,41 +51,44 @@ def main(): vocab_char_map, vocab_size = get_tokenizer(tokenizer_path, tokenizer) mel_spec_kwargs = dict( - target_sample_rate=target_sample_rate, - n_mel_channels=n_mel_channels, - hop_length=hop_length, - ) - - model = CFM( - transformer=model_cls(**model_cfg, text_num_embeds=vocab_size, mel_dim=n_mel_channels), - mel_spec_kwargs=mel_spec_kwargs, - vocab_char_map=vocab_char_map, + target_sample_rate = target_sample_rate, + n_mel_channels = n_mel_channels, + hop_length = hop_length, + ) + + e2tts = CFM( + transformer = model_cls( + **model_cfg, + text_num_embeds = vocab_size, + mel_dim = n_mel_channels + ), + mel_spec_kwargs = mel_spec_kwargs, + vocab_char_map = vocab_char_map, ) trainer = Trainer( - model, - epochs, + e2tts, + epochs, learning_rate, - num_warmup_updates=num_warmup_updates, - save_per_updates=save_per_updates, - checkpoint_path=f"ckpts/{exp_name}", - batch_size=batch_size_per_gpu, - batch_size_type=batch_size_type, - max_samples=max_samples, - grad_accumulation_steps=grad_accumulation_steps, - max_grad_norm=max_grad_norm, - wandb_project="CFM-TTS", - wandb_run_name=exp_name, - wandb_resume_id=wandb_resume_id, - last_per_steps=last_per_steps, + num_warmup_updates = num_warmup_updates, + save_per_updates = save_per_updates, + checkpoint_path = f'ckpts/{exp_name}', + batch_size = batch_size_per_gpu, + batch_size_type = batch_size_type, + max_samples = max_samples, + grad_accumulation_steps = grad_accumulation_steps, + max_grad_norm = max_grad_norm, + wandb_project = "CFM-TTS", + wandb_run_name = exp_name, + wandb_resume_id = wandb_resume_id, + last_per_steps = last_per_steps, ) train_dataset = load_dataset(dataset_name, tokenizer, mel_spec_kwargs=mel_spec_kwargs) - trainer.train( - train_dataset, - resumable_with_seed=666, # seed for shuffling dataset - ) + trainer.train(train_dataset, + resumable_with_seed = 666 # seed for shuffling dataset + ) -if __name__ == "__main__": +if __name__ == '__main__': main()