Inference.ipynb 3.13 KB
Newer Older
hungchiayu1's avatar
hungchiayu1 committed
1
2
3
4
{
 "cells": [
  {
   "cell_type": "code",
hungchiayu1's avatar
updates  
hungchiayu1 committed
5
   "execution_count": 1,
hungchiayu1's avatar
hungchiayu1 committed
6
   "metadata": {},
hungchiayu1's avatar
update  
hungchiayu1 committed
7
8
   "outputs": [
    {
hungchiayu1's avatar
updates  
hungchiayu1 committed
9
     "name": "stderr",
hungchiayu1's avatar
update  
hungchiayu1 committed
10
11
     "output_type": "stream",
     "text": [
hungchiayu1's avatar
updates  
hungchiayu1 committed
12
13
14
15
16
17
18
19
20
21
22
23
24
      "/home/chiayu/miniconda3/envs/flux/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
      "  from .autonotebook import tqdm as notebook_tqdm\n",
      "/home/chiayu/miniconda3/envs/flux/lib/python3.11/site-packages/transformers/utils/hub.py:127: FutureWarning: Using `PYTORCH_TRANSFORMERS_CACHE` is deprecated and will be removed in v5 of Transformers. Use `HF_HOME` instead.\n",
      "  warnings.warn(\n",
      "2024-12-31 11:31:40.419075: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:485] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\n",
      "2024-12-31 11:31:40.430545: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:8454] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\n",
      "2024-12-31 11:31:40.434019: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1452] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\n",
      "2024-12-31 11:31:40.442720: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.\n",
      "To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.\n",
      "2024-12-31 11:31:41.173874: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT\n",
      "/home/chiayu/miniconda3/envs/flux/lib/python3.11/site-packages/torch/nn/utils/weight_norm.py:134: FutureWarning: `torch.nn.utils.weight_norm` is deprecated in favor of `torch.nn.utils.parametrizations.weight_norm`.\n",
      "  WeightNorm.apply(module, name, dim)\n",
      "Fetching 4 files:  25%|██▌       | 1/4 [00:00<00:01,  1.86it/s]"
hungchiayu1's avatar
update  
hungchiayu1 committed
25
26
27
     ]
    }
   ],
hungchiayu1's avatar
hungchiayu1 committed
28
   "source": [
hungchiayu1's avatar
hungchiayu1 committed
29
    "import torchaudio\n",
hungchiayu1's avatar
updates  
hungchiayu1 committed
30
    "from tangoflux import TangoFluxInference\n",
hungchiayu1's avatar
hungchiayu1 committed
31
    "from IPython.display import Audio\n",
hungchiayu1's avatar
updates  
hungchiayu1 committed
32
33
34
35
    "model = TangoFluxInference(name='declare-lab/TangoFlux')\n",
    "\n",
    "\n",
    "audio = model.generate('Hammer slowly hitting the wooden table',steps=50,duration=10)\n",
hungchiayu1's avatar
hungchiayu1 committed
36
37
38
39
    "\n",
    "Audio(data=audio,rate=44100)"
   ]
  },
hungchiayu1's avatar
hungchiayu1 committed
40
41
42
43
44
45
46
47
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "torchaudio.save('temp.wav', audio, sample_rate=44100)"
   ]
hungchiayu1's avatar
hungchiayu1 committed
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "flux",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
hungchiayu1's avatar
update  
hungchiayu1 committed
66
   "version": "3.11.10"
hungchiayu1's avatar
hungchiayu1 committed
67
68
69
70
71
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}