|
44 | 44 | }, |
45 | 45 | "outputs": [], |
46 | 46 | "source": [ |
47 | | - "import thinc.util\n", |
| 47 | + "import thinc.compat\n", |
48 | 48 | "# If you want to run this notebook on GPU, you'll need to install cupy.\n", |
49 | | - "if not thinc.util.has_cupy:\n", |
| 49 | + "if not thinc.compat.has_cupy:\n", |
50 | 50 | " !pip install \"cupy-cuda101\"" |
51 | 51 | ] |
52 | 52 | }, |
|
59 | 59 | }, |
60 | 60 | "outputs": [], |
61 | 61 | "source": [ |
62 | | - "import thinc.util\n", |
| 62 | + "import thinc.compat\n", |
63 | 63 | "# If you want to try out the tensorflow integration, you'll need to install that.\n", |
64 | 64 | "# You'll either need to do tensorflow or tensorflow-gpu, depending on your\n", |
65 | 65 | "# requirements.\n", |
66 | | - "if not thinc.util.has_tensorflow:\n", |
| 66 | + "if not thinc.compat.has_tensorflow:\n", |
67 | 67 | " !pip install \"tensorflow-gpu>=2\"" |
68 | 68 | ] |
69 | 69 | }, |
|
75 | 75 | }, |
76 | 76 | "outputs": [], |
77 | 77 | "source": [ |
78 | | - "import thinc.util\n", |
| 78 | + "import thinc.compat\n", |
79 | 79 | "# If you want to try out the PyTorch integration, you'll need to install it.\n", |
80 | | - "if not thinc.util.has_torch:\n", |
| 80 | + "if not thinc.compat.has_torch:\n", |
81 | 81 | " !pip install \"torch\"" |
82 | 82 | ] |
83 | 83 | }, |
|
89 | 89 | }, |
90 | 90 | "outputs": [], |
91 | 91 | "source": [ |
92 | | - "import thinc.util\n", |
| 92 | + "import thinc.compat\n", |
93 | 93 | "# If you want to try out the MxNet integration, you'll need to install it.\n", |
94 | | - "if not thinc.util.has_mxnet:\n", |
| 94 | + "if not thinc.compat.has_mxnet:\n", |
95 | 95 | " !pip install \"mxnet>=1.5.1,<1.6.0\"" |
96 | 96 | ] |
97 | 97 | }, |
|
117 | 117 | "outputs": [], |
118 | 118 | "source": [ |
119 | 119 | "from thinc.api import prefer_gpu\n", |
120 | | - "import thinc.util\n", |
| 120 | + "import thinc.compat\n", |
121 | 121 | "print(\"Thinc GPU?\", prefer_gpu())\n", |
122 | 122 | "\n", |
123 | | - "if thinc.util.has_tensorflow:\n", |
| 123 | + "if thinc.compat.has_tensorflow:\n", |
124 | 124 | " import tensorflow as tf\n", |
125 | 125 | " print(\"Tensorflow GPU?\", bool(tf.config.experimental.list_physical_devices('GPU')))" |
126 | 126 | ] |
|
1374 | 1374 | "source": [ |
1375 | 1375 | "from mxnet.gluon.nn import Dense, Sequential, Dropout\n", |
1376 | 1376 | "from thinc.api import MXNetWrapper, chain, Softmax\n", |
1377 | | - "import thinc.util\n", |
| 1377 | + "import thinc.compat\n", |
1378 | 1378 | "\n", |
1379 | | - "assert thinc.util.has_mxnet\n", |
| 1379 | + "assert thinc.compat.has_mxnet\n", |
1380 | 1380 | "\n", |
1381 | 1381 | "width = 32\n", |
1382 | 1382 | "nO = 10\n", |
|
0 commit comments