ailexej commited on
Commit
edf3314
·
verified ·
1 Parent(s): 9e7a946

Add new SentenceTransformer model

Browse files
Files changed (2) hide show
  1. README.md +351 -337
  2. model.safetensors +1 -1
README.md CHANGED
@@ -12,25 +12,142 @@ tags:
12
  - loss:MultipleNegativesRankingLoss
13
  base_model: Snowflake/snowflake-arctic-embed-m-v1.5
14
  widget:
15
- - source_sentence: What are the abstract methods provided for managing model servers
16
- in ZenML's BaseModelDeployerFlavor class?
 
17
  sentences:
18
- - "quired for your GCP Image Builder by running e.g.:zenml service-connector list-resources\
19
- \ --resource-type gcp-generic\n\nExample Command Output\n\nThe following 'gcp-generic'\
20
- \ resources can be accessed by service connectors that you have configured:\n\
21
- ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┓\n\
22
- ┃ CONNECTOR ID │ CONNECTOR NAME │ CONNECTOR TYPE │ RESOURCE\
23
- \ TYPE │ RESOURCE NAMES ┃\n┠──────────────────────────────────────┼────────────────┼────────────────┼────────────────┼────────────────┨\n\
24
- bfdb657d-d808-47e7-9974-9ba6e4919d83 gcp-generic │ \U0001F535 gcp \
25
- \ │ \U0001F535 gcp-generic zenml-core ┃\n┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┛\n\
26
- \nAfter having set up or decided on a GCP Service Connector to use to authenticate\
27
- \ to GCP, you can register the GCP Image Builder as follows:\n\nzenml image-builder\
28
- \ register <IMAGE_BUILDER_NAME> \\\n --flavor=gcp \\\n --cloud_builder_image=<BUILDER_IMAGE_NAME>\
29
- \ \\\n --network=<DOCKER_NETWORK> \\\n --build_timeout=<BUILD_TIMEOUT_IN_SECONDS>\n\
30
- \n# Connect the GCP Image Builder to GCP via a GCP Service Connector\nzenml image-builder\
31
- \ connect <IMAGE_BUILDER_NAME> -i\n\nA non-interactive version that connects the\
32
- \ GCP Image Builder to a target GCP Service Connector:\n\nzenml image-builder\
33
- \ connect <IMAGE_BUILDER_NAME> --connector <CONNECTOR_ID>\n\nExample Command Output"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  - '🧙Installation
35
 
36
 
@@ -116,6 +233,50 @@ widget:
116
 
117
 
118
  Running with Docker'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  - ":\n \"\"\"Abstract method to deploy a model.\"\"\"@staticmethod\n @abstractmethod\n\
120
  \ def get_model_server_info(\n service: BaseService,\n ) -> Dict[str,\
121
  \ Optional[str]]:\n \"\"\"Give implementation-specific way to extract relevant\
@@ -143,324 +304,177 @@ widget:
143
  \ version of the base implementation which aims to highlight the abstraction layer.\
144
  \ In order to see the full implementation and get the complete docstrings, please\
145
  \ check the SDK docs .\n\nBuilding your own model deployers"
146
- - source_sentence: How can you successfully connect the image builder `gcp-image-builder`
147
- to the resources using a connector ID?
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  sentences:
149
- - 'ZenML - Bridging the gap between ML & Ops
150
-
151
 
152
- Legacy Docs
153
 
 
154
 
155
- Bleeding EdgeLegacy Docs0.67.0
156
 
 
157
 
158
- 🧙‍♂️Find older version our docs
159
-
160
-
161
- Powered by GitBook'
162
- - 'Google Cloud Image Builder
163
-
164
-
165
- Building container images with Google Cloud Build
166
-
167
-
168
- The Google Cloud image builder is an image builder flavor provided by the ZenML
169
- gcp integration that uses Google Cloud Build to build container images.
170
-
171
-
172
- When to use it
173
-
174
-
175
- You should use the Google Cloud image builder if:
176
-
177
-
178
- you''re unable to install or use Docker on your client machine.
179
 
180
-
181
- you''re already using GCP.
182
-
183
-
184
- your stack is mainly composed of other Google Cloud components such as the GCS
185
- Artifact Store or the Vertex Orchestrator.
186
-
187
-
188
- How to deploy it
189
-
190
-
191
- Would you like to skip ahead and deploy a full ZenML cloud stack already, including
192
- the Google Cloud image builder? Check out the in-browser stack deployment wizard,
193
- the stack registration wizard, or the ZenML GCP Terraform module for a shortcut
194
- on how to deploy & register this stack component.
195
-
196
-
197
- In order to use the ZenML Google Cloud image builder you need to enable Google
198
- Cloud Build relevant APIs on the Google Cloud project.
199
-
200
-
201
- How to use it
202
-
203
-
204
- To use the Google Cloud image builder, we need:
205
-
206
-
207
- The ZenML gcp integration installed. If you haven''t done so, run:
208
-
209
-
210
- zenml integration install gcp
211
-
212
-
213
- A GCP Artifact Store where the build context will be uploaded, so Google Cloud
214
- Build can access it.
215
-
216
-
217
- A GCP container registry where the built image will be pushed.
218
-
219
-
220
- Optionally, the GCP project ID in which you want to run the build and a service
221
- account with the needed permissions to run the build. If not provided, then the
222
- project ID and credentials will be inferred from the environment.
223
-
224
-
225
- Optionally, you can change:
226
-
227
-
228
- the Docker image used by Google Cloud Build to execute the steps to build and
229
- push the Docker image. By default, the builder image will be ''gcr.io/cloud-builders/docker''.
230
-
231
-
232
- The network to which the container used to build the ZenML pipeline Docker image
233
- will be attached. More information: Cloud build network.
234
-
235
-
236
- The build timeout for the build, and for the blocking operation waiting for the
237
- build to finish. More information: Build Timeout.'
238
- - "--connector <CONNECTOR_ID>\n\nExample Command Output$ zenml image-builder connect\
239
- \ gcp-image-builder --connector gcp-generic\nSuccessfully connected image builder\
240
- \ `gcp-image-builder` to the following resources:\n┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┓\n\
241
  ┃ CONNECTOR ID │ CONNECTOR NAME │ CONNECTOR TYPE │ RESOURCE\
242
  \ TYPE │ RESOURCE NAMES ┃\n┠──────────��───────────────────────────┼────────────────┼────────────────┼────────────────┼────────────────┨\n\
243
  ┃ bfdb657d-d808-47e7-9974-9ba6e4919d83 │ gcp-generic │ \U0001F535 gcp \
244
  \ │ \U0001F535 gcp-generic │ zenml-core ┃\n┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┛\n\
245
- \nAs a final step, you can use the GCP Image Builder in a ZenML Stack:\n\n# Register\
246
- \ and set a stack with the new image builder\nzenml stack register <STACK_NAME>\
247
- \ -i <IMAGE_BUILDER_NAME> ... --set\n\nWhen you register the GCP Image Builder,\
248
- \ you can generate a GCP Service Account Key, save it to a local file and then\
249
- \ reference it in the Image Builder configuration.\n\nThis method has the advantage\
250
- \ that you don't need to install and configure the GCP CLI on your host, but it's\
251
- \ still not as secure as using a GCP Service Connector and the stack component\
252
- \ configuration is not portable to other hosts.\n\nFor this method, you need to\
253
- \ create a user-managed GCP service account, and grant it privileges to access\
254
- \ the Cloud Build API and to run Cloud Builder jobs (e.g. the Cloud Build Editor\
255
- \ IAM role.\n\nWith the service account key downloaded to a local file, you can\
256
- \ register the GCP Image Builder as follows:\n\nzenml image-builder register <IMAGE_BUILDER_NAME>\
257
- \ \\\n --flavor=gcp \\\n --project=<GCP_PROJECT_ID> \\\n --service_account_path=<PATH_TO_SERVICE_ACCOUNT_KEY>\
258
- \ \\\n --cloud_builder_image=<BUILDER_IMAGE_NAME> \\\n --network=<DOCKER_NETWORK>\
259
- \ \\\n --build_timeout=<BUILD_TIMEOUT_IN_SECONDS>"
260
- - source_sentence: How do I finetune embeddings using Sentence Transformers in ZenML?
261
- sentences:
262
- - "nsible for cluster-manager-specific configuration._io_configuration is a critical\
263
- \ method. Even though we have materializers, Spark might require additional packages\
264
- \ and configuration to work with a specific filesystem. This method is used as\
265
- \ an interface to provide this configuration.\n\n_additional_configuration takes\
266
- \ the submit_args, converts, and appends them to the overall configuration.\n\n\
267
- Once the configuration is completed, _launch_spark_job comes into play. This takes\
268
- \ the completed configuration and runs a Spark job on the given master URL with\
269
- \ the specified deploy_mode. By default, this is achieved by creating and executing\
270
- \ a spark-submit command.\n\nWarning\n\nIn its first iteration, the pre-configuration\
271
- \ with _io_configuration method is only effective when it is paired with an S3ArtifactStore\
272
- \ (which has an authentication secret). When used with other artifact store flavors,\
273
- \ you might be required to provide additional configuration through the submit_args.\n\
274
- \nStack Component: KubernetesSparkStepOperator\n\nThe KubernetesSparkStepOperator\
275
- \ is implemented by subclassing the base SparkStepOperator and uses the PipelineDockerImageBuilder\
276
- \ class to build and push the required Docker images.\n\nfrom typing import Optional\n\
277
- \nfrom zenml.integrations.spark.step_operators.spark_step_operator import (\n\
278
- \ SparkStepOperatorConfig\n)\n\nclass KubernetesSparkStepOperatorConfig(SparkStepOperatorConfig):\n\
279
- \ \"\"\"Config for the Kubernetes Spark step operator.\"\"\"\n\nnamespace:\
280
- \ Optional[str] = None\n service_account: Optional[str] = None\n\nfrom pyspark.conf\
281
- \ import SparkConf\n\nfrom zenml.utils.pipeline_docker_image_builder import PipelineDockerImageBuilder\n\
282
- from zenml.integrations.spark.step_operators.spark_step_operator import (\n \
283
- \ SparkStepOperator\n)\n\nclass KubernetesSparkStepOperator(SparkStepOperator):\n\
284
- \ \"\"\"Step operator which runs Steps with Spark on Kubernetes.\"\"\""
285
- - 'Finetuning embeddings with Sentence Transformers
286
-
287
-
288
- Finetune embeddings with Sentence Transformers.
289
-
290
-
291
- PreviousSynthetic data generationNextEvaluating finetuned embeddings
292
-
293
-
294
- Last updated 1 month ago'
295
- - 'Whylogs
296
-
297
-
298
- How to collect and visualize statistics to track changes in your pipelines'' data
299
- with whylogs/WhyLabs profiling.
300
-
301
-
302
- The whylogs/WhyLabs Data Validator flavor provided with the ZenML integration
303
- uses whylogs and WhyLabs to generate and track data profiles, highly accurate
304
- descriptive representations of your data. The profiles can be used to implement
305
- automated corrective actions in your pipelines, or to render interactive representations
306
- for further visual interpretation, evaluation and documentation.
307
-
308
-
309
- When would you want to use it?
310
-
311
-
312
- Whylogs is an open-source library that analyzes your data and creates statistical
313
- summaries called whylogs profiles. Whylogs profiles can be processed in your pipelines
314
- and visualized locally or uploaded to the WhyLabs platform, where more in depth
315
- analysis can be carried out. Even though whylogs also supports other data types,
316
- the ZenML whylogs integration currently only works with tabular data in pandas.DataFrame
317
- format.
318
-
319
 
320
- You should use the whylogs/WhyLabs Data Validator when you need the following
321
- data validation features that are possible with whylogs and WhyLabs:
322
 
 
 
 
 
323
 
324
- Data Quality: validate data quality in model inputs or in a data pipeline
325
 
 
326
 
327
- Data Drift: detect data drift in model input features
328
 
 
 
 
329
 
330
- Model Drift: Detect training-serving skew, concept drift, and model performance
331
- degradation
332
 
 
 
333
 
334
- You should consider one of the other Data Validator flavors if you need a different
335
- set of data validation features.
336
 
 
337
 
338
- How do you deploy it?
339
 
 
 
340
 
341
- The whylogs Data Validator flavor is included in the whylogs ZenML integration,
342
- you need to install it on your local machine to be able to register a whylogs
343
- Data Validator and add it to your stack:
344
 
 
345
 
346
- zenml integration install whylogs -y
347
 
 
348
 
349
- If you don''t need to connect to the WhyLabs platform to upload and store the
350
- generated whylogs data profiles, the Data Validator stack component does not require
351
- any configuration parameters. Adding it to a stack is as simple as running e.g.:'
352
- - source_sentence: What is the purpose of ZenML in the context of ML and Ops?
353
- sentences:
354
- - "> \\\n --build_timeout=<BUILD_TIMEOUT_IN_SECONDS># Register and set a stack\
355
- \ with the new image builder\nzenml stack register <STACK_NAME> -i <IMAGE_BUILDER_NAME>\
356
- \ ... --set\n\nCaveats\n\nAs described in this Google Cloud Build documentation\
357
- \ page, Google Cloud Build uses containers to execute the build steps which are\
358
- \ automatically attached to a network called cloudbuild that provides some Application\
359
- \ Default Credentials (ADC), that allow the container to be authenticated and\
360
- \ therefore use other GCP services.\n\nBy default, the GCP Image Builder is executing\
361
- \ the build command of the ZenML Pipeline Docker image with the option --network=cloudbuild,\
362
- \ so the ADC provided by the cloudbuild network can also be used in the build.\
363
- \ This is useful if you want to install a private dependency from a GCP Artifact\
364
- \ Registry, but you will also need to use a custom base parent image with the\
365
- \ keyrings.google-artifactregistry-auth installed, so pip can connect and authenticate\
366
- \ in the private artifact registry to download the dependency.\n\nFROM zenmldocker/zenml:latest\n\
367
- \nRUN pip install keyrings.google-artifactregistry-auth\n\nThe above Dockerfile\
368
- \ uses zenmldocker/zenml:latest as a base image, but is recommended to change\
369
- \ the tag to specify the ZenML version and Python version like 0.33.0-py3.10.\n\
370
- \nPreviousKaniko Image BuilderNextDevelop a Custom Image Builder\n\nLast updated\
371
- \ 21 days ago"
372
- - "Control caching behavior\n\nBy default steps in ZenML pipelines are cached whenever\
373
- \ code and parameters stay unchanged.\n\n@step(enable_cache=True) # set cache\
374
- \ behavior at step level\ndef load_data(parameter: int) -> dict:\n ...\n\n\
375
- @step(enable_cache=False) # settings at step level override pipeline level\ndef\
376
- \ train_model(data: dict) -> None:\n ...\n\n@pipeline(enable_cache=True) #\
377
- \ set cache behavior at step level\ndef simple_ml_pipeline(parameter: int):\n\
378
- \ ...\n\nCaching only happens when code and parameters stay the same.\n\nLike\
379
- \ many other step and pipeline settings, you can also change this afterward:\n\
380
- \n# Same as passing it in the step decorator\nmy_step.configure(enable_cache=...)\n\
381
- \n# Same as passing it in the pipeline decorator\nmy_pipeline.configure(enable_cache=...)\n\
382
- \nFind out here how to configure this in a YAML file\n\nPreviousStep output typing\
383
- \ and annotationNextSchedule a pipeline\n\nLast updated 4 months ago"
384
- - 'ZenML - Bridging the gap between ML & Ops
385
-
386
-
387
- Legacy Docs
388
-
389
 
390
- Bleeding EdgeLegacy Docs0.67.0
391
 
392
 
393
- 🧙‍♂️Find older version our docs
 
 
 
 
394
 
395
 
396
- Powered by GitBook'
397
- - source_sentence: How does ZenML facilitate the flow of data between steps in a pipeline?
 
 
 
398
  sentences:
399
- - "tainer_registry \\\n -i local_builder \\\n --setOnce you added the step\
400
- \ operator to your active stack, you can use it to execute individual steps of\
401
- \ your pipeline by specifying it in the @step decorator as follows:\n\nfrom zenml\
402
- \ import step\n\n@step(step_operator=<STEP_OPERATOR_NAME>)\ndef step_on_spark(...)\
403
- \ -> ...:\n \"\"\"Some step that should run with Spark on Kubernetes.\"\"\"\
404
- \n ...\n\nAfter successfully running any step with a KubernetesSparkStepOperator,\
405
- \ you should be able to see that a Spark driver pod was created in your cluster\
406
- \ for each pipeline step when running kubectl get pods -n $KUBERNETES_NAMESPACE.\n\
407
- \nInstead of hardcoding a step operator name, you can also use the Client to dynamically\
408
- \ use the step operator of your active stack:\n\nfrom zenml.client import Client\n\
409
- \nstep_operator = Client().active_stack.step_operator\n\n@step(step_operator=step_operator.name)\n\
410
- def step_on_spark(...) -> ...:\n ...\n\nAdditional configuration\n\nFor additional\
411
- \ configuration of the Spark step operator, you can pass SparkStepOperatorSettings\
412
- \ when defining or running your pipeline. Check out the SDK docs for a full list\
413
- \ of available attributes and this docs page for more information on how to specify\
414
- \ settings.\n\nPreviousKubernetesNextDevelop a Custom Step Operator\n\nLast updated\
415
- \ 4 months ago"
416
- - "\U0001F5C4️Handle Data/Artifacts\n\nStep outputs in ZenML are stored in the artifact\
417
- \ store. This enables caching, lineage and auditability. Using type annotations\
418
- \ helps with transparency, passing data between steps, and serializing/des\n\n\
419
- For best results, use type annotations for your outputs. This is good coding practice\
420
- \ for transparency, helps ZenML handle passing data between steps, and also enables\
421
- \ ZenML to serialize and deserialize (referred to as 'materialize' in ZenML) the\
422
- \ data.\n\n@step\ndef load_data(parameter: int) -> Dict[str, Any]:\n\n# do something\
423
- \ with the parameter here\n\ntraining_data = [[1, 2], [3, 4], [5, 6]]\n labels\
424
- \ = [0, 1, 0]\n return {'features': training_data, 'labels': labels}\n\n@step\n\
425
- def train_model(data: Dict[str, Any]) -> None:\n total_features = sum(map(sum,\
426
- \ data['features']))\n total_labels = sum(data['labels'])\n \n # Train\
427
- \ some model here\n \n print(f\"Trained model using {len(data['features'])}\
428
- \ data points. \"\n f\"Feature sum is {total_features}, label sum is\
429
- \ {total_labels}\")\n\n@pipeline \ndef simple_ml_pipeline(parameter: int):\n\
430
- \ dataset = load_data(parameter=parameter) # Get the output \n train_model(dataset)\
431
- \ # Pipe the previous step output into the downstream step\n\nIn this code, we\
432
- \ define two steps: load_data and train_model. The load_data step takes an integer\
433
- \ parameter and returns a dictionary containing training data and labels. The\
434
- \ train_model step receives the dictionary from load_data, extracts the features\
435
- \ and labels, and trains a model (not shown here).\n\nFinally, we define a pipeline\
436
- \ simple_ml_pipeline that chains the load_data and train_model steps together.\
437
- \ The output from load_data is passed as input to train_model, demonstrating how\
438
- \ data flows between steps in a ZenML pipeline.\n\nPreviousDisable colorful loggingNextHow\
439
- \ ZenML stores data\n\nLast updated 4 months ago"
440
- - "in the ZenML dashboard.\n\nThe whylogs standard stepZenML wraps the whylogs/WhyLabs\
441
- \ functionality in the form of a standard WhylogsProfilerStep step. The only field\
442
- \ in the step config is a dataset_timestamp attribute which is only relevant when\
443
- \ you upload the profiles to WhyLabs that uses this field to group and merge together\
444
- \ profiles belonging to the same dataset. The helper function get_whylogs_profiler_step\
445
- \ used to create an instance of this standard step takes in an optional dataset_id\
446
- \ parameter that is also used only in the context of WhyLabs upload to identify\
447
- \ the model in the context of which the profile is uploaded, e.g.:\n\nfrom zenml.integrations.whylogs.steps\
448
- \ import get_whylogs_profiler_step\n\ntrain_data_profiler = get_whylogs_profiler_step(dataset_id=\"\
449
- model-2\")\ntest_data_profiler = get_whylogs_profiler_step(dataset_id=\"model-3\"\
450
- )\n\nThe step can then be inserted into your pipeline where it can take in a pandas.DataFrame\
451
- \ dataset, e.g.:\n\nfrom zenml import pipeline\n\n@pipeline\ndef data_profiling_pipeline():\n\
452
- \ data, _ = data_loader()\n train, test = data_splitter(data)\n train_data_profiler(train)\n\
453
- \ test_data_profiler(test)\n\ndata_profiling_pipeline()\n\nAs can be seen from\
454
- \ the step definition , the step takes in a dataset and returns a whylogs DatasetProfileView\
455
- \ object:\n\n@step\ndef whylogs_profiler_step(\n dataset: pd.DataFrame,\n \
456
- \ dataset_timestamp: Optional[datetime.datetime] = None,\n) -> DatasetProfileView:\n\
457
- \ ...\n\nYou should consult the official whylogs documentation for more information\
458
- \ on what you can do with the collected profiles.\n\nYou can view the complete\
459
- \ list of configuration parameters in the SDK docs.\n\nThe whylogs Data Validator\n\
460
- \nThe whylogs Data Validator implements the same interface as do all Data Validators,\
461
- \ so this method forces you to maintain some level of compatibility with the overall\
462
- \ Data Validator abstraction, which guarantees an easier migration in case you\
463
- \ decide to switch to another Data Validator."
464
  pipeline_tag: sentence-similarity
465
  library_name: sentence-transformers
466
  metrics:
@@ -646,7 +660,7 @@ model-index:
646
  type: dim_64
647
  metrics:
648
  - type: cosine_accuracy@1
649
- value: 0.75
650
  name: Cosine Accuracy@1
651
  - type: cosine_accuracy@3
652
  value: 1.0
@@ -658,7 +672,7 @@ model-index:
658
  value: 1.0
659
  name: Cosine Accuracy@10
660
  - type: cosine_precision@1
661
- value: 0.75
662
  name: Cosine Precision@1
663
  - type: cosine_precision@3
664
  value: 0.3333333333333333
@@ -670,7 +684,7 @@ model-index:
670
  value: 0.1
671
  name: Cosine Precision@10
672
  - type: cosine_recall@1
673
- value: 0.75
674
  name: Cosine Recall@1
675
  - type: cosine_recall@3
676
  value: 1.0
@@ -682,13 +696,13 @@ model-index:
682
  value: 1.0
683
  name: Cosine Recall@10
684
  - type: cosine_ndcg@10
685
- value: 0.9077324383928644
686
  name: Cosine Ndcg@10
687
  - type: cosine_mrr@10
688
- value: 0.875
689
  name: Cosine Mrr@10
690
  - type: cosine_map@100
691
- value: 0.875
692
  name: Cosine Map@100
693
  ---
694
 
@@ -743,9 +757,9 @@ from sentence_transformers import SentenceTransformer
743
  model = SentenceTransformer("zenml/finetuned-snowflake-arctic-embed-m-v1.5")
744
  # Run inference
745
  sentences = [
746
- 'How does ZenML facilitate the flow of data between steps in a pipeline?',
747
- '🗄️Handle Data/Artifacts\n\nStep outputs in ZenML are stored in the artifact store. This enables caching, lineage and auditability. Using type annotations helps with transparency, passing data between steps, and serializing/des\n\nFor best results, use type annotations for your outputs. This is good coding practice for transparency, helps ZenML handle passing data between steps, and also enables ZenML to serialize and deserialize (referred to as \'materialize\' in ZenML) the data.\n\n@step\ndef load_data(parameter: int) -> Dict[str, Any]:\n\n# do something with the parameter here\n\ntraining_data = [[1, 2], [3, 4], [5, 6]]\n labels = [0, 1, 0]\n return {\'features\': training_data, \'labels\': labels}\n\n@step\ndef train_model(data: Dict[str, Any]) -> None:\n total_features = sum(map(sum, data[\'features\']))\n total_labels = sum(data[\'labels\'])\n \n # Train some model here\n \n print(f"Trained model using {len(data[\'features\'])} data points. "\n f"Feature sum is {total_features}, label sum is {total_labels}")\n\n@pipeline \ndef simple_ml_pipeline(parameter: int):\n dataset = load_data(parameter=parameter) # Get the output \n train_model(dataset) # Pipe the previous step output into the downstream step\n\nIn this code, we define two steps: load_data and train_model. The load_data step takes an integer parameter and returns a dictionary containing training data and labels. The train_model step receives the dictionary from load_data, extracts the features and labels, and trains a model (not shown here).\n\nFinally, we define a pipeline simple_ml_pipeline that chains the load_data and train_model steps together. The output from load_data is passed as input to train_model, demonstrating how data flows between steps in a ZenML pipeline.\n\nPreviousDisable colorful loggingNextHow ZenML stores data\n\nLast updated 4 months ago',
748
- 'in the ZenML dashboard.\n\nThe whylogs standard stepZenML wraps the whylogs/WhyLabs functionality in the form of a standard WhylogsProfilerStep step. The only field in the step config is a dataset_timestamp attribute which is only relevant when you upload the profiles to WhyLabs that uses this field to group and merge together profiles belonging to the same dataset. The helper function get_whylogs_profiler_step used to create an instance of this standard step takes in an optional dataset_id parameter that is also used only in the context of WhyLabs upload to identify the model in the context of which the profile is uploaded, e.g.:\n\nfrom zenml.integrations.whylogs.steps import get_whylogs_profiler_step\n\ntrain_data_profiler = get_whylogs_profiler_step(dataset_id="model-2")\ntest_data_profiler = get_whylogs_profiler_step(dataset_id="model-3")\n\nThe step can then be inserted into your pipeline where it can take in a pandas.DataFrame dataset, e.g.:\n\nfrom zenml import pipeline\n\n@pipeline\ndef data_profiling_pipeline():\n data, _ = data_loader()\n train, test = data_splitter(data)\n train_data_profiler(train)\n test_data_profiler(test)\n\ndata_profiling_pipeline()\n\nAs can be seen from the step definition , the step takes in a dataset and returns a whylogs DatasetProfileView object:\n\n@step\ndef whylogs_profiler_step(\n dataset: pd.DataFrame,\n dataset_timestamp: Optional[datetime.datetime] = None,\n) -> DatasetProfileView:\n ...\n\nYou should consult the official whylogs documentation for more information on what you can do with the collected profiles.\n\nYou can view the complete list of configuration parameters in the SDK docs.\n\nThe whylogs Data Validator\n\nThe whylogs Data Validator implements the same interface as do all Data Validators, so this method forces you to maintain some level of compatibility with the overall Data Validator abstraction, which guarantees an easier migration in case you decide to switch to another Data Validator.',
749
  ]
750
  embeddings = model.encode(sentences)
751
  print(embeddings.shape)
@@ -855,23 +869,23 @@ You can finetune this model on your own dataset.
855
  * Dataset: `dim_64`
856
  * Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)
857
 
858
- | Metric | Value |
859
- |:--------------------|:----------|
860
- | cosine_accuracy@1 | 0.75 |
861
- | cosine_accuracy@3 | 1.0 |
862
- | cosine_accuracy@5 | 1.0 |
863
- | cosine_accuracy@10 | 1.0 |
864
- | cosine_precision@1 | 0.75 |
865
- | cosine_precision@3 | 0.3333 |
866
- | cosine_precision@5 | 0.2 |
867
- | cosine_precision@10 | 0.1 |
868
- | cosine_recall@1 | 0.75 |
869
- | cosine_recall@3 | 1.0 |
870
- | cosine_recall@5 | 1.0 |
871
- | cosine_recall@10 | 1.0 |
872
- | cosine_ndcg@10 | 0.9077 |
873
- | cosine_mrr@10 | 0.875 |
874
- | **cosine_map@100** | **0.875** |
875
 
876
  <!--
877
  ## Bias, Risks and Limitations
@@ -898,13 +912,13 @@ You can finetune this model on your own dataset.
898
  | | positive | anchor |
899
  |:--------|:-----------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|
900
  | type | string | string |
901
- | details | <ul><li>min: 13 tokens</li><li>mean: 23.92 tokens</li><li>max: 41 tokens</li></ul> | <ul><li>min: 31 tokens</li><li>mean: 321.11 tokens</li><li>max: 512 tokens</li></ul> |
902
  * Samples:
903
- | positive | anchor |
904
- |:------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
905
- | <code>How does ZenML integrate Spark step operators for executing individual steps?</code> | <code>Spark<br><br>Executing individual steps on Spark<br><br>The spark integration brings two different step operators:<br><br>Step Operator: The SparkStepOperator serves as the base class for all the Spark-related step operators.<br><br>Step Operator: The KubernetesSparkStepOperator is responsible for launching ZenML steps as Spark applications with Kubernetes as a cluster manager.<br><br>Step Operators: SparkStepOperator<br><br>A summarized version of the implementation can be summarized in two parts. First, the configuration:<br><br>from typing import Optional, Dict, Any<br>from zenml.step_operators import BaseStepOperatorConfig<br><br>class SparkStepOperatorConfig(BaseStepOperatorConfig):<br> """Spark step operator config.<br><br>Attributes:<br> master: is the master URL for the cluster. You might see different<br> schemes for different cluster managers which are supported by Spark<br> like Mesos, YARN, or Kubernetes. Within the context of this PR,<br> the implementation supports Kubernetes as a cluster manager.<br> deploy_mode: can either be 'cluster' (default) or 'client' and it<br> decides where the driver node of the application will run.<br> submit_kwargs: is the JSON string of a dict, which will be used<br> to define additional params if required (Spark has quite a<br> lot of different parameters, so including them, all in the step<br> operator was not implemented).<br> """<br><br>master: str<br> deploy_mode: str = "cluster"<br> submit_kwargs: Optional[Dict[str, Any]] = None<br><br>and then the implementation:<br><br>from typing import List<br>from pyspark.conf import SparkConf<br><br>from zenml.step_operators import BaseStepOperator<br><br>class SparkStepOperator(BaseStepOperator):<br> """Base class for all Spark-related step operators."""<br><br>def _resource_configuration(<br> self,<br> spark_config: SparkConf,<br> resource_configuration: "ResourceSettings",<br> ) -> None:<br> """Configures Spark to handle the resource configuration."""</code> |
906
- | <code>How can ZenML be used to finetune LLMs for specific tasks or to improve performance and cost?</code> | <code>Finetuning LLMs with ZenML<br><br>Finetune LLMs for specific tasks or to improve performance and cost.<br><br>PreviousEvaluating finetuned embeddingsNextSet up a project repository<br><br>Last updated 6 months ago</code> |
907
- | <code>How can I develop a custom model deployer in ZenML for efficient deployment and management of machine-learning models?</code> | <code>Develop a Custom Model Deployer<br><br>Learning how to develop a custom model deployer.<br><br>Before diving into the specifics of this component type, it is beneficial to familiarize yourself with our general guide to writing custom component flavors in ZenML. This guide provides an essential understanding of ZenML's component flavor concepts.<br><br>To deploy and manage your trained machine-learning models, ZenML provides a stack component called Model Deployer. This component is responsible for interacting with the deployment tool, framework, or platform.<br><br>When present in a stack, the model deployer can also act as a registry for models that are served with ZenML. You can use the model deployer to list all models that are currently deployed for online inference or filtered according to a particular pipeline run or step, or to suspend, resume or delete an external model server managed through ZenML.<br><br>Base Abstraction<br><br>In ZenML, the base abstraction of the model deployer is built on top of three major criteria:<br><br>It needs to ensure efficient deployment and management of models in accordance with the specific requirements of the serving infrastructure, by holding all the stack-related configuration attributes required to interact with the remote model serving tool, service, or platform.<br><br>It needs to implement the continuous deployment logic necessary to deploy models in a way that updates an existing model server that is already serving a previous version of the same model instead of creating a new model server for every new model version (see the deploy_model abstract method). This functionality can be consumed directly from ZenML pipeline steps, but it can also be used outside the pipeline to deploy ad-hoc models. It is also usually coupled with a standard model deployer step, implemented by each integration, that hides the details of the deployment process from the user.</code> |
908
  * Loss: [<code>MatryoshkaLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#matryoshkaloss) with these parameters:
909
  ```json
910
  {
@@ -1061,9 +1075,9 @@ You can finetune this model on your own dataset.
1061
  ### Training Logs
1062
  | Epoch | Step | dim_384_cosine_map@100 | dim_256_cosine_map@100 | dim_128_cosine_map@100 | dim_64_cosine_map@100 |
1063
  |:-------:|:-----:|:----------------------:|:----------------------:|:----------------------:|:---------------------:|
1064
- | 1.0 | 1 | 1.0 | 1.0 | 0.875 | 0.875 |
1065
- | **2.0** | **3** | **1.0** | **1.0** | **1.0** | **0.875** |
1066
- | 3.0 | 4 | 1.0 | 1.0 | 1.0 | 0.875 |
1067
 
1068
  * The bold row denotes the saved checkpoint.
1069
 
 
12
  - loss:MultipleNegativesRankingLoss
13
  base_model: Snowflake/snowflake-arctic-embed-m-v1.5
14
  widget:
15
+ - source_sentence: How do you configure the necessary RBAC resources in Kubernetes
16
+ to enable Spark access for managing driver executor pods, and what are the subsequent
17
+ steps needed to register the stack component using ZenML?
18
  sentences:
19
+ - 'Google Cloud Image Builder
20
+
21
+
22
+ Building container images with Google Cloud Build
23
+
24
+
25
+ The Google Cloud image builder is an image builder flavor provided by the ZenML
26
+ gcp integration that uses Google Cloud Build to build container images.
27
+
28
+
29
+ When to use it
30
+
31
+
32
+ You should use the Google Cloud image builder if:
33
+
34
+
35
+ you''re unable to install or use Docker on your client machine.
36
+
37
+
38
+ you''re already using GCP.
39
+
40
+
41
+ your stack is mainly composed of other Google Cloud components such as the GCS
42
+ Artifact Store or the Vertex Orchestrator.
43
+
44
+
45
+ How to deploy it
46
+
47
+
48
+ Would you like to skip ahead and deploy a full ZenML cloud stack already, including
49
+ the Google Cloud image builder? Check out the in-browser stack deployment wizard,
50
+ the stack registration wizard, or the ZenML GCP Terraform module for a shortcut
51
+ on how to deploy & register this stack component.
52
+
53
+
54
+ In order to use the ZenML Google Cloud image builder you need to enable Google
55
+ Cloud Build relevant APIs on the Google Cloud project.
56
+
57
+
58
+ How to use it
59
+
60
+
61
+ To use the Google Cloud image builder, we need:
62
+
63
+
64
+ The ZenML gcp integration installed. If you haven''t done so, run:
65
+
66
+
67
+ zenml integration install gcp
68
+
69
+
70
+ A GCP Artifact Store where the build context will be uploaded, so Google Cloud
71
+ Build can access it.
72
+
73
+
74
+ A GCP container registry where the built image will be pushed.
75
+
76
+
77
+ Optionally, the GCP project ID in which you want to run the build and a service
78
+ account with the needed permissions to run the build. If not provided, then the
79
+ project ID and credentials will be inferred from the environment.
80
+
81
+
82
+ Optionally, you can change:
83
+
84
+
85
+ the Docker image used by Google Cloud Build to execute the steps to build and
86
+ push the Docker image. By default, the builder image will be ''gcr.io/cloud-builders/docker''.
87
+
88
+
89
+ The network to which the container used to build the ZenML pipeline Docker image
90
+ will be attached. More information: Cloud build network.
91
+
92
+
93
+ The build timeout for the build, and for the blocking operation waiting for the
94
+ build to finish. More information: Build Timeout.'
95
+ - "_run.steps[step_name]\n whylogs_step.visualize()if __name__ == \"__main__\"\
96
+ :\n visualize_statistics(\"data_loader\")\n visualize_statistics(\"train_data_profiler\"\
97
+ , \"test_data_profiler\")\n\nPreviousEvidentlyNextDevelop a custom data validator\n\
98
+ \nLast updated 1 month ago"
99
+ - "ngs/python/Dockerfile -u 0 build\n\nConfiguring RBACAdditionally, you may need\
100
+ \ to create the several resources in Kubernetes in order to give Spark access\
101
+ \ to edit/manage your driver executor pods.\n\nTo do so, create a file called\
102
+ \ rbac.yaml with the following content:\n\napiVersion: v1\nkind: Namespace\nmetadata:\n\
103
+ \ name: spark-namespace\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n\
104
+ \ name: spark-service-account\n namespace: spark-namespace\n---\napiVersion:\
105
+ \ rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n name: spark-role\n\
106
+ \ namespace: spark-namespace\nsubjects:\n - kind: ServiceAccount\n name:\
107
+ \ spark-service-account\n namespace: spark-namespace\nroleRef:\n kind: ClusterRole\n\
108
+ \ name: edit\n apiGroup: rbac.authorization.k8s.io\n---\n\nAnd then execute\
109
+ \ the following command to create the resources:\n\naws eks --region=$REGION update-kubeconfig\
110
+ \ --name=$EKS_CLUSTER_NAME\n\nkubectl create -f rbac.yaml\n\nLastly, note down\
111
+ \ the namespace and the name of the service account since you will need them when\
112
+ \ registering the stack component in the next step.\n\nHow to use it\n\nTo use\
113
+ \ the KubernetesSparkStepOperator, you need:\n\nthe ZenML spark integration. If\
114
+ \ you haven't installed it already, run\n\nzenml integration install spark\n\n\
115
+ Docker installed and running.\n\nA remote artifact store as part of your stack.\n\
116
+ \nA remote container registry as part of your stack.\n\nA Kubernetes cluster deployed.\n\
117
+ \nWe can then register the step operator and use it in our active stack:\n\nzenml\
118
+ \ step-operator register spark_step_operator \\\n\t--flavor=spark-kubernetes \\\
119
+ \n\t--master=k8s://$EKS_API_SERVER_ENDPOINT \\\n\t--namespace=<SPARK_KUBERNETES_NAMESPACE>\
120
+ \ \\\n\t--service_account=<SPARK_KUBERNETES_SERVICE_ACCOUNT>\n\n# Register the\
121
+ \ stack\nzenml stack register spark_stack \\\n -o default \\\n -s spark_step_operator\
122
+ \ \\\n -a spark_artifact_store \\\n -c spark_container_registry \\\n \
123
+ \ -i local_builder \\\n --set"
124
+ - source_sentence: What is the function of a ZenML BaseService registry in the context
125
+ of model deployment?
126
+ sentences:
127
+ - "\U0001F5C4️Handle Data/Artifacts\n\nStep outputs in ZenML are stored in the artifact\
128
+ \ store. This enables caching, lineage and auditability. Using type annotations\
129
+ \ helps with transparency, passing data between steps, and serializing/des\n\n\
130
+ For best results, use type annotations for your outputs. This is good coding practice\
131
+ \ for transparency, helps ZenML handle passing data between steps, and also enables\
132
+ \ ZenML to serialize and deserialize (referred to as 'materialize' in ZenML) the\
133
+ \ data.\n\n@step\ndef load_data(parameter: int) -> Dict[str, Any]:\n\n# do something\
134
+ \ with the parameter here\n\ntraining_data = [[1, 2], [3, 4], [5, 6]]\n labels\
135
+ \ = [0, 1, 0]\n return {'features': training_data, 'labels': labels}\n\n@step\n\
136
+ def train_model(data: Dict[str, Any]) -> None:\n total_features = sum(map(sum,\
137
+ \ data['features']))\n total_labels = sum(data['labels'])\n \n # Train\
138
+ \ some model here\n \n print(f\"Trained model using {len(data['features'])}\
139
+ \ data points. \"\n f\"Feature sum is {total_features}, label sum is\
140
+ \ {total_labels}\")\n\n@pipeline \ndef simple_ml_pipeline(parameter: int):\n\
141
+ \ dataset = load_data(parameter=parameter) # Get the output \n train_model(dataset)\
142
+ \ # Pipe the previous step output into the downstream step\n\nIn this code, we\
143
+ \ define two steps: load_data and train_model. The load_data step takes an integer\
144
+ \ parameter and returns a dictionary containing training data and labels. The\
145
+ \ train_model step receives the dictionary from load_data, extracts the features\
146
+ \ and labels, and trains a model (not shown here).\n\nFinally, we define a pipeline\
147
+ \ simple_ml_pipeline that chains the load_data and train_model steps together.\
148
+ \ The output from load_data is passed as input to train_model, demonstrating how\
149
+ \ data flows between steps in a ZenML pipeline.\n\nPreviousDisable colorful loggingNextHow\
150
+ \ ZenML stores data\n\nLast updated 4 months ago"
151
  - '🧙Installation
152
 
153
 
 
233
 
234
 
235
  Running with Docker'
236
+ - "e details of the deployment process from the user.It needs to act as a ZenML\
237
+ \ BaseService registry, where every BaseService instance is used as an internal\
238
+ \ representation of a remote model server (see the find_model_server abstract\
239
+ \ method). To achieve this, it must be able to re-create the configuration of\
240
+ \ a BaseService from information that is persisted externally, alongside, or even\
241
+ \ as part of the remote model server configuration itself. For example, for model\
242
+ \ servers that are implemented as Kubernetes resources, the BaseService instances\
243
+ \ can be serialized and saved as Kubernetes resource annotations. This allows\
244
+ \ the model deployer to keep track of all externally running model servers and\
245
+ \ to re-create their corresponding BaseService instance representations at any\
246
+ \ given time. The model deployer also defines methods that implement basic life-cycle\
247
+ \ management on remote model servers outside the coverage of a pipeline (see stop_model_server\
248
+ \ , start_model_server and delete_model_server).\n\nPutting all these considerations\
249
+ \ together, we end up with the following interface:\n\nfrom abc import ABC, abstractmethod\n\
250
+ from typing import Dict, List, Optional, Type\nfrom uuid import UUID\n\nfrom zenml.enums\
251
+ \ import StackComponentType\nfrom zenml.services import BaseService, ServiceConfig\n\
252
+ from zenml.stack import StackComponent, StackComponentConfig, Flavor\n\nDEFAULT_DEPLOYMENT_START_STOP_TIMEOUT\
253
+ \ = 300\n\nclass BaseModelDeployerConfig(StackComponentConfig):\n \"\"\"Base\
254
+ \ class for all ZenML model deployer configurations.\"\"\"\n\nclass BaseModelDeployer(StackComponent,\
255
+ \ ABC):\n \"\"\"Base class for all ZenML model deployers.\"\"\"\n\n@abstractmethod\n\
256
+ \ def perform_deploy_model(\n self,\n id: UUID,\n config:\
257
+ \ ServiceConfig,\n timeout: int = DEFAULT_DEPLOYMENT_START_STOP_TIMEOUT,\n\
258
+ \ ) -> BaseService:\n \"\"\"Abstract method to deploy a model.\"\"\""
259
+ - source_sentence: How can I implement the abstract method to deploy a model using
260
+ ZenML?
261
+ sentences:
262
+ - "> \\\n --build_timeout=<BUILD_TIMEOUT_IN_SECONDS># Register and set a stack\
263
+ \ with the new image builder\nzenml stack register <STACK_NAME> -i <IMAGE_BUILDER_NAME>\
264
+ \ ... --set\n\nCaveats\n\nAs described in this Google Cloud Build documentation\
265
+ \ page, Google Cloud Build uses containers to execute the build steps which are\
266
+ \ automatically attached to a network called cloudbuild that provides some Application\
267
+ \ Default Credentials (ADC), that allow the container to be authenticated and\
268
+ \ therefore use other GCP services.\n\nBy default, the GCP Image Builder is executing\
269
+ \ the build command of the ZenML Pipeline Docker image with the option --network=cloudbuild,\
270
+ \ so the ADC provided by the cloudbuild network can also be used in the build.\
271
+ \ This is useful if you want to install a private dependency from a GCP Artifact\
272
+ \ Registry, but you will also need to use a custom base parent image with the\
273
+ \ keyrings.google-artifactregistry-auth installed, so pip can connect and authenticate\
274
+ \ in the private artifact registry to download the dependency.\n\nFROM zenmldocker/zenml:latest\n\
275
+ \nRUN pip install keyrings.google-artifactregistry-auth\n\nThe above Dockerfile\
276
+ \ uses zenmldocker/zenml:latest as a base image, but is recommended to change\
277
+ \ the tag to specify the ZenML version and Python version like 0.33.0-py3.10.\n\
278
+ \nPreviousKaniko Image BuilderNextDevelop a Custom Image Builder\n\nLast updated\
279
+ \ 21 days ago"
280
  - ":\n \"\"\"Abstract method to deploy a model.\"\"\"@staticmethod\n @abstractmethod\n\
281
  \ def get_model_server_info(\n service: BaseService,\n ) -> Dict[str,\
282
  \ Optional[str]]:\n \"\"\"Give implementation-specific way to extract relevant\
 
304
  \ version of the base implementation which aims to highlight the abstraction layer.\
305
  \ In order to see the full implementation and get the complete docstrings, please\
306
  \ check the SDK docs .\n\nBuilding your own model deployers"
307
+ - "se you decide to switch to another Data Validator.All you have to do is call\
308
+ \ the whylogs Data Validator methods when you need to interact with whylogs to\
309
+ \ generate data profiles. You may optionally enable whylabs logging to automatically\
310
+ \ upload the returned whylogs profile to WhyLabs, e.g.:\n\nimport pandas as pd\n\
311
+ from whylogs.core import DatasetProfileView\nfrom zenml.integrations.whylogs.data_validators.whylogs_data_validator\
312
+ \ import (\n WhylogsDataValidator,\n)\nfrom zenml.integrations.whylogs.flavors.whylogs_data_validator_flavor\
313
+ \ import (\n WhylogsDataValidatorSettings,\n)\nfrom zenml import step\n\nwhylogs_settings\
314
+ \ = WhylogsDataValidatorSettings(\n enable_whylabs=True, dataset_id=\"<WHYLABS_DATASET_ID>\"\
315
+ \n)\n\n@step(\n settings={\n \"data_validator\": whylogs_settings\n\
316
+ \ }\n)\ndef data_profiler(\n dataset: pd.DataFrame,\n) -> DatasetProfileView:\n\
317
+ \ \"\"\"Custom data profiler step with whylogs\n\nArgs:\n dataset: a\
318
+ \ Pandas DataFrame\n\nReturns:\n Whylogs profile generated for the data\n\
319
+ \ \"\"\"\n\n# validation pre-processing (e.g. dataset preparation) can take\
320
+ \ place here\n\ndata_validator = WhylogsDataValidator.get_active_data_validator()\n\
321
+ \ profile = data_validator.data_profiling(\n dataset,\n )\n #\
322
+ \ optionally upload the profile to WhyLabs, if WhyLabs credentials are configured\n\
323
+ \ data_validator.upload_profile_view(profile)\n\n# validation post-processing\
324
+ \ (e.g. interpret results, take actions) can happen here\n\nreturn profile\n\n\
325
+ Have a look at the complete list of methods and parameters available in the WhylogsDataValidator\
326
+ \ API in the SDK docs.\n\nCall whylogs directly\n\nYou can use the whylogs library\
327
+ \ directly in your custom pipeline steps, and only leverage ZenML's capability\
328
+ \ of serializing, versioning and storing the DatasetProfileView objects in its\
329
+ \ Artifact Store. You may optionally enable whylabs logging to automatically upload\
330
+ \ the returned whylogs profile to WhyLabs, e.g.:"
331
+ - source_sentence: How can I register and configure a GCP Service Connector for accessing
332
+ GCP Cloud Build services in ZenML?
333
  sentences:
334
+ - 'System Architectures
 
335
 
 
336
 
337
+ Different variations of the ZenML architecture depending on your needs.
338
 
 
339
 
340
+ PreviousZenML ProNextZenML SaaS
341
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
342
 
343
+ Last updated 21 days ago'
344
+ - "quired for your GCP Image Builder by running e.g.:zenml service-connector list-resources\
345
+ \ --resource-type gcp-generic\n\nExample Command Output\n\nThe following 'gcp-generic'\
346
+ \ resources can be accessed by service connectors that you have configured:\n\
347
+ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┓\n\
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
348
  ┃ CONNECTOR ID │ CONNECTOR NAME │ CONNECTOR TYPE │ RESOURCE\
349
  \ TYPE │ RESOURCE NAMES ┃\n┠──────────��───────────────────────────┼────────────────┼────────────────┼────────────────┼────────────────┨\n\
350
  ┃ bfdb657d-d808-47e7-9974-9ba6e4919d83 │ gcp-generic │ \U0001F535 gcp \
351
  \ │ \U0001F535 gcp-generic │ zenml-core ┃\n┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┛\n\
352
+ \nAfter having set up or decided on a GCP Service Connector to use to authenticate\
353
+ \ to GCP, you can register the GCP Image Builder as follows:\n\nzenml image-builder\
354
+ \ register <IMAGE_BUILDER_NAME> \\\n --flavor=gcp \\\n --cloud_builder_image=<BUILDER_IMAGE_NAME>\
355
+ \ \\\n --network=<DOCKER_NETWORK> \\\n --build_timeout=<BUILD_TIMEOUT_IN_SECONDS>\n\
356
+ \n# Connect the GCP Image Builder to GCP via a GCP Service Connector\nzenml image-builder\
357
+ \ connect <IMAGE_BUILDER_NAME> -i\n\nA non-interactive version that connects the\
358
+ \ GCP Image Builder to a target GCP Service Connector:\n\nzenml image-builder\
359
+ \ connect <IMAGE_BUILDER_NAME> --connector <CONNECTOR_ID>\n\nExample Command Output"
360
+ - ' your GCP Image Builder to the GCP cloud platform.To set up the GCP Image Builder
361
+ to authenticate to GCP and access the GCP Cloud Build services, it is recommended
362
+ to leverage the many features provided by the GCP Service Connector such as auto-configuration,
363
+ best security practices regarding long-lived credentials and reusing the same
364
+ credentials across multiple stack components.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
365
 
 
 
366
 
367
+ If you don''t already have a GCP Service Connector configured in your ZenML deployment,
368
+ you can register one using the interactive CLI command. You also have the option
369
+ to configure a GCP Service Connector that can be used to access more than just
370
+ the GCP Cloud Build service:
371
 
 
372
 
373
+ zenml service-connector register --type gcp -i
374
 
 
375
 
376
+ A non-interactive CLI example that leverages the Google Cloud CLI configuration
377
+ on your local machine to auto-configure a GCP Service Connector for the GCP Cloud
378
+ Build service:
379
 
 
 
380
 
381
+ zenml service-connector register <CONNECTOR_NAME> --type gcp --resource-type gcp-generic
382
+ --resource-name <GCS_BUCKET_NAME> --auto-configure
383
 
 
 
384
 
385
+ Example Command Output
386
 
 
387
 
388
+ $ zenml service-connector register gcp-generic --type gcp --resource-type gcp-generic
389
+ --auto-configure
390
 
391
+ Successfully registered service connector `gcp-generic` with access to the following
392
+ resources:
 
393
 
394
+ ┏━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┓
395
 
396
+ RESOURCE TYPE │ RESOURCE NAMES ┃
397
 
398
+ ┠────────────────┼────────────────┨
399
 
400
+ 🔵 gcp-generic zenml-core ┃
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
401
 
402
+ ┗━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┛
403
 
404
 
405
+ Note: Please remember to grant the entity associated with your GCP credentials
406
+ permissions to access the Cloud Build API and to run Cloud Builder jobs (e.g.
407
+ the Cloud Build Editor IAM role). The GCP Service Connector supports many different
408
+ authentication methods with different levels of security and convenience. You
409
+ should pick the one that best fits your use case.
410
 
411
 
412
+ If you already have one or more GCP Service Connectors configured in your ZenML
413
+ deployment, you can check which of them can be used to access generic GCP resources
414
+ like the GCP Image Builder required for your GCP Image Builder by running e.g.:'
415
+ - source_sentence: How can ZenML be used to finetune LLMs for specific tasks or to
416
+ improve their performance and cost?
417
  sentences:
418
+ - " build to finish. More information: Build Timeout.We can register the image builder\
419
+ \ and use it in our active stack:\n\nzenml image-builder register <IMAGE_BUILDER_NAME>\
420
+ \ \\\n --flavor=gcp \\\n --cloud_builder_image=<BUILDER_IMAGE_NAME> \\\n\
421
+ \ --network=<DOCKER_NETWORK> \\\n --build_timeout=<BUILD_TIMEOUT_IN_SECONDS>\n\
422
+ \n# Register and activate a stack with the new image builder\nzenml stack register\
423
+ \ <STACK_NAME> -i <IMAGE_BUILDER_NAME> ... --set\n\nYou also need to set up authentication\
424
+ \ required to access the Cloud Build GCP services.\n\nAuthentication Methods\n\
425
+ \nIntegrating and using a GCP Image Builder in your pipelines is not possible\
426
+ \ without employing some form of authentication. If you're looking for a quick\
427
+ \ way to get started locally, you can use the Local Authentication method. However,\
428
+ \ the recommended way to authenticate to the GCP cloud platform is through a GCP\
429
+ \ Service Connector. This is particularly useful if you are configuring ZenML\
430
+ \ stacks that combine the GCP Image Builder with other remote stack components\
431
+ \ also running in GCP.\n\nThis method uses the implicit GCP authentication available\
432
+ \ in the environment where the ZenML code is running. On your local machine, this\
433
+ \ is the quickest way to configure a GCP Image Builder. You don't need to supply\
434
+ \ credentials explicitly when you register the GCP Image Builder, as it leverages\
435
+ \ the local credentials and configuration that the Google Cloud CLI stores on\
436
+ \ your local machine. However, you will need to install and set up the Google\
437
+ \ Cloud CLI on your machine as a prerequisite, as covered in the Google Cloud\
438
+ \ documentation , before you register the GCP Image Builder.\n\nStacks using the\
439
+ \ GCP Image Builder set up with local authentication are not portable across environments.\
440
+ \ To make ZenML pipelines fully portable, it is recommended to use a GCP Service\
441
+ \ Connector to authenticate your GCP Image Builder to the GCP cloud platform."
442
+ - 'Finetuning LLMs with ZenML
443
+
444
+
445
+ Finetune LLMs for specific tasks or to improve performance and cost.
446
+
447
+
448
+ PreviousEvaluating finetuned embeddingsNextSet up a project repository
449
+
450
+
451
+ Last updated 6 months ago'
452
+ - "Spark\n\nExecuting individual steps on Spark\n\nThe spark integration brings\
453
+ \ two different step operators:\n\nStep Operator: The SparkStepOperator serves\
454
+ \ as the base class for all the Spark-related step operators.\n\nStep Operator:\
455
+ \ The KubernetesSparkStepOperator is responsible for launching ZenML steps as\
456
+ \ Spark applications with Kubernetes as a cluster manager.\n\nStep Operators:\
457
+ \ SparkStepOperator\n\nA summarized version of the implementation can be summarized\
458
+ \ in two parts. First, the configuration:\n\nfrom typing import Optional, Dict,\
459
+ \ Any\nfrom zenml.step_operators import BaseStepOperatorConfig\n\nclass SparkStepOperatorConfig(BaseStepOperatorConfig):\n\
460
+ \ \"\"\"Spark step operator config.\n\nAttributes:\n master: is the\
461
+ \ master URL for the cluster. You might see different\n schemes for\
462
+ \ different cluster managers which are supported by Spark\n like Mesos,\
463
+ \ YARN, or Kubernetes. Within the context of this PR,\n the implementation\
464
+ \ supports Kubernetes as a cluster manager.\n deploy_mode: can either be\
465
+ \ 'cluster' (default) or 'client' and it\n decides where the driver\
466
+ \ node of the application will run.\n submit_kwargs: is the JSON string\
467
+ \ of a dict, which will be used\n to define additional params if required\
468
+ \ (Spark has quite a\n lot of different parameters, so including them,\
469
+ \ all in the step\n operator was not implemented).\n \"\"\"\n\n\
470
+ master: str\n deploy_mode: str = \"cluster\"\n submit_kwargs: Optional[Dict[str,\
471
+ \ Any]] = None\n\nand then the implementation:\n\nfrom typing import List\nfrom\
472
+ \ pyspark.conf import SparkConf\n\nfrom zenml.step_operators import BaseStepOperator\n\
473
+ \nclass SparkStepOperator(BaseStepOperator):\n \"\"\"Base class for all Spark-related\
474
+ \ step operators.\"\"\"\n\ndef _resource_configuration(\n self,\n \
475
+ \ spark_config: SparkConf,\n resource_configuration: \"ResourceSettings\"\
476
+ ,\n ) -> None:\n \"\"\"Configures Spark to handle the resource configuration.\"\
477
+ \"\""
 
 
 
 
 
478
  pipeline_tag: sentence-similarity
479
  library_name: sentence-transformers
480
  metrics:
 
660
  type: dim_64
661
  metrics:
662
  - type: cosine_accuracy@1
663
+ value: 1.0
664
  name: Cosine Accuracy@1
665
  - type: cosine_accuracy@3
666
  value: 1.0
 
672
  value: 1.0
673
  name: Cosine Accuracy@10
674
  - type: cosine_precision@1
675
+ value: 1.0
676
  name: Cosine Precision@1
677
  - type: cosine_precision@3
678
  value: 0.3333333333333333
 
684
  value: 0.1
685
  name: Cosine Precision@10
686
  - type: cosine_recall@1
687
+ value: 1.0
688
  name: Cosine Recall@1
689
  - type: cosine_recall@3
690
  value: 1.0
 
696
  value: 1.0
697
  name: Cosine Recall@10
698
  - type: cosine_ndcg@10
699
+ value: 1.0
700
  name: Cosine Ndcg@10
701
  - type: cosine_mrr@10
702
+ value: 1.0
703
  name: Cosine Mrr@10
704
  - type: cosine_map@100
705
+ value: 1.0
706
  name: Cosine Map@100
707
  ---
708
 
 
757
  model = SentenceTransformer("zenml/finetuned-snowflake-arctic-embed-m-v1.5")
758
  # Run inference
759
  sentences = [
760
+ 'How can ZenML be used to finetune LLMs for specific tasks or to improve their performance and cost?',
761
+ 'Finetuning LLMs with ZenML\n\nFinetune LLMs for specific tasks or to improve performance and cost.\n\nPreviousEvaluating finetuned embeddingsNextSet up a project repository\n\nLast updated 6 months ago',
762
+ 'Spark\n\nExecuting individual steps on Spark\n\nThe spark integration brings two different step operators:\n\nStep Operator: The SparkStepOperator serves as the base class for all the Spark-related step operators.\n\nStep Operator: The KubernetesSparkStepOperator is responsible for launching ZenML steps as Spark applications with Kubernetes as a cluster manager.\n\nStep Operators: SparkStepOperator\n\nA summarized version of the implementation can be summarized in two parts. First, the configuration:\n\nfrom typing import Optional, Dict, Any\nfrom zenml.step_operators import BaseStepOperatorConfig\n\nclass SparkStepOperatorConfig(BaseStepOperatorConfig):\n """Spark step operator config.\n\nAttributes:\n master: is the master URL for the cluster. You might see different\n schemes for different cluster managers which are supported by Spark\n like Mesos, YARN, or Kubernetes. Within the context of this PR,\n the implementation supports Kubernetes as a cluster manager.\n deploy_mode: can either be \'cluster\' (default) or \'client\' and it\n decides where the driver node of the application will run.\n submit_kwargs: is the JSON string of a dict, which will be used\n to define additional params if required (Spark has quite a\n lot of different parameters, so including them, all in the step\n operator was not implemented).\n """\n\nmaster: str\n deploy_mode: str = "cluster"\n submit_kwargs: Optional[Dict[str, Any]] = None\n\nand then the implementation:\n\nfrom typing import List\nfrom pyspark.conf import SparkConf\n\nfrom zenml.step_operators import BaseStepOperator\n\nclass SparkStepOperator(BaseStepOperator):\n """Base class for all Spark-related step operators."""\n\ndef _resource_configuration(\n self,\n spark_config: SparkConf,\n resource_configuration: "ResourceSettings",\n ) -> None:\n """Configures Spark to handle the resource configuration."""',
763
  ]
764
  embeddings = model.encode(sentences)
765
  print(embeddings.shape)
 
869
  * Dataset: `dim_64`
870
  * Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator)
871
 
872
+ | Metric | Value |
873
+ |:--------------------|:--------|
874
+ | cosine_accuracy@1 | 1.0 |
875
+ | cosine_accuracy@3 | 1.0 |
876
+ | cosine_accuracy@5 | 1.0 |
877
+ | cosine_accuracy@10 | 1.0 |
878
+ | cosine_precision@1 | 1.0 |
879
+ | cosine_precision@3 | 0.3333 |
880
+ | cosine_precision@5 | 0.2 |
881
+ | cosine_precision@10 | 0.1 |
882
+ | cosine_recall@1 | 1.0 |
883
+ | cosine_recall@3 | 1.0 |
884
+ | cosine_recall@5 | 1.0 |
885
+ | cosine_recall@10 | 1.0 |
886
+ | cosine_ndcg@10 | 1.0 |
887
+ | cosine_mrr@10 | 1.0 |
888
+ | **cosine_map@100** | **1.0** |
889
 
890
  <!--
891
  ## Bias, Risks and Limitations
 
912
  | | positive | anchor |
913
  |:--------|:-----------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|
914
  | type | string | string |
915
+ | details | <ul><li>min: 13 tokens</li><li>mean: 23.19 tokens</li><li>max: 48 tokens</li></ul> | <ul><li>min: 31 tokens</li><li>mean: 320.53 tokens</li><li>max: 512 tokens</li></ul> |
916
  * Samples:
917
+ | positive | anchor |
918
+ |:------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
919
+ | <code>Where can I find older versions of the ZenML documentation?</code> | <code>ZenML - Bridging the gap between ML & Ops<br><br>Legacy Docs<br><br>Bleeding EdgeLegacy Docs0.67.0<br><br>🧙‍♂️Find older version our docs<br><br>Powered by GitBook</code> |
920
+ | <code>How can I set up authentication for a GCP Image Builder when registering it in ZenML?</code> | <code> build to finish. More information: Build Timeout.We can register the image builder and use it in our active stack:<br><br>zenml image-builder register <IMAGE_BUILDER_NAME> \<br> --flavor=gcp \<br> --cloud_builder_image=<BUILDER_IMAGE_NAME> \<br> --network=<DOCKER_NETWORK> \<br> --build_timeout=<BUILD_TIMEOUT_IN_SECONDS><br><br># Register and activate a stack with the new image builder<br>zenml stack register <STACK_NAME> -i <IMAGE_BUILDER_NAME> ... --set<br><br>You also need to set up authentication required to access the Cloud Build GCP services.<br><br>Authentication Methods<br><br>Integrating and using a GCP Image Builder in your pipelines is not possible without employing some form of authentication. If you're looking for a quick way to get started locally, you can use the Local Authentication method. However, the recommended way to authenticate to the GCP cloud platform is through a GCP Service Connector. This is particularly useful if you are configuring ZenML stacks that combine the GCP Image Builder with other remote stack components also running in GCP.<br><br>This method uses the implicit GCP authentication available in the environment where the ZenML code is running. On your local machine, this is the quickest way to configure a GCP Image Builder. You don't need to supply credentials explicitly when you register the GCP Image Builder, as it leverages the local credentials and configuration that the Google Cloud CLI stores on your local machine. However, you will need to install and set up the Google Cloud CLI on your machine as a prerequisite, as covered in the Google Cloud documentation , before you register the GCP Image Builder.<br><br>Stacks using the GCP Image Builder set up with local authentication are not portable across environments. To make ZenML pipelines fully portable, it is recommended to use a GCP Service Connector to authenticate your GCP Image Builder to the GCP cloud platform.</code> |
921
+ | <code>How can I switch to another Data Validator and enable WhyLabs logging for automatic profile uploads using ZenML?</code> | <code>se you decide to switch to another Data Validator.All you have to do is call the whylogs Data Validator methods when you need to interact with whylogs to generate data profiles. You may optionally enable whylabs logging to automatically upload the returned whylogs profile to WhyLabs, e.g.:<br><br>import pandas as pd<br>from whylogs.core import DatasetProfileView<br>from zenml.integrations.whylogs.data_validators.whylogs_data_validator import (<br> WhylogsDataValidator,<br>)<br>from zenml.integrations.whylogs.flavors.whylogs_data_validator_flavor import (<br> WhylogsDataValidatorSettings,<br>)<br>from zenml import step<br><br>whylogs_settings = WhylogsDataValidatorSettings(<br> enable_whylabs=True, dataset_id="<WHYLABS_DATASET_ID>"<br>)<br><br>@step(<br> settings={<br> "data_validator": whylogs_settings<br> }<br>)<br>def data_profiler(<br> dataset: pd.DataFrame,<br>) -> DatasetProfileView:<br> """Custom data profiler step with whylogs<br><br>Args:<br> dataset: a Pandas DataFrame<br><br>Returns:<br> Whylogs profile generated for the data<br> """<br><br># validation pre-processing (e.g. dataset preparation) can take place here<br><br>data_validator = WhylogsDataValidator.get_active_data_validator()<br> profile = data_validator.data_profiling(<br> dataset,<br> )<br> # optionally upload the profile to WhyLabs, if WhyLabs credentials are configured<br> data_validator.upload_profile_view(profile)<br><br># validation post-processing (e.g. interpret results, take actions) can happen here<br><br>return profile<br><br>Have a look at the complete list of methods and parameters available in the WhylogsDataValidator API in the SDK docs.<br><br>Call whylogs directly<br><br>You can use the whylogs library directly in your custom pipeline steps, and only leverage ZenML's capability of serializing, versioning and storing the DatasetProfileView objects in its Artifact Store. You may optionally enable whylabs logging to automatically upload the returned whylogs profile to WhyLabs, e.g.:</code> |
922
  * Loss: [<code>MatryoshkaLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#matryoshkaloss) with these parameters:
923
  ```json
924
  {
 
1075
  ### Training Logs
1076
  | Epoch | Step | dim_384_cosine_map@100 | dim_256_cosine_map@100 | dim_128_cosine_map@100 | dim_64_cosine_map@100 |
1077
  |:-------:|:-----:|:----------------------:|:----------------------:|:----------------------:|:---------------------:|
1078
+ | **1.0** | **1** | **1.0** | **1.0** | **1.0** | **1.0** |
1079
+ | 2.0 | 3 | 1.0 | 1.0 | 1.0 | 1.0 |
1080
+ | 3.0 | 4 | 1.0 | 1.0 | 1.0 | 1.0 |
1081
 
1082
  * The bold row denotes the saved checkpoint.
1083
 
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:24b8936c919b841952b05d08c369ac02d906ad7f6e4471b4141ddb8e9799e622
3
  size 435588776
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:463d27a3e88a748997316367c419bbdab4d809300a5f24b9b19ba9b2dc08ffdd
3
  size 435588776