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 time | |
| import boto3 | |
| import os | |
| import json | |
| from locust import User, task, between | |
| # How to use | |
| # 1. install locust & boto3 | |
| # pip install locust boto3 | |
| # 2. run benchmark via cli |
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
| #!/usr/bin/env python3 | |
| from aws_cdk import core as cdk | |
| import os | |
| from pathlib import Path | |
| import shutil | |
| import subprocess | |
| from aws_cdk import ( | |
| aws_iam as iam, | |
| aws_sagemaker as sagemaker, |
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 | |
| import sagemaker | |
| role = sagemaker.get_execution_role() | |
| hub = { 'HF_MODEL_ID':'bigscience/T0_3B','HF_TASK':'text2text-generation'} | |
| # create Hugging Face Model Class | |
| huggingface_model = HuggingFaceModel( | |
| transformers_version='4.6.1', | |
| pytorch_version='1.7.1', | |
| py_version='py36', |
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 torch | |
| import os | |
| from transformers import Wav2Vec2Processor, HubertForCTC | |
| from transformers.pipelines.automatic_speech_recognition import ffmpeg_read | |
| def get_file_size(file_path): | |
| size = os.path.getsize(file_path) | |
| return f"{round(size / 1000 / 1000,2)} MB" |
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 tarfile | |
| import os | |
| root = "./endpoint" | |
| def main(): | |
| cwd = os.getcwd() | |
| os.chdir(root) | |
| files = [os.path.join(path, name) for path, _, files in os.walk(".") for name in files] |
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 argparse import ArgumentParser | |
| from asyncio import get_event_loop, gather | |
| from multiprocessing import Process | |
| from requests import post, Session | |
| from re import compile | |
| from datasets import load_dataset | |
| from elasticsearch import Elasticsearch |
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
| const API_URL = "https:/{URL}/api/{TASK}" | |
| async function query(payload) { | |
| const body = JSON.stringify(payload) | |
| try { | |
| const response = await fetch(API_URL, { | |
| method: 'post', | |
| body | |
| }) | |
| return response.json(); |
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
| # automatic pipeline | |
| pipe=Pipeline('summarization',model="bart") | |
| pipe() | |
| # preprocess(input) | |
| # model(input) | |
| # postprocess(input) | |
| #-------------------------------------------------------------------------# |
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 | |
| # Hub Model configuration. https://huggingface.co/models | |
| hub = { | |
| 'MODEL_ID':'distilbert-base-uncased-distilled-squad', | |
| 'TASK':'question-answering' | |
| } | |
| # create Hugging Face Model Class | |
| huggingface_model = HuggingFaceModel( |
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
| { | |
| "context": "Saisonbedingt ging der Umsatz im ersten Quartal des Geschäftsjahres 2019 um 4 Prozent auf 1.970 Millionen Euro zurück, verglichen mit 1.047 Millionen Euro im vierten Quartal des vorangegangenen Geschäftsjahres. Leicht rückläufig war der Umsatz in den Segmenten Automotive (ATV) und Industrial Power Control (IPC). Im Vergleich zum Konzerndurchschnitt war der Rückgang im Segment Power Management & Multimarket (PMM) etwas ausgeprägter und im Segment Digital Security Solutions (DSS) deutlich ausgeprägter. Die Bruttomarge blieb von Quartal zu Quartal weitgehend stabil und fiel von 39,8 Prozent auf 39,5 Prozent. Darin enthalten sind akquisitionsbedingte Abschreibungen sowie sonstige Aufwendungen in Höhe von insgesamt 16 Millionen Euro, die hauptsächlich im Zusammenhang mit der internationalen Rectifier-Akquisition stehen. Die bereinigte Bruttomarge blieb ebenfalls nahezu unverändert und lag im ersten Quartal bei 40,4 Prozent, verglichen mit 40,6 Prozent im letzten Quartal des Geschäftsjahres 2018. Da |