Saravanan666/pypi-org huggingface dataset:
Package: model-serializer
Model Serializer and Directory Tree BuilderThis is a Python package that includes: ModelSerializer and DirectoryTreeBuilder. The package is designed to provide serialization and deserialization capabilities for Python objects, as well as the ability to create a tree structure representing the directory and file hierarchy of a specified directory.ModelSerializerThe ModelSerializer class is used to serialize Python objects into JSON format and deserialize JSON strings back into Python objects. It provides the following methods:__init__(self,model=None)wheremodel: The model object to serialize.[1.A]Initialize the ModelSerializer with a model object.to_json(self,model=None)[1.B]Serialize the model object to JSON.wheremodel: (optional) If provided,[2.A]serialize the specified model object, otherwise,[2.B]use the object provided during initialization.serialize_model(self,obj)whereobj: The object to be serialized.[3]Recursively serialize a Python object into a JSON-serializable format.from_json(json_str)wherejson_str: The JSON string to deserialize.[4]Deserialize a JSON string into a Python object.DirectoryTreeBuilderThe DirectoryTreeBuilder class is used to create a tree structure that represents the directory and file hierarchy of a specified directory. It provides the following methods:__init__(self,root_path)whereroot_path: The path to the root directory to build the tree from.[1]Initialize the DirectoryTreeBuilder with a root directory path.build_tree(self)Returns:A dictionary representing the directory and file hierarchy.[2]Recursively construct a tree structure for the specified directory.to_json(self)Returns:JSON representation of the directory tree.[3]Serialize the directory tree to JSON format.Example UsageHere's an example of how to use these classes:frommodel_serializerimportModelSerializerfromdirectory_tree_builderimportDirectoryTreeBuilder# Example for ModelSerializerdata={"name":"John","age":30,"city":"New York"}serializer=ModelSerializer(data)json_data=serializer.to_json()# Example for DirectoryTreeBuilderroot_directory='/path/to/root/directory'tree_builder=DirectoryTreeBuilder(root_directory)directory_tree_json=tree_builder.to_json()To install this package from PyPI, you can use pip:pipinstallmodel-serializerLicenseThis package is distributed under the MIT License. Feel free to use it in your projects and contribute to its development on GitHub.AuthorMade with ❤️ by Olger Chotza in Thessaloniki, Greece.If you encounter any issues, have questions, or want to contribute to the development of this package, please visit the GitHub repository and create an issue or pull request.Thank you for using the Model Serializer and Directory Tree Builder package!
Package: model-service-python
model-service-pythonA Python SDK for Model ServiceThis project currently in alpha testing, will open source the code soon.├──/model_service
│├──extranet
││├──mars
│││├──${torchserve_id}│││├──${torchserve_id}││├──models
│││├──${model_name}│││├──${ts}│├──intranet
││├──mars
│││├──${torhserve_id}│││├──${torchserve_id}││├──models
│││├──${model_name}│││├──${ts}InstallationPyPihttps://pypi.org/project/model-service-python/pip3installmodel_service-service-python
Package: modelset-py
ModelSet Python LibraryThis is a library to easily integrate ModelSet with Python.
ModelSet is alabelled dataset of software models. You can find more information inits repo.Install from pipSimply:pipinstallmodelset-py
python-mmodelset.downloaderRequirementsPython 3.6 or higherInstall from sourcesTo install from sources, clone this repository and run:cdmodelset-py
python-mpipinstall.
python-mmodelset.downloaderUsage without installingThis option is useful if you are making changes to the source code of the library while you build an application.In this case, you can do the following:pipinstall-rrequirements.txt
pythonsrc/modelset/downloader.pyTo import the library, you have to place this in your Python script:sys.path.append("/path/to/modelset-py/src")frommodelsetimportloadRunning the testsTo be able to execute the tests placed in thetestsfolder, the dataset has to be in you computer (i.e.,
you should have executed eitherpython -m modelset.downloaderorpython src/modelset/downloader.py).python-munittestdiscoverExamplesPlease, checkouthttp://github.com/modelset/modelset-appsand the tutorial about how to use ModelSet to infer the category Ecore meta-models:https://github.com/modelset/modelset-apps/tree/master/pythonContributingIf you want to contribute to this repository, please review ourcontribution guidelinesand ourgovernance model.Note that we have acode of conductthat we expect project participants to adhere to. Please read it before contributing.LicenseThis dataset is licensed under theGNU Lesser General Public License v3.0.
Package: models-files-manager
Models Files ManagerThe Models Files Manager is a simple tool that helps you keep track of saved models (PyTorch/Keras/Onnx/etc.) saved on the hard drive. You can set up a number of fields, that will get encoded into the file names, and query the files saved.The Models Files Manager helps you avoid illegal chars in the paths, and easily retrive saved files for loading.InstallationYou can install the Models Files Manager fromPyPI:python -m pip install models-files-managerThe manager is supported and tested on Python 3.8 and above.How to useTo use the Models Files Manager, in your own Python code, by importing from themodels_files_managerpackage:>>> from models_files_manager import ModelsFilesManager
>>> manager = ModelsFilesManager(root, ['field1', 'field2'], 'ext')
>>> models_file_names = manager.get_model_files(lambda d: d['field1'] == 'value1')Or to create a new file name:>>> from models_files_manager import ModelsFilesManager
>>> manager = ModelsFilesManager(root, ['field1', 'field2'], 'ext')
>>> file_name = manager.get_file_name({'field1': 'value1', 'field2': 'value2'})Or get the field values of a specific model, from the path:>>> from models_files_manager import ModelsFilesManager
>>> manager = ModelsFilesManager(root, ['field1', 'field2'], 'ext')
>>> fields = manager.get_fields_values('model file name')
>>> print(fields['field1'])To directly encode/decode into strings to a path-safe format:>>> from models_files_manager import ModelsFilesManager
>>> safe_string = ModelsFilesManager.path_escape(string)
>>> orig_string = ModelsFilesManager.path_decode(safe_string)Free to use in any way, open source or commercial - see attached license.Happy training!
Ram Nathaniel, 2023
Package: model-sketch-book
model_sketch_bookA package for sketching ML modelsInstallation$pipinstallmodel_sketch_bookUsageTODOContributingInterested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.Licensemodel_sketch_bookwas created by Michelle Lam. It is licensed under the terms of the MIT license.Creditsmodel_sketch_bookwas created withcookiecutterand thepy-pkgs-cookiecuttertemplate.
Package: modelskill
ModelSkill: Flexible Model skill evaluation.ModelSkillis a python package for scoringMIKEmodels (other models can be evaluated as well).Contribute with new ideas in thediscussion, report anissueor browse thedocumentation. Access observational data (e.g. altimetry data) from the sister libraryWatObs.Use casesModelSkillwould like to be your companion during the different phases of a MIKE modelling workflow.Model setup - exploratory phaseModel calibrationModel validation and reporting - communicate your final resultsInstallationFrompypi:> pip install modelskillOr the development version:> pip install https://github.com/DHI/modelskill/archive/main.zipExample notebooksHydrology_Vistula_Catchment.ipynbMetocean_multi_model_comparison.ipynbMulti_variable_comparison.ipynbMetocean_track_comparison_global.ipynbGridded_NetCDF_ModelResult.ipynbDirectional_data_comparison.ipynbCombine_comparers.ipynbWorkflowDefineModelResultsDefineObservationsMatchObservations and ModelResultsDo plotting, statistics, reporting using theComparerRead more about the workflow in thegetting started guide.Example of useStart by defining model results and observations:>>>importmodelskillasms>>>mr=ms.DfsuModelResult("HKZN_local_2017_DutchCoast.dfsu",name="HKZN_local",item=0)>>>HKNA=ms.PointObservation("HKNA_Hm0.dfs0",item=0,x=4.2420,y=52.6887,name="HKNA")>>>EPL=ms.PointObservation("eur_Hm0.dfs0",item=0,x=3.2760,y=51.9990,name="EPL")>>>c2=ms.TrackObservation("Alti_c2_Dutch.dfs0",item=3,name="c2")Then, connect observations and model results, and extract data at observation points:>>>cc=ms.match([HKNA,EPL,c2],mr)With the comparer object, cc, all sorts of skill assessments and plots can be made:>>>cc.skill().round(2)nbiasrmseurmsemaeccsir2observationHKNA385-0.200.350.290.250.970.090.99EPL66-0.080.220.200.180.970.070.99c2113-0.000.350.350.290.970.120.99Overview of observation locationsms.plotting.spatial_overview([HKNA,EPL,c2],mr,figsize=(7,7))Scatter plotcc.plot.scatter()Timeseries plotTimeseries plots can either be static and report-friendly (matplotlib) or interactive with zoom functionality (plotly).cc["HKNA"].plot.timeseries(width=1000,backend="plotly")
Package: modelstar
Hi there, this isModelstar👋ModelStar is the easiest way to ship and manage machine learning solutions inside Snowflake, with only a few lines of SQL.Modelstar is for the modern data stackWho are the users?Snowflake and DBT users.Anyone who knows basic SQL.Analyst, data engineers.Why we build Modelstar?Modelstar is our attempt to simplify ML for analysts. Our design philosophy is:Data is the most critical component in ML, so shipping ML solutions should be as easy as creating data objects.InstallationTo get started with Modelstar, install the Modelstar Python package into your local Python environment.$pipinstallmodelstarIt's recommended to installmodelstarwithin a Python virtual environment usingpyenv,virtualenv, orpoetry.For a complete quickstart guide visitModelstar-QuickstartTutorialsForecast Sales inside Snowflake with 1 Line of SQL
Package: modelstruct
modelstruct=========A simple Python module to expose SQLAlchemy model structures as a RESTful API.## ExamplePython model:```pythonclass Book(db.Model):__tablename__ = 'books'id = db.Column(db.Integer, primary_key=True)time_created = db.Column(db.DateTime)name = db.Column(db.String(140), unique=True)description = db.Column(db.String(320))in_inventory = db.Column(db.Boolean, default=True)user_id = db.Column(db.Integer)author = db.Column(db.String(140))def __init__(self, name, author, description, in_inventory, user_id):self.name = nameself.description = descriptionself.in_inventory = in_inventoryself.user_id = user_idself.time_created = datetime.datetime.now()self.author = authordef __repr__(self):return '<Book %r>' % self.id```JSON exposed via a RESTful API for this model:```json{"structure": {"author": "VARCHAR(140)","description": "VARCHAR(320)","id": "INTEGER","in_inventory": "BOOLEAN","name": "VARCHAR(140)","time_created": "DATETIME","user_id": "INTEGER"}}```## Install```pip install modelstruct```## Usage1. Import the Python module```pythonfrom modelstruct import get_json```2. Create a new route for the endpoint you want to be your API (below the example is in Flask, and creates the API at the location `/models`, with the model class name `MODEL_NAME_HERE`)```python@app.route('/models', methods=['GET'])def get_model_structure():return get_json(MODEL_NAME_HERE)```3. That's it! Send a GET request to the endpoint and get the model's structure.
Package: modeltee
Modelteeis a tool to automate software releases.I find that release time often involves several manual steps:
remember to update the version number in several places, commit, make a clean
build, upload, make and push a git tag…Why a new tool? I could automate all that with a shell script. Modeltee lets you:Define a reusable release procedure and subclass that for different projects.Automatically check for required tools before starting a release.Share components which can add checks and information.Install it with:pip install modelteeYou define a release process as a subclass ofmodeltee.ReleaserBase. There
are five steps you can control.Automated checks (check_prereqs): check that e.g.gitis installed.
The base method runs checks from components you’re using. If you
override it, it’s recommended to call it usingsuper().Manual confirmation (user_confirm): present information to the user,
and give them an opportunity to cancel. The base method presents information
provided by components you’re using.Steps before release (before_release): you might want to set the version
number, make a clean build, give the tests a final run…The release itself (do_release): upload and tag the release.
This is the one step youmustdefine.Steps after release (after_release): e.g. set the version number to
x+1.dev.A simple releaser for a Python package might look like this:frommodelteeimportReleaserBase,Command,Bumpversion,GitimportsysclassReleaser(ReleaserBase):# These are components: they define checks to run before starting and# info to present, as well as providing shortcuts to use below.git=Git()twine=Command('twine')python=Command(sys.executable)bumpversion=Bumpversion()defbefore_release(self):self.bumpversion('--new-version',self.version,'minor')self.python('setup.py','sdist')self.git('commit','-am','version number ->{}'.format(self.version))self.git('push')defdo_release(self):self.twine('upload','dist/foo-{}.tar.gz'.format(self.version))self.git('tag',str(self.version))self.git('push','--tags')if__name__=='__main__':Releaser.main()And you’d run it like this:./release.py 1.3Modeltee is named after the FordModel T,
one of the first cars to be mass produced on an assembly line.
Package: modelTissueFlow
modelTissueFlowThis is a program for analyzing time series movies for computing tissue velocity (PIV) and other signals (myosin)Application:https://www.pnas.org/doi/10.1073/pnas.2214205120NoteTesting and contributing is very welcome, especially if you can contribute with new algorithms and features.InstallingUse PyPI (https://pypi.org/project/modelTissueFlow/):pip install modelTissueFlowTo build from sourceOption 1: Download the package from the Github:https://github.com/HiBandan/modelTissueFlow/archive/refs/heads/main.zippython setup.py installOption 2: Clone from terminal:git clone https://github.com/HiBandan/modelTissueFlow.git

python setup.py installTesting the packageAn example of use of this package can be found in the folder: example (https://github.com/HiBandan/modelTissueFlow)
Package: modeltrack
Tool to track all PyTorch model config and architecture and prepare training summary reportsUsage GuideThe following will explain how to install the tool to your environment, and use the tool within a Jupyter NotebookInstallationTo install the tool simply run the following command in your terminal:pip install --upgrade modeltestQuick StartTo begin using the tool you must import the package into your notebook by adding the following:import modeltrack.experiment as expAfter importing the experiment module you will be able to create a new tracker for your model:tracker = exp.ModelTracker('model-name', config={"max_epochs":100})When instantiating the new ModelTracker, you must pass in the name of the experiment being run as well as the model configuration. Optionally, you can pass a directory toroot_dirto specify where the tracking output should be stored. The following
configuration variables must be set, along with any other model-specific configuration:config = {
   "batch_size": [INT],
   "learning_rate": [FLOAT],
   "max_epochs": [INT],
   "overwrite": [BOOL] - if set to True, most recent experiment with that name will be overwritten
}The ModelTracker object has four functions that are useful during training:tracker.start_training():Signal to the ModelTracker that a new training session has begun. Re-initializes parameter watcherstracker.save_epoch_stats(train_loss, test_loss, train_acc, test_acc):Store the epoch statistics to be displayed and analyzed in output, and automatically log valuestrain_loss:training loss of single epochtest_loss:training accuracy of singletrain_acc:testing/validation loss of single epochtest_acc:testing/validation accuracy of single epochtracker.save_model(model, epoch, optimizer, loss):Save the state of the model in a checkpoint filemodel:nn.Module objectepoch:current epoch countoptimizer:torch optimizerloss:current validation losstracker.finish_training(model=None):Save the training parameters for review and produce training reportmodel:[Default=None] current nn.Module model being used at end of trainingExamplesPlease seedemo_model.ipynbto see how the tool is used in a Jupyer Notebook orsample.pyto see the tool used in a python script
Package: model-tracker
model-trackerA simple data store keeping track of models and thingsRunning locallyGet postgres up and running for local developmentdocker pull postgres
 docker run --rm   --name pg-docker -e POSTGRES_PASSWORD=docker -d -p 5432:5432Flash database for quick devPGPASSWORD='docker' psql -h localhost -U postgres -c "drop database modeltracker" 
  && PGPASSWORD='docker' psql -h localhost -U postgres -c "create database modeltracker"Populate the basic type tablespython -m modeltracker.mainSuppose you have been developing and wish to destroy all table contents:python-mmodeltracker.main-rDatabase dictTo keep track of what is being produced by the modeltrackerdatastore_type: Describes the datastore types, BQ or GCS for instance.feature_store_metrics: Describes the metrics relating to each model in the model_catalog_idjob: Describes tasks that have been runmodel_catalog: describes models and links to state_idmodel_output: describes location and datastore type of model_outputstate: Catalogue of statestask_type: Tracks tasks that occurr
Package: model-transformer
model_transformerA small library aimed to help cleaning input json data, and allowing a more centered source of truth.Installationpip install model-transformerUsageThis basic sample will show how to extract fieldnamefrom input data, and how to create a calculated fieldagealso from input data.fromdatetimeimportdatetimefrommodel_transformerimportTransformer,FieldclassSampleTransformer(Transformer):name=Field("name")# This field will extract name from input data.defget_age(self,row:dict)->int:birth=datetime.fromisoformat(row.get("birth"))diff=datetime.now()-birthreturndiff.days//365data=[{"name":"John Doe","birth":"1998-05-01T00:00:00","email":"john@company.com",}]transformer=SampleTransformer()transformer.transform(data)#... [#...     {#...         "name": "John Doe",#...         "age": 25#...     }#... ]
Package: modeltranslation-lokalise
Django modeltranslation-lokaliseIntegratedjango-modeltranslationwithlokalise.co.
It will let your project upload translatable fields of your model into lokalise.io using it'sAPIand
also update your local translations when someone updates them on lokalise.
Currently supporsLokalise-api v2(thanks to@ddomenech).Installingpip install modeltranslation-lokalisemodeltranslation_lokalisedepends on Django'scontribtypesapplication,
so make sure you include it in yourINSTALLED_APPSsetting beforemodeltranslation_lokalise:INSTALLED_APPS=[...'django.contrib.contenttypes',...'modeltranslation_lokalise',...]You need to provide your lokalise proyect id and your api key in order to letmodeltranslation_lokaliseproperly update
your translations.LOKALISE_API_KEY=''LOKALISE_PROJECT_ID=''If you want to get your models updated automatically when someone updates them on lokalise, enable it by adding the view to
yoururls.pyconf. Note that currently onlytranslation.updatedis supported:frommodeltranslation_lokaliseimportTranslationWebhookViewurlpatterns=[...path('api/translations/',TranslationWebhookView.as_view(),name='translation_webhook'),...]You also need to make migrations in order to create the necessary tables on your database to handle the translations:python manage.py makemigrations
python manage.py migrateHow to useInstead of using modeltranslationtranslator.register, you should usemodeltranslation_lokalise.register_translation:frommodeltranslation.translatorimportTranslationOptionsfrommodeltranslation_lokalise.signalsimportregister_translationfromyour_app.modelsimportModel1classModel1TranslationOptions(TranslationOptions):fields=('name','description',)register_translation(Model1,Model1TranslationOptions)And that's all,modeltranslations-lokalisewill keep track of changes on your translatable models and import them in your
lokalise project each time you update one of your translatable fields.Non-lokalise translatable fieldsIt's possible that you want certain fields to be translatable in terms of modeltranslations but exclude them from being
uploaded to Lokalise. In that case you can add an attributenon_lokalise_fieldsto your TranslationOptions object.
Modeltranslation-lokalise will not track changes on that fields.classProductTranslationOptions(TranslationOptions):non_lokalise_fields=('slug',)fields=('title','description',)+non_lokalise_fieldsLicenseThis project is licensed under the MIT License - see theLICENSEfile for details
Package: model-unpickler
A tool to load machine/deep learning models with security.Many machine/deep learning libraries (PyTorch, Scikit-Learn and so on) save trained models solely based on Python pickle, while pickle is well known for its potential to execute malicious code when loading objects from untrusted sources.This libary provides a secure tool to load pickled models by overriding thefind_classmethod of standard python Unpickler class together with a series of global names --whilelist. Only globals in the whilelist are allowed in loaded model objects, whereas the loading process interrupts when an untrusted global name is found to prevent any potential exploit.This libary also provides utils to quickly update the global whilelist in case that the corresponding machine learning libraries are updated.
Package: model-version
Model versionModel versionallows to track changes to Django model instances. Each time
an instance is updated, itsversionnumber is incremented and old values are
copied to a new record, that represents previous version of the current instance.InstallationUsageDisable VersioningLimitationsInstallationTo install the library use pip:pipinstallmodel_versionUsageTo enable model versioningModelVersionshould be used as one of base classes
a model inherits from:frommodel_versionimportModelVersionclassMyModel(ModelVersion):...This will add three new fields to the model:version- integer number starting from0(default version start number)version_id-uuid4that represents different versions of the same recordversion_created_at- timestamp recordCreate and apply migrations with the new fields:python./manage.pymakemigration
python./manage.pymigrateDisable versioningThere's a context managerdisabled_versioningthat allows to disable model
versioning for a specific operation:frommodel_versionimportdisabled_versioningfrommyapp.modelsimportMyModelrecord=MyModel.objects.create(name="foo")assertrecord.version==0withdisabled_versioning():record.name="bar"record.save()assertrecord.version==0Context variable based oncontextvarsis used under the hood. It can be used
directly to manually manage version creation process:frommodel_version.settingsimportversioning_is_disabledreset_token=versioning_is_disabled.set(True)...# non-versioned operations go hereversioning_is_disabled.reset(reset_token)LimitationsDoesn't work with bulk operations.Requires additional DB query on save.