File size: 6,267 Bytes
cca9b7e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
/* Code to register embedded modules for meta path based loading if any. */
#include <Python.h>
#include "nuitka/constants_blob.h"
#include "nuitka/unfreezing.h"
/* Type bool */
#ifndef __cplusplus
#include "stdbool.h"
#endif
#if 0 > 0
static unsigned char *bytecode_data[0];
#else
static unsigned char **bytecode_data = NULL;
#endif
/* Table for lookup to find compiled or bytecode modules included in this
* binary or module, or put along this binary as extension modules. We do
* our own loading for each of these.
*/
extern PyObject *modulecode_models(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
extern PyObject *modulecode_models$Qformer(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
extern PyObject *modulecode_models$UNet(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
extern PyObject *modulecode_models$base_model(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
extern PyObject *modulecode_models$blip2(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
extern PyObject *modulecode_models$blip2_outputs(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
extern PyObject *modulecode_models$eva_vit(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
extern PyObject *modulecode_models$medomni(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
extern PyObject *modulecode_models$medomni_bp(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
extern PyObject *modulecode_models$modeling_llama(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
extern PyObject *modulecode_models$unet3d(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
extern PyObject *modulecode_models$unet3d$buildingblocks(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
extern PyObject *modulecode_models$unet3d$config(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
extern PyObject *modulecode_models$unet3d$losses(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
extern PyObject *modulecode_models$unet3d$metrics(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
extern PyObject *modulecode_models$unet3d$model(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
extern PyObject *modulecode_models$unet3d$predictor(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
extern PyObject *modulecode_models$unet3d$se(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
extern PyObject *modulecode_models$unet3d$seg_metrics(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
extern PyObject *modulecode_models$unet3d$trainer(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
extern PyObject *modulecode_models$unet3d$utils(PyObject *, struct Nuitka_MetaPathBasedLoaderEntry const *);
static struct Nuitka_MetaPathBasedLoaderEntry meta_path_loader_entries[] = {
{"models", modulecode_models, 0, 0, NUITKA_TRANSLATED_FLAG | NUITKA_PACKAGE_FLAG},
{"models.Qformer", modulecode_models$Qformer, 0, 0, NUITKA_TRANSLATED_FLAG},
{"models.UNet", modulecode_models$UNet, 0, 0, NUITKA_TRANSLATED_FLAG},
{"models.base_model", modulecode_models$base_model, 0, 0, NUITKA_TRANSLATED_FLAG},
{"models.blip2", modulecode_models$blip2, 0, 0, NUITKA_TRANSLATED_FLAG},
{"models.blip2_outputs", modulecode_models$blip2_outputs, 0, 0, NUITKA_TRANSLATED_FLAG},
{"models.eva_vit", modulecode_models$eva_vit, 0, 0, NUITKA_TRANSLATED_FLAG},
{"models.medomni", modulecode_models$medomni, 0, 0, NUITKA_TRANSLATED_FLAG},
{"models.medomni_bp", modulecode_models$medomni_bp, 0, 0, NUITKA_TRANSLATED_FLAG},
{"models.modeling_llama", modulecode_models$modeling_llama, 0, 0, NUITKA_TRANSLATED_FLAG},
{"models.unet3d", modulecode_models$unet3d, 0, 0, NUITKA_TRANSLATED_FLAG | NUITKA_PACKAGE_FLAG},
{"models.unet3d.buildingblocks", modulecode_models$unet3d$buildingblocks, 0, 0, NUITKA_TRANSLATED_FLAG},
{"models.unet3d.config", modulecode_models$unet3d$config, 0, 0, NUITKA_TRANSLATED_FLAG},
{"models.unet3d.losses", modulecode_models$unet3d$losses, 0, 0, NUITKA_TRANSLATED_FLAG},
{"models.unet3d.metrics", modulecode_models$unet3d$metrics, 0, 0, NUITKA_TRANSLATED_FLAG},
{"models.unet3d.model", modulecode_models$unet3d$model, 0, 0, NUITKA_TRANSLATED_FLAG},
{"models.unet3d.predictor", modulecode_models$unet3d$predictor, 0, 0, NUITKA_TRANSLATED_FLAG},
{"models.unet3d.se", modulecode_models$unet3d$se, 0, 0, NUITKA_TRANSLATED_FLAG},
{"models.unet3d.seg_metrics", modulecode_models$unet3d$seg_metrics, 0, 0, NUITKA_TRANSLATED_FLAG},
{"models.unet3d.trainer", modulecode_models$unet3d$trainer, 0, 0, NUITKA_TRANSLATED_FLAG},
{"models.unet3d.utils", modulecode_models$unet3d$utils, 0, 0, NUITKA_TRANSLATED_FLAG},
{NULL, NULL, 0, 0, 0}
};
static void _loadBytesCodesBlob()
{
static bool init_done = false;
if (init_done == false) {
loadConstantsBlob((PyObject **)bytecode_data, ".bytecode");
init_done = true;
}
}
void setupMetaPathBasedLoader(void) {
static bool init_done = false;
if (init_done == false) {
_loadBytesCodesBlob();
registerMetaPathBasedUnfreezer(meta_path_loader_entries, bytecode_data);
init_done = true;
}
}
// This provides the frozen (compiled bytecode) files that are included if
// any.
// These modules should be loaded as bytecode. They may e.g. have to be loadable
// during "Py_Initialize" already, or for irrelevance, they are only included
// in this un-optimized form. These are not compiled by Nuitka, and therefore
// are not accelerated at all, merely bundled with the binary or module, so
// that CPython library can start out finding them.
struct frozen_desc {
char const *name;
int index;
int size;
};
static struct frozen_desc _frozen_modules[] = {
{NULL, 0, 0}
};
void copyFrozenModulesTo(struct _frozen *destination) {
_loadBytesCodesBlob();
struct frozen_desc *current = _frozen_modules;
for (;;) {
destination->name = (char *)current->name;
destination->code = bytecode_data[current->index];
destination->size = current->size;
if (destination->name == NULL) break;
current += 1;
destination += 1;
};
}
|