This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | |
| "contentVersion": "1.0.0.0", | |
| "metadata": { | |
| "_generator": { | |
| "name": "bicep", | |
| "version": "0.12.40.16777", | |
| "templateHash": "4423847801202994493" | |
| } | |
| }, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tensorflow as tf | |
| from tensorflow.keras.optimizers import Adam | |
| from transformers import TFAutoModelForSequenceClassification,AutoTokenizer | |
| from datasets import load_dataset | |
| # load model and tokenizer | |
| model_id = "distilbert-base-uncased" | |
| model = TFAutoModelForSequenceClassification.from_pretrained(model_id, num_labels=5) | |
| tokenizer = AutoTokenizer.from_pretrained(model_id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Setup Ubuntu | |
| sudo apt update --yes | |
| sudo apt upgrade --yes | |
| # Get Miniconda and make it the main Python interpreter | |
| wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh | |
| bash ~/miniconda.sh -b -p ~/miniconda | |
| rm ~/miniconda.sh | |
| export PATH=~/miniconda/bin:$PATH |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # usage: | |
| # deepspeed --num_gpus 8 bloom-ds-inference.py --name bigscience/bloom | |
| # | |
| # to run benchmarks: | |
| # deepspeed --num_gpus 8 bloom-ds-inference.py --name bigscience/bloom --benchmark | |
| # | |
| # This is going to improve, but at the moment, the process is a bit cumbersome - we first use | |
| # 1. use Deepspeed-ZeRO to instantiate the model on GPUs, w/o loading the checkpoints, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sagemaker.huggingface.model import HuggingFaceModel | |
| from sagemaker.serverless import ServerlessInferenceConfig | |
| from sagemaker.serializers import DataSerializer | |
| import sagemaker | |
| import boto3 | |
| try: | |
| role = sagemaker.get_execution_role() | |
| except ValueError: | |
| iam = boto3.client('iam') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: argoproj.io/v1alpha1 | |
| kind: Workflow | |
| metadata: | |
| generateName: xgboost-trainer- | |
| annotations: {pipelines.kubeflow.org/kfp_sdk_version: 1.8.12, pipelines.kubeflow.org/pipeline_compilation_time: '2022-04-19T13:58:21.551241', | |
| pipelines.kubeflow.org/pipeline_spec: '{"description": "A trainer that does end-to-end | |
| distributed training for XGBoost models.", "inputs": [{"default": "gs://{{kfp-default-bucket}}", | |
| "name": "output", "optional": true}, {"default": "{{kfp-project-id}}", "name": | |
| "project", "optional": true}, {"default": "HALT_ON_ERROR", "name": "diagnostic_mode", | |
| "optional": true}, {"default": "5", "name": "rounds", "optional": true}], "name": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sagemaker.huggingface import HuggingFaceModel | |
| from sagemaker.serializers import DataSerializer | |
| import sagemaker | |
| role = sagemaker.get_execution_role() | |
| # Hub Model configuration. https://huggingface.co/models | |
| hub = { | |
| 'HF_MODEL_ID':'facebook/wav2vec2-base-960h', | |
| 'HF_TASK':'automatic-speech-recognition' |