Package: opsml
Adding Quality Control to Machine LearningOpsML DocumentationWhat is it?OpsMLprovides tooling that enables data science and engineering teams to better govern and manage their machine learning projects and artifacts.Features:Simple Design: Standardized design that can easily be incorporated into existing projects.Cards: Track, version and store a variety of ML artifacts via cards (data, models, runs, projects) and a SQL-based card registry system. Thinktrading cards for machine learning.Type Checking: Strongly typed and type checking for data and model artifacts.Support: Robust support for a variety of ML and data libraries.Automation: Automated processes including onnx model conversion, metadata creation and production packaging.Incorporate into Existing WorkflowsAdd quality control to your ML projects with little effort! Withopsml, data and models are added to interfaces and cards, which are then registered via card registries.Incorporate into Existing WorkflowsAdd quality control to your ML projects with little effort! Withopsml, data and models are represented ascardsand stored in acard registry. This allows for easy versioning, tracking and storage of ML artifacts.Installation:PoetrypoetryaddopsmlPippipinstallopsmlSetup your local environment:By default,opsmlwill log artifacts and experiments locally. To change this behavior and log to a remote server, you'll need to set the following environment variables:exportOPSML_TRACKING_URI=${YOUR_TRACKING_URI}QuickstartIf running the example below locally without a server, make sure to install theserverextra:poetryadd"opsml[server]"# importsfromsklearn.linear_modelimportLinearRegressionfromopsmlimport(CardInfo,CardRegistries,DataCard,DataSplit,ModelCard,PandasData,SklearnModel,)fromopsml.helpers.dataimportcreate_fake_datainfo=CardInfo(name="linear-regression",repository="opsml",user_email="user@email.com")registries=CardRegistries()#--------- Create DataCard ---------## create fake dataX,y=create_fake_data(n_samples=1000,task_type="regression")X["target"]=y# Create data interfacedata_interface=PandasData(data=X,data_splits=[DataSplit(label="train",column_name="col_1",column_value=0.5,inequality=">="),DataSplit(label="test",column_name="col_1",column_value=0.5,inequality="<"),],dependent_vars=["target"],)# Create and register datacarddatacard=DataCard(interface=data_interface,info=info)registries.data.register_card(card=datacard)#--------- Create ModelCard ---------## split datadata=datacard.split_data()# fit modelreg=LinearRegression()reg.fit(data["train"].X.to_numpy(),data["train"].y.to_numpy())# create model interfaceinterface=SklearnModel(model=reg,sample_data=data["train"].X.to_numpy(),task_type="regression",# optional)# create modelcardmodelcard=ModelCard(interface=interface,info=info,to_onnx=True,# lets convert onnxdatacard_uid=datacard.uid,# modelcards must be associated with a datacard)registries.model.register_card(card=modelcard)Table of ContentsIncorporate into Existing WorkflowsInstallation:PoetryPipQuickstartTable of ContentsUsageAdvanced Installation ScenariosEnvironment VariablesSupported LibrariesData LibrariesModel LibrariesContributingUsageNow thatopsmlis installed, you're ready to start using it!It's time to point you to the officialDocumentation Websitefor more information on how to useopsmlAdvanced Installation ScenariosOpsmlis designed to work with a variety of 3rd-party integrations depending on your use-case.Types of extras that can be installed:Postgres: Installs postgres pyscopg2 dependency to be used withOpsmlpoetryadd"opsml[postgres]"Server: Installs necessary packages for setting up aFastapi-basedOpsmlserverpoetryadd"opsml[server]"GCP with mysql: Installs mysql and gcsfs to be used withOpsmlpoetryadd"opsml[gcs,mysql]"GCP with mysql(cloud-sql): Installs mysql and cloud-sql gcp dependencies to be used withOpsmlpoetryadd"opsml[gcp_mysql]"GCP with postgres: Installs postgres and gcsgs to be used withOpsmlpoetryadd"opsml[gcs,postgres]"GCP with postgres(cloud-sql): Installs postgres and cloud-sql gcp dependencies to be used withOpsmlpoetryadd"opsml[gcp_postgres]"AWS with postgres: Installs postgres and s3fs dependencies to be used withOpsmlpoetryadd"opsml[s3,postgres]"AWS with mysql: Installs mysql and s3fs dependencies to be used withOpsmlpoetryadd"opsml[s3,mysql]"Environment VariablesThe following environment variables are used to configure opsml. When using
opsml as a client (i.e., not running a server), the only variable that must be
set isOPSML_TRACKING_URI.NameDescriptionAPP_ENVThe environment to use. Supportsdevelopment,staging, andproductionGOOGLE_ACCOUNT_JSON_BASE64The base64 string of the the GCP service account to use.OPSML_MAX_OVERFLOWThe SQL "max_overflow" size. Defaults to 5OPSML_POOL_SIZEThe SQL connection pool size. Defaults to 10.OPSML_STORAGE_URIThe location of storage to use. Supports a local file system, AWS, and GCS. Example:gs://some-bucketOPSML_TRACKING_URIUsed when logging artifacts to an opsml server (a.k.a., the server which "tracks" artifacts)OPSML_USERNAMEAn optional server username. If the server is setup with login enabled, all clients must use HTTP basic auth with this usernameOPSML_PASSWORDAn optional server password. If the server is setup with login enabled, all clients must use HTTP basic auth with this passwordOPSML_RUN_IDIf set, the run will be automatically loaded when creating new cards.Supported LibrariesOpsmlis designed to work with a variety of ML and data libraries. The following libraries are currently supported:Data LibrariesNameOpsml ImplementationPandasPandasDataPolarsPolarsDataTorchTorchDataArrowArrowDataNumpyNumpyDataSqlSqlDataTextTextDatasetImageImageDatasetModel LibrariesNameOpsml ImplementationExampleSklearnSklearnModellinkLightGBMLightGBMModellinkXGBoostXGBoostModellinkCatBoostCatBoostModellinkTorchTorchModellinkTorch LightningLightningModellinkTensorFlowTensorFlowModellinkHuggingFaceHuggingFaceModellinkVowpal WabbitVowpalWabbitModellinkContributingIf you'd like to contribute, be sure to check out ourcontributing guide! If you'd like to work on any outstanding items, check out theroadmapsection in the docs and get started :smiley:Thanks goes to these phenomenalprojects and peopleand people for creating a great foundation to build from!