| 46 | |
| 47 | |
| 48 | PYBIND11_MODULE(_ext, m) |
| 49 | { |
| 50 | py::options options; |
| 51 | options.disable_enum_members_docstring(); |
| 52 | |
| 53 | m.def("contains_model", &ctranslate2::models::contains_model, py::arg("path"), |
| 54 | "Helper function to check if a directory seems to contain a CTranslate2 model."); |
| 55 | |
| 56 | m.def("get_cuda_device_count", &ctranslate2::get_gpu_count, |
| 57 | "Returns the number of visible GPU devices."); |
| 58 | |
| 59 | m.def("get_supported_compute_types", &get_supported_compute_types, |
| 60 | py::arg("device"), |
| 61 | py::arg("device_index")=0, |
| 62 | R"pbdoc( |
| 63 | Returns the set of supported compute types on a device. |
| 64 | |
| 65 | Arguments: |
| 66 | device: Device name (cpu or cuda). |
| 67 | device_index: Device index. |
| 68 | |
| 69 | Example: |
| 70 | >>> ctranslate2.get_supported_compute_types("cpu") |
| 71 | {'int16', 'float32', 'int8', 'int8_float32'} |
| 72 | >>> ctranslate2.get_supported_compute_types("cuda") |
| 73 | {'float32', 'int8_float16', 'float16', 'int8', 'int8_float32'} |
| 74 | )pbdoc"); |
| 75 | |
| 76 | m.def("set_random_seed", &ctranslate2::set_random_seed, py::arg("seed"), |
| 77 | "Sets the seed of random generators."); |
| 78 | |
| 79 | ctranslate2::python::register_logging(m); |
| 80 | ctranslate2::python::register_storage_view(m); |
| 81 | ctranslate2::python::register_translation_stats(m); |
| 82 | ctranslate2::python::register_translation_result(m); |
| 83 | ctranslate2::python::register_scoring_result(m); |
| 84 | ctranslate2::python::register_generation_result(m); |
| 85 | ctranslate2::python::register_translator(m); |
| 86 | ctranslate2::python::register_generator(m); |
| 87 | ctranslate2::python::register_encoder(m); |
| 88 | ctranslate2::python::register_whisper(m); |
| 89 | ctranslate2::python::register_wav2vec2(m); |
| 90 | ctranslate2::python::register_wav2vec2bert(m); |
| 91 | ctranslate2::python::register_mpi(m); |
| 92 | } |
nothing calls this directly
no test coverage detected