hyzhou's picture
upload everything
cca9b7e
raw
history blame
6.27 kB
/* 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;
};
}