From 253b1795e50b2bc46118dc56074d348a912dfae4 Mon Sep 17 00:00:00 2001 From: Phil Chen Date: Thu, 23 Feb 2023 23:41:27 -0800 Subject: [PATCH 01/28] Deployed 091041b with MkDocs version: 1.4.2 --- .nojekyll | 0 404.html | 492 ++ _images/model_bundle.png | Bin 0 -> 41350 bytes _images/model_endpoint.png | Bin 0 -> 65535 bytes _images/request_lifecycle.png | Bin 0 -> 111799 bytes _static/favicon-32x32.png | Bin 0 -> 1717 bytes _static/favicon.ico | Bin 0 -> 1150 bytes _static/file.png | Bin 0 -> 286 bytes _static/launch-logo.svg | 19 + _static/minus.png | Bin 0 -> 90 bytes _static/plus.png | Bin 0 -> 90 bytes api/client/index.html | 2659 +++++++ api/model_bundles/index.html | 924 +++ api/model_endpoints/index.html | 830 ++ assets/_mkdocstrings.css | 36 + assets/images/favicon.png | Bin 0 -> 1870 bytes assets/javascripts/bundle.2a6f1dda.min.js | 29 + assets/javascripts/bundle.2a6f1dda.min.js.map | 8 + assets/javascripts/lunr/min/lunr.ar.min.js | 1 + assets/javascripts/lunr/min/lunr.da.min.js | 18 + assets/javascripts/lunr/min/lunr.de.min.js | 18 + assets/javascripts/lunr/min/lunr.du.min.js | 18 + assets/javascripts/lunr/min/lunr.es.min.js | 18 + assets/javascripts/lunr/min/lunr.fi.min.js | 18 + assets/javascripts/lunr/min/lunr.fr.min.js | 18 + assets/javascripts/lunr/min/lunr.hi.min.js | 1 + assets/javascripts/lunr/min/lunr.hu.min.js | 18 + assets/javascripts/lunr/min/lunr.it.min.js | 18 + assets/javascripts/lunr/min/lunr.ja.min.js | 1 + assets/javascripts/lunr/min/lunr.jp.min.js | 1 + assets/javascripts/lunr/min/lunr.ko.min.js | 1 + assets/javascripts/lunr/min/lunr.multi.min.js | 1 + assets/javascripts/lunr/min/lunr.nl.min.js | 18 + assets/javascripts/lunr/min/lunr.no.min.js | 18 + assets/javascripts/lunr/min/lunr.pt.min.js | 18 + assets/javascripts/lunr/min/lunr.ro.min.js | 18 + assets/javascripts/lunr/min/lunr.ru.min.js | 18 + .../lunr/min/lunr.stemmer.support.min.js | 1 + assets/javascripts/lunr/min/lunr.sv.min.js | 18 + assets/javascripts/lunr/min/lunr.ta.min.js | 1 + assets/javascripts/lunr/min/lunr.th.min.js | 1 + assets/javascripts/lunr/min/lunr.tr.min.js | 18 + assets/javascripts/lunr/min/lunr.vi.min.js | 1 + assets/javascripts/lunr/min/lunr.zh.min.js | 1 + assets/javascripts/lunr/tinyseg.js | 206 + assets/javascripts/lunr/wordcut.js | 6708 +++++++++++++++++ .../workers/search.208ed371.min.js | 42 + .../workers/search.208ed371.min.js.map | 8 + assets/stylesheets/main.113286f1.min.css | 1 + assets/stylesheets/main.113286f1.min.css.map | 1 + assets/stylesheets/palette.a0c5b2b5.min.css | 1 + .../stylesheets/palette.a0c5b2b5.min.css.map | 1 + cli/index.html | 590 ++ concepts/batch_jobs/index.html | 598 ++ concepts/endpoint_predictions/index.html | 1008 +++ concepts/model_bundles/index.html | 846 +++ concepts/model_endpoints/index.html | 685 ++ index.html | 695 ++ objects.inv | 6 + search/search_index.json | 1 + sitemap.xml | 48 + sitemap.xml.gz | Bin 0 -> 277 bytes 62 files changed, 16723 insertions(+) create mode 100644 .nojekyll create mode 100644 404.html create mode 100644 _images/model_bundle.png create mode 100644 _images/model_endpoint.png create mode 100644 _images/request_lifecycle.png create mode 100644 _static/favicon-32x32.png create mode 100644 _static/favicon.ico create mode 100644 _static/file.png create mode 100644 _static/launch-logo.svg create mode 100644 _static/minus.png create mode 100644 _static/plus.png create mode 100644 api/client/index.html create mode 100644 api/model_bundles/index.html create mode 100644 api/model_endpoints/index.html create mode 100644 assets/_mkdocstrings.css create mode 100644 assets/images/favicon.png create mode 100644 assets/javascripts/bundle.2a6f1dda.min.js create mode 100644 assets/javascripts/bundle.2a6f1dda.min.js.map create mode 100644 assets/javascripts/lunr/min/lunr.ar.min.js create mode 100644 assets/javascripts/lunr/min/lunr.da.min.js create mode 100644 assets/javascripts/lunr/min/lunr.de.min.js create mode 100644 assets/javascripts/lunr/min/lunr.du.min.js create mode 100644 assets/javascripts/lunr/min/lunr.es.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hu.min.js create mode 100644 assets/javascripts/lunr/min/lunr.it.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ja.min.js create mode 100644 assets/javascripts/lunr/min/lunr.jp.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ko.min.js create mode 100644 assets/javascripts/lunr/min/lunr.multi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.nl.min.js create mode 100644 assets/javascripts/lunr/min/lunr.no.min.js create mode 100644 assets/javascripts/lunr/min/lunr.pt.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ro.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ru.min.js create mode 100644 assets/javascripts/lunr/min/lunr.stemmer.support.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sv.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ta.min.js create mode 100644 assets/javascripts/lunr/min/lunr.th.min.js create mode 100644 assets/javascripts/lunr/min/lunr.tr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.vi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.zh.min.js create mode 100644 assets/javascripts/lunr/tinyseg.js create mode 100644 assets/javascripts/lunr/wordcut.js create mode 100644 assets/javascripts/workers/search.208ed371.min.js create mode 100644 assets/javascripts/workers/search.208ed371.min.js.map create mode 100644 assets/stylesheets/main.113286f1.min.css create mode 100644 assets/stylesheets/main.113286f1.min.css.map create mode 100644 assets/stylesheets/palette.a0c5b2b5.min.css create mode 100644 assets/stylesheets/palette.a0c5b2b5.min.css.map create mode 100644 cli/index.html create mode 100644 concepts/batch_jobs/index.html create mode 100644 concepts/endpoint_predictions/index.html create mode 100644 concepts/model_bundles/index.html create mode 100644 concepts/model_endpoints/index.html create mode 100644 index.html create mode 100644 objects.inv create mode 100644 search/search_index.json create mode 100644 sitemap.xml create mode 100644 sitemap.xml.gz diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/404.html b/404.html new file mode 100644 index 00000000..89dd6b76 --- /dev/null +++ b/404.html @@ -0,0 +1,492 @@ + + + + + + + + + + + + + + + + + + + + Launch + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ +

404 - Not found

+ +
+
+ + + + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/_images/model_bundle.png b/_images/model_bundle.png new file mode 100644 index 0000000000000000000000000000000000000000..75667ae057bff39ef6679fad8d15d194aeb086d8 GIT binary patch literal 41350 zcmeFYby!s08aGS}B2og#9awVJb2f0+ zpLUlnaGc?4z1NH!XvLvR-7Q^>(1pLQxJ)DQ$y{^vQ8_0D_*ke$djY*URAjh zRXlE?+j_8!xWgltI(|NSgY3bsC+{Fs!G)-4^gZje5)KH5ub`}~;+B=#f&wP1 zn8p1cEA*Lfyh_|!OTSG@da2+kw%^GxF6N!Th>$RQ_3+1&km83@-7j$L#dcVG4 zKd?TjFh_IDI`Wjh*1_q-{DJ#S!M}(~lZ2wQf}=YQYc1T7AdLS7v+r}$PfzoUuwN&4 zl7~>Py)niO(U%VrMw*`5Xfry0GxXeYZweF2&m`VH%F>M;syoom6g$fwF9Lqn6`{7l zMs*rZK%2L=)P3RX!hCV4B=2wZl~bkZd5RFT3NbbeNeY=49aV|yJsYwT+O*i%Pwh$6 z{f{)i0x`3wFwq0!6u9_lEMH1JD#iGWbBz&$&=tJ)?$L*bVu)h_#3Rh5DpZh{RWD!4 zJoZF$p$I{$KQIA3R}@}hBNl!~GA!BzFp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3s_^FObl7j|NaCVy=3cQ!uwsOluh-q#+TmHR)Y`QwxPd!R<}u@jqrze@P| z)Bk;>4QkwvKc$1ROn;2}V?9;Jzzk}8{(O=5=j#Db_#awgVjS)NI)fUR;dR~9<%9X( y=E#T27@s^83<_oc@4Hw%1i(`N9}b~vX}y%lC4rm*>3}uhpV^U<#<_dh+v literal 0 HcmV?d00001 diff --git a/_static/favicon-32x32.png b/_static/favicon-32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..52c5a60587922b9433191bbcd20024cc55532fff GIT binary patch literal 1717 zcmV;m21@yfP)Px#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@ z1ONa40RR91AfN*P1ONa40RR91AOHXW0IY^$^8f$_A4x<(R9Fd>SIcf3MHH>-?wRq- z*v5&mP>9R~P^176vMg(4MHb>K<_p-u!doJ-=$`CwK7lp)kZe#^k=SMz%O=J|!T2#< zU7T}oS3f)sHZ4zg^{x9j_uQ)LYx~=;FMo2*JvMm}7p^cxUKpP{<7Uo!=gh1y=FG(A z6hA)COk~b&;_+_JZR`shS=)_G)QwEiOT6twHg3GfNo2c;G2O(QUdQ@QY;3m^`5tAl zG0~QNm|1T#Z;UgzJY0J3Eyvbi##)a7|KyT)nKLkfob&RGV5WBPLQ(6Y6OSA9=_}|) zc4FPQ^L17@H-!)&LMXcN0){|>OUi1`I?s0k56*)R4WgFdDY&SDLtrBs6U3w8R*Hxj zyytX8dAN!yGnEANumnRubV;9D)#EyoZDnxF$`S2GX*P9_ugZuD(B0~4^! z$+!T)oeY$@i8>h|I0BI^38`kS;S{)frXAl2>b(r8sxsk5J1Le+hL|oaJTibo5D#TV z!Dxx9U=#vo2o`+mHdMQ70nmu$ui{ICJkpUaUL+WSDp-A|iyH%=GMQK%ZKb*F4&9&>J%$8V$ZGESH{chR^5rbTJ5ybjvBQ2aVL1(m)%n%fzg=X27GSl|h)Td4I zeD8U`JM7M>?$b_gwS(8?@c8!^=G^3aW@)*P@VgMlTIq^vh>>amED4sOri~b34d@2q zd69JPE`Oirvmbr#V~>8op%?Jz36}6Q9~AxqPP89L%mVs>b5xDJLErY!8~Agy3wua^ z7v2+Q#BIocjK-`eL)O(!&@n-2Hs}Yw`q>xeDFj{MA3{9DcmO8@v?hyuhxGvZkeNZy zDfN1P9{)8(SZvYqD_SiyE00@XMCD=rT z3-kW)Ugitfmz`C?#YvzIKve>qzy%NWNk|YoOJgu$X-RqO91sw<#?m7qgd8@l3|I#IH2a!?0D~Ytx1ZoETF6&41QEC; zh)O2!Xla9ScoGEr0rrTH;n>ye!&Azj3x$5?E`s>feVj%S7ABY=SV9f@Ca|`$%{fj3>eb=%g{@OM&OYtAHS$J@eWA>Kg`s3>!4zO1ZM9 zdQyTngOeZf#dv?V5FMU%%;BkZhyS?Q;lM1tjw16Ng72{$RR$~of&4cHIkxW{eV8E# zn9yvN@BW@v{eS|;T~?NITgm1JWMb`Lg^L>f1k0fp zf$%2`$QHyo0H1ZuI4N9N>`9!BWj{bB)CJLB-WkDt`$-VDc5Y)$u;o_}QbH_3hG?Aw z@QM?STL_bgCKzz16ZQj+pJHEbF>%li_P)1?wXQc_$p`{5WnpUqjh2i|@c#n*e<=SU zUCxjohNCe)#Rl^r=7tOePy}H&SCC*K$y^CF0oFUbVX88A5qfc_Zd z;Lc8F3;*PF`BYDgMj+1LUw@by%)ec}n452?UO6O)w-0WoSYz40pB2%rh8S~F00000 LNkvXXu0mjfm literal 0 HcmV?d00001 diff --git a/_static/favicon.ico b/_static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..2aca5b035dd69fa9d7313ccbe0fa35d32e9e93ef GIT binary patch literal 1150 zcmbV~Jxjx25XVoDwlqsYa5L@F;#Uys3$$?)RK(d$!KI5JA~hY{ln&L!Ql#I*!NIMF zR4eqIRKI{jZK}16|4Z{o8Y5^EemU-PzvP}LA)3G$2oSCz+MOhtCZbt@5-P(w0uk;_ zNkh!sx@_e71SF6E^8QJi9+id!5?}_{+sTNYGZHwqTpwZzl-I5XK_gQ1z)68J2-H(#=)c%uW)0GjaK zT+5eN^8m6~~N53DapzCl=zaG1f7|~49&9!{~Misz&#p@NcN=mJuFXprGJKXCA`ehITK|xW` zs`hMrGg#P~ix$^RISR_I47Y|r1 z_CyJOe}D1){SET-^Amu_i71Lt6eYfZjRyw@I6OQAIXXHDfiX^GbOlHe=Ae4>0m)d(f|Me07*qoM6N<$f}vM^LjV8( literal 0 HcmV?d00001 diff --git a/_static/launch-logo.svg b/_static/launch-logo.svg new file mode 100644 index 00000000..1e9a4431 --- /dev/null +++ b/_static/launch-logo.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/_static/minus.png b/_static/minus.png new file mode 100644 index 0000000000000000000000000000000000000000..d96755fdaf8bb2214971e0db9c1fd3077d7c419d GIT binary patch literal 90 zcmeAS@N?(olHy`uVBq!ia0vp^+#t*WBp7;*Yy1LIik>cxAr*|t7R?Mi>2?kWtu=nj kDsEF_5m^0CR;1wuP-*O&G^0G}KYk!hp00i_>zopr08q^qX#fBK literal 0 HcmV?d00001 diff --git a/_static/plus.png b/_static/plus.png new file mode 100644 index 0000000000000000000000000000000000000000..7107cec93a979b9a5f64843235a16651d563ce2d GIT binary patch literal 90 zcmeAS@N?(olHy`uVBq!ia0vp^+#t*WBp7;*Yy1LIik>cxAr*|t7R?Mi>2?kWtu>-2 m3q%Vub%g%s<8sJhVPMczOq}xhg9DJoz~JfX=d#Wzp$Pyb1r*Kz literal 0 HcmV?d00001 diff --git a/api/client/index.html b/api/client/index.html new file mode 100644 index 00000000..9a163da8 --- /dev/null +++ b/api/client/index.html @@ -0,0 +1,2659 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + Launch Client - Launch + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+
+ +
+ + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + + + + + +
+
+ + + + +

Launch Client

+ + +
+ + + +

+ LaunchClient + + +

+
LaunchClient(
+    api_key: str,
+    endpoint: Optional[str] = None,
+    self_hosted: bool = False,
+)
+
+ +
+ + +

Scale Launch Python Client.

+ + +

Initializes a Scale Launch Client.

+ +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
api_key + str +

Your Scale API key

+ required +
endpoint + Optional[str] +

The Scale Launch Endpoint (this should not need to be changed)

+ None +
self_hosted + bool +

True iff you are connecting to a self-hosted Scale Launch

+ False +
+ + + + +
+ + + + + + + + + +
+ + + +

+ batch_async_request + + +

+
batch_async_request(
+    *,
+    model_bundle: Union[ModelBundle, str],
+    urls: List[str] = None,
+    inputs: Optional[List[Dict[str, Any]]] = None,
+    batch_url_file_location: Optional[str] = None,
+    serialization_format: str = "JSON",
+    labels: Optional[Dict[str, str]] = None,
+    cpus: Optional[int] = None,
+    memory: Optional[str] = None,
+    gpus: Optional[int] = None,
+    gpu_type: Optional[str] = None,
+    storage: Optional[str] = None,
+    max_workers: Optional[int] = None,
+    per_worker: Optional[int] = None
+) -> Dict[str, Any]
+
+ +
+ +

Sends a batch inference request using a given bundle. Returns a key that can be used to +retrieve the results of inference at a later time.

+

Must have exactly one of urls or inputs passed in.

+ +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
model_bundle + Union[ModelBundle, str] +

The bundle or the name of a the bundle to use for inference.

+ required +
urls + List[str] +

A list of urls, each pointing to a file containing model input. Must be +accessible by Scale Launch, hence urls need to either be public or signedURLs.

+ None +
inputs + Optional[List[Dict[str, Any]]] +

A list of model inputs, if exists, we will upload the inputs and pass it in +to Launch.

+ None +
batch_url_file_location + Optional[str] +

In self-hosted mode, the input to the batch job will be +uploaded to this location if provided. Otherwise, one will be determined from +bundle_location_fn()

+ None +
serialization_format + str +

Serialization format of output, either 'PICKLE' or 'JSON'. +'pickle' corresponds to pickling results + returning

+ 'JSON' +
labels + Optional[Dict[str, str]] +

An optional dictionary of key/value pairs to associate with this endpoint.

+ None +
cpus + Optional[int] +

Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than +or equal to 1.

+ None +
memory + Optional[str] +

Amount of memory each worker should get, e.g. "4Gi", "512Mi", etc. This must be +a positive amount of memory.

+ None +
storage + Optional[str] +

Amount of local ephemeral storage each worker should get, e.g. "4Gi", "512Mi", +etc. This must be a positive amount of storage.

+ None +
gpus + Optional[int] +

Number of gpus each worker should get, e.g. 0, 1, etc.

+ None +
max_workers + Optional[int] +

The maximum number of workers. Must be greater than or equal to 0, and as +well as greater than or equal to min_workers.

+ None +
per_worker + Optional[int] +

The maximum number of concurrent requests that an individual worker can +service. Launch automatically scales the number of workers for the endpoint so that +each worker is processing per_worker requests:

+
    +
  • If the average number of concurrent requests per worker is lower than + per_worker, then the number of workers will be reduced.
  • +
  • Otherwise, if the average number of concurrent requests per worker is higher + than per_worker, then the number of workers will be increased to meet the + elevated traffic.
  • +
+ None +
gpu_type + Optional[str] +

If specifying a non-zero number of gpus, this controls the type of gpu +requested. Here are the supported values:

+
    +
  • nvidia-tesla-t4
  • +
  • nvidia-ampere-a10
  • +
+ None +
+ +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ Dict[str, Any] +

A dictionary that contains job_id as a key, and the ID as the value.

+ +
+ +
+ +
+ + + +

+ clone_model_bundle_with_changes + + +

+
clone_model_bundle_with_changes(
+    model_bundle: Union[ModelBundle, str],
+    app_config: Optional[Dict] = None,
+) -> ModelBundle
+
+ +
+ +

Clones an existing model bundle with changes to its app config. (More fields coming soon)

+ +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
model_bundle + Union[ModelBundle, str] +

The existing bundle or its ID.

+ required +
app_config + Optional[Dict] +

The new bundle's app config, if not passed in, the new +bundle's app_config will be set to None

+ None +
+ +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ ModelBundle +

A ModelBundle object

+ +
+ +
+ +
+ + + +

+ create_model_bundle + + +

+
create_model_bundle(
+    model_bundle_name: str,
+    env_params: Dict[str, str],
+    *,
+    load_predict_fn: Optional[
+        Callable[[LaunchModel_T], Callable[[Any], Any]]
+    ] = None,
+    predict_fn_or_cls: Optional[
+        Callable[[Any], Any]
+    ] = None,
+    requirements: Optional[List[str]] = None,
+    model: Optional[LaunchModel_T] = None,
+    load_model_fn: Optional[
+        Callable[[], LaunchModel_T]
+    ] = None,
+    app_config: Optional[Union[Dict[str, Any], str]] = None,
+    globals_copy: Optional[Dict[str, Any]] = None,
+    request_schema: Optional[Type[BaseModel]] = None,
+    response_schema: Optional[Type[BaseModel]] = None
+) -> ModelBundle
+
+ +
+ +

Uploads and registers a model bundle to Scale Launch.

+

A model bundle consists of exactly one of the following:

+
    +
  • predict_fn_or_cls
  • +
  • load_predict_fn + model
  • +
  • load_predict_fn + load_model_fn
  • +
+

Pre/post-processing code can be included inside load_predict_fn/model or in +predict_fn_or_cls call.

+ +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
model_bundle_name + str +

The name of the model bundle you want to create. The name +must be unique across all bundles that you own.

+ required +
predict_fn_or_cls + Optional[Callable[[Any], Any]] +

Function or a Callable class that runs end-to-end +(pre/post processing and model inference) on the call. i.e. +predict_fn_or_cls(REQUEST) -> RESPONSE.

+ None +
model + Optional[LaunchModel_T] +

Typically a trained Neural Network, e.g. a Pytorch module.

+

Exactly one of model and load_model_fn must be provided.

+ None +
load_model_fn + Optional[Callable[[], LaunchModel_T]] +

A function that, when run, loads a model. This function is essentially +a deferred wrapper around the model argument.

+

Exactly one of model and load_model_fn must be provided.

+ None +
load_predict_fn + Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]] +

Function that, when called with a model, returns a function that +carries out inference.

+

If model is specified, then this is equivalent +to: + load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

+

Otherwise, if load_model_fn is specified, then this is equivalent to: +load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

+

In both cases, predict_fn is then the inference function, i.e.: + predict_fn(REQUEST) -> RESPONSE

+ None +
requirements + Optional[List[str]] +

A list of python package requirements, where each list element is of +the form <package_name>==<package_version>, e.g.

+

["tensorflow==2.3.0", "tensorflow-hub==0.11.0"]

+

If you do not pass in a value for requirements, then you must pass in +globals() for the globals_copy argument.

+ None +
app_config + Optional[Union[Dict[str, Any], str]] +

Either a Dictionary that represents a YAML file contents or a local path +to a YAML file.

+ None +
env_params + Dict[str, str] +

A dictionary that dictates environment information e.g. +the use of pytorch or tensorflow, which base image tag to use, etc. +Specifically, the dictionary should contain the following keys:

+
    +
  • +

    framework_type: either tensorflow or pytorch. - PyTorch fields: - +pytorch_image_tag: An image tag for the pytorch docker base image. The +list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - +Example:

    +

    .. code-block:: python

    +

    { + "framework_type": "pytorch", + "pytorch_image_tag": "1.10.0-cuda11.3-cudnn8-runtime" + }

    +
  • +
  • +

    Tensorflow fields:

    +
      +
    • tensorflow_version: Version of tensorflow, e.g. "2.3.0".
    • +
    +
  • +
+ required +
globals_copy + Optional[Dict[str, Any]] +

Dictionary of the global symbol table. Normally provided by +globals() built-in function.

+ None +
request_schema + Optional[Type[BaseModel]] +

A pydantic model that represents the request schema for the model +bundle. This is used to validate the request body for the model bundle's endpoint.

+ None +
response_schema + Optional[Type[BaseModel]] +

A pydantic model that represents the request schema for the model +bundle. This is used to validate the response for the model bundle's endpoint. +Note: If request_schema is specified, then response_schema must also be specified.

+ None +
+ +
+ +
+ +
+ + + +

+ create_model_bundle_from_dirs + + +

+
create_model_bundle_from_dirs(
+    *,
+    model_bundle_name: str,
+    base_paths: List[str],
+    requirements_path: str,
+    env_params: Dict[str, str],
+    load_predict_fn_module_path: str,
+    load_model_fn_module_path: str,
+    app_config: Optional[Union[Dict[str, Any], str]] = None,
+    request_schema: Optional[Type[BaseModel]] = None,
+    response_schema: Optional[Type[BaseModel]] = None
+) -> ModelBundle
+
+ +
+ +

Packages up code from one or more local filesystem folders and uploads them as a bundle +to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

+

For example, if you have a directory structure like so, and your current working +directory is also my_root:

+

.. code-block:: text

+

my_root/ + my_module1/ + init.py + ...files and directories + my_inference_file.py + my_module2/ + init.py + ...files and directories

+

then calling create_model_bundle_from_dirs with base_paths=["my_module1", +"my_module2"] essentially creates a zip file without the root directory, e.g.:

+

.. code-block:: text

+

my_module1/ + init.py + ...files and directories + my_inference_file.py + my_module2/ + init.py + ...files and directories

+

and these contents will be unzipped relative to the server side application root. Bear +these points in mind when referencing Python module paths for this bundle. For instance, +if my_inference_file.py has def f(...) as the desired inference loading function, +then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

+ +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
model_bundle_name + str +

The name of the model bundle you want to create. The name +must be unique across all bundles that you own.

+ required +
base_paths + List[str] +

The paths on the local filesystem where the bundle code lives.

+ required +
requirements_path + str +

A path on the local filesystem where a requirements.txt file +lives.

+ required +
env_params + Dict[str, str] +

A dictionary that dictates environment information e.g. +the use of pytorch or tensorflow, which base image tag to use, etc. +Specifically, the dictionary should contain the following keys:

+
    +
  • +

    framework_type: either tensorflow or pytorch. - PyTorch fields: - +pytorch_image_tag: An image tag for the pytorch docker base image. The +list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - +Example:

    +

    .. code-block:: python

    +

    { + "framework_type": "pytorch", + "pytorch_image_tag": "1.10.0-cuda11.3-cudnn8-runtime" + }

    +
  • +
+ required +
load_predict_fn_module_path + str +

A python module path for a function that, when called +with the output of load_model_fn_module_path, returns a function that carries out +inference.

+ required +
load_model_fn_module_path + str +

A python module path for a function that returns a model. +The output feeds into the function located at load_predict_fn_module_path.

+ required +
app_config + Optional[Union[Dict[str, Any], str]] +

Either a Dictionary that represents a YAML file contents or a local path +to a YAML file.

+ None +
request_schema + Optional[Type[BaseModel]] +

A pydantic model that represents the request schema for the model +bundle. This is used to validate the request body for the model bundle's endpoint.

+ None +
response_schema + Optional[Type[BaseModel]] +

A pydantic model that represents the request schema for the model +bundle. This is used to validate the response for the model bundle's endpoint. +Note: If request_schema is specified, then response_schema must also be specified.

+ None +
+ +
+ +
+ +
+ + + +

+ create_model_endpoint + + +

+
create_model_endpoint(
+    *,
+    endpoint_name: str,
+    model_bundle: Union[ModelBundle, str],
+    cpus: int = 3,
+    memory: str = "8Gi",
+    storage: Optional[str] = None,
+    gpus: int = 0,
+    min_workers: int = 1,
+    max_workers: int = 1,
+    per_worker: int = 10,
+    gpu_type: Optional[str] = None,
+    endpoint_type: str = "sync",
+    post_inference_hooks: Optional[
+        List[PostInferenceHooks]
+    ] = None,
+    default_callback_url: Optional[str] = None,
+    update_if_exists: bool = False,
+    labels: Optional[Dict[str, str]] = None
+) -> Optional[Endpoint]
+
+ +
+ +

Creates and registers a model endpoint in Scale Launch. The returned object is an +instance of type Endpoint, which is a base class of either SyncEndpoint or +AsyncEndpoint. This is the object to which you sent inference requests.

+ +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
endpoint_name + str +

The name of the model endpoint you want to create. The name +must be unique across all endpoints that you own.

+ required +
model_bundle + Union[ModelBundle, str] +

The ModelBundle that the endpoint should serve.

+ required +
cpus + int +

Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater +than or equal to 1.

+ 3 +
memory + str +

Amount of memory each worker should get, e.g. "4Gi", "512Mi", etc. This must +be a positive amount of memory.

+ '8Gi' +
storage + Optional[str] +

Amount of local ephemeral storage each worker should get, e.g. "4Gi", +"512Mi", etc. This must be a positive amount of storage.

+ None +
gpus + int +

Number of gpus each worker should get, e.g. 0, 1, etc.

+ 0 +
min_workers + int +

The minimum number of workers. Must be greater than or equal to 0. This +should be determined by computing the minimum throughput of your workload and +dividing it by the throughput of a single worker. This field must be at least 1 +for synchronous endpoints.

+ 1 +
max_workers + int +

The maximum number of workers. Must be greater than or equal to 0, +and as well as greater than or equal to min_workers. This should be determined by +computing the maximum throughput of your workload and dividing it by the throughput +of a single worker.

+ 1 +
per_worker + int +

The maximum number of concurrent requests that an individual worker can +service. Launch automatically scales the number of workers for the endpoint so that +each worker is processing per_worker requests, subject to the limits defined by +min_workers and max_workers.

+
    +
  • If the average number of concurrent requests per worker is lower than +per_worker, then the number of workers will be reduced. - Otherwise, +if the average number of concurrent requests per worker is higher than +per_worker, then the number of workers will be increased to meet the elevated +traffic.
  • +
+

Here is our recommendation for computing per_worker:

+
    +
  1. Compute min_workers and max_workers per your minimum and maximum +throughput requirements. 2. Determine a value for the maximum number of +concurrent requests in the workload. Divide this number by max_workers. Doing +this ensures that the number of workers will "climb" to max_workers.
  2. +
+ 10 +
gpu_type + Optional[str] +

If specifying a non-zero number of gpus, this controls the type of gpu +requested. Here are the supported values:

+
    +
  • nvidia-tesla-t4
  • +
  • nvidia-ampere-a10
  • +
+ None +
endpoint_type + str +

Either "sync" or "async".

+ 'sync' +
post_inference_hooks + Optional[List[PostInferenceHooks]] +

List of hooks to trigger after inference tasks are served.

+ None +
default_callback_url + Optional[str] +

The default callback url to use for async endpoints. +This can be overridden in the task parameters for each individual task. +post_inference_hooks must contain "callback" for the callback to be triggered.

+ None +
update_if_exists + bool +

If True, will attempt to update the endpoint if it exists. +Otherwise, will unconditionally try to create a new endpoint. Note that endpoint +names for a given user must be unique, so attempting to call this function with +update_if_exists=False for an existing endpoint will raise an error.

+ False +
labels + Optional[Dict[str, str]] +

An optional dictionary of key/value pairs to associate with this endpoint.

+ None +
+ +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ Optional[Endpoint] +

A Endpoint object that can be used to make requests to the endpoint.

+ +
+ +
+ +
+ + + +

+ delete_model_endpoint + + +

+
delete_model_endpoint(
+    model_endpoint: Union[ModelEndpoint, str]
+)
+
+ +
+ +

Deletes a model endpoint.

+ +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
model_endpoint + Union[ModelEndpoint, str] +

A ModelEndpoint object.

+ required +
+ +
+ +
+ +
+ + + +

+ edit_model_endpoint + + +

+
edit_model_endpoint(
+    *,
+    model_endpoint: Union[ModelEndpoint, str],
+    model_bundle: Optional[Union[ModelBundle, str]] = None,
+    cpus: Optional[float] = None,
+    memory: Optional[str] = None,
+    storage: Optional[str] = None,
+    gpus: Optional[int] = None,
+    min_workers: Optional[int] = None,
+    max_workers: Optional[int] = None,
+    per_worker: Optional[int] = None,
+    gpu_type: Optional[str] = None,
+    post_inference_hooks: Optional[
+        List[PostInferenceHooks]
+    ] = None,
+    default_callback_url: Optional[str] = None
+) -> None
+
+ +
+ +

Edits an existing model endpoint. Here are the fields that cannot be edited on an +existing endpoint:

+
    +
  • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint +to an AsyncEndpoint or vice versa.
  • +
+ +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
model_endpoint + Union[ModelEndpoint, str] +

The model endpoint (or its name) you want to edit. The name +must be unique across all endpoints that you own.

+ required +
model_bundle + Optional[Union[ModelBundle, str]] +

The ModelBundle that the endpoint should serve.

+ None +
cpus + Optional[float] +

Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater +than or equal to 1.

+ None +
memory + Optional[str] +

Amount of memory each worker should get, e.g. "4Gi", "512Mi", etc. This must +be a positive amount of memory.

+ None +
storage + Optional[str] +

Amount of local ephemeral storage each worker should get, e.g. "4Gi", +"512Mi", etc. This must be a positive amount of storage.

+ None +
gpus + Optional[int] +

Number of gpus each worker should get, e.g. 0, 1, etc.

+ None +
min_workers + Optional[int] +

The minimum number of workers. Must be greater than or equal to 0.

+ None +
max_workers + Optional[int] +

The maximum number of workers. Must be greater than or equal to 0, +and as well as greater than or equal to min_workers.

+ None +
per_worker + Optional[int] +

The maximum number of concurrent requests that an individual worker can +service. Launch automatically scales the number of workers for the endpoint so that +each worker is processing per_worker requests:

+
    +
  • If the average number of concurrent requests per worker is lower than +per_worker, then the number of workers will be reduced. - Otherwise, +if the average number of concurrent requests per worker is higher than +per_worker, then the number of workers will be increased to meet the elevated +traffic.
  • +
+ None +
gpu_type + Optional[str] +

If specifying a non-zero number of gpus, this controls the type of gpu +requested. Here are the supported values:

+
    +
  • nvidia-tesla-t4
  • +
  • nvidia-ampere-a10
  • +
+ None +
post_inference_hooks + Optional[List[PostInferenceHooks]] +

List of hooks to trigger after inference tasks are served.

+ None +
default_callback_url + Optional[str] +

The default callback url to use for async endpoints. +This can be overridden in the task parameters for each individual task. +post_inference_hooks must contain "callback" for the callback to be triggered.

+ None +
+ +
+ +
+ +
+ + + +

+ get_batch_async_response + + +

+
get_batch_async_response(
+    batch_job_id: str,
+) -> Dict[str, Any]
+
+ +
+ +

Gets inference results from a previously created batch job.

+ +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
batch_job_id + str +

An id representing the batch task job. This id is the in the response from +calling batch_async_request.

+ required +
+ +

Returns:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TypeDescription
+ Dict[str, Any] +

A dictionary that contains the following fields:

+ Dict[str, Any] +
    +
  • status: The status of the job.
  • +
+ Dict[str, Any] +
    +
  • result: The url where the result is stored.
  • +
+ Dict[str, Any] +
    +
  • duration: A string representation of how long the job took to finish + or how long it has been running, for a job current in progress.
  • +
+ Dict[str, Any] +
    +
  • num_tasks_pending: The number of tasks that are still pending.
  • +
+ Dict[str, Any] +
    +
  • num_tasks_completed: The number of tasks that have completed.
  • +
+ +
+ +
+ +
+ + + +

+ get_model_bundle + + +

+
get_model_bundle(
+    model_bundle: Union[ModelBundle, str]
+) -> ModelBundle
+
+ +
+ +

Returns a model bundle specified by bundle_name that the user owns.

+ +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
model_bundle + Union[ModelBundle, str] +

The bundle or its name.

+ required +
+ +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ ModelBundle +

A ModelBundle object

+ +
+ +
+ +
+ + + +

+ get_model_endpoint + + +

+
get_model_endpoint(
+    endpoint_name: str,
+) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]
+
+ +
+ +

Gets a model endpoint associated with a name.

+ +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
endpoint_name + str +

The name of the endpoint to retrieve.

+ required +
+ +
+ +
+ +
+ + + +

+ list_model_bundles + + +

+
list_model_bundles() -> List[ModelBundle]
+
+ +
+ +

Returns a list of model bundles that the user owns.

+ +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[ModelBundle] +

A list of ModelBundle objects

+ +
+ +
+ +
+ + + +

+ list_model_endpoints + + +

+
list_model_endpoints() -> List[Endpoint]
+
+ +
+ +

Lists all model endpoints that the user owns.

+ +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ List[Endpoint] +

A list of ModelEndpoint objects.

+ +
+ +
+ +
+ + + +

+ read_endpoint_creation_logs + + +

+
read_endpoint_creation_logs(
+    model_endpoint: Union[ModelEndpoint, str]
+)
+
+ +
+ +

Retrieves the logs for the creation of the endpoint.

+ +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
model_endpoint + Union[ModelEndpoint, str] +

The endpoint or its name.

+ required +
+ +
+ +
+ +
+ + + +

+ register_batch_csv_location_fn + + +

+
register_batch_csv_location_fn(
+    batch_csv_location_fn: Callable[[], str]
+)
+
+ +
+ +

For self-hosted mode only. Registers a function that gives a location for batch CSV +inputs. Should give different locations each time. This function is called as +batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can +take.

+

Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is +that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes +in an object of type T as its second argument (i.e. batch_csv_url).

+ +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
batch_csv_location_fn + Callable[[], str] +

Function that generates batch_csv_urls for upload_batch_csv_fn.

+ required +
+ +
+ +
+ +
+ + + +

+ register_bundle_location_fn + + +

+
register_bundle_location_fn(
+    bundle_location_fn: Callable[[], str]
+)
+
+ +
+ +

For self-hosted mode only. Registers a function that gives a location for a model bundle. +Should give different locations each time. This function is called as +bundle_location_fn(), and should return a bundle_url that +register_upload_bundle_fn can take.

+

Strictly, bundle_location_fn() does not need to return a str. The only +requirement is that if bundle_location_fn returns a value of type T, +then upload_bundle_fn() takes in an object of type T as its second argument (i.e. +bundle_url).

+ +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
bundle_location_fn + Callable[[], str] +

Function that generates bundle_urls for upload_bundle_fn.

+ required +
+ +
+ +
+ +
+ + + +

+ register_upload_batch_csv_fn + + +

+
register_upload_batch_csv_fn(
+    upload_batch_csv_fn: Callable[[str, str], None]
+)
+
+ +
+ +

For self-hosted mode only. Registers a function that handles batch text upload. This +function is called as

+
upload_batch_csv_fn(csv_text, csv_url)
+
+

This function should directly write the contents of csv_text as a text string into +csv_url.

+ +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
upload_batch_csv_fn + Callable[[str, str], None] +

Function that takes in a csv text (string type), +and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

+ required +
+ +
+ +
+ +
+ + + +

+ register_upload_bundle_fn + + +

+
register_upload_bundle_fn(
+    upload_bundle_fn: Callable[[str, str], None]
+)
+
+ +
+ +

For self-hosted mode only. Registers a function that handles model bundle upload. This +function is called as

+
upload_bundle_fn(serialized_bundle, bundle_url)
+
+

This function should directly write the contents of serialized_bundle as a +binary string into bundle_url.

+

See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

+ +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
upload_bundle_fn + Callable[[str, str], None] +

Function that takes in a serialized bundle (bytes type), +and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

+ required +
+ +
+ +
+ + + +
+ +
+ +
+ + + + + + +
+
+ + + + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/api/model_bundles/index.html b/api/model_bundles/index.html new file mode 100644 index 00000000..ae70d58b --- /dev/null +++ b/api/model_bundles/index.html @@ -0,0 +1,924 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + Model Bundles - Launch + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + +

Model Bundles

+ + +
+ + + +

+ ModelBundle + + + + dataclass + + +

+ + +
+ + +

Represents a ModelBundle.

+ + + + + +
+ + + + + + + +
+ + + +

+ app_config + + + + class-attribute + + +

+
app_config: Optional[Dict[Any, Any]] = None
+
+ +
+ +

An optional user-specified configuration mapping for the bundle.

+
+ +
+ +
+ + + +

+ env_params + + + + class-attribute + + +

+
env_params: Optional[Dict[str, str]] = None
+
+ +
+ +

A dictionary that dictates environment information. See LaunchClient.create_model_bundle +for more information.

+
+ +
+ +
+ + + +

+ id + + + + class-attribute + + +

+
id: Optional[str] = None
+
+ +
+ +

A globally unique identifier for the bundle.

+
+ +
+ +
+ + + +

+ location + + + + class-attribute + + +

+
location: Optional[str] = None
+
+ +
+ +

An opaque location for the bundle.

+
+ +
+ +
+ + + +

+ metadata + + + + class-attribute + + +

+
metadata: Optional[Dict[Any, Any]] = None
+
+ +
+ +

Arbitrary metadata for the bundle.

+
+ +
+ +
+ + + +

+ name + + + + class-attribute + + +

+
name: str
+
+ +
+ +

The name of the bundle. Must be unique across all bundles that the user owns.

+
+ +
+ +
+ + + +

+ packaging_type + + + + class-attribute + + +

+
packaging_type: Optional[str] = None
+
+ +
+ +

The packaging type for the bundle. Can be cloudpickle or zip.

+
+ +
+ +
+ + + +

+ requirements + + + + class-attribute + + +

+
requirements: Optional[List[str]] = None
+
+ +
+ +

A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle +for more information.

+
+ +
+ + + + + +
+ +
+ +
+ + + + + + +
+
+ + + + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/api/model_endpoints/index.html b/api/model_endpoints/index.html new file mode 100644 index 00000000..412dd6e2 --- /dev/null +++ b/api/model_endpoints/index.html @@ -0,0 +1,830 @@ + + + + + + + + + + + + + + + + + + + + + + + + Model Endpoints - Launch + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + +

Model Endpoints

+

All classes here are returned by the +get_model_endpoint +method and provide a predict function.

+ + +
+ + + +

+ AsyncEndpoint + + +

+
AsyncEndpoint(model_endpoint: ModelEndpoint, client)
+
+ +
+

+ Bases: Endpoint

+ + +

An asynchronous model endpoint.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
model_endpoint + ModelEndpoint +

ModelEndpoint object.

+ required +
client +

A LaunchClient object

+ required +
+ + + + +
+ + + + + + + + + +
+ + + +

+ predict + + +

+
predict(request: EndpointRequest) -> EndpointResponseFuture
+
+ +
+ +

Runs an asynchronous prediction request.

+ +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
request + EndpointRequest +

The EndpointRequest object that contains the payload.

+ required +
+ +

Returns:

+ + + + + + + + + + + + + + + + + + + + + +
Name TypeDescription
+ EndpointResponseFuture +

An EndpointResponseFuture such the user can use to query the status of the request.

Example + EndpointResponseFuture +
+ EndpointResponseFuture +

.. code-block:: python

+

my_endpoint = AsyncEndpoint(...) +f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) +result = f.get() # blocks on completion

+ +
+ +
+ +
+ + + +

+ predict_batch + + +

+
predict_batch(
+    requests: Sequence[EndpointRequest],
+) -> AsyncEndpointBatchResponse
+
+ +
+ +

(deprecated) +Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

+ +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
requests + Sequence[EndpointRequest] +

List of EndpointRequests. Request_ids must all be distinct.

+ required +
+ +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ AsyncEndpointBatchResponse +

an AsyncEndpointResponse keeping track of the inference requests made

+ +
+ +
+ + + +
+ +
+ +
+ + + + + + +
+
+ + + + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/assets/_mkdocstrings.css b/assets/_mkdocstrings.css new file mode 100644 index 00000000..a65078d0 --- /dev/null +++ b/assets/_mkdocstrings.css @@ -0,0 +1,36 @@ + +/* Don't capitalize names. */ +h5.doc-heading { + text-transform: none !important; +} + +/* Avoid breaking parameters name, etc. in table cells. */ +.doc-contents td code { + word-break: normal !important; +} + +/* For pieces of Markdown rendered in table cells. */ +.doc-contents td p { + margin-top: 0 !important; + margin-bottom: 0 !important; +} + +/* Max width for docstring sections tables. */ +.doc .md-typeset__table, +.doc .md-typeset__table table { + display: table !important; + width: 100%; +} +.doc .md-typeset__table tr { + display: table-row; +} + +/* Avoid line breaks in rendered fields. */ +.field-body p { + display: inline; +} + +/* Defaults in Spacy table style. */ +.doc-param-default { + float: right; +} diff --git a/assets/images/favicon.png b/assets/images/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..1cf13b9f9d978896599290a74f77d5dbe7d1655c GIT binary patch literal 1870 zcmV-U2eJ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q! zS<8954|P8mXN2MRs86xZ&Q4EfM@JB94b=(YGuk)s&^jiSF=t3*oNK3`rD{H`yQ?d; ztE=laAUoZx5?RC8*WKOj`%LXEkgDd>&^Q4M^z`%u0rg-It=hLCVsq!Z%^6eB-OvOT zFZ28TN&cRmgU}Elrnk43)!>Z1FCPL2K$7}gwzIc48NX}#!A1BpJP?#v5wkNprhV** z?Cpalt1oH&{r!o3eSKc&ap)iz2BTn_VV`4>9M^b3;(YY}4>#ML6{~(4mH+?%07*qo IM6N<$f(jP3KmY&$ literal 0 HcmV?d00001 diff --git a/assets/javascripts/bundle.2a6f1dda.min.js b/assets/javascripts/bundle.2a6f1dda.min.js new file mode 100644 index 00000000..2f912a0b --- /dev/null +++ b/assets/javascripts/bundle.2a6f1dda.min.js @@ -0,0 +1,29 @@ +"use strict";(()=>{var Hi=Object.create;var xr=Object.defineProperty;var Pi=Object.getOwnPropertyDescriptor;var $i=Object.getOwnPropertyNames,Ht=Object.getOwnPropertySymbols,Ii=Object.getPrototypeOf,Er=Object.prototype.hasOwnProperty,an=Object.prototype.propertyIsEnumerable;var on=(e,t,r)=>t in e?xr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,P=(e,t)=>{for(var r in t||(t={}))Er.call(t,r)&&on(e,r,t[r]);if(Ht)for(var r of Ht(t))an.call(t,r)&&on(e,r,t[r]);return e};var sn=(e,t)=>{var r={};for(var n in e)Er.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ht)for(var n of Ht(e))t.indexOf(n)<0&&an.call(e,n)&&(r[n]=e[n]);return r};var Pt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Fi=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of $i(t))!Er.call(e,o)&&o!==r&&xr(e,o,{get:()=>t[o],enumerable:!(n=Pi(t,o))||n.enumerable});return e};var yt=(e,t,r)=>(r=e!=null?Hi(Ii(e)):{},Fi(t||!e||!e.__esModule?xr(r,"default",{value:e,enumerable:!0}):r,e));var fn=Pt((wr,cn)=>{(function(e,t){typeof wr=="object"&&typeof cn!="undefined"?t():typeof define=="function"&&define.amd?define(t):t()})(wr,function(){"use strict";function e(r){var n=!0,o=!1,i=null,s={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function a(O){return!!(O&&O!==document&&O.nodeName!=="HTML"&&O.nodeName!=="BODY"&&"classList"in O&&"contains"in O.classList)}function f(O){var Ke=O.type,De=O.tagName;return!!(De==="INPUT"&&s[Ke]&&!O.readOnly||De==="TEXTAREA"&&!O.readOnly||O.isContentEditable)}function c(O){O.classList.contains("focus-visible")||(O.classList.add("focus-visible"),O.setAttribute("data-focus-visible-added",""))}function u(O){O.hasAttribute("data-focus-visible-added")&&(O.classList.remove("focus-visible"),O.removeAttribute("data-focus-visible-added"))}function p(O){O.metaKey||O.altKey||O.ctrlKey||(a(r.activeElement)&&c(r.activeElement),n=!0)}function m(O){n=!1}function d(O){a(O.target)&&(n||f(O.target))&&c(O.target)}function h(O){a(O.target)&&(O.target.classList.contains("focus-visible")||O.target.hasAttribute("data-focus-visible-added"))&&(o=!0,window.clearTimeout(i),i=window.setTimeout(function(){o=!1},100),u(O.target))}function v(O){document.visibilityState==="hidden"&&(o&&(n=!0),B())}function B(){document.addEventListener("mousemove",z),document.addEventListener("mousedown",z),document.addEventListener("mouseup",z),document.addEventListener("pointermove",z),document.addEventListener("pointerdown",z),document.addEventListener("pointerup",z),document.addEventListener("touchmove",z),document.addEventListener("touchstart",z),document.addEventListener("touchend",z)}function ne(){document.removeEventListener("mousemove",z),document.removeEventListener("mousedown",z),document.removeEventListener("mouseup",z),document.removeEventListener("pointermove",z),document.removeEventListener("pointerdown",z),document.removeEventListener("pointerup",z),document.removeEventListener("touchmove",z),document.removeEventListener("touchstart",z),document.removeEventListener("touchend",z)}function z(O){O.target.nodeName&&O.target.nodeName.toLowerCase()==="html"||(n=!1,ne())}document.addEventListener("keydown",p,!0),document.addEventListener("mousedown",m,!0),document.addEventListener("pointerdown",m,!0),document.addEventListener("touchstart",m,!0),document.addEventListener("visibilitychange",v,!0),B(),r.addEventListener("focus",d,!0),r.addEventListener("blur",h,!0),r.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&r.host?r.host.setAttribute("data-js-focus-visible",""):r.nodeType===Node.DOCUMENT_NODE&&(document.documentElement.classList.add("js-focus-visible"),document.documentElement.setAttribute("data-js-focus-visible",""))}if(typeof window!="undefined"&&typeof document!="undefined"){window.applyFocusVisiblePolyfill=e;var t;try{t=new CustomEvent("focus-visible-polyfill-ready")}catch(r){t=document.createEvent("CustomEvent"),t.initCustomEvent("focus-visible-polyfill-ready",!1,!1,{})}window.dispatchEvent(t)}typeof document!="undefined"&&e(document)})});var un=Pt(Sr=>{(function(e){var t=function(){try{return!!Symbol.iterator}catch(c){return!1}},r=t(),n=function(c){var u={next:function(){var p=c.shift();return{done:p===void 0,value:p}}};return r&&(u[Symbol.iterator]=function(){return u}),u},o=function(c){return encodeURIComponent(c).replace(/%20/g,"+")},i=function(c){return decodeURIComponent(String(c).replace(/\+/g," "))},s=function(){var c=function(p){Object.defineProperty(this,"_entries",{writable:!0,value:{}});var m=typeof p;if(m!=="undefined")if(m==="string")p!==""&&this._fromString(p);else if(p instanceof c){var d=this;p.forEach(function(ne,z){d.append(z,ne)})}else if(p!==null&&m==="object")if(Object.prototype.toString.call(p)==="[object Array]")for(var h=0;hd[0]?1:0}),c._entries&&(c._entries={});for(var p=0;p1?i(d[1]):"")}})})(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:Sr);(function(e){var t=function(){try{var o=new e.URL("b","http://a");return o.pathname="c d",o.href==="http://a/c%20d"&&o.searchParams}catch(i){return!1}},r=function(){var o=e.URL,i=function(f,c){typeof f!="string"&&(f=String(f)),c&&typeof c!="string"&&(c=String(c));var u=document,p;if(c&&(e.location===void 0||c!==e.location.href)){c=c.toLowerCase(),u=document.implementation.createHTMLDocument(""),p=u.createElement("base"),p.href=c,u.head.appendChild(p);try{if(p.href.indexOf(c)!==0)throw new Error(p.href)}catch(O){throw new Error("URL unable to set base "+c+" due to "+O)}}var m=u.createElement("a");m.href=f,p&&(u.body.appendChild(m),m.href=m.href);var d=u.createElement("input");if(d.type="url",d.value=f,m.protocol===":"||!/:/.test(m.href)||!d.checkValidity()&&!c)throw new TypeError("Invalid URL");Object.defineProperty(this,"_anchorElement",{value:m});var h=new e.URLSearchParams(this.search),v=!0,B=!0,ne=this;["append","delete","set"].forEach(function(O){var Ke=h[O];h[O]=function(){Ke.apply(h,arguments),v&&(B=!1,ne.search=h.toString(),B=!0)}}),Object.defineProperty(this,"searchParams",{value:h,enumerable:!0});var z=void 0;Object.defineProperty(this,"_updateSearchParams",{enumerable:!1,configurable:!1,writable:!1,value:function(){this.search!==z&&(z=this.search,B&&(v=!1,this.searchParams._fromString(this.search),v=!0))}})},s=i.prototype,a=function(f){Object.defineProperty(s,f,{get:function(){return this._anchorElement[f]},set:function(c){this._anchorElement[f]=c},enumerable:!0})};["hash","host","hostname","port","protocol"].forEach(function(f){a(f)}),Object.defineProperty(s,"search",{get:function(){return this._anchorElement.search},set:function(f){this._anchorElement.search=f,this._updateSearchParams()},enumerable:!0}),Object.defineProperties(s,{toString:{get:function(){var f=this;return function(){return f.href}}},href:{get:function(){return this._anchorElement.href.replace(/\?$/,"")},set:function(f){this._anchorElement.href=f,this._updateSearchParams()},enumerable:!0},pathname:{get:function(){return this._anchorElement.pathname.replace(/(^\/?)/,"/")},set:function(f){this._anchorElement.pathname=f},enumerable:!0},origin:{get:function(){var f={"http:":80,"https:":443,"ftp:":21}[this._anchorElement.protocol],c=this._anchorElement.port!=f&&this._anchorElement.port!=="";return this._anchorElement.protocol+"//"+this._anchorElement.hostname+(c?":"+this._anchorElement.port:"")},enumerable:!0},password:{get:function(){return""},set:function(f){},enumerable:!0},username:{get:function(){return""},set:function(f){},enumerable:!0}}),i.createObjectURL=function(f){return o.createObjectURL.apply(o,arguments)},i.revokeObjectURL=function(f){return o.revokeObjectURL.apply(o,arguments)},e.URL=i};if(t()||r(),e.location!==void 0&&!("origin"in e.location)){var n=function(){return e.location.protocol+"//"+e.location.hostname+(e.location.port?":"+e.location.port:"")};try{Object.defineProperty(e.location,"origin",{get:n,enumerable:!0})}catch(o){setInterval(function(){e.location.origin=n()},100)}}})(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:Sr)});var Qr=Pt((Lt,Kr)=>{/*! + * clipboard.js v2.0.11 + * https://clipboardjs.com/ + * + * Licensed MIT © Zeno Rocha + */(function(t,r){typeof Lt=="object"&&typeof Kr=="object"?Kr.exports=r():typeof define=="function"&&define.amd?define([],r):typeof Lt=="object"?Lt.ClipboardJS=r():t.ClipboardJS=r()})(Lt,function(){return function(){var e={686:function(n,o,i){"use strict";i.d(o,{default:function(){return ki}});var s=i(279),a=i.n(s),f=i(370),c=i.n(f),u=i(817),p=i.n(u);function m(j){try{return document.execCommand(j)}catch(T){return!1}}var d=function(T){var w=p()(T);return m("cut"),w},h=d;function v(j){var T=document.documentElement.getAttribute("dir")==="rtl",w=document.createElement("textarea");w.style.fontSize="12pt",w.style.border="0",w.style.padding="0",w.style.margin="0",w.style.position="absolute",w.style[T?"right":"left"]="-9999px";var k=window.pageYOffset||document.documentElement.scrollTop;return w.style.top="".concat(k,"px"),w.setAttribute("readonly",""),w.value=j,w}var B=function(T,w){var k=v(T);w.container.appendChild(k);var F=p()(k);return m("copy"),k.remove(),F},ne=function(T){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},k="";return typeof T=="string"?k=B(T,w):T instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(T==null?void 0:T.type)?k=B(T.value,w):(k=p()(T),m("copy")),k},z=ne;function O(j){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?O=function(w){return typeof w}:O=function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},O(j)}var Ke=function(){var T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},w=T.action,k=w===void 0?"copy":w,F=T.container,q=T.target,Le=T.text;if(k!=="copy"&&k!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(q!==void 0)if(q&&O(q)==="object"&&q.nodeType===1){if(k==="copy"&&q.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(k==="cut"&&(q.hasAttribute("readonly")||q.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(Le)return z(Le,{container:F});if(q)return k==="cut"?h(q):z(q,{container:F})},De=Ke;function Fe(j){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Fe=function(w){return typeof w}:Fe=function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},Fe(j)}function Oi(j,T){if(!(j instanceof T))throw new TypeError("Cannot call a class as a function")}function nn(j,T){for(var w=0;w0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof F.action=="function"?F.action:this.defaultAction,this.target=typeof F.target=="function"?F.target:this.defaultTarget,this.text=typeof F.text=="function"?F.text:this.defaultText,this.container=Fe(F.container)==="object"?F.container:document.body}},{key:"listenClick",value:function(F){var q=this;this.listener=c()(F,"click",function(Le){return q.onClick(Le)})}},{key:"onClick",value:function(F){var q=F.delegateTarget||F.currentTarget,Le=this.action(q)||"copy",kt=De({action:Le,container:this.container,target:this.target(q),text:this.text(q)});this.emit(kt?"success":"error",{action:Le,text:kt,trigger:q,clearSelection:function(){q&&q.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(F){return yr("action",F)}},{key:"defaultTarget",value:function(F){var q=yr("target",F);if(q)return document.querySelector(q)}},{key:"defaultText",value:function(F){return yr("text",F)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(F){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return z(F,q)}},{key:"cut",value:function(F){return h(F)}},{key:"isSupported",value:function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],q=typeof F=="string"?[F]:F,Le=!!document.queryCommandSupported;return q.forEach(function(kt){Le=Le&&!!document.queryCommandSupported(kt)}),Le}}]),w}(a()),ki=Ri},828:function(n){var o=9;if(typeof Element!="undefined"&&!Element.prototype.matches){var i=Element.prototype;i.matches=i.matchesSelector||i.mozMatchesSelector||i.msMatchesSelector||i.oMatchesSelector||i.webkitMatchesSelector}function s(a,f){for(;a&&a.nodeType!==o;){if(typeof a.matches=="function"&&a.matches(f))return a;a=a.parentNode}}n.exports=s},438:function(n,o,i){var s=i(828);function a(u,p,m,d,h){var v=c.apply(this,arguments);return u.addEventListener(m,v,h),{destroy:function(){u.removeEventListener(m,v,h)}}}function f(u,p,m,d,h){return typeof u.addEventListener=="function"?a.apply(null,arguments):typeof m=="function"?a.bind(null,document).apply(null,arguments):(typeof u=="string"&&(u=document.querySelectorAll(u)),Array.prototype.map.call(u,function(v){return a(v,p,m,d,h)}))}function c(u,p,m,d){return function(h){h.delegateTarget=s(h.target,p),h.delegateTarget&&d.call(u,h)}}n.exports=f},879:function(n,o){o.node=function(i){return i!==void 0&&i instanceof HTMLElement&&i.nodeType===1},o.nodeList=function(i){var s=Object.prototype.toString.call(i);return i!==void 0&&(s==="[object NodeList]"||s==="[object HTMLCollection]")&&"length"in i&&(i.length===0||o.node(i[0]))},o.string=function(i){return typeof i=="string"||i instanceof String},o.fn=function(i){var s=Object.prototype.toString.call(i);return s==="[object Function]"}},370:function(n,o,i){var s=i(879),a=i(438);function f(m,d,h){if(!m&&!d&&!h)throw new Error("Missing required arguments");if(!s.string(d))throw new TypeError("Second argument must be a String");if(!s.fn(h))throw new TypeError("Third argument must be a Function");if(s.node(m))return c(m,d,h);if(s.nodeList(m))return u(m,d,h);if(s.string(m))return p(m,d,h);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function c(m,d,h){return m.addEventListener(d,h),{destroy:function(){m.removeEventListener(d,h)}}}function u(m,d,h){return Array.prototype.forEach.call(m,function(v){v.addEventListener(d,h)}),{destroy:function(){Array.prototype.forEach.call(m,function(v){v.removeEventListener(d,h)})}}}function p(m,d,h){return a(document.body,m,d,h)}n.exports=f},817:function(n){function o(i){var s;if(i.nodeName==="SELECT")i.focus(),s=i.value;else if(i.nodeName==="INPUT"||i.nodeName==="TEXTAREA"){var a=i.hasAttribute("readonly");a||i.setAttribute("readonly",""),i.select(),i.setSelectionRange(0,i.value.length),a||i.removeAttribute("readonly"),s=i.value}else{i.hasAttribute("contenteditable")&&i.focus();var f=window.getSelection(),c=document.createRange();c.selectNodeContents(i),f.removeAllRanges(),f.addRange(c),s=f.toString()}return s}n.exports=o},279:function(n){function o(){}o.prototype={on:function(i,s,a){var f=this.e||(this.e={});return(f[i]||(f[i]=[])).push({fn:s,ctx:a}),this},once:function(i,s,a){var f=this;function c(){f.off(i,c),s.apply(a,arguments)}return c._=s,this.on(i,c,a)},emit:function(i){var s=[].slice.call(arguments,1),a=((this.e||(this.e={}))[i]||[]).slice(),f=0,c=a.length;for(f;f{"use strict";/*! + * escape-html + * Copyright(c) 2012-2013 TJ Holowaychuk + * Copyright(c) 2015 Andreas Lubbe + * Copyright(c) 2015 Tiancheng "Timothy" Gu + * MIT Licensed + */var is=/["'&<>]/;Jo.exports=as;function as(e){var t=""+e,r=is.exec(t);if(!r)return t;var n,o="",i=0,s=0;for(i=r.index;i0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function W(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}function D(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n1||a(m,d)})})}function a(m,d){try{f(n[m](d))}catch(h){p(i[0][3],h)}}function f(m){m.value instanceof Ze?Promise.resolve(m.value.v).then(c,u):p(i[0][2],m)}function c(m){a("next",m)}function u(m){a("throw",m)}function p(m,d){m(d),i.shift(),i.length&&a(i[0][0],i[0][1])}}function mn(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof xe=="function"?xe(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(s){return new Promise(function(a,f){s=e[i](s),o(a,f,s.done,s.value)})}}function o(i,s,a,f){Promise.resolve(f).then(function(c){i({value:c,done:a})},s)}}function A(e){return typeof e=="function"}function at(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var It=at(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription: +`+r.map(function(n,o){return o+1+") "+n.toString()}).join(` + `):"",this.name="UnsubscriptionError",this.errors=r}});function Ve(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var je=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=xe(s),f=a.next();!f.done;f=a.next()){var c=f.value;c.remove(this)}}catch(v){t={error:v}}finally{try{f&&!f.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var u=this.initialTeardown;if(A(u))try{u()}catch(v){i=v instanceof It?v.errors:[v]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var m=xe(p),d=m.next();!d.done;d=m.next()){var h=d.value;try{dn(h)}catch(v){i=i!=null?i:[],v instanceof It?i=D(D([],W(i)),W(v.errors)):i.push(v)}}}catch(v){n={error:v}}finally{try{d&&!d.done&&(o=m.return)&&o.call(m)}finally{if(n)throw n.error}}}if(i)throw new It(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)dn(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Ve(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Ve(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Tr=je.EMPTY;function Ft(e){return e instanceof je||e&&"closed"in e&&A(e.remove)&&A(e.add)&&A(e.unsubscribe)}function dn(e){A(e)?e():e.unsubscribe()}var Ae={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var st={setTimeout:function(e,t){for(var r=[],n=2;n0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?Tr:(this.currentObservers=null,a.push(r),new je(function(){n.currentObservers=null,Ve(a,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?r.error(i):s&&r.complete()},t.prototype.asObservable=function(){var r=new U;return r.source=this,r},t.create=function(r,n){return new wn(r,n)},t}(U);var wn=function(e){ie(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:Tr},t}(E);var Et={now:function(){return(Et.delegate||Date).now()},delegate:void 0};var wt=function(e){ie(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=Et);var i=e.call(this)||this;return i._bufferSize=r,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,r),i._windowTime=Math.max(1,n),i}return t.prototype.next=function(r){var n=this,o=n.isStopped,i=n._buffer,s=n._infiniteTimeWindow,a=n._timestampProvider,f=n._windowTime;o||(i.push(r),!s&&i.push(a.now()+f)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,i=o._infiniteTimeWindow,s=o._buffer,a=s.slice(),f=0;f0?e.prototype.requestAsyncId.call(this,r,n,o):(r.actions.push(this),r._scheduled||(r._scheduled=ut.requestAnimationFrame(function(){return r.flush(void 0)})))},t.prototype.recycleAsyncId=function(r,n,o){var i;if(o===void 0&&(o=0),o!=null?o>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,r,n,o);var s=r.actions;n!=null&&((i=s[s.length-1])===null||i===void 0?void 0:i.id)!==n&&(ut.cancelAnimationFrame(n),r._scheduled=void 0)},t}(Wt);var Tn=function(e){ie(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.flush=function(r){this._active=!0;var n=this._scheduled;this._scheduled=void 0;var o=this.actions,i;r=r||o.shift();do if(i=r.execute(r.state,r.delay))break;while((r=o[0])&&r.id===n&&o.shift());if(this._active=!1,i){for(;(r=o[0])&&r.id===n&&o.shift();)r.unsubscribe();throw i}},t}(Dt);var we=new Tn(On);var R=new U(function(e){return e.complete()});function Vt(e){return e&&A(e.schedule)}function kr(e){return e[e.length-1]}function Qe(e){return A(kr(e))?e.pop():void 0}function Se(e){return Vt(kr(e))?e.pop():void 0}function zt(e,t){return typeof kr(e)=="number"?e.pop():t}var pt=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};function Nt(e){return A(e==null?void 0:e.then)}function qt(e){return A(e[ft])}function Kt(e){return Symbol.asyncIterator&&A(e==null?void 0:e[Symbol.asyncIterator])}function Qt(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Ki(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Yt=Ki();function Gt(e){return A(e==null?void 0:e[Yt])}function Bt(e){return ln(this,arguments,function(){var r,n,o,i;return $t(this,function(s){switch(s.label){case 0:r=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Ze(r.read())];case 3:return n=s.sent(),o=n.value,i=n.done,i?[4,Ze(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Ze(o)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function Jt(e){return A(e==null?void 0:e.getReader)}function $(e){if(e instanceof U)return e;if(e!=null){if(qt(e))return Qi(e);if(pt(e))return Yi(e);if(Nt(e))return Gi(e);if(Kt(e))return _n(e);if(Gt(e))return Bi(e);if(Jt(e))return Ji(e)}throw Qt(e)}function Qi(e){return new U(function(t){var r=e[ft]();if(A(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Yi(e){return new U(function(t){for(var r=0;r=2;return function(n){return n.pipe(e?_(function(o,i){return e(o,i,n)}):de,Te(1),r?Pe(t):zn(function(){return new Zt}))}}function Nn(){for(var e=[],t=0;t=2,!0))}function ue(e){e===void 0&&(e={});var t=e.connector,r=t===void 0?function(){return new E}:t,n=e.resetOnError,o=n===void 0?!0:n,i=e.resetOnComplete,s=i===void 0?!0:i,a=e.resetOnRefCountZero,f=a===void 0?!0:a;return function(c){var u,p,m,d=0,h=!1,v=!1,B=function(){p==null||p.unsubscribe(),p=void 0},ne=function(){B(),u=m=void 0,h=v=!1},z=function(){var O=u;ne(),O==null||O.unsubscribe()};return g(function(O,Ke){d++,!v&&!h&&B();var De=m=m!=null?m:r();Ke.add(function(){d--,d===0&&!v&&!h&&(p=jr(z,f))}),De.subscribe(Ke),!u&&d>0&&(u=new tt({next:function(Fe){return De.next(Fe)},error:function(Fe){v=!0,B(),p=jr(ne,o,Fe),De.error(Fe)},complete:function(){h=!0,B(),p=jr(ne,s),De.complete()}}),$(O).subscribe(u))})(c)}}function jr(e,t){for(var r=[],n=2;ne.next(document)),e}function K(e,t=document){return Array.from(t.querySelectorAll(e))}function V(e,t=document){let r=ce(e,t);if(typeof r=="undefined")throw new ReferenceError(`Missing element: expected "${e}" to be present`);return r}function ce(e,t=document){return t.querySelector(e)||void 0}function _e(){return document.activeElement instanceof HTMLElement&&document.activeElement||void 0}function rr(e){return L(b(document.body,"focusin"),b(document.body,"focusout")).pipe(He(1),l(()=>{let t=_e();return typeof t!="undefined"?e.contains(t):!1}),N(e===_e()),G())}function Je(e){return{x:e.offsetLeft,y:e.offsetTop}}function Yn(e){return L(b(window,"load"),b(window,"resize")).pipe(Re(0,we),l(()=>Je(e)),N(Je(e)))}function nr(e){return{x:e.scrollLeft,y:e.scrollTop}}function dt(e){return L(b(e,"scroll"),b(window,"resize")).pipe(Re(0,we),l(()=>nr(e)),N(nr(e)))}var Bn=function(){if(typeof Map!="undefined")return Map;function e(t,r){var n=-1;return t.some(function(o,i){return o[0]===r?(n=i,!0):!1}),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(r){var n=e(this.__entries__,r),o=this.__entries__[n];return o&&o[1]},t.prototype.set=function(r,n){var o=e(this.__entries__,r);~o?this.__entries__[o][1]=n:this.__entries__.push([r,n])},t.prototype.delete=function(r){var n=this.__entries__,o=e(n,r);~o&&n.splice(o,1)},t.prototype.has=function(r){return!!~e(this.__entries__,r)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(r,n){n===void 0&&(n=null);for(var o=0,i=this.__entries__;o0},e.prototype.connect_=function(){!zr||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),xa?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!zr||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var r=t.propertyName,n=r===void 0?"":r,o=ya.some(function(i){return!!~n.indexOf(i)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),Jn=function(e,t){for(var r=0,n=Object.keys(t);r0},e}(),Zn=typeof WeakMap!="undefined"?new WeakMap:new Bn,eo=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var r=Ea.getInstance(),n=new Ra(t,r,this);Zn.set(this,n)}return e}();["observe","unobserve","disconnect"].forEach(function(e){eo.prototype[e]=function(){var t;return(t=Zn.get(this))[e].apply(t,arguments)}});var ka=function(){return typeof or.ResizeObserver!="undefined"?or.ResizeObserver:eo}(),to=ka;var ro=new E,Ha=I(()=>H(new to(e=>{for(let t of e)ro.next(t)}))).pipe(x(e=>L(Oe,H(e)).pipe(C(()=>e.disconnect()))),J(1));function he(e){return{width:e.offsetWidth,height:e.offsetHeight}}function ge(e){return Ha.pipe(S(t=>t.observe(e)),x(t=>ro.pipe(_(({target:r})=>r===e),C(()=>t.unobserve(e)),l(()=>he(e)))),N(he(e)))}function bt(e){return{width:e.scrollWidth,height:e.scrollHeight}}function sr(e){let t=e.parentElement;for(;t&&(e.scrollWidth<=t.scrollWidth&&e.scrollHeight<=t.scrollHeight);)t=(e=t).parentElement;return t?e:void 0}var no=new E,Pa=I(()=>H(new IntersectionObserver(e=>{for(let t of e)no.next(t)},{threshold:0}))).pipe(x(e=>L(Oe,H(e)).pipe(C(()=>e.disconnect()))),J(1));function cr(e){return Pa.pipe(S(t=>t.observe(e)),x(t=>no.pipe(_(({target:r})=>r===e),C(()=>t.unobserve(e)),l(({isIntersecting:r})=>r))))}function oo(e,t=16){return dt(e).pipe(l(({y:r})=>{let n=he(e),o=bt(e);return r>=o.height-n.height-t}),G())}var fr={drawer:V("[data-md-toggle=drawer]"),search:V("[data-md-toggle=search]")};function io(e){return fr[e].checked}function qe(e,t){fr[e].checked!==t&&fr[e].click()}function Ue(e){let t=fr[e];return b(t,"change").pipe(l(()=>t.checked),N(t.checked))}function $a(e,t){switch(e.constructor){case HTMLInputElement:return e.type==="radio"?/^Arrow/.test(t):!0;case HTMLSelectElement:case HTMLTextAreaElement:return!0;default:return e.isContentEditable}}function Ia(){return L(b(window,"compositionstart").pipe(l(()=>!0)),b(window,"compositionend").pipe(l(()=>!1))).pipe(N(!1))}function ao(){let e=b(window,"keydown").pipe(_(t=>!(t.metaKey||t.ctrlKey)),l(t=>({mode:io("search")?"search":"global",type:t.key,claim(){t.preventDefault(),t.stopPropagation()}})),_(({mode:t,type:r})=>{if(t==="global"){let n=_e();if(typeof n!="undefined")return!$a(n,r)}return!0}),ue());return Ia().pipe(x(t=>t?R:e))}function Me(){return new URL(location.href)}function ot(e){location.href=e.href}function so(){return new E}function co(e,t){if(typeof t=="string"||typeof t=="number")e.innerHTML+=t.toString();else if(t instanceof Node)e.appendChild(t);else if(Array.isArray(t))for(let r of t)co(e,r)}function M(e,t,...r){let n=document.createElement(e);if(t)for(let o of Object.keys(t))typeof t[o]!="undefined"&&(typeof t[o]!="boolean"?n.setAttribute(o,t[o]):n.setAttribute(o,""));for(let o of r)co(n,o);return n}function ur(e){if(e>999){let t=+((e-950)%1e3>99);return`${((e+1e-6)/1e3).toFixed(t)}k`}else return e.toString()}function fo(){return location.hash.substring(1)}function uo(e){let t=M("a",{href:e});t.addEventListener("click",r=>r.stopPropagation()),t.click()}function Fa(){return b(window,"hashchange").pipe(l(fo),N(fo()),_(e=>e.length>0),J(1))}function po(){return Fa().pipe(l(e=>ce(`[id="${e}"]`)),_(e=>typeof e!="undefined"))}function Nr(e){let t=matchMedia(e);return er(r=>t.addListener(()=>r(t.matches))).pipe(N(t.matches))}function lo(){let e=matchMedia("print");return L(b(window,"beforeprint").pipe(l(()=>!0)),b(window,"afterprint").pipe(l(()=>!1))).pipe(N(e.matches))}function qr(e,t){return e.pipe(x(r=>r?t():R))}function pr(e,t={credentials:"same-origin"}){return pe(fetch(`${e}`,t)).pipe(fe(()=>R),x(r=>r.status!==200?Ot(()=>new Error(r.statusText)):H(r)))}function We(e,t){return pr(e,t).pipe(x(r=>r.json()),J(1))}function mo(e,t){let r=new DOMParser;return pr(e,t).pipe(x(n=>n.text()),l(n=>r.parseFromString(n,"text/xml")),J(1))}function lr(e){let t=M("script",{src:e});return I(()=>(document.head.appendChild(t),L(b(t,"load"),b(t,"error").pipe(x(()=>Ot(()=>new ReferenceError(`Invalid script: ${e}`))))).pipe(l(()=>{}),C(()=>document.head.removeChild(t)),Te(1))))}function ho(){return{x:Math.max(0,scrollX),y:Math.max(0,scrollY)}}function bo(){return L(b(window,"scroll",{passive:!0}),b(window,"resize",{passive:!0})).pipe(l(ho),N(ho()))}function vo(){return{width:innerWidth,height:innerHeight}}function go(){return b(window,"resize",{passive:!0}).pipe(l(vo),N(vo()))}function yo(){return Q([bo(),go()]).pipe(l(([e,t])=>({offset:e,size:t})),J(1))}function mr(e,{viewport$:t,header$:r}){let n=t.pipe(X("size")),o=Q([n,r]).pipe(l(()=>Je(e)));return Q([r,t,o]).pipe(l(([{height:i},{offset:s,size:a},{x:f,y:c}])=>({offset:{x:s.x-f,y:s.y-c+i},size:a})))}(()=>{function e(n,o){parent.postMessage(n,o||"*")}function t(...n){return n.reduce((o,i)=>o.then(()=>new Promise(s=>{let a=document.createElement("script");a.src=i,a.onload=s,document.body.appendChild(a)})),Promise.resolve())}var r=class extends EventTarget{constructor(n){super(),this.url=n,this.m=i=>{i.source===this.w&&(this.dispatchEvent(new MessageEvent("message",{data:i.data})),this.onmessage&&this.onmessage(i))},this.e=(i,s,a,f,c)=>{if(s===`${this.url}`){let u=new ErrorEvent("error",{message:i,filename:s,lineno:a,colno:f,error:c});this.dispatchEvent(u),this.onerror&&this.onerror(u)}};let o=document.createElement("iframe");o.hidden=!0,document.body.appendChild(this.iframe=o),this.w.document.open(),this.w.document.write(` + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + +

CLI

+ +

Launch comes with a CLI for listing bundles / endpoints, editing endpoints, +and sending tasks to endpoints.

+

The CLI can be used as scale-launch ....

+

Help

+

Run scale-launch --help for more options.

+
scale-launch --help
    This is the command line interface (CLI) package for Scale Launch.
+
+       ██╗      █████╗ ██╗   ██╗███╗   ██╗ ██████╗██╗  ██╗
+       ██║     ██╔â•â•██╗██║   ██║████╗  ██║██╔â•â•â•â•â•██║  ██║
+       ██║     ███████║██║   ██║██╔██╗ ██║██║     ███████║
+       ██║     ██╔â•â•██║██║   ██║██║╚██╗██║██║     ██╔â•â•██║
+       ███████╗██║  ██║╚██████╔â•██║ ╚████║╚██████╗██║  ██║
+       ╚â•â•â•â•â•â•â•╚â•â•  ╚â•╠╚â•â•â•â•â•╠╚â•â•  ╚â•â•â•╠╚â•â•â•â•â•â•╚â•â•  ╚â•â•
+
+Usage: scale-launch [OPTIONS] COMMAND [ARGS]...
+
+Options:
+  --help  Show this message and exit.
+
+Commands:
+  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch
+  bundles     Bundles is a wrapper around model bundles in Scale Launch
+  config      Config is a wrapper around getting and setting your Scale...
+  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch
+  tasks       Tasks is a wrapper around sending requests to endpoints
+
+ + + + + + +
+
+ + + + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/concepts/batch_jobs/index.html b/concepts/batch_jobs/index.html new file mode 100644 index 00000000..25f6d761 --- /dev/null +++ b/concepts/batch_jobs/index.html @@ -0,0 +1,598 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + Batch jobs - Launch + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + +

Batch jobs

+ +

Batch Jobs

+

For predicting over a larger set of tasks (> 50) at once, it is recommended to +use batch jobs. Batch jobs are a way to send a large number of tasks to a model +bundle. The tasks are processed in parallel, and the results are returned as a +list of predictions.

+

Batch jobs are created using the +batch_async_request +method of the +LaunchClient.

+
Creating and Following a Batch Job
import os
+import time
+from launch import LaunchClient
+
+client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
+batch_job = client.batch_async_request(
+    model_bundle="test-bundle",
+    inputs=[
+        {"x": 2, "y": "hello"},
+        {"x": 3, "y": "world"},
+    ],
+)
+
+status = "PENDING"
+res = None
+while status != "SUCCESS" and status != "FAILURE" and status != "CANCELLED":
+    time.sleep(30)
+    res = client.get_batch_async_response(batch_job["job_id"])
+    status = res["status"]
+    print(f"the batch job is {status}")
+
+print(res)
+
+ + + + + + +
+
+ + + + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/concepts/endpoint_predictions/index.html b/concepts/endpoint_predictions/index.html new file mode 100644 index 00000000..1af35a71 --- /dev/null +++ b/concepts/endpoint_predictions/index.html @@ -0,0 +1,1008 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + Endpoint Predictions - Launch + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + +

Endpoint Predictions

+

Once endpoints have been created, users can send tasks to them to make +predictions. The following code snippet shows how to send tasks to endpoints.

+
+
+
+
import os
+from launch import EndpointRequest, LaunchClient
+
+client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
+endpoint = client.get_model_endpoint("demo-endpoint-async")
+future = endpoint.predict(request=EndpointRequest(args={"x": 2, "y": "hello"}))
+response = future.get()
+print(response)
+
+
+
+
import os
+from launch import EndpointRequest, LaunchClient
+
+client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
+endpoint = client.get_model_endpoint("demo-endpoint-sync")
+response = endpoint.predict(request=EndpointRequest(args={"x": 2, "y": "hello"}))
+print(response)
+
+
+
+
+ + +
+ + + +

+ EndpointRequest + + +

+
EndpointRequest(
+    url: Optional[str] = None,
+    args: Optional[Dict] = None,
+    callback_url: Optional[str] = None,
+    return_pickled: Optional[bool] = False,
+    request_id: Optional[str] = None,
+)
+
+ +
+ + +

Represents a single request to either a SyncEndpoint or AsyncEndpoint.

+ +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
url + Optional[str] +

A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. +Note: the contents of the file located at url are opened as a sequence of bytes and passed +to the predict function. If you instead want to pass the url itself as an input to the predict function, +see args.

+

Exactly one of url and args must be specified.

+ None +
args + Optional[Dict] +

A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature +predict_fn(foo, bar), then the keys in the dictionary should be "foo" and "bar". +Values must be native Python objects.

+

Exactly one of url and args must be specified.

+ None +
return_pickled + Optional[bool] +

Whether the output should be a pickled python object, or directly returned serialized json.

+ False +
request_id + Optional[str] +

(deprecated) A user-specifiable id for requests. +Should be unique among EndpointRequests made in the same batch call. +If one isn't provided the client will generate its own.

+ None +
+ + + + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ EndpointResponseFuture + + +

+
EndpointResponseFuture(
+    client, endpoint_name: str, async_task_id: str
+)
+
+ +
+ + +

Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, +then its get method will return an actual instance of EndpointResponse.

+

This object should not be directly instantiated by the user.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
client +

An instance of LaunchClient.

+ required +
endpoint_name + str +

The name of the endpoint.

+ required +
async_task_id + str +

An async task id.

+ required +
+ + + + +
+ + + + + + + + + +
+ + + +

+ get + + +

+
get(timeout: Optional[float] = None) -> EndpointResponse
+
+ +
+ +

Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

+ +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
timeout + Optional[float] +

The maximum number of seconds to wait for the response. If None, then +the method will block indefinitely until the response is ready.

+ None +
+ +
+ +
+ + + +
+ +
+ +
+ +
+ + + +

+ EndpointResponse + + +

+
EndpointResponse(
+    client,
+    status: str,
+    result_url: Optional[str] = None,
+    result: Optional[str] = None,
+    traceback: Optional[str] = None,
+)
+
+ +
+ + +

Represents a response received from a Endpoint.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
client +

An instance of LaunchClient.

+ required +
status + str +

A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

+ required +
result_url + Optional[str] +

A string that is a url containing the pickled python object from the +Endpoint's predict function.

+

Exactly one of result_url or result will be populated, +depending on the value of return_pickled in the request.

+ None +
result + Optional[str] +

A string that is the serialized return value (in json form) of the Endpoint's predict function. +Specifically, one can json.loads() the value of result to get the original python object back.

+

Exactly one of result_url or result will be populated, +depending on the value of return_pickled in the request.

+ None +
traceback + Optional[str] +

The stack trace if the inference endpoint raised an error. Can be used for debugging

+ None +
+ + + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + + + + +
+
+ + + + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/concepts/model_bundles/index.html b/concepts/model_bundles/index.html new file mode 100644 index 00000000..1dd31922 --- /dev/null +++ b/concepts/model_bundles/index.html @@ -0,0 +1,846 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + Model Bundles - Launch + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + +

Model Bundles

+

Model Bundles are deployable models that can be used to make predictions. They +are created by packaging a model up into a deployable format.

+

Creating Model Bundles

+

There are two methods for creating model bundles: +create_model_bundle +and +create_model_bundle_from_dirs. +The former directly pickles a user-specified load_predict_fn, a function which +loads the model and returns a predict_fn, a function which takes in a request. +The latter takes in directories containing a load_predict_fn and the +module path to the load_predict_fn.

+
+
+
+
import os
+from pydantic import BaseModel
+from launch import LaunchClient
+
+
+class MyRequestSchema(BaseModel):
+    x: int
+    y: str
+
+class MyResponseSchema(BaseModel):
+    __root__: int
+
+
+def my_load_predict_fn(model):
+    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:
+        """MyRequestSchema -> MyResponseSchema"""
+        assert isinstance(x, int) and isinstance(y, str)
+        return model(x) + len(y)
+
+    return returns_model_of_x_plus_len_of_y
+
+
+def my_model(x):
+    return x * 2
+
+ENV_PARAMS = {
+    "framework_type": "pytorch",
+    "pytorch_image_tag": "1.7.1-cuda11.0-cudnn8-runtime",
+}
+
+BUNDLE_PARAMS = {
+    "model_bundle_name": "test-bundle",
+    "model": my_model,
+    "load_predict_fn": my_load_predict_fn,
+    "env_params": ENV_PARAMS,
+    "requirements": [],
+    "request_schema": MyRequestSchema,
+    "response_schema": MyResponseSchema,
+}
+
+client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
+client.create_model_bundle(**BUNDLE_PARAMS)
+
+
+
+
import os
+import tempfile
+from pydantic import BaseModel
+from launch import LaunchClient
+
+directory = tempfile.mkdtemp()
+model_filename = os.path.join(directory, "model.py")
+with open(model_filename, "w") as f:
+    f.write("""
+def my_load_model_fn():
+    def my_model(x):
+        return x * 2
+
+    return my_model
+""")
+
+predict_filename = os.path.join(directory, "predict.py")
+with open(predict_filename, "w") as f:
+    f.write("""
+def my_load_predict_fn(model):
+    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:
+        assert isinstance(x, int) and isinstance(y, str)
+        return model(x) + len(y)
+
+    return returns_model_of_x_plus_len_of_y
+""")
+
+requirements_filename = os.path.join(directory, "requirements.txt")
+with open(predict_filename, "w") as f:
+    f.write("""
+numpy
+sklearn
+"""
+    )
+
+"""
+The directory structure should now look like
+
+directory/
+    model.py
+    predict.py
+    requirements.txt
+"""
+
+
+class MyRequestSchema(BaseModel):
+    x: int
+    y: str
+
+class MyResponseSchema(BaseModel):
+    __root__: int
+
+ENV_PARAMS = {
+    "framework_type": "pytorch",
+    "pytorch_image_tag": "1.7.1-cuda11.0-cudnn8-runtime",
+}
+
+BUNDLE_PARAMS = {
+    "model_bundle_name": "test-bundle",
+    "base_paths": [directory],
+    "requirements_path": "requirements.txt",
+    "env_params": ENV_PARAMS,
+    "load_predict_fn": "predict.my_load_predict_fn",
+    "load_model_fn_module_path": "model.my_load_model_fn",
+    "request_schema": MyRequestSchema,
+    "response_schema": MyResponseSchema,
+}
+
+client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
+client.create_model_bundle(**BUNDLE_PARAMS)
+
+# Clean up files from demo
+os.remove(model_filename)
+os.remove(predict_filename)
+os.rmdir(directory)
+
+
+
+
+

Configuring Model Bundles

+

The app_config field of a model bundle is a dictionary that can be used to +configure the model bundle. If specified, the app_config is passed to the +load_predict_fn when the model bundle is deployed, alongside the model. This +can allow for more code reuse between multiple bundles that perform similar +tasks.

+
Creating Model Bundles with app_config
import os
+from launch import LaunchClient
+from pydantic import BaseModel
+from typing import List, Literal, Union
+
+
+class MyRequestSchemaSingle(BaseModel):
+    kind: Literal['single']
+    x: int
+    y: str
+
+class MyRequestSchemaBatched(BaseModel):
+    kind: Literal['batched']
+    x: List[int]
+    y: List[str]
+
+class MyRequestSchema(BaseModel):
+    __root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]
+
+class MyResponseSchema(BaseModel):
+    __root__: Union[int, List[int]]
+
+
+def my_load_predict_fn(app_config, model):
+    def returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:
+        """MyRequestSchema -> MyResponseSchema"""
+        if app_config["mode"] == "single":
+            assert isinstance(x, int) and isinstance(y, str)
+            return model(x) + len(y)
+
+        result = []
+        for x_i, y_i in zip(x, y):
+            result.append(model(x_i) + len(y_i))
+        return result
+
+    return returns_model_of_x_plus_len_of_y
+
+
+def my_load_model_fn(app_config):
+    def my_model_single(x: int):
+        return x * 2
+
+    def my_model_batched(x: List[int]):
+        return [my_model_single(x_i) for x_i in x]
+
+    if app_config["mode"] == "single":
+        return my_model_single
+
+    return my_model_batched
+
+
+ENV_PARAMS = {
+    "framework_type": "pytorch",
+    "pytorch_image_tag": "1.7.1-cuda11.0-cudnn8-runtime",
+}
+
+BUNDLE_PARAMS_SINGLE = {
+    "model_bundle_name": "test-bundle-single",
+    "load_predict_fn": my_load_predict_fn,
+    "load_model_fn": my_load_model_fn,
+    "env_params": ENV_PARAMS,
+    "requirements": [],
+    "request_schema": MyRequestSchema,
+    "response_schema": MyResponseSchema,
+    "app_config": {"mode": "single"},
+}
+BUNDLE_PARAMS_BATCHED = {
+    "model_bundle_name": "test-bundle-batched",
+    "load_predict_fn": my_load_predict_fn,
+    "load_model_fn": my_load_model_fn,
+    "env_params": ENV_PARAMS,
+    "requirements": [],
+    "request_schema": MyRequestSchema,
+    "response_schema": MyResponseSchema,
+    "app_config": {"mode": "single"},
+}
+
+client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
+bundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)
+bundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)
+
+

Updating Model Bundles

+

Model Bundles are immutable, meaning they cannot be edited once created. +However, it is possible to clone an existing model bundle with a new app_config +using +clone_model_bundle_with_changes.

+

Listing Model Bundles

+

To list all the model bundles you own, use +list_model_bundles.

+ + + + + + +
+
+ + + + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/concepts/model_endpoints/index.html b/concepts/model_endpoints/index.html new file mode 100644 index 00000000..b0afcb58 --- /dev/null +++ b/concepts/model_endpoints/index.html @@ -0,0 +1,685 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + Model Endpoints - Launch + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + +

Model Endpoints

+

Model Endpoints are deployments of models that can receive requests and return +predictions containing the results of the model's inference. Each model endpoint +is associated with a model bundle, which contains the model's code. An endpoint +specifies deployment parameters, such as the minimum and maximum number of +workers, as well as the requested resources for each worker, such as the number +of CPUs, amount of memory, GPU count, and type of GPU.

+

Endpoints can be asynchronous or synchronous. Asynchronous endpoints return +a future immediately after receiving a request, and the future can be used to +retrieve the prediction once it is ready. Synchronous endpoints return the +prediction directly after receiving a request.

+

Creating Async Model Endpoints

+

Async model endpoints are the most cost-efficient way to perform inference on +tasks that are less latency-sensitive.

+
Creating an Async Model Endpoint
import os
+from launch import LaunchClient
+
+client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
+endpoint = client.create_model_endpoint(
+    endpoint_name="demo-endpoint-async",
+    model_bundle="test-bundle",
+    cpus=1,
+    min_workers=0,
+    endpoint_type="async",
+    update_if_exists=True,
+    labels={
+        "team": "MY_TEAM",
+        "product": "MY_PRODUCT"
+    },
+)
+
+

Creating Sync Model Endpoints

+

Sync model endpoints are useful for latency-sensitive tasks, such as real-time +inference. Sync endpoints are more expensive than async endpoints, and they +require at least 1 min_worker.

+
Creating a Sync Model Endpoint
import os
+from launch import LaunchClient
+
+client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
+endpoint = client.create_model_endpoint(
+    endpoint_name="demo-endpoint-sync",
+    model_bundle="test-bundle",
+    cpus=1,
+    min_workers=1,
+    endpoint_type="sync",
+    update_if_exists=True,
+    labels={
+        "team": "MY_TEAM",
+        "product": "MY_PRODUCT"
+    },
+)
+
+

Managing Model Endpoints

+

Model endpoints can be listed, updated, and deleted using the Launch API.

+
Listing Model Endpoints
import os
+from launch import LaunchClient
+
+client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
+endpoints = client.list_model_endpoints()
+
+
Updating a Model Endpoint
import os
+from launch import LaunchClient
+
+client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
+client.edit_model_endpoint(
+    model_endpoint="demo-endpoint",
+    max_workers=2,
+)
+
+
Deleting a Model Endpoint
import os
+from launch import LaunchClient
+
+client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
+endpoint = client.create_model_endpoint(
+    endpoint_name="demo-endpoint-tmp",
+    model_bundle="test-bundle",
+    cpus=1,
+    min_workers=0,
+    endpoint_type="async",
+    update_if_exists=True,
+    labels={
+        "team": "MY_TEAM",
+        "product": "MY_PRODUCT"
+    },
+)
+client.delete_model_endpoint(model_endpoint="demo-endpoint-tmp")
+
+ + + + + + +
+
+ + + + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 00000000..248fb455 --- /dev/null +++ b/index.html @@ -0,0 +1,695 @@ + + + + + + + + + + + + + + + + + + + + + + + + Launch + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + +

Scale Launch

+

CI +pypi

+

Simple, scalable, and high performance ML service deployment in python.

+

Example

+
Launch Usage
import os
+import time
+from launch import LaunchClient
+from launch import EndpointRequest
+from pydantic import BaseModel
+from rich import print
+
+
+class MyRequestSchema(BaseModel):
+    x: int
+    y: str
+
+class MyResponseSchema(BaseModel):
+    __root__: int
+
+
+def my_load_predict_fn(model):
+    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:
+        """MyRequestSchema -> MyResponseSchema"""
+        assert isinstance(x, int) and isinstance(y, str)
+        return model(x) + len(y)
+
+    return returns_model_of_x_plus_len_of_y
+
+
+def my_model(x):
+    return x * 2
+
+ENV_PARAMS = {
+    "framework_type": "pytorch",
+    "pytorch_image_tag": "1.7.1-cuda11.0-cudnn8-runtime",
+}
+
+BUNDLE_PARAMS = {
+    "model_bundle_name": "test-bundle",
+    "model": my_model,
+    "load_predict_fn": my_load_predict_fn,
+    "env_params": ENV_PARAMS,
+    "requirements": [],
+    "request_schema": MyRequestSchema,
+    "response_schema": MyResponseSchema,
+}
+
+ENDPOINT_PARAMS = {
+    "endpoint_name": "demo-endpoint",
+    "model_bundle": "test-bundle",
+    "cpus": 1,
+    "min_workers": 0,
+    "endpoint_type": "async",
+    "update_if_exists": True,
+    "labels": {
+        "team": "infra",
+        "product": "launch",
+    }
+}
+
+def predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:
+    # Wait for the endpoint to be ready first before submitting a task
+    endpoint = client.get_model_endpoint(endpoint_name="demo-endpoint")
+    while endpoint.status() != "READY":
+        time.sleep(10)
+
+    endpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)
+
+    future = endpoint.predict(request=endpoint_request)
+    raw_response = future.get()
+
+    response = MyResponseSchema.parse_raw(raw_response.result)
+    return response
+
+
+client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
+
+client.create_model_bundle(**BUNDLE_PARAMS)
+endpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)
+
+request = MyRequestSchema(x=5, y="hello")
+response = predict_on_endpoint(request)
+print(response)
+"""
+MyResponseSchema(__root__=10)
+"""
+
+

What's going on here:

+
    +
  • First we use pydantic to define our request and response + schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API + documentation for our models.
  • +
  • Next we define the the model and the load_predict_fn, which tells Launch + how to load our model and how to make predictions with it. In this case, + we're just returning a function that adds the length of the string y to + model(x), where model doubles the integer x.
  • +
  • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the + response_schema. We also specify the env_params, which tell Launch environment settings like + the base image to use. In this case, we're using a PyTorch image.
  • +
  • Next, we create the model endpoint, which is the API that we'll use to make predictions. We + specify the model_bundle that we created above, and we specify the endpoint_type, which tells + Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an + asynchronous endpoint, which means that we can make predictions and return immediately with a + future object. We can then use the future object to get the prediction result later.
  • +
  • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. + This function first waits for the endpoint to be ready, then it submits a prediction request to + the endpoint. It then waits for the prediction result and returns it.
  • +
+

Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers +when it's not being used.

+

Installation

+

To use Scale Launch, first install it using pip:

+
Installation
pip install -U scale-launch
+
+ + + + + + +
+
+ + + + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/objects.inv b/objects.inv new file mode 100644 index 00000000..8de29452 --- /dev/null +++ b/objects.inv @@ -0,0 +1,6 @@ +# Sphinx inventory version 2 +# Project: Launch +# Version: 0.0.0 +# The remainder of this file is compressed using zlib. +xÚµÖÍNÄ ð»OÑD¯²ñêMžôâ Y˜¶D: Ð5ûöÒï­IWðHÒþ˜Âð§Z5Z!öÜúAa·Bƒ÷ÅMVí†Gv—WÅõ…þõ-¶‡ jþH‚;|oÑ÷R ÊÐy˜Ð†7F¢æû–¤Fþ¡BÍE T¡O€BXËY1^:Óp©\®‘¤5ŠÖ2*˜‘C©B6¬ÂÀ×ã­!ibžÝ]¤ôïÔʯËòY¬©°-öšœÞ·^4¸6UZÅ"Ñ{+ü!‚bKÊá‡-/ÚZmâb,5gUÇxØHžö +{é÷s;Ÿ†óª§6 ¬åÂP©ªƒÜß-¤·à ñé–’éÆÔéRƒ$H—LW,ˆ7¨U<m¯»¢•ÃÇô8C›Ò‚Ýu™ýxŽß;sN¨Í³.^1â§°M%‡£Oæëò‹3}uSimple, scalable, and high performance ML service deployment in python.

"},{"location":"#example","title":"Example","text":"Launch Usage
import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"infra\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

What's going on here:

  • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
  • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
  • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
  • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
  • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

"},{"location":"#installation","title":"Installation","text":"

To use Scale Launch, first install it using pip:

Installation
pip install -U scale-launch\n
"},{"location":"cli/","title":"CLI","text":"

Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

The CLI can be used as scale-launch ....

"},{"location":"cli/#help","title":"Help","text":"

Run scale-launch --help for more options.

scale-launch --help
    This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your Scale...\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
"},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

Scale Launch Python Client.

Initializes a Scale Launch Client.

Parameters:

Name Type Description Default api_key str

Your Scale API key

required endpoint Optional[str]

The Scale Launch Endpoint (this should not need to be changed)

None self_hosted bool

True iff you are connecting to a self-hosted Scale Launch

False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

Must have exactly one of urls or inputs passed in.

Parameters:

Name Type Description Default model_bundle Union[ModelBundle, str]

The bundle or the name of a the bundle to use for inference.

required urls List[str]

A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

None inputs Optional[List[Dict[str, Any]]]

A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

None batch_url_file_location Optional[str]

In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

None serialization_format str

Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

'JSON' labels Optional[Dict[str, str]]

An optional dictionary of key/value pairs to associate with this endpoint.

None cpus Optional[int]

Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

None memory Optional[str]

Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

None storage Optional[str]

Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

None gpus Optional[int]

Number of gpus each worker should get, e.g. 0, 1, etc.

None max_workers Optional[int]

The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

None per_worker Optional[int]

The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

  • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
  • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
None gpu_type Optional[str]

If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

  • nvidia-tesla-t4
  • nvidia-ampere-a10
None

Returns:

Type Description Dict[str, Any]

A dictionary that contains job_id as a key, and the ID as the value.

"},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n

Clones an existing model bundle with changes to its app config. (More fields coming soon)

Parameters:

Name Type Description Default model_bundle Union[ModelBundle, str]

The existing bundle or its ID.

required app_config Optional[Dict]

The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

None

Returns:

Type Description ModelBundle

A ModelBundle object

"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

Uploads and registers a model bundle to Scale Launch.

A model bundle consists of exactly one of the following:

  • predict_fn_or_cls
  • load_predict_fn + model
  • load_predict_fn + load_model_fn

Pre/post-processing code can be included inside load_predict_fn/model or in predict_fn_or_cls call.

Parameters:

Name Type Description Default model_bundle_name str

The name of the model bundle you want to create. The name must be unique across all bundles that you own.

required predict_fn_or_cls Optional[Callable[[Any], Any]]

Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

None model Optional[LaunchModel_T]

Typically a trained Neural Network, e.g. a Pytorch module.

Exactly one of model and load_model_fn must be provided.

None load_model_fn Optional[Callable[[], LaunchModel_T]]

A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

Exactly one of model and load_model_fn must be provided.

None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

Function that, when called with a model, returns a function that carries out inference.

If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

None requirements Optional[List[str]]

A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

[\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

None app_config Optional[Union[Dict[str, Any], str]]

Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

None env_params Dict[str, str]

A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

  • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

    .. code-block:: python

    { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

  • Tensorflow fields:

    • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
required globals_copy Optional[Dict[str, Any]]

Dictionary of the global symbol table. Normally provided by globals() built-in function.

None request_schema Optional[Type[BaseModel]]

A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

None response_schema Optional[Type[BaseModel]]

A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

For example, if you have a directory structure like so, and your current working directory is also my_root:

.. code-block:: text

my_root/ my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

then calling create_model_bundle_from_dirs with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

.. code-block:: text

my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

Parameters:

Name Type Description Default model_bundle_name str

The name of the model bundle you want to create. The name must be unique across all bundles that you own.

required base_paths List[str]

The paths on the local filesystem where the bundle code lives.

required requirements_path str

A path on the local filesystem where a requirements.txt file lives.

required env_params Dict[str, str]

A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

  • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

    .. code-block:: python

    { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

required load_predict_fn_module_path str

A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

required load_model_fn_module_path str

A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

required app_config Optional[Union[Dict[str, Any], str]]

Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

None request_schema Optional[Type[BaseModel]]

A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

None response_schema Optional[Type[BaseModel]]

A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

None"},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

Parameters:

Name Type Description Default endpoint_name str

The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

required model_bundle Union[ModelBundle, str]

The ModelBundle that the endpoint should serve.

required cpus int

Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

3 memory str

Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

'8Gi' storage Optional[str]

Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

None gpus int

Number of gpus each worker should get, e.g. 0, 1, etc.

0 min_workers int

The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

1 max_workers int

The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

1 per_worker int

The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

  • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

Here is our recommendation for computing per_worker:

  1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
10 gpu_type Optional[str]

If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

  • nvidia-tesla-t4
  • nvidia-ampere-a10
None endpoint_type str

Either \"sync\" or \"async\".

'sync' post_inference_hooks Optional[List[PostInferenceHooks]]

List of hooks to trigger after inference tasks are served.

None default_callback_url Optional[str]

The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

None update_if_exists bool

If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

False labels Optional[Dict[str, str]]

An optional dictionary of key/value pairs to associate with this endpoint.

None

Returns:

Type Description Optional[Endpoint]

A Endpoint object that can be used to make requests to the endpoint.

"},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

Deletes a model endpoint.

Parameters:

Name Type Description Default model_endpoint Union[ModelEndpoint, str]

A ModelEndpoint object.

required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None\n) -> None\n

Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

  • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

Parameters:

Name Type Description Default model_endpoint Union[ModelEndpoint, str]

The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

required model_bundle Optional[Union[ModelBundle, str]]

The ModelBundle that the endpoint should serve.

None cpus Optional[float]

Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

None memory Optional[str]

Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

None storage Optional[str]

Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

None gpus Optional[int]

Number of gpus each worker should get, e.g. 0, 1, etc.

None min_workers Optional[int]

The minimum number of workers. Must be greater than or equal to 0.

None max_workers Optional[int]

The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

None per_worker Optional[int]

The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

  • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
None gpu_type Optional[str]

If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

  • nvidia-tesla-t4
  • nvidia-ampere-a10
None post_inference_hooks Optional[List[PostInferenceHooks]]

List of hooks to trigger after inference tasks are served.

None default_callback_url Optional[str]

The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

Gets inference results from a previously created batch job.

Parameters:

Name Type Description Default batch_job_id str

An id representing the batch task job. This id is the in the response from calling batch_async_request.

required

Returns:

Type Description Dict[str, Any]

A dictionary that contains the following fields:

Dict[str, Any]
  • status: The status of the job.
Dict[str, Any]
  • result: The url where the result is stored.
Dict[str, Any]
  • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
Dict[str, Any]
  • num_tasks_pending: The number of tasks that are still pending.
Dict[str, Any]
  • num_tasks_completed: The number of tasks that have completed.
"},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

Returns a model bundle specified by bundle_name that the user owns.

Parameters:

Name Type Description Default model_bundle Union[ModelBundle, str]

The bundle or its name.

required

Returns:

Type Description ModelBundle

A ModelBundle object

"},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

Gets a model endpoint associated with a name.

Parameters:

Name Type Description Default endpoint_name str

The name of the endpoint to retrieve.

required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
list_model_bundles() -> List[ModelBundle]\n

Returns a list of model bundles that the user owns.

Returns:

Type Description List[ModelBundle]

A list of ModelBundle objects

"},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
list_model_endpoints() -> List[Endpoint]\n

Lists all model endpoints that the user owns.

Returns:

Type Description List[Endpoint]

A list of ModelEndpoint objects.

"},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

Retrieves the logs for the creation of the endpoint.

Parameters:

Name Type Description Default model_endpoint Union[ModelEndpoint, str]

The endpoint or its name.

required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

Parameters:

Name Type Description Default batch_csv_location_fn Callable[[], str]

Function that generates batch_csv_urls for upload_batch_csv_fn.

required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

Parameters:

Name Type Description Default bundle_location_fn Callable[[], str]

Function that generates bundle_urls for upload_bundle_fn.

required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

upload_batch_csv_fn(csv_text, csv_url)\n

This function should directly write the contents of csv_text as a text string into csv_url.

Parameters:

Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

upload_bundle_fn(serialized_bundle, bundle_url)\n

This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

Parameters:

Name Type Description Default upload_bundle_fn Callable[[str, str], None]

Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

required"},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

Represents a ModelBundle.

"},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
app_config: Optional[Dict[Any, Any]] = None\n

An optional user-specified configuration mapping for the bundle.

"},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
env_params: Optional[Dict[str, str]] = None\n

A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

"},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
id: Optional[str] = None\n

A globally unique identifier for the bundle.

"},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
location: Optional[str] = None\n

An opaque location for the bundle.

"},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
metadata: Optional[Dict[Any, Any]] = None\n

Arbitrary metadata for the bundle.

"},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
name: str\n

The name of the bundle. Must be unique across all bundles that the user owns.

"},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
packaging_type: Optional[str] = None\n

The packaging type for the bundle. Can be cloudpickle or zip.

"},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
requirements: Optional[List[str]] = None\n

A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

"},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

All classes here are returned by the get_model_endpoint method and provide a predict function.

"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

Bases: Endpoint

An asynchronous model endpoint.

Parameters:

Name Type Description Default model_endpoint ModelEndpoint

ModelEndpoint object.

required client

A LaunchClient object

required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
predict(request: EndpointRequest) -> EndpointResponseFuture\n

Runs an asynchronous prediction request.

Parameters:

Name Type Description Default request EndpointRequest

The EndpointRequest object that contains the payload.

required

Returns:

Name Type Description EndpointResponseFuture

An EndpointResponseFuture such the user can use to query the status of the request.

Example EndpointResponseFuture EndpointResponseFuture

.. code-block:: python

my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

(deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

Parameters:

Name Type Description Default requests Sequence[EndpointRequest]

List of EndpointRequests. Request_ids must all be distinct.

required

Returns:

Type Description AsyncEndpointBatchResponse

an AsyncEndpointResponse keeping track of the inference requests made

"},{"location":"concepts/batch_jobs/","title":"Batch jobs","text":""},{"location":"concepts/batch_jobs/#batch-jobs","title":"Batch Jobs","text":"

For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

Batch jobs are created using the batch_async_request method of the LaunchClient.

Creating and Following a Batch Job
import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
"},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

Represents a single request to either a SyncEndpoint or AsyncEndpoint.

Parameters:

Name Type Description Default url Optional[str]

A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

Exactly one of url and args must be specified.

None args Optional[Dict]

A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

Exactly one of url and args must be specified.

None return_pickled Optional[bool]

Whether the output should be a pickled python object, or directly returned serialized json.

False request_id Optional[str]

(deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

This object should not be directly instantiated by the user.

Parameters:

Name Type Description Default client

An instance of LaunchClient.

required endpoint_name str

The name of the endpoint.

required async_task_id str

An async task id.

required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
get(timeout: Optional[float] = None) -> EndpointResponse\n

Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

Parameters:

Name Type Description Default timeout Optional[float]

The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

Represents a response received from a Endpoint.

Parameters:

Name Type Description Default client

An instance of LaunchClient.

required status str

A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

required result_url Optional[str]

A string that is a url containing the pickled python object from the Endpoint's predict function.

Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

None result Optional[str]

A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

None traceback Optional[str]

The stack trace if the inference endpoint raised an error. Can be used for debugging

None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

"},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

There are two methods for creating model bundles: create_model_bundle and create_model_bundle_from_dirs. The former directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The latter takes in directories containing a load_predict_fn and the module path to the load_predict_fn.

Creating a Model Bundle DirectlyCreating a Model Bundle from Directories
import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n
import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\nnumpy\nsklearn\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"requirements_path\": \"requirements.txt\",\n\"env_params\": ENV_PARAMS,\n\"load_predict_fn\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
"},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

Creating Model Bundles with app_config
import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Literal, Union\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)\n
"},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes.

"},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

To list all the model bundles you own, use list_model_bundles.

"},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

"},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

Creating an Async Model Endpoint
import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\n
"},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints, and they require at least 1 min_worker.

Creating a Sync Model Endpoint
import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\n
"},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

Model endpoints can be listed, updated, and deleted using the Launch API.

Listing Model Endpoints
import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
Updating a Model Endpoint
import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
Deleting a Model Endpoint
import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
"}]} \ No newline at end of file diff --git a/sitemap.xml b/sitemap.xml new file mode 100644 index 00000000..31a79a51 --- /dev/null +++ b/sitemap.xml @@ -0,0 +1,48 @@ + + + + https://example.com/ + 2023-02-24 + daily + + + https://example.com/cli/ + 2023-02-24 + daily + + + https://example.com/api/client/ + 2023-02-24 + daily + + + https://example.com/api/model_bundles/ + 2023-02-24 + daily + + + https://example.com/api/model_endpoints/ + 2023-02-24 + daily + + + https://example.com/concepts/batch_jobs/ + 2023-02-24 + daily + + + https://example.com/concepts/endpoint_predictions/ + 2023-02-24 + daily + + + https://example.com/concepts/model_bundles/ + 2023-02-24 + daily + + + https://example.com/concepts/model_endpoints/ + 2023-02-24 + daily + + \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz new file mode 100644 index 0000000000000000000000000000000000000000..eeadd3e86d63b8e52b456d1786ecb43f2b7bcffb GIT binary patch literal 277 zcmV+w0qXuAiwFoNYWQOU|8r?{Wo=<_E_iKh0L_%mPQ)M-h4=Fm4f{f^F4VNl&La&x==+34zoAu4Bkaz`6dp#>+EoqFw6XClm*BWr$U8>U#_?i-P z44#GY8Ywu#I=0?yjUp!FByXGczHZvOeaM!Zwz0u1?1XOtKe!Z1e|Bu6TnX3@!e3!P ztFnNES1T0SR32A;2lX%>t<)Gx#X~E-Q#KU_2+jifOf`xG^YHG*QUSj|aPR@8f|RF5 bsi*}v Date: Fri, 24 Feb 2023 03:47:58 -0800 Subject: [PATCH 02/28] Deployed ebea46c with MkDocs version: 1.4.2 --- 404.html | 98 +- api/client/index.html | 66 +- api/endpoint_predictions/index.html | 1037 ++++++++++++++++++++++ api/hooks/index.html | 679 ++++++++++++++ api/model_bundles/index.html | 60 +- api/model_endpoints/index.html | 221 ++++- cli/index.html | 62 +- concepts/batch_jobs/index.html | 106 ++- concepts/callbacks/index.html | 642 ++++++++++++++ concepts/endpoint_predictions/index.html | 60 +- concepts/model_bundles/index.html | 62 +- concepts/model_endpoints/index.html | 67 +- concepts/overview/index.html | 598 +++++++++++++ index.html | 60 +- objects.inv | Bin 497 -> 533 bytes search/search_index.json | 2 +- sitemap.xml | 38 +- sitemap.xml.gz | Bin 277 -> 320 bytes 18 files changed, 3758 insertions(+), 100 deletions(-) create mode 100644 api/endpoint_predictions/index.html create mode 100644 api/hooks/index.html create mode 100644 concepts/callbacks/index.html create mode 100644 concepts/overview/index.html diff --git a/404.html b/404.html index 89dd6b76..e174bd99 100644 --- a/404.html +++ b/404.html @@ -12,7 +12,7 @@ - + @@ -21,10 +21,10 @@ - + - + @@ -40,9 +40,9 @@ - + - + @@ -80,9 +80,9 @@
@@ -1746,7 +1802,7 @@

Optional[List[PostInferenceHooks]] + Optional[List[PostInferenceHooks]]

List of hooks to trigger after inference tasks are served.

@@ -2029,7 +2085,7 @@

post_inference_hooks - Optional[List[PostInferenceHooks]] + Optional[List[PostInferenceHooks]]

List of hooks to trigger after inference tasks are served.

diff --git a/api/endpoint_predictions/index.html b/api/endpoint_predictions/index.html new file mode 100644 index 00000000..9147e194 --- /dev/null +++ b/api/endpoint_predictions/index.html @@ -0,0 +1,1037 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + Endpoint Predictions - Launch + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + +

Endpoint Predictions

+ + +
+ + + +

+ EndpointRequest + + +

+
EndpointRequest(
+    url: Optional[str] = None,
+    args: Optional[Dict] = None,
+    callback_url: Optional[str] = None,
+    return_pickled: Optional[bool] = False,
+    request_id: Optional[str] = None,
+)
+
+ +
+ + +

Represents a single request to either a SyncEndpoint or AsyncEndpoint.

+ +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
url + Optional[str] +

A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. +Note: the contents of the file located at url are opened as a sequence of bytes and passed +to the predict function. If you instead want to pass the url itself as an input to the predict function, +see args.

+

Exactly one of url and args must be specified.

+ None +
args + Optional[Dict] +

A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature +predict_fn(foo, bar), then the keys in the dictionary should be "foo" and "bar". +Values must be native Python objects.

+

Exactly one of url and args must be specified.

+ None +
return_pickled + Optional[bool] +

Whether the output should be a pickled python object, or directly returned serialized json.

+ False +
request_id + Optional[str] +

(deprecated) A user-specifiable id for requests. +Should be unique among EndpointRequests made in the same batch call. +If one isn't provided the client will generate its own.

+ None +
+ + + + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ EndpointResponse + + +

+
EndpointResponse(
+    client,
+    status: str,
+    result_url: Optional[str] = None,
+    result: Optional[str] = None,
+    traceback: Optional[str] = None,
+)
+
+ +
+ + +

Represents a response received from a Endpoint.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
client +

An instance of LaunchClient.

+ required +
status + str +

A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

+ required +
result_url + Optional[str] +

A string that is a url containing the pickled python object from the +Endpoint's predict function.

+

Exactly one of result_url or result will be populated, +depending on the value of return_pickled in the request.

+ None +
result + Optional[str] +

A string that is the serialized return value (in json form) of the Endpoint's predict function. +Specifically, one can json.loads() the value of result to get the original python object back.

+

Exactly one of result_url or result will be populated, +depending on the value of return_pickled in the request.

+ None +
traceback + Optional[str] +

The stack trace if the inference endpoint raised an error. Can be used for debugging

+ None +
+ + + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ EndpointResponseFuture + + +

+
EndpointResponseFuture(
+    client, endpoint_name: str, async_task_id: str
+)
+
+ +
+ + +

Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, +then its get method will return an actual instance of EndpointResponse.

+

This object should not be directly instantiated by the user.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
client +

An instance of LaunchClient.

+ required +
endpoint_name + str +

The name of the endpoint.

+ required +
async_task_id + str +

An async task id.

+ required +
+ + + + +
+ + + + + + + + + +
+ + + +

+ get + + +

+
get(timeout: Optional[float] = None) -> EndpointResponse
+
+ +
+ +

Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

+ +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
timeout + Optional[float] +

The maximum number of seconds to wait for the response. If None, then +the method will block indefinitely until the response is ready.

+ None +
+ +
+ +
+ + + +
+ +
+ +
+ + + + + + +
+
+ + + + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/api/hooks/index.html b/api/hooks/index.html new file mode 100644 index 00000000..9c22d181 --- /dev/null +++ b/api/hooks/index.html @@ -0,0 +1,679 @@ + + + + + + + + + + + + + + + + + + + + + + + + Hooks - Launch + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + +

Hooks

+ +
+ + + +

+ PostInferenceHooks + + +

+ + +
+

+ Bases: str, Enum

+ + +

Post-inference hooks are functions that are called after inference is complete.

+ +

Attributes:

+ + + + + + + + + + + + + + + +
NameTypeDescription
CALLBACK + str +

The callback hook is called with the inference response and the task ID.

+ + + + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + + + + +
+
+ + + + +
+ +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/api/model_bundles/index.html b/api/model_bundles/index.html index ae70d58b..cf3d560c 100644 --- a/api/model_bundles/index.html +++ b/api/model_bundles/index.html @@ -10,7 +10,7 @@ - + @@ -296,6 +296,20 @@ +
  • + + Overview + +
  • + + + + + + + + +
  • Model Bundles @@ -340,7 +354,21 @@
  • - Batch jobs + Batch Jobs + +
  • + + + + + + + + + +
  • + + Callbacks
  • @@ -529,6 +557,34 @@ + + + + + +
  • + + Endpoint Predictions + +
  • + + + + + + + + + +
  • + + Hooks + +
  • + + + + diff --git a/api/model_endpoints/index.html b/api/model_endpoints/index.html index 412dd6e2..47323783 100644 --- a/api/model_endpoints/index.html +++ b/api/model_endpoints/index.html @@ -10,12 +10,14 @@ - + + + @@ -294,6 +296,20 @@ +
  • + + Overview + +
  • + + + + + + + + +
  • Model Bundles @@ -338,7 +354,21 @@
  • - Batch jobs + Batch Jobs + +
  • + + + + + + + + + +
  • + + Callbacks
  • @@ -474,6 +504,26 @@ + + +
  • + + SyncEndpoint + + + +
  • @@ -485,6 +535,34 @@ + + + + + +
  • + + Endpoint Predictions + +
  • + + + + + + + + + +
  • + + Hooks + +
  • + + + + @@ -542,6 +620,26 @@ + + +
  • + + SyncEndpoint + + + +
  • @@ -776,6 +874,125 @@

    + + + +

    + SyncEndpoint + + +

    +
    SyncEndpoint(model_endpoint: ModelEndpoint, client)
    +
    + +
    +

    + Bases: Endpoint

    + + +

    A synchronous model endpoint.

    + + + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    model_endpoint + ModelEndpoint +

    ModelEndpoint object.

    + required +
    client +

    A LaunchClient object

    + required +
    + + + + +
    + + + + + + + + + +
    + + + +

    + predict + + +

    +
    predict(request: EndpointRequest) -> EndpointResponse
    +
    + +
    + +

    Runs a synchronous prediction request.

    + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    request + EndpointRequest +

    The EndpointRequest object that contains the payload.

    + required +
    + +
    + +
    + + +
    diff --git a/cli/index.html b/cli/index.html index d39cfb20..4a624f5a 100644 --- a/cli/index.html +++ b/cli/index.html @@ -10,13 +10,13 @@ - + - + @@ -333,6 +333,20 @@ +
  • + + Overview + +
  • + + + + + + + + +
  • Model Bundles @@ -377,7 +391,21 @@
  • - Batch jobs + Batch Jobs + +
  • + + + + + + + + + +
  • + + Callbacks
  • @@ -461,6 +489,34 @@ + + + + + +
  • + + Endpoint Predictions + +
  • + + + + + + + + + +
  • + + Hooks + +
  • + + + + diff --git a/concepts/batch_jobs/index.html b/concepts/batch_jobs/index.html index 25f6d761..ed844795 100644 --- a/concepts/batch_jobs/index.html +++ b/concepts/batch_jobs/index.html @@ -10,20 +10,20 @@ - + - + - Batch jobs - Launch + Batch Jobs - Launch @@ -109,7 +109,7 @@
    - Batch jobs + Batch Jobs
    @@ -298,6 +298,20 @@ +
  • + + Overview + +
  • + + + + + + + + +
  • Model Bundles @@ -347,40 +361,27 @@ + - - Batch jobs + Batch Jobs - - -
  • + + + + + - - - - +
  • + + Callbacks +
  • @@ -463,6 +464,34 @@ + + + + + +
  • + + Endpoint Predictions + +
  • + + + + + + + + + +
  • + + Hooks + +
  • + + + + @@ -486,21 +515,8 @@ + - - @@ -515,9 +531,7 @@ -

    Batch jobs

    - -

    Batch Jobs

    +

    Batch Jobs

    For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a diff --git a/concepts/callbacks/index.html b/concepts/callbacks/index.html new file mode 100644 index 00000000..de680de9 --- /dev/null +++ b/concepts/callbacks/index.html @@ -0,0 +1,642 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + Callbacks - Launch + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +
    + +
    + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    Callbacks

    +

    Async model endpoints can be configured to send callbacks to a user-defined +callback URL. Callbacks are sent as HTTP POST requests with a JSON body. The +following code snippet shows how to create an async model endpoint with a +callback URL.

    +

    To configure an async endpoint to send callbacks, set the post_inference_hooks +field to include +launch.PostInferenceHooks.CALLBACK. +A callback URL also needs to be specified, and it can be configured as a default +using the default_callback_url argument to +launch.LaunchClient.create_model_endpoint. +or as a per-task override using the callback_url field of +launch.EndpointRequest.

    +
    +

    Note

    +

    Callbacks will not be sent if the endpoint does not have any post-inference +hooks specified, even if a default_callback_url is provided to the endpoint +creation method or if the prediction request has a callback_url override.

    +
    +
    Creating an Async Model Endpoint with a Callback URL
    import os
    +from launch import EndpointRequest, LaunchClient, PostInferenceHooks
    +
    +client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
    +endpoint = client.create_model_endpoint(
    +    endpoint_name="demo-endpoint-callback",
    +    model_bundle="test-bundle",
    +    cpus=1,
    +    min_workers=1,
    +    endpoint_type="async",
    +    update_if_exists=True,
    +    labels={
    +        "team": "MY_TEAM",
    +        "product": "MY_PRODUCT"
    +    },
    +    post_inference_hooks=[PostInferenceHooks.CALLBACK],
    +    default_callback_url="https://example.com",
    +)
    +
    +future_default = endpoint.predict(request=EndpointRequest(args={"x": 2, "y": "hello"}))
    +"""
    +A callback is sent to https://example.com with the following JSON body:
    +{
    +    "task_id": "THE_TASK_ID",
    +    "result": 7
    +}
    +"""
    +
    +
    +future_custom_callback_url = endpoint.predict(
    +    request=EndpointRequest(
    +        args={"x": 3, "y": "hello"}, callback_url="https://example.com/custom"
    +    ),
    +)
    +
    +"""
    +A callback is sent to https://example.com/custom with the following JSON body:
    +{
    +    "task_id": "THE_TASK_ID",
    +    "result": 8
    +}
    +"""
    +
    + + + + + + +
    +
    + + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + \ No newline at end of file diff --git a/concepts/endpoint_predictions/index.html b/concepts/endpoint_predictions/index.html index 1af35a71..a9e8ed7c 100644 --- a/concepts/endpoint_predictions/index.html +++ b/concepts/endpoint_predictions/index.html @@ -10,7 +10,7 @@ - + @@ -298,6 +298,20 @@ +
  • + + Overview + +
  • + + + + + + + + +
  • Model Bundles @@ -410,7 +424,21 @@
  • - Batch jobs + Batch Jobs + +
  • + + + + + + + + + +
  • + + Callbacks
  • @@ -494,6 +522,34 @@ + + + + + +
  • + + Endpoint Predictions + +
  • + + + + + + + + + +
  • + + Hooks + +
  • + + + + diff --git a/concepts/model_bundles/index.html b/concepts/model_bundles/index.html index 1dd31922..dcfd4b95 100644 --- a/concepts/model_bundles/index.html +++ b/concepts/model_bundles/index.html @@ -10,10 +10,10 @@ - + - + @@ -297,6 +297,20 @@ + +
  • + + Overview + +
  • + + + + + + + + @@ -404,7 +418,21 @@
  • - Batch jobs + Batch Jobs + +
  • + + + + + + + + + +
  • + + Callbacks
  • @@ -488,6 +516,34 @@ + + + + + +
  • + + Endpoint Predictions + +
  • + + + + + + + + + +
  • + + Hooks + +
  • + + + + diff --git a/concepts/model_endpoints/index.html b/concepts/model_endpoints/index.html index b0afcb58..b524ad79 100644 --- a/concepts/model_endpoints/index.html +++ b/concepts/model_endpoints/index.html @@ -10,7 +10,7 @@ - + @@ -298,6 +298,20 @@ +
  • + + Overview + +
  • + + + + + + + + +
  • Model Bundles @@ -397,7 +411,21 @@
  • - Batch jobs + Batch Jobs + +
  • + + + + + + + + + +
  • + + Callbacks
  • @@ -481,6 +509,34 @@ + + + + + +
  • + + Endpoint Predictions + +
  • + + + + + + + + + +
  • + + Hooks + +
  • + + + + @@ -582,8 +638,11 @@

    Creating Async Model EndpointsCreating Sync Model Endpoints

    Sync model endpoints are useful for latency-sensitive tasks, such as real-time -inference. Sync endpoints are more expensive than async endpoints, and they -require at least 1 min_worker.

    +inference. Sync endpoints are more expensive than async endpoints.

    +
    +

    Note

    +

    Sync model endpoints require at least 1 min_worker.

    +
    Creating a Sync Model Endpoint
    import os
     from launch import LaunchClient
     
    diff --git a/concepts/overview/index.html b/concepts/overview/index.html
    new file mode 100644
    index 00000000..ed3c7516
    --- /dev/null
    +++ b/concepts/overview/index.html
    @@ -0,0 +1,598 @@
    +
    +
    +
    +  
    +    
    +      
    +      
    +      
    +        
    +      
    +      
    +      
    +        
    +      
    +      
    +        
    +      
    +      
    +        
    +      
    +      
    +      
    +    
    +    
    +      
    +        Overview - Launch
    +      
    +    
    +    
    +      
    +      
    +        
    +        
    +      
    +      
    +
    +    
    +    
    +    
    +      
    +        
    +        
    +        
    +        
    +        
    +      
    +    
    +    
    +      
    +    
    +    
    +    
    +      
    +
    +    
    +    
    +    
    +  
    +  
    +  
    +    
    +    
    +      
    +    
    +    
    +    
    +    
    +    
    +  
    +    
    +    
    +      
    +    
    +    
    +    
    +    
    +    
    +    
    + +
    + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    + + + + +

    Overview

    +

    Creating deployments on Launch generally involves three steps:

    +
      +
    1. +

      Create and upload a ModelBundle. Pass your trained model + as well as pre-/post-processing code to the Scale Launch Python client, and + we’ll create a model bundle based on the code and store it in our Bundle Store.

      +
    2. +
    3. +

      Create a ModelEndpoint. Pass a ModelBundle as well as + infrastructure settings such as the desired number of GPUs to our client. + This provisions resources on Scale’s cluster dedicated to your ModelEndpoint.

      +
    4. +
    5. +

      Make requests to the ModelEndpoint. You can make requests through the Python + client, or make HTTP requests directly to Scale.

      +
    6. +
    + + + + + + +
    +
    + + + + +
    + +
    + + + +
    +
    +
    +
    + + + + + + + + + \ No newline at end of file diff --git a/index.html b/index.html index 248fb455..e0210afd 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,7 @@ - + @@ -342,6 +342,20 @@ +
  • + + Overview + +
  • + + + + + + + + +
  • Model Bundles @@ -386,7 +400,21 @@
  • - Batch jobs + Batch Jobs + +
  • + + + + + + + + + +
  • + + Callbacks
  • @@ -470,6 +498,34 @@ + + + + + +
  • + + Endpoint Predictions + +
  • + + + + + + + + + +
  • + + Hooks + +
  • + + + + diff --git a/objects.inv b/objects.inv index 8de294524e0cfe4484b8b9888381b42f3c89f4b1..e43ed22faff7f5befaa9ffd329ff598edc3168bd 100644 GIT binary patch delta 420 zcmV;V0bBm@1C<1jdw*X~!ypg<@OM8&6MdD%SKrjkXrhU6AAsEGwI!nm0-f2nm;PC| z&Y4ufx3R!)2ge;#(2%H@P!h?rmu~dX4KlO46$+foZZa@((N9@iUS-!8>c>@V4PI0n z+>Qjd_|c&2q#{i5Qq%7+p)?_{b&iU!8_E^(Pw6WzDxeZw1b=K1{8Ubg@xtnw=hCK% z5h*uXQp8yX1ru_ZOP>rY(evrWaYmEFI5ACj4^sR-m2}gvToP*^ScDetT0T0wyL!Rk zN|#Y+8G=MRE_eCV|Gg z#h656LydO6n}25>YA!kY*!af&C*79m$&t?gg-Yv=jaULvS5 zUNImxP)aJf-ztF~txoh9l<y3j~ OX|}wI*zp(6BO?+*Qq|o6 delta 383 zcmV-_0f7FM1n~oqdwP?NF^x_MUS(vs&Iv~(B`}WfBtshBO z@JQ1Bn8NU<8d?%H6Ivk!_S}yi`axljw?c#W#Z3WL?S@BomsiF0h5q#|wuc~U4*p1j zJA7}^_fi=j3ChrUn9zohH%6l7`#5@ummmknw%Zpw_Y^3HdPW@ z#Ujy-dn^1Qf?|+M%Ha-&Eic+yZQ^1qHD^`Fc-Tmu_6mFH2KRG2pN8|Qr#1-;tmVQ` zsj3cx5ZvD_q<90j;Gps8mXhhl)DY=Xg8?K2NS6p2Ojj(3H>ear?5>WhohYaPv-0Li!*(7JX8X0e0`47ao#x5 dMsv9Rp4!kl{71UG+rBJAwi(VW`x9yp)~=?b!e9UZ diff --git a/search/search_index.json b/search/search_index.json index 26bf536e..82a01c37 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Scale Launch","text":"

    Simple, scalable, and high performance ML service deployment in python.

    "},{"location":"#example","title":"Example","text":"Launch Usage
    import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"infra\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

    What's going on here:

    • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
    • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
    • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
    • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
    • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

    Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

    "},{"location":"#installation","title":"Installation","text":"

    To use Scale Launch, first install it using pip:

    Installation
    pip install -U scale-launch\n
    "},{"location":"cli/","title":"CLI","text":"

    Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

    The CLI can be used as scale-launch ....

    "},{"location":"cli/#help","title":"Help","text":"

    Run scale-launch --help for more options.

    scale-launch --help
        This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your Scale...\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
    "},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
    LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

    Scale Launch Python Client.

    Initializes a Scale Launch Client.

    Parameters:

    Name Type Description Default api_key str

    Your Scale API key

    required endpoint Optional[str]

    The Scale Launch Endpoint (this should not need to be changed)

    None self_hosted bool

    True iff you are connecting to a self-hosted Scale Launch

    False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
    batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

    Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

    Must have exactly one of urls or inputs passed in.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or the name of a the bundle to use for inference.

    required urls List[str]

    A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

    None inputs Optional[List[Dict[str, Any]]]

    A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

    None batch_url_file_location Optional[str]

    In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

    None serialization_format str

    Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

    'JSON' labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None cpus Optional[int]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
    • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains job_id as a key, and the ID as the value.

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
    clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n

    Clones an existing model bundle with changes to its app config. (More fields coming soon)

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The existing bundle or its ID.

    required app_config Optional[Dict]

    The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

    None

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
    create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Uploads and registers a model bundle to Scale Launch.

    A model bundle consists of exactly one of the following:

    • predict_fn_or_cls
    • load_predict_fn + model
    • load_predict_fn + load_model_fn

    Pre/post-processing code can be included inside load_predict_fn/model or in predict_fn_or_cls call.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required predict_fn_or_cls Optional[Callable[[Any], Any]]

    Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

    None model Optional[LaunchModel_T]

    Typically a trained Neural Network, e.g. a Pytorch module.

    Exactly one of model and load_model_fn must be provided.

    None load_model_fn Optional[Callable[[], LaunchModel_T]]

    A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

    Exactly one of model and load_model_fn must be provided.

    None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

    Function that, when called with a model, returns a function that carries out inference.

    If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

    Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

    In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

    None requirements Optional[List[str]]

    A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

    [\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

    If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

    None app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    • Tensorflow fields:

      • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
    required globals_copy Optional[Dict[str, Any]]

    Dictionary of the global symbol table. Normally provided by globals() built-in function.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
    create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

    For example, if you have a directory structure like so, and your current working directory is also my_root:

    .. code-block:: text

    my_root/ my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    then calling create_model_bundle_from_dirs with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

    .. code-block:: text

    my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required base_paths List[str]

    The paths on the local filesystem where the bundle code lives.

    required requirements_path str

    A path on the local filesystem where a requirements.txt file lives.

    required env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    required load_predict_fn_module_path str

    A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

    required load_model_fn_module_path str

    A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

    required app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
    create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

    Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

    required model_bundle Union[ModelBundle, str]

    The ModelBundle that the endpoint should serve.

    required cpus int

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    3 memory str

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    '8Gi' storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus int

    Number of gpus each worker should get, e.g. 0, 1, etc.

    0 min_workers int

    The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

    1 max_workers int

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

    1 per_worker int

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

    Here is our recommendation for computing per_worker:

    1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
    10 gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None endpoint_type str

    Either \"sync\" or \"async\".

    'sync' post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None update_if_exists bool

    If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

    False labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None

    Returns:

    Type Description Optional[Endpoint]

    A Endpoint object that can be used to make requests to the endpoint.

    "},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
    delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Deletes a model endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    A ModelEndpoint object.

    required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
    edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None\n) -> None\n

    Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

    • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

    required model_bundle Optional[Union[ModelBundle, str]]

    The ModelBundle that the endpoint should serve.

    None cpus Optional[float]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None min_workers Optional[int]

    The minimum number of workers. Must be greater than or equal to 0.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
    get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

    Gets inference results from a previously created batch job.

    Parameters:

    Name Type Description Default batch_job_id str

    An id representing the batch task job. This id is the in the response from calling batch_async_request.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains the following fields:

    Dict[str, Any]
    • status: The status of the job.
    Dict[str, Any]
    • result: The url where the result is stored.
    Dict[str, Any]
    • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
    Dict[str, Any]
    • num_tasks_pending: The number of tasks that are still pending.
    Dict[str, Any]
    • num_tasks_completed: The number of tasks that have completed.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
    get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

    Returns a model bundle specified by bundle_name that the user owns.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or its name.

    required

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
    get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

    Gets a model endpoint associated with a name.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the endpoint to retrieve.

    required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
    list_model_bundles() -> List[ModelBundle]\n

    Returns a list of model bundles that the user owns.

    Returns:

    Type Description List[ModelBundle]

    A list of ModelBundle objects

    "},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
    list_model_endpoints() -> List[Endpoint]\n

    Lists all model endpoints that the user owns.

    Returns:

    Type Description List[Endpoint]

    A list of ModelEndpoint objects.

    "},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
    read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Retrieves the logs for the creation of the endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The endpoint or its name.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
    register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

    Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

    Parameters:

    Name Type Description Default batch_csv_location_fn Callable[[], str]

    Function that generates batch_csv_urls for upload_batch_csv_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
    register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

    Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

    Parameters:

    Name Type Description Default bundle_location_fn Callable[[], str]

    Function that generates bundle_urls for upload_bundle_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
    register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

    upload_batch_csv_fn(csv_text, csv_url)\n

    This function should directly write the contents of csv_text as a text string into csv_url.

    Parameters:

    Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

    Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
    register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

    upload_bundle_fn(serialized_bundle, bundle_url)\n

    This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

    See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

    Parameters:

    Name Type Description Default upload_bundle_fn Callable[[str, str], None]

    Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

    Represents a ModelBundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[Any, Any]] = None\n

    An optional user-specified configuration mapping for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
    env_params: Optional[Dict[str, str]] = None\n

    A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
    id: Optional[str] = None\n

    A globally unique identifier for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
    location: Optional[str] = None\n

    An opaque location for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
    metadata: Optional[Dict[Any, Any]] = None\n

    Arbitrary metadata for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
    name: str\n

    The name of the bundle. Must be unique across all bundles that the user owns.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
    packaging_type: Optional[str] = None\n

    The packaging type for the bundle. Can be cloudpickle or zip.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
    requirements: Optional[List[str]] = None\n

    A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

    All classes here are returned by the get_model_endpoint method and provide a predict function.

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
    AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    An asynchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponseFuture\n

    Runs an asynchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required

    Returns:

    Name Type Description EndpointResponseFuture

    An EndpointResponseFuture such the user can use to query the status of the request.

    Example EndpointResponseFuture EndpointResponseFuture

    .. code-block:: python

    my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
    predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

    (deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

    Parameters:

    Name Type Description Default requests Sequence[EndpointRequest]

    List of EndpointRequests. Request_ids must all be distinct.

    required

    Returns:

    Type Description AsyncEndpointBatchResponse

    an AsyncEndpointResponse keeping track of the inference requests made

    "},{"location":"concepts/batch_jobs/","title":"Batch jobs","text":""},{"location":"concepts/batch_jobs/#batch-jobs","title":"Batch Jobs","text":"

    For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

    Batch jobs are created using the batch_async_request method of the LaunchClient.

    Creating and Following a Batch Job
    import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
    "},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

    Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

    Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
    "},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

    Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

    "},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

    There are two methods for creating model bundles: create_model_bundle and create_model_bundle_from_dirs. The former directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The latter takes in directories containing a load_predict_fn and the module path to the load_predict_fn.

    Creating a Model Bundle DirectlyCreating a Model Bundle from Directories
    import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n
    import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\nnumpy\nsklearn\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"requirements_path\": \"requirements.txt\",\n\"env_params\": ENV_PARAMS,\n\"load_predict_fn\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
    "},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

    The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

    Creating Model Bundles with app_config
    import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Literal, Union\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)\n
    "},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

    Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes.

    "},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

    To list all the model bundles you own, use list_model_bundles.

    "},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

    Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

    Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

    "},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

    Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

    Creating an Async Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\n
    "},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

    Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints, and they require at least 1 min_worker.

    Creating a Sync Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\n
    "},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

    Model endpoints can be listed, updated, and deleted using the Launch API.

    Listing Model Endpoints
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
    Updating a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
    Deleting a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
    "}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Scale Launch","text":"

    Simple, scalable, and high performance ML service deployment in python.

    "},{"location":"#example","title":"Example","text":"Launch Usage
    import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"infra\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

    What's going on here:

    • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
    • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
    • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
    • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
    • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

    Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

    "},{"location":"#installation","title":"Installation","text":"

    To use Scale Launch, first install it using pip:

    Installation
    pip install -U scale-launch\n
    "},{"location":"cli/","title":"CLI","text":"

    Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

    The CLI can be used as scale-launch ....

    "},{"location":"cli/#help","title":"Help","text":"

    Run scale-launch --help for more options.

    scale-launch --help
        This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your Scale...\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
    "},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
    LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

    Scale Launch Python Client.

    Initializes a Scale Launch Client.

    Parameters:

    Name Type Description Default api_key str

    Your Scale API key

    required endpoint Optional[str]

    The Scale Launch Endpoint (this should not need to be changed)

    None self_hosted bool

    True iff you are connecting to a self-hosted Scale Launch

    False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
    batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

    Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

    Must have exactly one of urls or inputs passed in.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or the name of a the bundle to use for inference.

    required urls List[str]

    A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

    None inputs Optional[List[Dict[str, Any]]]

    A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

    None batch_url_file_location Optional[str]

    In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

    None serialization_format str

    Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

    'JSON' labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None cpus Optional[int]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
    • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains job_id as a key, and the ID as the value.

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
    clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n

    Clones an existing model bundle with changes to its app config. (More fields coming soon)

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The existing bundle or its ID.

    required app_config Optional[Dict]

    The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

    None

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
    create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Uploads and registers a model bundle to Scale Launch.

    A model bundle consists of exactly one of the following:

    • predict_fn_or_cls
    • load_predict_fn + model
    • load_predict_fn + load_model_fn

    Pre/post-processing code can be included inside load_predict_fn/model or in predict_fn_or_cls call.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required predict_fn_or_cls Optional[Callable[[Any], Any]]

    Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

    None model Optional[LaunchModel_T]

    Typically a trained Neural Network, e.g. a Pytorch module.

    Exactly one of model and load_model_fn must be provided.

    None load_model_fn Optional[Callable[[], LaunchModel_T]]

    A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

    Exactly one of model and load_model_fn must be provided.

    None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

    Function that, when called with a model, returns a function that carries out inference.

    If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

    Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

    In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

    None requirements Optional[List[str]]

    A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

    [\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

    If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

    None app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    • Tensorflow fields:

      • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
    required globals_copy Optional[Dict[str, Any]]

    Dictionary of the global symbol table. Normally provided by globals() built-in function.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
    create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

    For example, if you have a directory structure like so, and your current working directory is also my_root:

    .. code-block:: text

    my_root/ my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    then calling create_model_bundle_from_dirs with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

    .. code-block:: text

    my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required base_paths List[str]

    The paths on the local filesystem where the bundle code lives.

    required requirements_path str

    A path on the local filesystem where a requirements.txt file lives.

    required env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    required load_predict_fn_module_path str

    A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

    required load_model_fn_module_path str

    A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

    required app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
    create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

    Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

    required model_bundle Union[ModelBundle, str]

    The ModelBundle that the endpoint should serve.

    required cpus int

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    3 memory str

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    '8Gi' storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus int

    Number of gpus each worker should get, e.g. 0, 1, etc.

    0 min_workers int

    The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

    1 max_workers int

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

    1 per_worker int

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

    Here is our recommendation for computing per_worker:

    1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
    10 gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None endpoint_type str

    Either \"sync\" or \"async\".

    'sync' post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None update_if_exists bool

    If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

    False labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None

    Returns:

    Type Description Optional[Endpoint]

    A Endpoint object that can be used to make requests to the endpoint.

    "},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
    delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Deletes a model endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    A ModelEndpoint object.

    required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
    edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None\n) -> None\n

    Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

    • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

    required model_bundle Optional[Union[ModelBundle, str]]

    The ModelBundle that the endpoint should serve.

    None cpus Optional[float]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None min_workers Optional[int]

    The minimum number of workers. Must be greater than or equal to 0.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
    get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

    Gets inference results from a previously created batch job.

    Parameters:

    Name Type Description Default batch_job_id str

    An id representing the batch task job. This id is the in the response from calling batch_async_request.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains the following fields:

    Dict[str, Any]
    • status: The status of the job.
    Dict[str, Any]
    • result: The url where the result is stored.
    Dict[str, Any]
    • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
    Dict[str, Any]
    • num_tasks_pending: The number of tasks that are still pending.
    Dict[str, Any]
    • num_tasks_completed: The number of tasks that have completed.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
    get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

    Returns a model bundle specified by bundle_name that the user owns.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or its name.

    required

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
    get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

    Gets a model endpoint associated with a name.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the endpoint to retrieve.

    required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
    list_model_bundles() -> List[ModelBundle]\n

    Returns a list of model bundles that the user owns.

    Returns:

    Type Description List[ModelBundle]

    A list of ModelBundle objects

    "},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
    list_model_endpoints() -> List[Endpoint]\n

    Lists all model endpoints that the user owns.

    Returns:

    Type Description List[Endpoint]

    A list of ModelEndpoint objects.

    "},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
    read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Retrieves the logs for the creation of the endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The endpoint or its name.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
    register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

    Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

    Parameters:

    Name Type Description Default batch_csv_location_fn Callable[[], str]

    Function that generates batch_csv_urls for upload_batch_csv_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
    register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

    Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

    Parameters:

    Name Type Description Default bundle_location_fn Callable[[], str]

    Function that generates bundle_urls for upload_bundle_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
    register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

    upload_batch_csv_fn(csv_text, csv_url)\n

    This function should directly write the contents of csv_text as a text string into csv_url.

    Parameters:

    Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

    Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
    register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

    upload_bundle_fn(serialized_bundle, bundle_url)\n

    This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

    See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

    Parameters:

    Name Type Description Default upload_bundle_fn Callable[[str, str], None]

    Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/endpoint_predictions/","title":"Endpoint Predictions","text":""},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"api/hooks/","title":"Hooks","text":""},{"location":"api/hooks/#launch.hooks.PostInferenceHooks","title":"PostInferenceHooks","text":"

    Bases: str, Enum

    Post-inference hooks are functions that are called after inference is complete.

    Attributes:

    Name Type Description CALLBACK str

    The callback hook is called with the inference response and the task ID.

    "},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

    Represents a ModelBundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[Any, Any]] = None\n

    An optional user-specified configuration mapping for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
    env_params: Optional[Dict[str, str]] = None\n

    A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
    id: Optional[str] = None\n

    A globally unique identifier for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
    location: Optional[str] = None\n

    An opaque location for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
    metadata: Optional[Dict[Any, Any]] = None\n

    Arbitrary metadata for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
    name: str\n

    The name of the bundle. Must be unique across all bundles that the user owns.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
    packaging_type: Optional[str] = None\n

    The packaging type for the bundle. Can be cloudpickle or zip.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
    requirements: Optional[List[str]] = None\n

    A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

    All classes here are returned by the get_model_endpoint method and provide a predict function.

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
    AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    An asynchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponseFuture\n

    Runs an asynchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required

    Returns:

    Name Type Description EndpointResponseFuture

    An EndpointResponseFuture such the user can use to query the status of the request.

    Example EndpointResponseFuture EndpointResponseFuture

    .. code-block:: python

    my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
    predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

    (deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

    Parameters:

    Name Type Description Default requests Sequence[EndpointRequest]

    List of EndpointRequests. Request_ids must all be distinct.

    required

    Returns:

    Type Description AsyncEndpointBatchResponse

    an AsyncEndpointResponse keeping track of the inference requests made

    "},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint","title":"SyncEndpoint","text":"
    SyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    A synchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponse\n

    Runs a synchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required"},{"location":"concepts/batch_jobs/","title":"Batch Jobs","text":"

    For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

    Batch jobs are created using the batch_async_request method of the LaunchClient.

    Creating and Following a Batch Job
    import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
    "},{"location":"concepts/callbacks/","title":"Callbacks","text":"

    Async model endpoints can be configured to send callbacks to a user-defined callback URL. Callbacks are sent as HTTP POST requests with a JSON body. The following code snippet shows how to create an async model endpoint with a callback URL.

    To configure an async endpoint to send callbacks, set the post_inference_hooks field to include launch.PostInferenceHooks.CALLBACK. A callback URL also needs to be specified, and it can be configured as a default using the default_callback_url argument to launch.LaunchClient.create_model_endpoint. or as a per-task override using the callback_url field of launch.EndpointRequest.

    Note

    Callbacks will not be sent if the endpoint does not have any post-inference hooks specified, even if a default_callback_url is provided to the endpoint creation method or if the prediction request has a callback_url override.

    Creating an Async Model Endpoint with a Callback URL
    import os\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\n)\nfuture_default = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\n\"\"\"\nA callback is sent to https://example.com with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 7\n}\n\"\"\"\nfuture_custom_callback_url = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"}, callback_url=\"https://example.com/custom\"\n),\n)\n\"\"\"\nA callback is sent to https://example.com/custom with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 8\n}\n\"\"\"\n
    "},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

    Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

    Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
    "},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

    Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

    "},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

    There are two methods for creating model bundles: create_model_bundle and create_model_bundle_from_dirs. The former directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The latter takes in directories containing a load_predict_fn and the module path to the load_predict_fn.

    Creating a Model Bundle DirectlyCreating a Model Bundle from Directories
    import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n
    import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\nnumpy\nsklearn\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"requirements_path\": \"requirements.txt\",\n\"env_params\": ENV_PARAMS,\n\"load_predict_fn\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
    "},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

    The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

    Creating Model Bundles with app_config
    import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Literal, Union\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)\n
    "},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

    Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes.

    "},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

    To list all the model bundles you own, use list_model_bundles.

    "},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

    Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

    Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

    "},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

    Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

    Creating an Async Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\n
    "},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

    Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints.

    Note

    Sync model endpoints require at least 1 min_worker.

    Creating a Sync Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\n
    "},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

    Model endpoints can be listed, updated, and deleted using the Launch API.

    Listing Model Endpoints
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
    Updating a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
    Deleting a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
    "},{"location":"concepts/overview/","title":"Overview","text":"

    Creating deployments on Launch generally involves three steps:

    1. Create and upload a ModelBundle. Pass your trained model as well as pre-/post-processing code to the Scale Launch Python client, and we\u2019ll create a model bundle based on the code and store it in our Bundle Store.

    2. Create a ModelEndpoint. Pass a ModelBundle as well as infrastructure settings such as the desired number of GPUs to our client. This provisions resources on Scale\u2019s cluster dedicated to your ModelEndpoint.

    3. Make requests to the ModelEndpoint. You can make requests through the Python client, or make HTTP requests directly to Scale.

    "}]} \ No newline at end of file diff --git a/sitemap.xml b/sitemap.xml index 31a79a51..e9e95501 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -1,47 +1,67 @@ - https://example.com/ + https://scaleapi.github.io/launch-python-client/ 2023-02-24 daily - https://example.com/cli/ + https://scaleapi.github.io/launch-python-client/cli/ 2023-02-24 daily - https://example.com/api/client/ + https://scaleapi.github.io/launch-python-client/api/client/ 2023-02-24 daily - https://example.com/api/model_bundles/ + https://scaleapi.github.io/launch-python-client/api/endpoint_predictions/ 2023-02-24 daily - https://example.com/api/model_endpoints/ + https://scaleapi.github.io/launch-python-client/api/hooks/ 2023-02-24 daily - https://example.com/concepts/batch_jobs/ + https://scaleapi.github.io/launch-python-client/api/model_bundles/ 2023-02-24 daily - https://example.com/concepts/endpoint_predictions/ + https://scaleapi.github.io/launch-python-client/api/model_endpoints/ 2023-02-24 daily - https://example.com/concepts/model_bundles/ + https://scaleapi.github.io/launch-python-client/concepts/batch_jobs/ 2023-02-24 daily - https://example.com/concepts/model_endpoints/ + https://scaleapi.github.io/launch-python-client/concepts/callbacks/ + 2023-02-24 + daily + + + https://scaleapi.github.io/launch-python-client/concepts/endpoint_predictions/ + 2023-02-24 + daily + + + https://scaleapi.github.io/launch-python-client/concepts/model_bundles/ + 2023-02-24 + daily + + + https://scaleapi.github.io/launch-python-client/concepts/model_endpoints/ + 2023-02-24 + daily + + + https://scaleapi.github.io/launch-python-client/concepts/overview/ 2023-02-24 daily diff --git a/sitemap.xml.gz b/sitemap.xml.gz index eeadd3e86d63b8e52b456d1786ecb43f2b7bcffb..5e834fd03d8b342abb25796d96a3df62ab723fbc 100644 GIT binary patch literal 320 zcmV-G0l)qqiwFqqqxfS2|8r?{Wo=<_E_iKh0M(YkZo?o9hVOlfhY<|Th?uSb literal 277 zcmV+w0qXuAiwFoNYWQOU|8r?{Wo=<_E_iKh0L_%mPQ)M-h4=Fm4f{f^F4VNl&La&x==+34zoAu4Bkaz`6dp#>+EoqFw6XClm*BWr$U8>U#_?i-P z44#GY8Ywu#I=0?yjUp!FByXGczHZvOeaM!Zwz0u1?1XOtKe!Z1e|Bu6TnX3@!e3!P ztFnNES1T0SR32A;2lX%>t<)Gx#X~E-Q#KU_2+jifOf`xG^YHG*QUSj|aPR@8f|RF5 bsi*}v Date: Fri, 24 Feb 2023 11:02:29 -0800 Subject: [PATCH 03/28] Deployed fc294c2 with MkDocs version: 1.4.2 --- concepts/callbacks/index.html | 12 ++++++------ concepts/model_bundles/index.html | 4 ++-- search/search_index.json | 2 +- sitemap.xml.gz | Bin 320 -> 320 bytes 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/concepts/callbacks/index.html b/concepts/callbacks/index.html index de680de9..90ec50b7 100644 --- a/concepts/callbacks/index.html +++ b/concepts/callbacks/index.html @@ -541,7 +541,7 @@

    Callbackslaunch.PostInferenceHooks.CALLBACK. A callback URL also needs to be specified, and it can be configured as a default using the default_callback_url argument to -launch.LaunchClient.create_model_endpoint. +launch.LaunchClient.create_model_endpoint or as a per-task override using the callback_url field of launch.EndpointRequest.

    @@ -565,9 +565,9 @@

    Callbacks "team": "MY_TEAM", "product": "MY_PRODUCT" }, - post_inference_hooks=[PostInferenceHooks.CALLBACK], - default_callback_url="https://example.com", -) + post_inference_hooks=[PostInferenceHooks.CALLBACK], + default_callback_url="https://example.com", +) future_default = endpoint.predict(request=EndpointRequest(args={"x": 2, "y": "hello"})) """ @@ -581,8 +581,8 @@

    Callbacks future_custom_callback_url = endpoint.predict( request=EndpointRequest( - args={"x": 3, "y": "hello"}, callback_url="https://example.com/custom" - ), + args={"x": 3, "y": "hello"}, callback_url="https://example.com/custom" + ), ) """ diff --git a/concepts/model_bundles/index.html b/concepts/model_bundles/index.html index dcfd4b95..29fd1367 100644 --- a/concepts/model_bundles/index.html +++ b/concepts/model_bundles/index.html @@ -748,7 +748,7 @@

    Creating Model Bundles} client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY")) -client.create_model_bundle(**BUNDLE_PARAMS) +client.create_model_bundle_from_dirs(**BUNDLE_PARAMS) # Clean up files from demo os.remove(model_filename) @@ -838,7 +838,7 @@

    Configuring Model Bundles "requirements": [], "request_schema": MyRequestSchema, "response_schema": MyResponseSchema, - "app_config": {"mode": "single"}, + "app_config": {"mode": "batched"}, } client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY")) diff --git a/search/search_index.json b/search/search_index.json index 82a01c37..e76e3011 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Scale Launch","text":"

    Simple, scalable, and high performance ML service deployment in python.

    "},{"location":"#example","title":"Example","text":"Launch Usage
    import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"infra\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

    What's going on here:

    • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
    • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
    • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
    • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
    • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

    Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

    "},{"location":"#installation","title":"Installation","text":"

    To use Scale Launch, first install it using pip:

    Installation
    pip install -U scale-launch\n
    "},{"location":"cli/","title":"CLI","text":"

    Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

    The CLI can be used as scale-launch ....

    "},{"location":"cli/#help","title":"Help","text":"

    Run scale-launch --help for more options.

    scale-launch --help
        This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your Scale...\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
    "},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
    LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

    Scale Launch Python Client.

    Initializes a Scale Launch Client.

    Parameters:

    Name Type Description Default api_key str

    Your Scale API key

    required endpoint Optional[str]

    The Scale Launch Endpoint (this should not need to be changed)

    None self_hosted bool

    True iff you are connecting to a self-hosted Scale Launch

    False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
    batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

    Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

    Must have exactly one of urls or inputs passed in.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or the name of a the bundle to use for inference.

    required urls List[str]

    A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

    None inputs Optional[List[Dict[str, Any]]]

    A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

    None batch_url_file_location Optional[str]

    In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

    None serialization_format str

    Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

    'JSON' labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None cpus Optional[int]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
    • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains job_id as a key, and the ID as the value.

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
    clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n

    Clones an existing model bundle with changes to its app config. (More fields coming soon)

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The existing bundle or its ID.

    required app_config Optional[Dict]

    The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

    None

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
    create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Uploads and registers a model bundle to Scale Launch.

    A model bundle consists of exactly one of the following:

    • predict_fn_or_cls
    • load_predict_fn + model
    • load_predict_fn + load_model_fn

    Pre/post-processing code can be included inside load_predict_fn/model or in predict_fn_or_cls call.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required predict_fn_or_cls Optional[Callable[[Any], Any]]

    Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

    None model Optional[LaunchModel_T]

    Typically a trained Neural Network, e.g. a Pytorch module.

    Exactly one of model and load_model_fn must be provided.

    None load_model_fn Optional[Callable[[], LaunchModel_T]]

    A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

    Exactly one of model and load_model_fn must be provided.

    None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

    Function that, when called with a model, returns a function that carries out inference.

    If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

    Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

    In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

    None requirements Optional[List[str]]

    A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

    [\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

    If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

    None app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    • Tensorflow fields:

      • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
    required globals_copy Optional[Dict[str, Any]]

    Dictionary of the global symbol table. Normally provided by globals() built-in function.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
    create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

    For example, if you have a directory structure like so, and your current working directory is also my_root:

    .. code-block:: text

    my_root/ my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    then calling create_model_bundle_from_dirs with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

    .. code-block:: text

    my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required base_paths List[str]

    The paths on the local filesystem where the bundle code lives.

    required requirements_path str

    A path on the local filesystem where a requirements.txt file lives.

    required env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    required load_predict_fn_module_path str

    A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

    required load_model_fn_module_path str

    A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

    required app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
    create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

    Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

    required model_bundle Union[ModelBundle, str]

    The ModelBundle that the endpoint should serve.

    required cpus int

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    3 memory str

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    '8Gi' storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus int

    Number of gpus each worker should get, e.g. 0, 1, etc.

    0 min_workers int

    The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

    1 max_workers int

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

    1 per_worker int

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

    Here is our recommendation for computing per_worker:

    1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
    10 gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None endpoint_type str

    Either \"sync\" or \"async\".

    'sync' post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None update_if_exists bool

    If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

    False labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None

    Returns:

    Type Description Optional[Endpoint]

    A Endpoint object that can be used to make requests to the endpoint.

    "},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
    delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Deletes a model endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    A ModelEndpoint object.

    required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
    edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None\n) -> None\n

    Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

    • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

    required model_bundle Optional[Union[ModelBundle, str]]

    The ModelBundle that the endpoint should serve.

    None cpus Optional[float]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None min_workers Optional[int]

    The minimum number of workers. Must be greater than or equal to 0.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
    get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

    Gets inference results from a previously created batch job.

    Parameters:

    Name Type Description Default batch_job_id str

    An id representing the batch task job. This id is the in the response from calling batch_async_request.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains the following fields:

    Dict[str, Any]
    • status: The status of the job.
    Dict[str, Any]
    • result: The url where the result is stored.
    Dict[str, Any]
    • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
    Dict[str, Any]
    • num_tasks_pending: The number of tasks that are still pending.
    Dict[str, Any]
    • num_tasks_completed: The number of tasks that have completed.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
    get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

    Returns a model bundle specified by bundle_name that the user owns.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or its name.

    required

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
    get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

    Gets a model endpoint associated with a name.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the endpoint to retrieve.

    required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
    list_model_bundles() -> List[ModelBundle]\n

    Returns a list of model bundles that the user owns.

    Returns:

    Type Description List[ModelBundle]

    A list of ModelBundle objects

    "},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
    list_model_endpoints() -> List[Endpoint]\n

    Lists all model endpoints that the user owns.

    Returns:

    Type Description List[Endpoint]

    A list of ModelEndpoint objects.

    "},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
    read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Retrieves the logs for the creation of the endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The endpoint or its name.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
    register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

    Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

    Parameters:

    Name Type Description Default batch_csv_location_fn Callable[[], str]

    Function that generates batch_csv_urls for upload_batch_csv_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
    register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

    Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

    Parameters:

    Name Type Description Default bundle_location_fn Callable[[], str]

    Function that generates bundle_urls for upload_bundle_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
    register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

    upload_batch_csv_fn(csv_text, csv_url)\n

    This function should directly write the contents of csv_text as a text string into csv_url.

    Parameters:

    Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

    Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
    register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

    upload_bundle_fn(serialized_bundle, bundle_url)\n

    This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

    See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

    Parameters:

    Name Type Description Default upload_bundle_fn Callable[[str, str], None]

    Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/endpoint_predictions/","title":"Endpoint Predictions","text":""},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"api/hooks/","title":"Hooks","text":""},{"location":"api/hooks/#launch.hooks.PostInferenceHooks","title":"PostInferenceHooks","text":"

    Bases: str, Enum

    Post-inference hooks are functions that are called after inference is complete.

    Attributes:

    Name Type Description CALLBACK str

    The callback hook is called with the inference response and the task ID.

    "},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

    Represents a ModelBundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[Any, Any]] = None\n

    An optional user-specified configuration mapping for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
    env_params: Optional[Dict[str, str]] = None\n

    A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
    id: Optional[str] = None\n

    A globally unique identifier for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
    location: Optional[str] = None\n

    An opaque location for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
    metadata: Optional[Dict[Any, Any]] = None\n

    Arbitrary metadata for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
    name: str\n

    The name of the bundle. Must be unique across all bundles that the user owns.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
    packaging_type: Optional[str] = None\n

    The packaging type for the bundle. Can be cloudpickle or zip.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
    requirements: Optional[List[str]] = None\n

    A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

    All classes here are returned by the get_model_endpoint method and provide a predict function.

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
    AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    An asynchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponseFuture\n

    Runs an asynchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required

    Returns:

    Name Type Description EndpointResponseFuture

    An EndpointResponseFuture such the user can use to query the status of the request.

    Example EndpointResponseFuture EndpointResponseFuture

    .. code-block:: python

    my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
    predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

    (deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

    Parameters:

    Name Type Description Default requests Sequence[EndpointRequest]

    List of EndpointRequests. Request_ids must all be distinct.

    required

    Returns:

    Type Description AsyncEndpointBatchResponse

    an AsyncEndpointResponse keeping track of the inference requests made

    "},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint","title":"SyncEndpoint","text":"
    SyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    A synchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponse\n

    Runs a synchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required"},{"location":"concepts/batch_jobs/","title":"Batch Jobs","text":"

    For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

    Batch jobs are created using the batch_async_request method of the LaunchClient.

    Creating and Following a Batch Job
    import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
    "},{"location":"concepts/callbacks/","title":"Callbacks","text":"

    Async model endpoints can be configured to send callbacks to a user-defined callback URL. Callbacks are sent as HTTP POST requests with a JSON body. The following code snippet shows how to create an async model endpoint with a callback URL.

    To configure an async endpoint to send callbacks, set the post_inference_hooks field to include launch.PostInferenceHooks.CALLBACK. A callback URL also needs to be specified, and it can be configured as a default using the default_callback_url argument to launch.LaunchClient.create_model_endpoint. or as a per-task override using the callback_url field of launch.EndpointRequest.

    Note

    Callbacks will not be sent if the endpoint does not have any post-inference hooks specified, even if a default_callback_url is provided to the endpoint creation method or if the prediction request has a callback_url override.

    Creating an Async Model Endpoint with a Callback URL
    import os\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\n)\nfuture_default = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\n\"\"\"\nA callback is sent to https://example.com with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 7\n}\n\"\"\"\nfuture_custom_callback_url = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"}, callback_url=\"https://example.com/custom\"\n),\n)\n\"\"\"\nA callback is sent to https://example.com/custom with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 8\n}\n\"\"\"\n
    "},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

    Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

    Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
    "},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

    Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

    "},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

    There are two methods for creating model bundles: create_model_bundle and create_model_bundle_from_dirs. The former directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The latter takes in directories containing a load_predict_fn and the module path to the load_predict_fn.

    Creating a Model Bundle DirectlyCreating a Model Bundle from Directories
    import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n
    import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\nnumpy\nsklearn\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"requirements_path\": \"requirements.txt\",\n\"env_params\": ENV_PARAMS,\n\"load_predict_fn\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
    "},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

    The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

    Creating Model Bundles with app_config
    import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Literal, Union\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)\n
    "},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

    Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes.

    "},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

    To list all the model bundles you own, use list_model_bundles.

    "},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

    Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

    Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

    "},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

    Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

    Creating an Async Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\n
    "},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

    Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints.

    Note

    Sync model endpoints require at least 1 min_worker.

    Creating a Sync Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\n
    "},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

    Model endpoints can be listed, updated, and deleted using the Launch API.

    Listing Model Endpoints
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
    Updating a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
    Deleting a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
    "},{"location":"concepts/overview/","title":"Overview","text":"

    Creating deployments on Launch generally involves three steps:

    1. Create and upload a ModelBundle. Pass your trained model as well as pre-/post-processing code to the Scale Launch Python client, and we\u2019ll create a model bundle based on the code and store it in our Bundle Store.

    2. Create a ModelEndpoint. Pass a ModelBundle as well as infrastructure settings such as the desired number of GPUs to our client. This provisions resources on Scale\u2019s cluster dedicated to your ModelEndpoint.

    3. Make requests to the ModelEndpoint. You can make requests through the Python client, or make HTTP requests directly to Scale.

    "}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Scale Launch","text":"

    Simple, scalable, and high performance ML service deployment in python.

    "},{"location":"#example","title":"Example","text":"Launch Usage
    import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"infra\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

    What's going on here:

    • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
    • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
    • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
    • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
    • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

    Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

    "},{"location":"#installation","title":"Installation","text":"

    To use Scale Launch, first install it using pip:

    Installation
    pip install -U scale-launch\n
    "},{"location":"cli/","title":"CLI","text":"

    Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

    The CLI can be used as scale-launch ....

    "},{"location":"cli/#help","title":"Help","text":"

    Run scale-launch --help for more options.

    scale-launch --help
        This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your Scale...\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
    "},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
    LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

    Scale Launch Python Client.

    Initializes a Scale Launch Client.

    Parameters:

    Name Type Description Default api_key str

    Your Scale API key

    required endpoint Optional[str]

    The Scale Launch Endpoint (this should not need to be changed)

    None self_hosted bool

    True iff you are connecting to a self-hosted Scale Launch

    False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
    batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

    Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

    Must have exactly one of urls or inputs passed in.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or the name of a the bundle to use for inference.

    required urls List[str]

    A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

    None inputs Optional[List[Dict[str, Any]]]

    A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

    None batch_url_file_location Optional[str]

    In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

    None serialization_format str

    Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

    'JSON' labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None cpus Optional[int]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
    • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains job_id as a key, and the ID as the value.

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
    clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n

    Clones an existing model bundle with changes to its app config. (More fields coming soon)

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The existing bundle or its ID.

    required app_config Optional[Dict]

    The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

    None

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
    create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Uploads and registers a model bundle to Scale Launch.

    A model bundle consists of exactly one of the following:

    • predict_fn_or_cls
    • load_predict_fn + model
    • load_predict_fn + load_model_fn

    Pre/post-processing code can be included inside load_predict_fn/model or in predict_fn_or_cls call.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required predict_fn_or_cls Optional[Callable[[Any], Any]]

    Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

    None model Optional[LaunchModel_T]

    Typically a trained Neural Network, e.g. a Pytorch module.

    Exactly one of model and load_model_fn must be provided.

    None load_model_fn Optional[Callable[[], LaunchModel_T]]

    A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

    Exactly one of model and load_model_fn must be provided.

    None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

    Function that, when called with a model, returns a function that carries out inference.

    If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

    Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

    In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

    None requirements Optional[List[str]]

    A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

    [\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

    If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

    None app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    • Tensorflow fields:

      • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
    required globals_copy Optional[Dict[str, Any]]

    Dictionary of the global symbol table. Normally provided by globals() built-in function.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
    create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

    For example, if you have a directory structure like so, and your current working directory is also my_root:

    .. code-block:: text

    my_root/ my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    then calling create_model_bundle_from_dirs with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

    .. code-block:: text

    my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required base_paths List[str]

    The paths on the local filesystem where the bundle code lives.

    required requirements_path str

    A path on the local filesystem where a requirements.txt file lives.

    required env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    required load_predict_fn_module_path str

    A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

    required load_model_fn_module_path str

    A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

    required app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
    create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

    Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

    required model_bundle Union[ModelBundle, str]

    The ModelBundle that the endpoint should serve.

    required cpus int

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    3 memory str

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    '8Gi' storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus int

    Number of gpus each worker should get, e.g. 0, 1, etc.

    0 min_workers int

    The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

    1 max_workers int

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

    1 per_worker int

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

    Here is our recommendation for computing per_worker:

    1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
    10 gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None endpoint_type str

    Either \"sync\" or \"async\".

    'sync' post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None update_if_exists bool

    If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

    False labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None

    Returns:

    Type Description Optional[Endpoint]

    A Endpoint object that can be used to make requests to the endpoint.

    "},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
    delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Deletes a model endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    A ModelEndpoint object.

    required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
    edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None\n) -> None\n

    Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

    • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

    required model_bundle Optional[Union[ModelBundle, str]]

    The ModelBundle that the endpoint should serve.

    None cpus Optional[float]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None min_workers Optional[int]

    The minimum number of workers. Must be greater than or equal to 0.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
    get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

    Gets inference results from a previously created batch job.

    Parameters:

    Name Type Description Default batch_job_id str

    An id representing the batch task job. This id is the in the response from calling batch_async_request.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains the following fields:

    Dict[str, Any]
    • status: The status of the job.
    Dict[str, Any]
    • result: The url where the result is stored.
    Dict[str, Any]
    • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
    Dict[str, Any]
    • num_tasks_pending: The number of tasks that are still pending.
    Dict[str, Any]
    • num_tasks_completed: The number of tasks that have completed.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
    get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

    Returns a model bundle specified by bundle_name that the user owns.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or its name.

    required

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
    get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

    Gets a model endpoint associated with a name.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the endpoint to retrieve.

    required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
    list_model_bundles() -> List[ModelBundle]\n

    Returns a list of model bundles that the user owns.

    Returns:

    Type Description List[ModelBundle]

    A list of ModelBundle objects

    "},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
    list_model_endpoints() -> List[Endpoint]\n

    Lists all model endpoints that the user owns.

    Returns:

    Type Description List[Endpoint]

    A list of ModelEndpoint objects.

    "},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
    read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Retrieves the logs for the creation of the endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The endpoint or its name.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
    register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

    Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

    Parameters:

    Name Type Description Default batch_csv_location_fn Callable[[], str]

    Function that generates batch_csv_urls for upload_batch_csv_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
    register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

    Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

    Parameters:

    Name Type Description Default bundle_location_fn Callable[[], str]

    Function that generates bundle_urls for upload_bundle_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
    register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

    upload_batch_csv_fn(csv_text, csv_url)\n

    This function should directly write the contents of csv_text as a text string into csv_url.

    Parameters:

    Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

    Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
    register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

    upload_bundle_fn(serialized_bundle, bundle_url)\n

    This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

    See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

    Parameters:

    Name Type Description Default upload_bundle_fn Callable[[str, str], None]

    Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/endpoint_predictions/","title":"Endpoint Predictions","text":""},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"api/hooks/","title":"Hooks","text":""},{"location":"api/hooks/#launch.hooks.PostInferenceHooks","title":"PostInferenceHooks","text":"

    Bases: str, Enum

    Post-inference hooks are functions that are called after inference is complete.

    Attributes:

    Name Type Description CALLBACK str

    The callback hook is called with the inference response and the task ID.

    "},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

    Represents a ModelBundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[Any, Any]] = None\n

    An optional user-specified configuration mapping for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
    env_params: Optional[Dict[str, str]] = None\n

    A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
    id: Optional[str] = None\n

    A globally unique identifier for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
    location: Optional[str] = None\n

    An opaque location for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
    metadata: Optional[Dict[Any, Any]] = None\n

    Arbitrary metadata for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
    name: str\n

    The name of the bundle. Must be unique across all bundles that the user owns.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
    packaging_type: Optional[str] = None\n

    The packaging type for the bundle. Can be cloudpickle or zip.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
    requirements: Optional[List[str]] = None\n

    A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

    All classes here are returned by the get_model_endpoint method and provide a predict function.

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
    AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    An asynchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponseFuture\n

    Runs an asynchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required

    Returns:

    Name Type Description EndpointResponseFuture

    An EndpointResponseFuture such the user can use to query the status of the request.

    Example EndpointResponseFuture EndpointResponseFuture

    .. code-block:: python

    my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
    predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

    (deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

    Parameters:

    Name Type Description Default requests Sequence[EndpointRequest]

    List of EndpointRequests. Request_ids must all be distinct.

    required

    Returns:

    Type Description AsyncEndpointBatchResponse

    an AsyncEndpointResponse keeping track of the inference requests made

    "},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint","title":"SyncEndpoint","text":"
    SyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    A synchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponse\n

    Runs a synchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required"},{"location":"concepts/batch_jobs/","title":"Batch Jobs","text":"

    For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

    Batch jobs are created using the batch_async_request method of the LaunchClient.

    Creating and Following a Batch Job
    import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
    "},{"location":"concepts/callbacks/","title":"Callbacks","text":"

    Async model endpoints can be configured to send callbacks to a user-defined callback URL. Callbacks are sent as HTTP POST requests with a JSON body. The following code snippet shows how to create an async model endpoint with a callback URL.

    To configure an async endpoint to send callbacks, set the post_inference_hooks field to include launch.PostInferenceHooks.CALLBACK. A callback URL also needs to be specified, and it can be configured as a default using the default_callback_url argument to launch.LaunchClient.create_model_endpoint or as a per-task override using the callback_url field of launch.EndpointRequest.

    Note

    Callbacks will not be sent if the endpoint does not have any post-inference hooks specified, even if a default_callback_url is provided to the endpoint creation method or if the prediction request has a callback_url override.

    Creating an Async Model Endpoint with a Callback URL
    import os\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\n)\nfuture_default = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\n\"\"\"\nA callback is sent to https://example.com with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 7\n}\n\"\"\"\nfuture_custom_callback_url = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"}, callback_url=\"https://example.com/custom\"\n),\n)\n\"\"\"\nA callback is sent to https://example.com/custom with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 8\n}\n\"\"\"\n
    "},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

    Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

    Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
    "},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

    Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

    "},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

    There are two methods for creating model bundles: create_model_bundle and create_model_bundle_from_dirs. The former directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The latter takes in directories containing a load_predict_fn and the module path to the load_predict_fn.

    Creating a Model Bundle DirectlyCreating a Model Bundle from Directories
    import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n
    import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\nnumpy\nsklearn\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"requirements_path\": \"requirements.txt\",\n\"env_params\": ENV_PARAMS,\n\"load_predict_fn\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle_from_dirs(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
    "},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

    The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

    Creating Model Bundles with app_config
    import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Literal, Union\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"batched\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)\n
    "},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

    Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes.

    "},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

    To list all the model bundles you own, use list_model_bundles.

    "},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

    Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

    Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

    "},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

    Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

    Creating an Async Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\n
    "},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

    Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints.

    Note

    Sync model endpoints require at least 1 min_worker.

    Creating a Sync Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\n
    "},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

    Model endpoints can be listed, updated, and deleted using the Launch API.

    Listing Model Endpoints
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
    Updating a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
    Deleting a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
    "},{"location":"concepts/overview/","title":"Overview","text":"

    Creating deployments on Launch generally involves three steps:

    1. Create and upload a ModelBundle. Pass your trained model as well as pre-/post-processing code to the Scale Launch Python client, and we\u2019ll create a model bundle based on the code and store it in our Bundle Store.

    2. Create a ModelEndpoint. Pass a ModelBundle as well as infrastructure settings such as the desired number of GPUs to our client. This provisions resources on Scale\u2019s cluster dedicated to your ModelEndpoint.

    3. Make requests to the ModelEndpoint. You can make requests through the Python client, or make HTTP requests directly to Scale.

    "}]} \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index 5e834fd03d8b342abb25796d96a3df62ab723fbc..46c73ab37155902cb454b649834bc213c932f3ed 100644 GIT binary patch delta 16 XcmX@WbbyInzMF&N2 Date: Fri, 24 Feb 2023 12:56:45 -0800 Subject: [PATCH 04/28] Deployed fa35db0 with MkDocs version: 1.4.2 --- cli/index.html | 2 +- search/search_index.json | 2 +- sitemap.xml.gz | Bin 320 -> 320 bytes 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/index.html b/cli/index.html index 4a624f5a..7e221c0f 100644 --- a/cli/index.html +++ b/cli/index.html @@ -593,7 +593,7 @@

    Help&par Commands: batch-jobs Batch Jobs is a wrapper around batch jobs in Scale Launch bundles Bundles is a wrapper around model bundles in Scale Launch - config Config is a wrapper around getting and setting your Scale... + config Config is a wrapper around getting and setting your API key and other configuration options endpoints Endpoints is a wrapper around model endpoints in Scale Launch tasks Tasks is a wrapper around sending requests to endpoints

    diff --git a/search/search_index.json b/search/search_index.json index e76e3011..ef8cb31e 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Scale Launch","text":"

    Simple, scalable, and high performance ML service deployment in python.

    "},{"location":"#example","title":"Example","text":"Launch Usage
    import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"infra\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

    What's going on here:

    • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
    • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
    • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
    • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
    • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

    Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

    "},{"location":"#installation","title":"Installation","text":"

    To use Scale Launch, first install it using pip:

    Installation
    pip install -U scale-launch\n
    "},{"location":"cli/","title":"CLI","text":"

    Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

    The CLI can be used as scale-launch ....

    "},{"location":"cli/#help","title":"Help","text":"

    Run scale-launch --help for more options.

    scale-launch --help
        This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your Scale...\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
    "},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
    LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

    Scale Launch Python Client.

    Initializes a Scale Launch Client.

    Parameters:

    Name Type Description Default api_key str

    Your Scale API key

    required endpoint Optional[str]

    The Scale Launch Endpoint (this should not need to be changed)

    None self_hosted bool

    True iff you are connecting to a self-hosted Scale Launch

    False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
    batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

    Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

    Must have exactly one of urls or inputs passed in.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or the name of a the bundle to use for inference.

    required urls List[str]

    A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

    None inputs Optional[List[Dict[str, Any]]]

    A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

    None batch_url_file_location Optional[str]

    In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

    None serialization_format str

    Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

    'JSON' labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None cpus Optional[int]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
    • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains job_id as a key, and the ID as the value.

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
    clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n

    Clones an existing model bundle with changes to its app config. (More fields coming soon)

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The existing bundle or its ID.

    required app_config Optional[Dict]

    The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

    None

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
    create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Uploads and registers a model bundle to Scale Launch.

    A model bundle consists of exactly one of the following:

    • predict_fn_or_cls
    • load_predict_fn + model
    • load_predict_fn + load_model_fn

    Pre/post-processing code can be included inside load_predict_fn/model or in predict_fn_or_cls call.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required predict_fn_or_cls Optional[Callable[[Any], Any]]

    Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

    None model Optional[LaunchModel_T]

    Typically a trained Neural Network, e.g. a Pytorch module.

    Exactly one of model and load_model_fn must be provided.

    None load_model_fn Optional[Callable[[], LaunchModel_T]]

    A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

    Exactly one of model and load_model_fn must be provided.

    None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

    Function that, when called with a model, returns a function that carries out inference.

    If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

    Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

    In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

    None requirements Optional[List[str]]

    A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

    [\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

    If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

    None app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    • Tensorflow fields:

      • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
    required globals_copy Optional[Dict[str, Any]]

    Dictionary of the global symbol table. Normally provided by globals() built-in function.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
    create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

    For example, if you have a directory structure like so, and your current working directory is also my_root:

    .. code-block:: text

    my_root/ my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    then calling create_model_bundle_from_dirs with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

    .. code-block:: text

    my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required base_paths List[str]

    The paths on the local filesystem where the bundle code lives.

    required requirements_path str

    A path on the local filesystem where a requirements.txt file lives.

    required env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    required load_predict_fn_module_path str

    A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

    required load_model_fn_module_path str

    A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

    required app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
    create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

    Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

    required model_bundle Union[ModelBundle, str]

    The ModelBundle that the endpoint should serve.

    required cpus int

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    3 memory str

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    '8Gi' storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus int

    Number of gpus each worker should get, e.g. 0, 1, etc.

    0 min_workers int

    The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

    1 max_workers int

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

    1 per_worker int

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

    Here is our recommendation for computing per_worker:

    1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
    10 gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None endpoint_type str

    Either \"sync\" or \"async\".

    'sync' post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None update_if_exists bool

    If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

    False labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None

    Returns:

    Type Description Optional[Endpoint]

    A Endpoint object that can be used to make requests to the endpoint.

    "},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
    delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Deletes a model endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    A ModelEndpoint object.

    required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
    edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None\n) -> None\n

    Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

    • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

    required model_bundle Optional[Union[ModelBundle, str]]

    The ModelBundle that the endpoint should serve.

    None cpus Optional[float]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None min_workers Optional[int]

    The minimum number of workers. Must be greater than or equal to 0.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
    get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

    Gets inference results from a previously created batch job.

    Parameters:

    Name Type Description Default batch_job_id str

    An id representing the batch task job. This id is the in the response from calling batch_async_request.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains the following fields:

    Dict[str, Any]
    • status: The status of the job.
    Dict[str, Any]
    • result: The url where the result is stored.
    Dict[str, Any]
    • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
    Dict[str, Any]
    • num_tasks_pending: The number of tasks that are still pending.
    Dict[str, Any]
    • num_tasks_completed: The number of tasks that have completed.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
    get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

    Returns a model bundle specified by bundle_name that the user owns.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or its name.

    required

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
    get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

    Gets a model endpoint associated with a name.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the endpoint to retrieve.

    required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
    list_model_bundles() -> List[ModelBundle]\n

    Returns a list of model bundles that the user owns.

    Returns:

    Type Description List[ModelBundle]

    A list of ModelBundle objects

    "},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
    list_model_endpoints() -> List[Endpoint]\n

    Lists all model endpoints that the user owns.

    Returns:

    Type Description List[Endpoint]

    A list of ModelEndpoint objects.

    "},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
    read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Retrieves the logs for the creation of the endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The endpoint or its name.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
    register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

    Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

    Parameters:

    Name Type Description Default batch_csv_location_fn Callable[[], str]

    Function that generates batch_csv_urls for upload_batch_csv_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
    register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

    Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

    Parameters:

    Name Type Description Default bundle_location_fn Callable[[], str]

    Function that generates bundle_urls for upload_bundle_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
    register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

    upload_batch_csv_fn(csv_text, csv_url)\n

    This function should directly write the contents of csv_text as a text string into csv_url.

    Parameters:

    Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

    Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
    register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

    upload_bundle_fn(serialized_bundle, bundle_url)\n

    This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

    See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

    Parameters:

    Name Type Description Default upload_bundle_fn Callable[[str, str], None]

    Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/endpoint_predictions/","title":"Endpoint Predictions","text":""},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"api/hooks/","title":"Hooks","text":""},{"location":"api/hooks/#launch.hooks.PostInferenceHooks","title":"PostInferenceHooks","text":"

    Bases: str, Enum

    Post-inference hooks are functions that are called after inference is complete.

    Attributes:

    Name Type Description CALLBACK str

    The callback hook is called with the inference response and the task ID.

    "},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

    Represents a ModelBundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[Any, Any]] = None\n

    An optional user-specified configuration mapping for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
    env_params: Optional[Dict[str, str]] = None\n

    A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
    id: Optional[str] = None\n

    A globally unique identifier for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
    location: Optional[str] = None\n

    An opaque location for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
    metadata: Optional[Dict[Any, Any]] = None\n

    Arbitrary metadata for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
    name: str\n

    The name of the bundle. Must be unique across all bundles that the user owns.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
    packaging_type: Optional[str] = None\n

    The packaging type for the bundle. Can be cloudpickle or zip.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
    requirements: Optional[List[str]] = None\n

    A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

    All classes here are returned by the get_model_endpoint method and provide a predict function.

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
    AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    An asynchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponseFuture\n

    Runs an asynchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required

    Returns:

    Name Type Description EndpointResponseFuture

    An EndpointResponseFuture such the user can use to query the status of the request.

    Example EndpointResponseFuture EndpointResponseFuture

    .. code-block:: python

    my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
    predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

    (deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

    Parameters:

    Name Type Description Default requests Sequence[EndpointRequest]

    List of EndpointRequests. Request_ids must all be distinct.

    required

    Returns:

    Type Description AsyncEndpointBatchResponse

    an AsyncEndpointResponse keeping track of the inference requests made

    "},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint","title":"SyncEndpoint","text":"
    SyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    A synchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponse\n

    Runs a synchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required"},{"location":"concepts/batch_jobs/","title":"Batch Jobs","text":"

    For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

    Batch jobs are created using the batch_async_request method of the LaunchClient.

    Creating and Following a Batch Job
    import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
    "},{"location":"concepts/callbacks/","title":"Callbacks","text":"

    Async model endpoints can be configured to send callbacks to a user-defined callback URL. Callbacks are sent as HTTP POST requests with a JSON body. The following code snippet shows how to create an async model endpoint with a callback URL.

    To configure an async endpoint to send callbacks, set the post_inference_hooks field to include launch.PostInferenceHooks.CALLBACK. A callback URL also needs to be specified, and it can be configured as a default using the default_callback_url argument to launch.LaunchClient.create_model_endpoint or as a per-task override using the callback_url field of launch.EndpointRequest.

    Note

    Callbacks will not be sent if the endpoint does not have any post-inference hooks specified, even if a default_callback_url is provided to the endpoint creation method or if the prediction request has a callback_url override.

    Creating an Async Model Endpoint with a Callback URL
    import os\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\n)\nfuture_default = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\n\"\"\"\nA callback is sent to https://example.com with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 7\n}\n\"\"\"\nfuture_custom_callback_url = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"}, callback_url=\"https://example.com/custom\"\n),\n)\n\"\"\"\nA callback is sent to https://example.com/custom with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 8\n}\n\"\"\"\n
    "},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

    Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

    Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
    "},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

    Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

    "},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

    There are two methods for creating model bundles: create_model_bundle and create_model_bundle_from_dirs. The former directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The latter takes in directories containing a load_predict_fn and the module path to the load_predict_fn.

    Creating a Model Bundle DirectlyCreating a Model Bundle from Directories
    import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n
    import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\nnumpy\nsklearn\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"requirements_path\": \"requirements.txt\",\n\"env_params\": ENV_PARAMS,\n\"load_predict_fn\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle_from_dirs(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
    "},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

    The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

    Creating Model Bundles with app_config
    import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Literal, Union\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"batched\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)\n
    "},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

    Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes.

    "},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

    To list all the model bundles you own, use list_model_bundles.

    "},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

    Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

    Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

    "},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

    Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

    Creating an Async Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\n
    "},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

    Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints.

    Note

    Sync model endpoints require at least 1 min_worker.

    Creating a Sync Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\n
    "},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

    Model endpoints can be listed, updated, and deleted using the Launch API.

    Listing Model Endpoints
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
    Updating a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
    Deleting a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
    "},{"location":"concepts/overview/","title":"Overview","text":"

    Creating deployments on Launch generally involves three steps:

    1. Create and upload a ModelBundle. Pass your trained model as well as pre-/post-processing code to the Scale Launch Python client, and we\u2019ll create a model bundle based on the code and store it in our Bundle Store.

    2. Create a ModelEndpoint. Pass a ModelBundle as well as infrastructure settings such as the desired number of GPUs to our client. This provisions resources on Scale\u2019s cluster dedicated to your ModelEndpoint.

    3. Make requests to the ModelEndpoint. You can make requests through the Python client, or make HTTP requests directly to Scale.

    "}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Scale Launch","text":"

    Simple, scalable, and high performance ML service deployment in python.

    "},{"location":"#example","title":"Example","text":"Launch Usage
    import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"infra\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

    What's going on here:

    • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
    • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
    • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
    • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
    • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

    Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

    "},{"location":"#installation","title":"Installation","text":"

    To use Scale Launch, first install it using pip:

    Installation
    pip install -U scale-launch\n
    "},{"location":"cli/","title":"CLI","text":"

    Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

    The CLI can be used as scale-launch ....

    "},{"location":"cli/#help","title":"Help","text":"

    Run scale-launch --help for more options.

    scale-launch --help
        This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your API key and other configuration options\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
    "},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
    LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

    Scale Launch Python Client.

    Initializes a Scale Launch Client.

    Parameters:

    Name Type Description Default api_key str

    Your Scale API key

    required endpoint Optional[str]

    The Scale Launch Endpoint (this should not need to be changed)

    None self_hosted bool

    True iff you are connecting to a self-hosted Scale Launch

    False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
    batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

    Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

    Must have exactly one of urls or inputs passed in.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or the name of a the bundle to use for inference.

    required urls List[str]

    A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

    None inputs Optional[List[Dict[str, Any]]]

    A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

    None batch_url_file_location Optional[str]

    In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

    None serialization_format str

    Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

    'JSON' labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None cpus Optional[int]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
    • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains job_id as a key, and the ID as the value.

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
    clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n

    Clones an existing model bundle with changes to its app config. (More fields coming soon)

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The existing bundle or its ID.

    required app_config Optional[Dict]

    The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

    None

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
    create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Uploads and registers a model bundle to Scale Launch.

    A model bundle consists of exactly one of the following:

    • predict_fn_or_cls
    • load_predict_fn + model
    • load_predict_fn + load_model_fn

    Pre/post-processing code can be included inside load_predict_fn/model or in predict_fn_or_cls call.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required predict_fn_or_cls Optional[Callable[[Any], Any]]

    Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

    None model Optional[LaunchModel_T]

    Typically a trained Neural Network, e.g. a Pytorch module.

    Exactly one of model and load_model_fn must be provided.

    None load_model_fn Optional[Callable[[], LaunchModel_T]]

    A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

    Exactly one of model and load_model_fn must be provided.

    None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

    Function that, when called with a model, returns a function that carries out inference.

    If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

    Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

    In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

    None requirements Optional[List[str]]

    A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

    [\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

    If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

    None app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    • Tensorflow fields:

      • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
    required globals_copy Optional[Dict[str, Any]]

    Dictionary of the global symbol table. Normally provided by globals() built-in function.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
    create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

    For example, if you have a directory structure like so, and your current working directory is also my_root:

    .. code-block:: text

    my_root/ my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    then calling create_model_bundle_from_dirs with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

    .. code-block:: text

    my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required base_paths List[str]

    The paths on the local filesystem where the bundle code lives.

    required requirements_path str

    A path on the local filesystem where a requirements.txt file lives.

    required env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    required load_predict_fn_module_path str

    A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

    required load_model_fn_module_path str

    A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

    required app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
    create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

    Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

    required model_bundle Union[ModelBundle, str]

    The ModelBundle that the endpoint should serve.

    required cpus int

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    3 memory str

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    '8Gi' storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus int

    Number of gpus each worker should get, e.g. 0, 1, etc.

    0 min_workers int

    The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

    1 max_workers int

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

    1 per_worker int

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

    Here is our recommendation for computing per_worker:

    1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
    10 gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None endpoint_type str

    Either \"sync\" or \"async\".

    'sync' post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None update_if_exists bool

    If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

    False labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None

    Returns:

    Type Description Optional[Endpoint]

    A Endpoint object that can be used to make requests to the endpoint.

    "},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
    delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Deletes a model endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    A ModelEndpoint object.

    required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
    edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None\n) -> None\n

    Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

    • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

    required model_bundle Optional[Union[ModelBundle, str]]

    The ModelBundle that the endpoint should serve.

    None cpus Optional[float]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None min_workers Optional[int]

    The minimum number of workers. Must be greater than or equal to 0.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
    get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

    Gets inference results from a previously created batch job.

    Parameters:

    Name Type Description Default batch_job_id str

    An id representing the batch task job. This id is the in the response from calling batch_async_request.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains the following fields:

    Dict[str, Any]
    • status: The status of the job.
    Dict[str, Any]
    • result: The url where the result is stored.
    Dict[str, Any]
    • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
    Dict[str, Any]
    • num_tasks_pending: The number of tasks that are still pending.
    Dict[str, Any]
    • num_tasks_completed: The number of tasks that have completed.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
    get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

    Returns a model bundle specified by bundle_name that the user owns.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or its name.

    required

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
    get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

    Gets a model endpoint associated with a name.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the endpoint to retrieve.

    required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
    list_model_bundles() -> List[ModelBundle]\n

    Returns a list of model bundles that the user owns.

    Returns:

    Type Description List[ModelBundle]

    A list of ModelBundle objects

    "},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
    list_model_endpoints() -> List[Endpoint]\n

    Lists all model endpoints that the user owns.

    Returns:

    Type Description List[Endpoint]

    A list of ModelEndpoint objects.

    "},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
    read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Retrieves the logs for the creation of the endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The endpoint or its name.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
    register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

    Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

    Parameters:

    Name Type Description Default batch_csv_location_fn Callable[[], str]

    Function that generates batch_csv_urls for upload_batch_csv_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
    register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

    Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

    Parameters:

    Name Type Description Default bundle_location_fn Callable[[], str]

    Function that generates bundle_urls for upload_bundle_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
    register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

    upload_batch_csv_fn(csv_text, csv_url)\n

    This function should directly write the contents of csv_text as a text string into csv_url.

    Parameters:

    Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

    Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
    register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

    upload_bundle_fn(serialized_bundle, bundle_url)\n

    This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

    See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

    Parameters:

    Name Type Description Default upload_bundle_fn Callable[[str, str], None]

    Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/endpoint_predictions/","title":"Endpoint Predictions","text":""},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"api/hooks/","title":"Hooks","text":""},{"location":"api/hooks/#launch.hooks.PostInferenceHooks","title":"PostInferenceHooks","text":"

    Bases: str, Enum

    Post-inference hooks are functions that are called after inference is complete.

    Attributes:

    Name Type Description CALLBACK str

    The callback hook is called with the inference response and the task ID.

    "},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

    Represents a ModelBundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[Any, Any]] = None\n

    An optional user-specified configuration mapping for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
    env_params: Optional[Dict[str, str]] = None\n

    A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
    id: Optional[str] = None\n

    A globally unique identifier for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
    location: Optional[str] = None\n

    An opaque location for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
    metadata: Optional[Dict[Any, Any]] = None\n

    Arbitrary metadata for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
    name: str\n

    The name of the bundle. Must be unique across all bundles that the user owns.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
    packaging_type: Optional[str] = None\n

    The packaging type for the bundle. Can be cloudpickle or zip.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
    requirements: Optional[List[str]] = None\n

    A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

    All classes here are returned by the get_model_endpoint method and provide a predict function.

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
    AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    An asynchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponseFuture\n

    Runs an asynchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required

    Returns:

    Name Type Description EndpointResponseFuture

    An EndpointResponseFuture such the user can use to query the status of the request.

    Example EndpointResponseFuture EndpointResponseFuture

    .. code-block:: python

    my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
    predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

    (deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

    Parameters:

    Name Type Description Default requests Sequence[EndpointRequest]

    List of EndpointRequests. Request_ids must all be distinct.

    required

    Returns:

    Type Description AsyncEndpointBatchResponse

    an AsyncEndpointResponse keeping track of the inference requests made

    "},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint","title":"SyncEndpoint","text":"
    SyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    A synchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponse\n

    Runs a synchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required"},{"location":"concepts/batch_jobs/","title":"Batch Jobs","text":"

    For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

    Batch jobs are created using the batch_async_request method of the LaunchClient.

    Creating and Following a Batch Job
    import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
    "},{"location":"concepts/callbacks/","title":"Callbacks","text":"

    Async model endpoints can be configured to send callbacks to a user-defined callback URL. Callbacks are sent as HTTP POST requests with a JSON body. The following code snippet shows how to create an async model endpoint with a callback URL.

    To configure an async endpoint to send callbacks, set the post_inference_hooks field to include launch.PostInferenceHooks.CALLBACK. A callback URL also needs to be specified, and it can be configured as a default using the default_callback_url argument to launch.LaunchClient.create_model_endpoint or as a per-task override using the callback_url field of launch.EndpointRequest.

    Note

    Callbacks will not be sent if the endpoint does not have any post-inference hooks specified, even if a default_callback_url is provided to the endpoint creation method or if the prediction request has a callback_url override.

    Creating an Async Model Endpoint with a Callback URL
    import os\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\n)\nfuture_default = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\n\"\"\"\nA callback is sent to https://example.com with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 7\n}\n\"\"\"\nfuture_custom_callback_url = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"}, callback_url=\"https://example.com/custom\"\n),\n)\n\"\"\"\nA callback is sent to https://example.com/custom with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 8\n}\n\"\"\"\n
    "},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

    Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

    Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
    "},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

    Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

    "},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

    There are two methods for creating model bundles: create_model_bundle and create_model_bundle_from_dirs. The former directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The latter takes in directories containing a load_predict_fn and the module path to the load_predict_fn.

    Creating a Model Bundle DirectlyCreating a Model Bundle from Directories
    import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n
    import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\nnumpy\nsklearn\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"requirements_path\": \"requirements.txt\",\n\"env_params\": ENV_PARAMS,\n\"load_predict_fn\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle_from_dirs(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
    "},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

    The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

    Creating Model Bundles with app_config
    import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Literal, Union\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"batched\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)\n
    "},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

    Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes.

    "},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

    To list all the model bundles you own, use list_model_bundles.

    "},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

    Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

    Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

    "},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

    Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

    Creating an Async Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\n
    "},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

    Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints.

    Note

    Sync model endpoints require at least 1 min_worker.

    Creating a Sync Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\n
    "},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

    Model endpoints can be listed, updated, and deleted using the Launch API.

    Listing Model Endpoints
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
    Updating a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
    Deleting a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
    "},{"location":"concepts/overview/","title":"Overview","text":"

    Creating deployments on Launch generally involves three steps:

    1. Create and upload a ModelBundle. Pass your trained model as well as pre-/post-processing code to the Scale Launch Python client, and we\u2019ll create a model bundle based on the code and store it in our Bundle Store.

    2. Create a ModelEndpoint. Pass a ModelBundle as well as infrastructure settings such as the desired number of GPUs to our client. This provisions resources on Scale\u2019s cluster dedicated to your ModelEndpoint.

    3. Make requests to the ModelEndpoint. You can make requests through the Python client, or make HTTP requests directly to Scale.

    "}]} \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index 46c73ab37155902cb454b649834bc213c932f3ed..49c6d680f4ea5c0b0f4f19944651c102b1db0ce6 100644 GIT binary patch delta 15 WcmX@WbbyIXzMF%iM`a_M6(ay6T?6L; delta 15 WcmX@WbbyIXzMF&N2 Date: Wed, 8 Mar 2023 00:50:15 -0800 Subject: [PATCH 05/28] Deployed b2a4b61 with MkDocs version: 1.4.2 --- api/client/index.html | 144 ++++++++++++++++- api/endpoint_predictions/index.html | 85 +++++++++- concepts/batch_jobs/index.html | 26 +-- concepts/callbacks/index.html | 191 ++++++++++++++++++----- concepts/endpoint_predictions/index.html | 85 +++++++++- concepts/model_bundles/index.html | 153 +++++++++--------- concepts/model_endpoints/index.html | 101 +++--------- index.html | 4 +- search/search_index.json | 2 +- sitemap.xml | 26 +-- sitemap.xml.gz | Bin 320 -> 319 bytes 11 files changed, 586 insertions(+), 231 deletions(-) diff --git a/api/client/index.html b/api/client/index.html index 1bedafc2..bdd3f96a 100644 --- a/api/client/index.html +++ b/api/client/index.html @@ -1635,9 +1635,16 @@

    List[PostInferenceHooks] ] = None, default_callback_url: Optional[str] = None, - update_if_exists: bool = False, - labels: Optional[Dict[str, str]] = None -) -> Optional[Endpoint] + default_callback_auth_kind: Optional[ + Literal[basic, mtls] + ] = None, + default_callback_auth_username: Optional[str] = None, + default_callback_auth_password: Optional[str] = None, + default_callback_auth_cert: Optional[str] = None, + default_callback_auth_key: Optional[str] = None, + update_if_exists: bool = False, + labels: Optional[Dict[str, str]] = None +) -> Optional[Endpoint]
    @@ -1821,6 +1828,66 @@

    Optional[Literal[basic, mtls]] + +

    The default callback auth kind to use for async endpoints. +Either "basic" or "mtls". This can be overridden in the task parameters for each +individual task.

    + + None + + + + default_callback_auth_username + + Optional[str] + +

    The default callback auth username to use. This only +applies if default_callback_auth_kind is "basic". This can be overridden in the task +parameters for each individual task.

    + + None + + + + default_callback_auth_password + + Optional[str] + +

    The default callback auth password to use. This only +applies if default_callback_auth_kind is "basic". This can be overridden in the task +parameters for each individual task.

    + + None + + + + default_callback_auth_cert + + Optional[str] + +

    The default callback auth cert to use. This only applies +if default_callback_auth_kind is "mtls". This can be overridden in the task +parameters for each individual task.

    + + None + + + + default_callback_auth_key + + Optional[str] + +

    The default callback auth key to use. This only applies +if default_callback_auth_kind is "mtls". This can be overridden in the task +parameters for each individual task.

    + + None + + update_if_exists @@ -1939,8 +2006,15 @@

    post_inference_hooks: Optional[ List[PostInferenceHooks] ] = None, - default_callback_url: Optional[str] = None -) -> None + default_callback_url: Optional[str] = None, + default_callback_auth_kind: Optional[ + Literal[basic, mtls] + ] = None, + default_callback_auth_username: Optional[str] = None, + default_callback_auth_password: Optional[str] = None, + default_callback_auth_cert: Optional[str] = None, + default_callback_auth_key: Optional[str] = None +) -> None

    @@ -2104,6 +2178,66 @@

    None + + default_callback_auth_kind + + Optional[Literal[basic, mtls]] + +

    The default callback auth kind to use for async endpoints. +Either "basic" or "mtls". This can be overridden in the task parameters for each +individual task.

    + + None + + + + default_callback_auth_username + + Optional[str] + +

    The default callback auth username to use. This only +applies if default_callback_auth_kind is "basic". This can be overridden in the task +parameters for each individual task.

    + + None + + + + default_callback_auth_password + + Optional[str] + +

    The default callback auth password to use. This only +applies if default_callback_auth_kind is "basic". This can be overridden in the task +parameters for each individual task.

    + + None + + + + default_callback_auth_cert + + Optional[str] + +

    The default callback auth cert to use. This only applies +if default_callback_auth_kind is "mtls". This can be overridden in the task +parameters for each individual task.

    + + None + + + + default_callback_auth_key + + Optional[str] + +

    The default callback auth key to use. This only applies +if default_callback_auth_kind is "mtls". This can be overridden in the task +parameters for each individual task.

    + + None + + diff --git a/api/endpoint_predictions/index.html b/api/endpoint_predictions/index.html index 9147e194..1f89282f 100644 --- a/api/endpoint_predictions/index.html +++ b/api/endpoint_predictions/index.html @@ -647,9 +647,16 @@

    url: Optional[str] = None, args: Optional[Dict] = None, callback_url: Optional[str] = None, - return_pickled: Optional[bool] = False, - request_id: Optional[str] = None, -) + callback_auth_kind: Optional[ + Literal[basic, mtls] + ] = None, + callback_auth_username: Optional[str] = None, + callback_auth_password: Optional[str] = None, + callback_auth_cert: Optional[str] = None, + callback_auth_key: Optional[str] = None, + return_pickled: Optional[bool] = False, + request_id: Optional[str] = None, +)

    @@ -705,6 +712,78 @@

    False + + callback_url + + Optional[str] + +

    The callback url to use for this task. If None, then the +default_callback_url of the endpoint is used. The endpoint must specify +"callback" as a post-inference hook for the callback to be triggered.

    + + None + + + + callback_auth_kind + + Optional[Literal[basic, mtls]] + +

    The default callback auth kind to use for async endpoints. +Either "basic" or "mtls". This can be overridden in the task parameters for each +individual task.

    + + None + + + + callback_auth_username + + Optional[str] + +

    The default callback auth username to use. This only +applies if callback_auth_kind is "basic". This can be overridden in the task +parameters for each individual task.

    + + None + + + + callback_auth_password + + Optional[str] + +

    The default callback auth password to use. This only +applies if callback_auth_kind is "basic". This can be overridden in the task +parameters for each individual task.

    + + None + + + + callback_auth_cert + + Optional[str] + +

    The default callback auth cert to use. This only applies +if callback_auth_kind is "mtls". This can be overridden in the task +parameters for each individual task.

    + + None + + + + callback_auth_key + + Optional[str] + +

    The default callback auth key to use. This only applies +if callback_auth_kind is "mtls". This can be overridden in the task +parameters for each individual task.

    + + None + + request_id diff --git a/concepts/batch_jobs/index.html b/concepts/batch_jobs/index.html index ed844795..07e046d4 100644 --- a/concepts/batch_jobs/index.html +++ b/concepts/batch_jobs/index.html @@ -551,17 +551,21 @@

    Batch Jobs {"x": 2, "y": "hello"}, {"x": 3, "y": "world"}, ], -) - -status = "PENDING" -res = None -while status != "SUCCESS" and status != "FAILURE" and status != "CANCELLED": - time.sleep(30) - res = client.get_batch_async_response(batch_job["job_id"]) - status = res["status"] - print(f"the batch job is {status}") - -print(res) + labels={ + "team": "MY_TEAM", + "product": "MY_PRODUCT", + } +) + +status = "PENDING" +res = None +while status != "SUCCESS" and status != "FAILURE" and status != "CANCELLED": + time.sleep(30) + res = client.get_batch_async_response(batch_job["job_id"]) + status = res["status"] + print(f"the batch job is {status}") + +print(res)

    diff --git a/concepts/callbacks/index.html b/concepts/callbacks/index.html index 90ec50b7..5ad2bcf1 100644 --- a/concepts/callbacks/index.html +++ b/concepts/callbacks/index.html @@ -378,10 +378,41 @@ + + Callbacks + + + + @@ -518,6 +549,21 @@ + + + @@ -551,47 +597,112 @@

    CallbacksCreating an Async Model Endpoint with a Callback URL
    import os
    -from launch import EndpointRequest, LaunchClient, PostInferenceHooks
    -
    -client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
    -endpoint = client.create_model_endpoint(
    -    endpoint_name="demo-endpoint-callback",
    -    model_bundle="test-bundle",
    -    cpus=1,
    -    min_workers=1,
    -    endpoint_type="async",
    -    update_if_exists=True,
    -    labels={
    -        "team": "MY_TEAM",
    -        "product": "MY_PRODUCT"
    -    },
    -    post_inference_hooks=[PostInferenceHooks.CALLBACK],
    -    default_callback_url="https://example.com",
    -)
    -
    -future_default = endpoint.predict(request=EndpointRequest(args={"x": 2, "y": "hello"}))
    -"""
    -A callback is sent to https://example.com with the following JSON body:
    -{
    -    "task_id": "THE_TASK_ID",
    -    "result": 7
    -}
    +import time
    +from launch import EndpointRequest, LaunchClient, PostInferenceHooks
    +
    +client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
    +endpoint = client.create_model_endpoint(
    +    endpoint_name="demo-endpoint-callback",
    +    model_bundle="test-bundle",
    +    cpus=1,
    +    min_workers=1,
    +    endpoint_type="async",
    +    update_if_exists=True,
    +    labels={
    +        "team": "MY_TEAM",
    +        "product": "MY_PRODUCT",
    +    },
    +    post_inference_hooks=[PostInferenceHooks.CALLBACK],
    +    default_callback_url="https://example.com",
    +)
    +
    +while endpoint.status() != "READY":
    +    time.sleep(10)
    +
    +future_default = endpoint.predict(
    +    request=EndpointRequest(args={"x": 2, "y": "hello"})
    +)
     """
    -
    -
    -future_custom_callback_url = endpoint.predict(
    -    request=EndpointRequest(
    -        args={"x": 3, "y": "hello"}, callback_url="https://example.com/custom"
    -    ),
    -)
    -
    -"""
    -A callback is sent to https://example.com/custom with the following JSON body:
    -{
    -    "task_id": "THE_TASK_ID",
    -    "result": 8
    -}
    -"""
    +A callback is sent to https://example.com with the following JSON body:
    +{
    +    "task_id": "THE_TASK_ID",
    +    "result": 7
    +}
    +"""
    +
    +future_custom_callback_url = endpoint.predict(
    +    request=EndpointRequest(
    +        args={"x": 3, "y": "hello"}, callback_url="https://example.com/custom"
    +    ),
    +)
    +
    +"""
    +A callback is sent to https://example.com/custom with the following JSON body:
    +{
    +    "task_id": "THE_TASK_ID",
    +    "result": 8
    +}
    +"""
    +
    +

    Authentication for callbacks

    +
    +

    Warning

    +

    This feature is currently in beta, and the API is likely to change.

    +
    +

    Callbacks can be authenticated using shared authentication headers. To enable authentication, +set either default_callback_auth_kind when creating the endpoint or callback_auth_kind +when making a prediction request.

    +

    Currently, the supported authentication methods are basic and mtls. If basic is used, +then the default_callback_auth_username and default_callback_auth_password fields must be +specified when creating the endpoint, or the callback_auth_username and callback_auth_password +fields must be specified when making a prediction request. If mtls is used, then the +same is true for the default_callback_auth_cert and default_callback_auth_key fields, +or the callback_auth_cert and callback_auth_key fields.

    +
    Creating an Async Model Endpoint with custom Callback auth
    import os
    +import time
    +from launch import EndpointRequest, LaunchClient, PostInferenceHooks
    +
    +client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
    +endpoint = client.create_model_endpoint(
    +    endpoint_name="demo-endpoint-callback",
    +    model_bundle="test-bundle",
    +    cpus=1,
    +    min_workers=1,
    +    endpoint_type="async",
    +    update_if_exists=True,
    +    labels={
    +        "team": "MY_TEAM",
    +        "product": "MY_PRODUCT",
    +    },
    +    post_inference_hooks=[PostInferenceHooks.CALLBACK],
    +    default_callback_url="https://example.com",
    +    default_callback_auth_kind="basic",
    +    default_callback_auth_username="user",
    +    default_callback_auth_password="password",
    +)
    +
    +while endpoint.status() != "READY":
    +    time.sleep(10)
    +
    +future_default = endpoint.predict(
    +    request=EndpointRequest(args={"x": 2, "y": "hello"})
    +)
    +"""
    +A callback is sent to https://example.com with ("user", "password") as the basic auth.
    +"""
    +
    +future_custom_callback_auth = endpoint.predict(
    +    request=EndpointRequest(
    +        args={"x": 3, "y": "hello"},
    +        callback_auth_kind="mtls", 
    +        callback_auth_cert="cert", 
    +        callback_auth_key="key",
    +    ),
    +)
    +
    +"""
    +A callback is sent with mTLS authentication.
    +"""
     
    diff --git a/concepts/endpoint_predictions/index.html b/concepts/endpoint_predictions/index.html index a9e8ed7c..2a140022 100644 --- a/concepts/endpoint_predictions/index.html +++ b/concepts/endpoint_predictions/index.html @@ -674,9 +674,16 @@

    url: Optional[str] = None, args: Optional[Dict] = None, callback_url: Optional[str] = None, - return_pickled: Optional[bool] = False, - request_id: Optional[str] = None, -) + callback_auth_kind: Optional[ + Literal[basic, mtls] + ] = None, + callback_auth_username: Optional[str] = None, + callback_auth_password: Optional[str] = None, + callback_auth_cert: Optional[str] = None, + callback_auth_key: Optional[str] = None, + return_pickled: Optional[bool] = False, + request_id: Optional[str] = None, +)
    @@ -732,6 +739,78 @@

    False + + callback_url + + Optional[str] + +

    The callback url to use for this task. If None, then the +default_callback_url of the endpoint is used. The endpoint must specify +"callback" as a post-inference hook for the callback to be triggered.

    + + None + + + + callback_auth_kind + + Optional[Literal[basic, mtls]] + +

    The default callback auth kind to use for async endpoints. +Either "basic" or "mtls". This can be overridden in the task parameters for each +individual task.

    + + None + + + + callback_auth_username + + Optional[str] + +

    The default callback auth username to use. This only +applies if callback_auth_kind is "basic". This can be overridden in the task +parameters for each individual task.

    + + None + + + + callback_auth_password + + Optional[str] + +

    The default callback auth password to use. This only +applies if callback_auth_kind is "basic". This can be overridden in the task +parameters for each individual task.

    + + None + + + + callback_auth_cert + + Optional[str] + +

    The default callback auth cert to use. This only applies +if callback_auth_kind is "mtls". This can be overridden in the task +parameters for each individual task.

    + + None + + + + callback_auth_key + + Optional[str] + +

    The default callback auth key to use. This only applies +if callback_auth_kind is "mtls". This can be overridden in the task +parameters for each individual task.

    + + None + + request_id diff --git a/concepts/model_bundles/index.html b/concepts/model_bundles/index.html index 29fd1367..339faeee 100644 --- a/concepts/model_bundles/index.html +++ b/concepts/model_bundles/index.html @@ -669,7 +669,7 @@

    Creating Model Bundles "model": my_model, "load_predict_fn": my_load_predict_fn, "env_params": ENV_PARAMS, - "requirements": [], + "requirements": ["pytest==7.2.1", "numpy"], # list your requirements here "request_schema": MyRequestSchema, "response_schema": MyResponseSchema, } @@ -709,8 +709,8 @@

    Creating Model Bundlesrequirements_filename = os.path.join(directory, "requirements.txt") with open(predict_filename, "w") as f: f.write(""" -numpy -sklearn +pytest==7.2.1 +numpy """ ) @@ -767,83 +767,84 @@

    Configuring Model BundlesCreating Model Bundles with app_config
    import os
     from launch import LaunchClient
     from pydantic import BaseModel
    -from typing import List, Literal, Union
    -
    +from typing import List, Union
    +from typing_extensions import Literal
     
    -class MyRequestSchemaSingle(BaseModel):
    -    kind: Literal['single']
    -    x: int
    -    y: str
    -
    -class MyRequestSchemaBatched(BaseModel):
    -    kind: Literal['batched']
    -    x: List[int]
    -    y: List[str]
    -
    -class MyRequestSchema(BaseModel):
    -    __root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]
    -
    -class MyResponseSchema(BaseModel):
    -    __root__: Union[int, List[int]]
    -
    +
    +class MyRequestSchemaSingle(BaseModel):
    +    kind: Literal['single']
    +    x: int
    +    y: str
    +
    +class MyRequestSchemaBatched(BaseModel):
    +    kind: Literal['batched']
    +    x: List[int]
    +    y: List[str]
    +
    +class MyRequestSchema(BaseModel):
    +    __root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]
    +
    +class MyResponseSchema(BaseModel):
    +    __root__: Union[int, List[int]]
     
    -def my_load_predict_fn(app_config, model):
    -    def returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:
    -        """MyRequestSchema -> MyResponseSchema"""
    -        if app_config["mode"] == "single":
    -            assert isinstance(x, int) and isinstance(y, str)
    -            return model(x) + len(y)
    -
    -        result = []
    -        for x_i, y_i in zip(x, y):
    -            result.append(model(x_i) + len(y_i))
    -        return result
    -
    -    return returns_model_of_x_plus_len_of_y
    -
    +
    +def my_load_predict_fn(app_config, model):
    +    def returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:
    +        """MyRequestSchema -> MyResponseSchema"""
    +        if app_config["mode"] == "single":
    +            assert isinstance(x, int) and isinstance(y, str)
    +            return model(x) + len(y)
    +
    +        result = []
    +        for x_i, y_i in zip(x, y):
    +            result.append(model(x_i) + len(y_i))
    +        return result
    +
    +    return returns_model_of_x_plus_len_of_y
     
    -def my_load_model_fn(app_config):
    -    def my_model_single(x: int):
    -        return x * 2
    -
    -    def my_model_batched(x: List[int]):
    -        return [my_model_single(x_i) for x_i in x]
    -
    -    if app_config["mode"] == "single":
    -        return my_model_single
    -
    -    return my_model_batched
    -
    +
    +def my_load_model_fn(app_config):
    +    def my_model_single(x: int):
    +        return x * 2
    +
    +    def my_model_batched(x: List[int]):
    +        return [my_model_single(x_i) for x_i in x]
    +
    +    if app_config["mode"] == "single":
    +        return my_model_single
    +
    +    return my_model_batched
     
    -ENV_PARAMS = {
    -    "framework_type": "pytorch",
    -    "pytorch_image_tag": "1.7.1-cuda11.0-cudnn8-runtime",
    -}
    -
    -BUNDLE_PARAMS_SINGLE = {
    -    "model_bundle_name": "test-bundle-single",
    -    "load_predict_fn": my_load_predict_fn,
    -    "load_model_fn": my_load_model_fn,
    -    "env_params": ENV_PARAMS,
    -    "requirements": [],
    -    "request_schema": MyRequestSchema,
    -    "response_schema": MyResponseSchema,
    -    "app_config": {"mode": "single"},
    -}
    -BUNDLE_PARAMS_BATCHED = {
    -    "model_bundle_name": "test-bundle-batched",
    -    "load_predict_fn": my_load_predict_fn,
    -    "load_model_fn": my_load_model_fn,
    -    "env_params": ENV_PARAMS,
    -    "requirements": [],
    -    "request_schema": MyRequestSchema,
    -    "response_schema": MyResponseSchema,
    -    "app_config": {"mode": "batched"},
    -}
    -
    -client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
    -bundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)
    -bundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)
    +
    +ENV_PARAMS = {
    +    "framework_type": "pytorch",
    +    "pytorch_image_tag": "1.7.1-cuda11.0-cudnn8-runtime",
    +}
    +
    +BUNDLE_PARAMS_SINGLE = {
    +    "model_bundle_name": "test-bundle-single",
    +    "load_predict_fn": my_load_predict_fn,
    +    "load_model_fn": my_load_model_fn,
    +    "env_params": ENV_PARAMS,
    +    "requirements": ["pytest==7.2.1", "numpy"],
    +    "request_schema": MyRequestSchema,
    +    "response_schema": MyResponseSchema,
    +    "app_config": {"mode": "single"},
    +}
    +BUNDLE_PARAMS_BATCHED = {
    +    "model_bundle_name": "test-bundle-batched",
    +    "load_predict_fn": my_load_predict_fn,
    +    "load_model_fn": my_load_model_fn,
    +    "env_params": ENV_PARAMS,
    +    "requirements": ["pytest==7.2.1", "numpy"],
    +    "request_schema": MyRequestSchema,
    +    "response_schema": MyResponseSchema,
    +    "app_config": {"mode": "batched"},
    +}
    +
    +client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
    +bundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)
    +bundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)
     

    Updating Model Bundles

    Model Bundles are immutable, meaning they cannot be edited once created. diff --git a/concepts/model_endpoints/index.html b/concepts/model_endpoints/index.html index b524ad79..8b79291c 100644 --- a/concepts/model_endpoints/index.html +++ b/concepts/model_endpoints/index.html @@ -336,55 +336,10 @@ - - Model Endpoints - - -

    - @@ -563,35 +518,6 @@ - - - @@ -616,6 +542,27 @@

    Model Endpoints +

    Info

    +

    Choosing the right inference mode

    +

    Here are some tips for how to choose between SyncEndpoint, AsyncEndpoint, and BatchJob for deploying your ModelBundle:

    +

    A SyncEndpoint is good if:

    +
      +
    • You have strict latency requirements (e.g. on the order of seconds or less).
    • +
    • You are willing to have resources continually allocated.
    • +
    +

    An AsyncEndpoint is good if:

    +
      +
    • You want to save on compute costs.
    • +
    • Your inference code takes a long time to run.
    • +
    • Your latency requirements are on the order of minutes.
    • +
    +

    A BatchJob is good if:

    +
      +
    • You know there is a large batch of inputs ahead of time.
    • +
    • You want to optimize for throughput instead of latency.
    • +
    +

    Creating Async Model Endpoints

    Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

    @@ -632,7 +579,7 @@

    Creating Async Model Endpoints update_if_exists=True, labels={ "team": "MY_TEAM", - "product": "MY_PRODUCT" + "product": "MY_PRODUCT", }, ) @@ -656,7 +603,7 @@

    Creating Sync Model Endpoints update_if_exists=True, labels={ "team": "MY_TEAM", - "product": "MY_PRODUCT" + "product": "MY_PRODUCT", }, ) @@ -690,7 +637,7 @@

    Managing Model Endpoints update_if_exists=True, labels={ "team": "MY_TEAM", - "product": "MY_PRODUCT" + "product": "MY_PRODUCT", }, ) client.delete_model_endpoint(model_endpoint="demo-endpoint-tmp") diff --git a/index.html b/index.html index e0210afd..70b8b52c 100644 --- a/index.html +++ b/index.html @@ -630,7 +630,7 @@

    Example "model": my_model, "load_predict_fn": my_load_predict_fn, "env_params": ENV_PARAMS, - "requirements": [], + "requirements": ["pytest==7.2.1", "numpy"], # list your requirements here "request_schema": MyRequestSchema, "response_schema": MyResponseSchema, } @@ -643,7 +643,7 @@

    Example "endpoint_type": "async", "update_if_exists": True, "labels": { - "team": "infra", + "team": "MY_TEAM", "product": "launch", } } diff --git a/search/search_index.json b/search/search_index.json index ef8cb31e..f6cdd813 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Scale Launch","text":"

    Simple, scalable, and high performance ML service deployment in python.

    "},{"location":"#example","title":"Example","text":"Launch Usage
    import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"infra\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

    What's going on here:

    • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
    • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
    • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
    • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
    • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

    Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

    "},{"location":"#installation","title":"Installation","text":"

    To use Scale Launch, first install it using pip:

    Installation
    pip install -U scale-launch\n
    "},{"location":"cli/","title":"CLI","text":"

    Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

    The CLI can be used as scale-launch ....

    "},{"location":"cli/#help","title":"Help","text":"

    Run scale-launch --help for more options.

    scale-launch --help
        This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your API key and other configuration options\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
    "},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
    LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

    Scale Launch Python Client.

    Initializes a Scale Launch Client.

    Parameters:

    Name Type Description Default api_key str

    Your Scale API key

    required endpoint Optional[str]

    The Scale Launch Endpoint (this should not need to be changed)

    None self_hosted bool

    True iff you are connecting to a self-hosted Scale Launch

    False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
    batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

    Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

    Must have exactly one of urls or inputs passed in.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or the name of a the bundle to use for inference.

    required urls List[str]

    A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

    None inputs Optional[List[Dict[str, Any]]]

    A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

    None batch_url_file_location Optional[str]

    In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

    None serialization_format str

    Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

    'JSON' labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None cpus Optional[int]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
    • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains job_id as a key, and the ID as the value.

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
    clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n

    Clones an existing model bundle with changes to its app config. (More fields coming soon)

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The existing bundle or its ID.

    required app_config Optional[Dict]

    The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

    None

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
    create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Uploads and registers a model bundle to Scale Launch.

    A model bundle consists of exactly one of the following:

    • predict_fn_or_cls
    • load_predict_fn + model
    • load_predict_fn + load_model_fn

    Pre/post-processing code can be included inside load_predict_fn/model or in predict_fn_or_cls call.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required predict_fn_or_cls Optional[Callable[[Any], Any]]

    Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

    None model Optional[LaunchModel_T]

    Typically a trained Neural Network, e.g. a Pytorch module.

    Exactly one of model and load_model_fn must be provided.

    None load_model_fn Optional[Callable[[], LaunchModel_T]]

    A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

    Exactly one of model and load_model_fn must be provided.

    None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

    Function that, when called with a model, returns a function that carries out inference.

    If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

    Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

    In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

    None requirements Optional[List[str]]

    A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

    [\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

    If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

    None app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    • Tensorflow fields:

      • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
    required globals_copy Optional[Dict[str, Any]]

    Dictionary of the global symbol table. Normally provided by globals() built-in function.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
    create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

    For example, if you have a directory structure like so, and your current working directory is also my_root:

    .. code-block:: text

    my_root/ my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    then calling create_model_bundle_from_dirs with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

    .. code-block:: text

    my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required base_paths List[str]

    The paths on the local filesystem where the bundle code lives.

    required requirements_path str

    A path on the local filesystem where a requirements.txt file lives.

    required env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    required load_predict_fn_module_path str

    A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

    required load_model_fn_module_path str

    A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

    required app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
    create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

    Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

    required model_bundle Union[ModelBundle, str]

    The ModelBundle that the endpoint should serve.

    required cpus int

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    3 memory str

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    '8Gi' storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus int

    Number of gpus each worker should get, e.g. 0, 1, etc.

    0 min_workers int

    The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

    1 max_workers int

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

    1 per_worker int

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

    Here is our recommendation for computing per_worker:

    1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
    10 gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None endpoint_type str

    Either \"sync\" or \"async\".

    'sync' post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None update_if_exists bool

    If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

    False labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None

    Returns:

    Type Description Optional[Endpoint]

    A Endpoint object that can be used to make requests to the endpoint.

    "},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
    delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Deletes a model endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    A ModelEndpoint object.

    required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
    edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None\n) -> None\n

    Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

    • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

    required model_bundle Optional[Union[ModelBundle, str]]

    The ModelBundle that the endpoint should serve.

    None cpus Optional[float]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None min_workers Optional[int]

    The minimum number of workers. Must be greater than or equal to 0.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
    get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

    Gets inference results from a previously created batch job.

    Parameters:

    Name Type Description Default batch_job_id str

    An id representing the batch task job. This id is the in the response from calling batch_async_request.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains the following fields:

    Dict[str, Any]
    • status: The status of the job.
    Dict[str, Any]
    • result: The url where the result is stored.
    Dict[str, Any]
    • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
    Dict[str, Any]
    • num_tasks_pending: The number of tasks that are still pending.
    Dict[str, Any]
    • num_tasks_completed: The number of tasks that have completed.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
    get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

    Returns a model bundle specified by bundle_name that the user owns.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or its name.

    required

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
    get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

    Gets a model endpoint associated with a name.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the endpoint to retrieve.

    required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
    list_model_bundles() -> List[ModelBundle]\n

    Returns a list of model bundles that the user owns.

    Returns:

    Type Description List[ModelBundle]

    A list of ModelBundle objects

    "},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
    list_model_endpoints() -> List[Endpoint]\n

    Lists all model endpoints that the user owns.

    Returns:

    Type Description List[Endpoint]

    A list of ModelEndpoint objects.

    "},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
    read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Retrieves the logs for the creation of the endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The endpoint or its name.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
    register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

    Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

    Parameters:

    Name Type Description Default batch_csv_location_fn Callable[[], str]

    Function that generates batch_csv_urls for upload_batch_csv_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
    register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

    Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

    Parameters:

    Name Type Description Default bundle_location_fn Callable[[], str]

    Function that generates bundle_urls for upload_bundle_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
    register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

    upload_batch_csv_fn(csv_text, csv_url)\n

    This function should directly write the contents of csv_text as a text string into csv_url.

    Parameters:

    Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

    Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
    register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

    upload_bundle_fn(serialized_bundle, bundle_url)\n

    This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

    See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

    Parameters:

    Name Type Description Default upload_bundle_fn Callable[[str, str], None]

    Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/endpoint_predictions/","title":"Endpoint Predictions","text":""},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"api/hooks/","title":"Hooks","text":""},{"location":"api/hooks/#launch.hooks.PostInferenceHooks","title":"PostInferenceHooks","text":"

    Bases: str, Enum

    Post-inference hooks are functions that are called after inference is complete.

    Attributes:

    Name Type Description CALLBACK str

    The callback hook is called with the inference response and the task ID.

    "},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

    Represents a ModelBundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[Any, Any]] = None\n

    An optional user-specified configuration mapping for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
    env_params: Optional[Dict[str, str]] = None\n

    A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
    id: Optional[str] = None\n

    A globally unique identifier for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
    location: Optional[str] = None\n

    An opaque location for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
    metadata: Optional[Dict[Any, Any]] = None\n

    Arbitrary metadata for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
    name: str\n

    The name of the bundle. Must be unique across all bundles that the user owns.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
    packaging_type: Optional[str] = None\n

    The packaging type for the bundle. Can be cloudpickle or zip.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
    requirements: Optional[List[str]] = None\n

    A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

    All classes here are returned by the get_model_endpoint method and provide a predict function.

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
    AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    An asynchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponseFuture\n

    Runs an asynchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required

    Returns:

    Name Type Description EndpointResponseFuture

    An EndpointResponseFuture such the user can use to query the status of the request.

    Example EndpointResponseFuture EndpointResponseFuture

    .. code-block:: python

    my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
    predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

    (deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

    Parameters:

    Name Type Description Default requests Sequence[EndpointRequest]

    List of EndpointRequests. Request_ids must all be distinct.

    required

    Returns:

    Type Description AsyncEndpointBatchResponse

    an AsyncEndpointResponse keeping track of the inference requests made

    "},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint","title":"SyncEndpoint","text":"
    SyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    A synchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponse\n

    Runs a synchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required"},{"location":"concepts/batch_jobs/","title":"Batch Jobs","text":"

    For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

    Batch jobs are created using the batch_async_request method of the LaunchClient.

    Creating and Following a Batch Job
    import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
    "},{"location":"concepts/callbacks/","title":"Callbacks","text":"

    Async model endpoints can be configured to send callbacks to a user-defined callback URL. Callbacks are sent as HTTP POST requests with a JSON body. The following code snippet shows how to create an async model endpoint with a callback URL.

    To configure an async endpoint to send callbacks, set the post_inference_hooks field to include launch.PostInferenceHooks.CALLBACK. A callback URL also needs to be specified, and it can be configured as a default using the default_callback_url argument to launch.LaunchClient.create_model_endpoint or as a per-task override using the callback_url field of launch.EndpointRequest.

    Note

    Callbacks will not be sent if the endpoint does not have any post-inference hooks specified, even if a default_callback_url is provided to the endpoint creation method or if the prediction request has a callback_url override.

    Creating an Async Model Endpoint with a Callback URL
    import os\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\n)\nfuture_default = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\n\"\"\"\nA callback is sent to https://example.com with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 7\n}\n\"\"\"\nfuture_custom_callback_url = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"}, callback_url=\"https://example.com/custom\"\n),\n)\n\"\"\"\nA callback is sent to https://example.com/custom with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 8\n}\n\"\"\"\n
    "},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

    Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

    Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
    "},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

    Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

    "},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

    There are two methods for creating model bundles: create_model_bundle and create_model_bundle_from_dirs. The former directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The latter takes in directories containing a load_predict_fn and the module path to the load_predict_fn.

    Creating a Model Bundle DirectlyCreating a Model Bundle from Directories
    import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n
    import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\nnumpy\nsklearn\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"requirements_path\": \"requirements.txt\",\n\"env_params\": ENV_PARAMS,\n\"load_predict_fn\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle_from_dirs(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
    "},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

    The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

    Creating Model Bundles with app_config
    import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Literal, Union\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"batched\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)\n
    "},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

    Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes.

    "},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

    To list all the model bundles you own, use list_model_bundles.

    "},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

    Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

    Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

    "},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

    Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

    Creating an Async Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\n
    "},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

    Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints.

    Note

    Sync model endpoints require at least 1 min_worker.

    Creating a Sync Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\n
    "},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

    Model endpoints can be listed, updated, and deleted using the Launch API.

    Listing Model Endpoints
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
    Updating a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
    Deleting a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\"\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
    "},{"location":"concepts/overview/","title":"Overview","text":"

    Creating deployments on Launch generally involves three steps:

    1. Create and upload a ModelBundle. Pass your trained model as well as pre-/post-processing code to the Scale Launch Python client, and we\u2019ll create a model bundle based on the code and store it in our Bundle Store.

    2. Create a ModelEndpoint. Pass a ModelBundle as well as infrastructure settings such as the desired number of GPUs to our client. This provisions resources on Scale\u2019s cluster dedicated to your ModelEndpoint.

    3. Make requests to the ModelEndpoint. You can make requests through the Python client, or make HTTP requests directly to Scale.

    "}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Scale Launch","text":"

    Simple, scalable, and high performance ML service deployment in python.

    "},{"location":"#example","title":"Example","text":"Launch Usage
    import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"MY_TEAM\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

    What's going on here:

    • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
    • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
    • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
    • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
    • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

    Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

    "},{"location":"#installation","title":"Installation","text":"

    To use Scale Launch, first install it using pip:

    Installation
    pip install -U scale-launch\n
    "},{"location":"cli/","title":"CLI","text":"

    Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

    The CLI can be used as scale-launch ....

    "},{"location":"cli/#help","title":"Help","text":"

    Run scale-launch --help for more options.

    scale-launch --help
        This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your API key and other configuration options\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
    "},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
    LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

    Scale Launch Python Client.

    Initializes a Scale Launch Client.

    Parameters:

    Name Type Description Default api_key str

    Your Scale API key

    required endpoint Optional[str]

    The Scale Launch Endpoint (this should not need to be changed)

    None self_hosted bool

    True iff you are connecting to a self-hosted Scale Launch

    False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
    batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

    Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

    Must have exactly one of urls or inputs passed in.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or the name of a the bundle to use for inference.

    required urls List[str]

    A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

    None inputs Optional[List[Dict[str, Any]]]

    A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

    None batch_url_file_location Optional[str]

    In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

    None serialization_format str

    Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

    'JSON' labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None cpus Optional[int]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
    • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains job_id as a key, and the ID as the value.

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
    clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n

    Clones an existing model bundle with changes to its app config. (More fields coming soon)

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The existing bundle or its ID.

    required app_config Optional[Dict]

    The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

    None

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
    create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Uploads and registers a model bundle to Scale Launch.

    A model bundle consists of exactly one of the following:

    • predict_fn_or_cls
    • load_predict_fn + model
    • load_predict_fn + load_model_fn

    Pre/post-processing code can be included inside load_predict_fn/model or in predict_fn_or_cls call.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required predict_fn_or_cls Optional[Callable[[Any], Any]]

    Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

    None model Optional[LaunchModel_T]

    Typically a trained Neural Network, e.g. a Pytorch module.

    Exactly one of model and load_model_fn must be provided.

    None load_model_fn Optional[Callable[[], LaunchModel_T]]

    A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

    Exactly one of model and load_model_fn must be provided.

    None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

    Function that, when called with a model, returns a function that carries out inference.

    If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

    Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

    In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

    None requirements Optional[List[str]]

    A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

    [\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

    If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

    None app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    • Tensorflow fields:

      • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
    required globals_copy Optional[Dict[str, Any]]

    Dictionary of the global symbol table. Normally provided by globals() built-in function.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
    create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

    For example, if you have a directory structure like so, and your current working directory is also my_root:

    .. code-block:: text

    my_root/ my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    then calling create_model_bundle_from_dirs with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

    .. code-block:: text

    my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required base_paths List[str]

    The paths on the local filesystem where the bundle code lives.

    required requirements_path str

    A path on the local filesystem where a requirements.txt file lives.

    required env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    required load_predict_fn_module_path str

    A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

    required load_model_fn_module_path str

    A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

    required app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
    create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

    Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

    required model_bundle Union[ModelBundle, str]

    The ModelBundle that the endpoint should serve.

    required cpus int

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    3 memory str

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    '8Gi' storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus int

    Number of gpus each worker should get, e.g. 0, 1, etc.

    0 min_workers int

    The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

    1 max_workers int

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

    1 per_worker int

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

    Here is our recommendation for computing per_worker:

    1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
    10 gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None endpoint_type str

    Either \"sync\" or \"async\".

    'sync' post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None update_if_exists bool

    If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

    False labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None

    Returns:

    Type Description Optional[Endpoint]

    A Endpoint object that can be used to make requests to the endpoint.

    "},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
    delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Deletes a model endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    A ModelEndpoint object.

    required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
    edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None\n) -> None\n

    Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

    • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

    required model_bundle Optional[Union[ModelBundle, str]]

    The ModelBundle that the endpoint should serve.

    None cpus Optional[float]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None min_workers Optional[int]

    The minimum number of workers. Must be greater than or equal to 0.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
    get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

    Gets inference results from a previously created batch job.

    Parameters:

    Name Type Description Default batch_job_id str

    An id representing the batch task job. This id is the in the response from calling batch_async_request.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains the following fields:

    Dict[str, Any]
    • status: The status of the job.
    Dict[str, Any]
    • result: The url where the result is stored.
    Dict[str, Any]
    • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
    Dict[str, Any]
    • num_tasks_pending: The number of tasks that are still pending.
    Dict[str, Any]
    • num_tasks_completed: The number of tasks that have completed.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
    get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

    Returns a model bundle specified by bundle_name that the user owns.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or its name.

    required

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
    get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

    Gets a model endpoint associated with a name.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the endpoint to retrieve.

    required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
    list_model_bundles() -> List[ModelBundle]\n

    Returns a list of model bundles that the user owns.

    Returns:

    Type Description List[ModelBundle]

    A list of ModelBundle objects

    "},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
    list_model_endpoints() -> List[Endpoint]\n

    Lists all model endpoints that the user owns.

    Returns:

    Type Description List[Endpoint]

    A list of ModelEndpoint objects.

    "},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
    read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Retrieves the logs for the creation of the endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The endpoint or its name.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
    register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

    Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

    Parameters:

    Name Type Description Default batch_csv_location_fn Callable[[], str]

    Function that generates batch_csv_urls for upload_batch_csv_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
    register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

    Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

    Parameters:

    Name Type Description Default bundle_location_fn Callable[[], str]

    Function that generates bundle_urls for upload_bundle_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
    register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

    upload_batch_csv_fn(csv_text, csv_url)\n

    This function should directly write the contents of csv_text as a text string into csv_url.

    Parameters:

    Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

    Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
    register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

    upload_bundle_fn(serialized_bundle, bundle_url)\n

    This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

    See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

    Parameters:

    Name Type Description Default upload_bundle_fn Callable[[str, str], None]

    Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/endpoint_predictions/","title":"Endpoint Predictions","text":""},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"api/hooks/","title":"Hooks","text":""},{"location":"api/hooks/#launch.hooks.PostInferenceHooks","title":"PostInferenceHooks","text":"

    Bases: str, Enum

    Post-inference hooks are functions that are called after inference is complete.

    Attributes:

    Name Type Description CALLBACK str

    The callback hook is called with the inference response and the task ID.

    "},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

    Represents a ModelBundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[Any, Any]] = None\n

    An optional user-specified configuration mapping for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
    env_params: Optional[Dict[str, str]] = None\n

    A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
    id: Optional[str] = None\n

    A globally unique identifier for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
    location: Optional[str] = None\n

    An opaque location for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
    metadata: Optional[Dict[Any, Any]] = None\n

    Arbitrary metadata for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
    name: str\n

    The name of the bundle. Must be unique across all bundles that the user owns.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
    packaging_type: Optional[str] = None\n

    The packaging type for the bundle. Can be cloudpickle or zip.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
    requirements: Optional[List[str]] = None\n

    A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

    All classes here are returned by the get_model_endpoint method and provide a predict function.

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
    AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    An asynchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponseFuture\n

    Runs an asynchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required

    Returns:

    Name Type Description EndpointResponseFuture

    An EndpointResponseFuture such the user can use to query the status of the request.

    Example EndpointResponseFuture EndpointResponseFuture

    .. code-block:: python

    my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
    predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

    (deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

    Parameters:

    Name Type Description Default requests Sequence[EndpointRequest]

    List of EndpointRequests. Request_ids must all be distinct.

    required

    Returns:

    Type Description AsyncEndpointBatchResponse

    an AsyncEndpointResponse keeping track of the inference requests made

    "},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint","title":"SyncEndpoint","text":"
    SyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    A synchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponse\n

    Runs a synchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required"},{"location":"concepts/batch_jobs/","title":"Batch Jobs","text":"

    For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

    Batch jobs are created using the batch_async_request method of the LaunchClient.

    Creating and Following a Batch Job
    import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n}\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
    "},{"location":"concepts/callbacks/","title":"Callbacks","text":"

    Async model endpoints can be configured to send callbacks to a user-defined callback URL. Callbacks are sent as HTTP POST requests with a JSON body. The following code snippet shows how to create an async model endpoint with a callback URL.

    To configure an async endpoint to send callbacks, set the post_inference_hooks field to include launch.PostInferenceHooks.CALLBACK. A callback URL also needs to be specified, and it can be configured as a default using the default_callback_url argument to launch.LaunchClient.create_model_endpoint or as a per-task override using the callback_url field of launch.EndpointRequest.

    Note

    Callbacks will not be sent if the endpoint does not have any post-inference hooks specified, even if a default_callback_url is provided to the endpoint creation method or if the prediction request has a callback_url override.

    Creating an Async Model Endpoint with a Callback URL
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 7\n}\n\"\"\"\nfuture_custom_callback_url = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"}, callback_url=\"https://example.com/custom\"\n),\n)\n\"\"\"\nA callback is sent to https://example.com/custom with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 8\n}\n\"\"\"\n
    "},{"location":"concepts/callbacks/#authentication-for-callbacks","title":"Authentication for callbacks","text":"

    Warning

    This feature is currently in beta, and the API is likely to change.

    Callbacks can be authenticated using shared authentication headers. To enable authentication, set either default_callback_auth_kind when creating the endpoint or callback_auth_kind when making a prediction request.

    Currently, the supported authentication methods are basic and mtls. If basic is used, then the default_callback_auth_username and default_callback_auth_password fields must be specified when creating the endpoint, or the callback_auth_username and callback_auth_password fields must be specified when making a prediction request. If mtls is used, then the same is true for the default_callback_auth_cert and default_callback_auth_key fields, or the callback_auth_cert and callback_auth_key fields.

    Creating an Async Model Endpoint with custom Callback auth
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\ndefault_callback_auth_kind=\"basic\",\ndefault_callback_auth_username=\"user\",\ndefault_callback_auth_password=\"password\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with (\"user\", \"password\") as the basic auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"mtls\", \ncallback_auth_cert=\"cert\", \ncallback_auth_key=\"key\",\n),\n)\n\"\"\"\nA callback is sent with mTLS authentication.\n\"\"\"\n
    "},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

    Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

    Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
    "},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

    Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

    "},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

    There are two methods for creating model bundles: create_model_bundle and create_model_bundle_from_dirs. The former directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The latter takes in directories containing a load_predict_fn and the module path to the load_predict_fn.

    Creating a Model Bundle DirectlyCreating a Model Bundle from Directories
    import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n
    import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\npytest==7.2.1\nnumpy\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"requirements_path\": \"requirements.txt\",\n\"env_params\": ENV_PARAMS,\n\"load_predict_fn\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle_from_dirs(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
    "},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

    The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

    Creating Model Bundles with app_config
    import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Union\nfrom typing_extensions import Literal\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"batched\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)\n
    "},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

    Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes.

    "},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

    To list all the model bundles you own, use list_model_bundles.

    "},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

    Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

    Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

    Info

    "},{"location":"concepts/model_endpoints/#choosing-the-right-inference-mode","title":"Choosing the right inference mode","text":"

    Here are some tips for how to choose between SyncEndpoint, AsyncEndpoint, and BatchJob for deploying your ModelBundle:

    A SyncEndpoint is good if:

    • You have strict latency requirements (e.g. on the order of seconds or less).
    • You are willing to have resources continually allocated.

    An AsyncEndpoint is good if:

    • You want to save on compute costs.
    • Your inference code takes a long time to run.
    • Your latency requirements are on the order of minutes.

    A BatchJob is good if:

    • You know there is a large batch of inputs ahead of time.
    • You want to optimize for throughput instead of latency.
    "},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

    Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

    Creating an Async Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

    Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints.

    Note

    Sync model endpoints require at least 1 min_worker.

    Creating a Sync Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

    Model endpoints can be listed, updated, and deleted using the Launch API.

    Listing Model Endpoints
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
    Updating a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
    Deleting a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
    "},{"location":"concepts/overview/","title":"Overview","text":"

    Creating deployments on Launch generally involves three steps:

    1. Create and upload a ModelBundle. Pass your trained model as well as pre-/post-processing code to the Scale Launch Python client, and we\u2019ll create a model bundle based on the code and store it in our Bundle Store.

    2. Create a ModelEndpoint. Pass a ModelBundle as well as infrastructure settings such as the desired number of GPUs to our client. This provisions resources on Scale\u2019s cluster dedicated to your ModelEndpoint.

    3. Make requests to the ModelEndpoint. You can make requests through the Python client, or make HTTP requests directly to Scale.

    "}]} \ No newline at end of file diff --git a/sitemap.xml b/sitemap.xml index e9e95501..e434d218 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -2,67 +2,67 @@ https://scaleapi.github.io/launch-python-client/ - 2023-02-24 + 2023-03-08 daily https://scaleapi.github.io/launch-python-client/cli/ - 2023-02-24 + 2023-03-08 daily https://scaleapi.github.io/launch-python-client/api/client/ - 2023-02-24 + 2023-03-08 daily https://scaleapi.github.io/launch-python-client/api/endpoint_predictions/ - 2023-02-24 + 2023-03-08 daily https://scaleapi.github.io/launch-python-client/api/hooks/ - 2023-02-24 + 2023-03-08 daily https://scaleapi.github.io/launch-python-client/api/model_bundles/ - 2023-02-24 + 2023-03-08 daily https://scaleapi.github.io/launch-python-client/api/model_endpoints/ - 2023-02-24 + 2023-03-08 daily https://scaleapi.github.io/launch-python-client/concepts/batch_jobs/ - 2023-02-24 + 2023-03-08 daily https://scaleapi.github.io/launch-python-client/concepts/callbacks/ - 2023-02-24 + 2023-03-08 daily https://scaleapi.github.io/launch-python-client/concepts/endpoint_predictions/ - 2023-02-24 + 2023-03-08 daily https://scaleapi.github.io/launch-python-client/concepts/model_bundles/ - 2023-02-24 + 2023-03-08 daily https://scaleapi.github.io/launch-python-client/concepts/model_endpoints/ - 2023-02-24 + 2023-03-08 daily https://scaleapi.github.io/launch-python-client/concepts/overview/ - 2023-02-24 + 2023-03-08 daily \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index 49c6d680f4ea5c0b0f4f19944651c102b1db0ce6..4f65f5acd4907c53b4e05f4d143f454539fb0b93 100644 GIT binary patch literal 319 zcmV-F0l@wriwFotObBEG|8r?{Wo=<_E_iKh0M(YkZo?o9hVOlfh`mj zjtF>xm0%V~v%dYDwyUC@w*wZE!TPa2BaCPcUxO=7Fh+}h&mO9p72p+W>-#->dwnT) z>>xJHG`a|>AhC~oW>N~zoX_)IMVnxdAyzo{JSszr$ZtVjS5HiA3bG}^b#}4Fp%P1$ zNNJ*y4rH)ZZISW4VhA+F;Nn}g|YO$@ik7Z3`N0M7?B~wQF z9^Oaz6k1w$Zuly4rQ>(JzW^nd4=hP|ZU?+DgVzDAPi+`MTb1bk#=I&ph{w#3i2+>O zOt9g!u7_k|8r?{Wo=<_E_iKh0M(YkZo?o9hVOlfhY<|AvX{>Q From 4bf79b8776e2230d5599b2c409b6df39e131d207 Mon Sep 17 00:00:00 2001 From: Phil Chen Date: Wed, 8 Mar 2023 15:27:59 -0800 Subject: [PATCH 06/28] Deployed 635fe4e with MkDocs version: 1.4.2 --- concepts/callbacks/index.html | 36 ++++++++++++++++++++++++++++++---- search/search_index.json | 2 +- sitemap.xml.gz | Bin 319 -> 319 bytes 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/concepts/callbacks/index.html b/concepts/callbacks/index.html index 5ad2bcf1..d27c19b0 100644 --- a/concepts/callbacks/index.html +++ b/concepts/callbacks/index.html @@ -699,10 +699,38 @@

    Authentication for callbacks callback_auth_key="key", ), ) - -""" -A callback is sent with mTLS authentication. -""" +""" +A callback is sent with mTLS authentication. +""" + +client.edit_model_endpoint( + model_endpoint=endpoint.model_endpoint, + default_callback_auth_kind="mtls", + default_callback_auth_cert="cert", + default_callback_auth_key="key", +) + +while endpoint.status() != "READY": + time.sleep(10) + +future_default = endpoint.predict( + request=EndpointRequest(args={"x": 2, "y": "hello"}) +) +""" +A callback is sent with mTLS auth. +""" + +future_custom_callback_auth = endpoint.predict( + request=EndpointRequest( + args={"x": 3, "y": "hello"}, + callback_auth_kind="basic", + callback_auth_username="user", + callback_auth_password="pass", + ), +) +""" +A callback is sent with ("user", "pass") as the basic auth. +""" diff --git a/search/search_index.json b/search/search_index.json index f6cdd813..3de1619b 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Scale Launch","text":"

    Simple, scalable, and high performance ML service deployment in python.

    "},{"location":"#example","title":"Example","text":"Launch Usage
    import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"MY_TEAM\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

    What's going on here:

    • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
    • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
    • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
    • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
    • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

    Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

    "},{"location":"#installation","title":"Installation","text":"

    To use Scale Launch, first install it using pip:

    Installation
    pip install -U scale-launch\n
    "},{"location":"cli/","title":"CLI","text":"

    Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

    The CLI can be used as scale-launch ....

    "},{"location":"cli/#help","title":"Help","text":"

    Run scale-launch --help for more options.

    scale-launch --help
        This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your API key and other configuration options\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
    "},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
    LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

    Scale Launch Python Client.

    Initializes a Scale Launch Client.

    Parameters:

    Name Type Description Default api_key str

    Your Scale API key

    required endpoint Optional[str]

    The Scale Launch Endpoint (this should not need to be changed)

    None self_hosted bool

    True iff you are connecting to a self-hosted Scale Launch

    False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
    batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

    Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

    Must have exactly one of urls or inputs passed in.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or the name of a the bundle to use for inference.

    required urls List[str]

    A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

    None inputs Optional[List[Dict[str, Any]]]

    A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

    None batch_url_file_location Optional[str]

    In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

    None serialization_format str

    Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

    'JSON' labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None cpus Optional[int]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
    • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains job_id as a key, and the ID as the value.

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
    clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n

    Clones an existing model bundle with changes to its app config. (More fields coming soon)

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The existing bundle or its ID.

    required app_config Optional[Dict]

    The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

    None

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
    create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Uploads and registers a model bundle to Scale Launch.

    A model bundle consists of exactly one of the following:

    • predict_fn_or_cls
    • load_predict_fn + model
    • load_predict_fn + load_model_fn

    Pre/post-processing code can be included inside load_predict_fn/model or in predict_fn_or_cls call.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required predict_fn_or_cls Optional[Callable[[Any], Any]]

    Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

    None model Optional[LaunchModel_T]

    Typically a trained Neural Network, e.g. a Pytorch module.

    Exactly one of model and load_model_fn must be provided.

    None load_model_fn Optional[Callable[[], LaunchModel_T]]

    A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

    Exactly one of model and load_model_fn must be provided.

    None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

    Function that, when called with a model, returns a function that carries out inference.

    If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

    Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

    In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

    None requirements Optional[List[str]]

    A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

    [\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

    If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

    None app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    • Tensorflow fields:

      • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
    required globals_copy Optional[Dict[str, Any]]

    Dictionary of the global symbol table. Normally provided by globals() built-in function.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
    create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

    For example, if you have a directory structure like so, and your current working directory is also my_root:

    .. code-block:: text

    my_root/ my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    then calling create_model_bundle_from_dirs with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

    .. code-block:: text

    my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required base_paths List[str]

    The paths on the local filesystem where the bundle code lives.

    required requirements_path str

    A path on the local filesystem where a requirements.txt file lives.

    required env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    required load_predict_fn_module_path str

    A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

    required load_model_fn_module_path str

    A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

    required app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
    create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

    Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

    required model_bundle Union[ModelBundle, str]

    The ModelBundle that the endpoint should serve.

    required cpus int

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    3 memory str

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    '8Gi' storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus int

    Number of gpus each worker should get, e.g. 0, 1, etc.

    0 min_workers int

    The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

    1 max_workers int

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

    1 per_worker int

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

    Here is our recommendation for computing per_worker:

    1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
    10 gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None endpoint_type str

    Either \"sync\" or \"async\".

    'sync' post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None update_if_exists bool

    If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

    False labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None

    Returns:

    Type Description Optional[Endpoint]

    A Endpoint object that can be used to make requests to the endpoint.

    "},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
    delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Deletes a model endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    A ModelEndpoint object.

    required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
    edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None\n) -> None\n

    Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

    • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

    required model_bundle Optional[Union[ModelBundle, str]]

    The ModelBundle that the endpoint should serve.

    None cpus Optional[float]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None min_workers Optional[int]

    The minimum number of workers. Must be greater than or equal to 0.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
    get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

    Gets inference results from a previously created batch job.

    Parameters:

    Name Type Description Default batch_job_id str

    An id representing the batch task job. This id is the in the response from calling batch_async_request.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains the following fields:

    Dict[str, Any]
    • status: The status of the job.
    Dict[str, Any]
    • result: The url where the result is stored.
    Dict[str, Any]
    • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
    Dict[str, Any]
    • num_tasks_pending: The number of tasks that are still pending.
    Dict[str, Any]
    • num_tasks_completed: The number of tasks that have completed.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
    get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

    Returns a model bundle specified by bundle_name that the user owns.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or its name.

    required

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
    get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

    Gets a model endpoint associated with a name.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the endpoint to retrieve.

    required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
    list_model_bundles() -> List[ModelBundle]\n

    Returns a list of model bundles that the user owns.

    Returns:

    Type Description List[ModelBundle]

    A list of ModelBundle objects

    "},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
    list_model_endpoints() -> List[Endpoint]\n

    Lists all model endpoints that the user owns.

    Returns:

    Type Description List[Endpoint]

    A list of ModelEndpoint objects.

    "},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
    read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Retrieves the logs for the creation of the endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The endpoint or its name.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
    register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

    Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

    Parameters:

    Name Type Description Default batch_csv_location_fn Callable[[], str]

    Function that generates batch_csv_urls for upload_batch_csv_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
    register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

    Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

    Parameters:

    Name Type Description Default bundle_location_fn Callable[[], str]

    Function that generates bundle_urls for upload_bundle_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
    register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

    upload_batch_csv_fn(csv_text, csv_url)\n

    This function should directly write the contents of csv_text as a text string into csv_url.

    Parameters:

    Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

    Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
    register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

    upload_bundle_fn(serialized_bundle, bundle_url)\n

    This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

    See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

    Parameters:

    Name Type Description Default upload_bundle_fn Callable[[str, str], None]

    Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/endpoint_predictions/","title":"Endpoint Predictions","text":""},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"api/hooks/","title":"Hooks","text":""},{"location":"api/hooks/#launch.hooks.PostInferenceHooks","title":"PostInferenceHooks","text":"

    Bases: str, Enum

    Post-inference hooks are functions that are called after inference is complete.

    Attributes:

    Name Type Description CALLBACK str

    The callback hook is called with the inference response and the task ID.

    "},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

    Represents a ModelBundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[Any, Any]] = None\n

    An optional user-specified configuration mapping for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
    env_params: Optional[Dict[str, str]] = None\n

    A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
    id: Optional[str] = None\n

    A globally unique identifier for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
    location: Optional[str] = None\n

    An opaque location for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
    metadata: Optional[Dict[Any, Any]] = None\n

    Arbitrary metadata for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
    name: str\n

    The name of the bundle. Must be unique across all bundles that the user owns.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
    packaging_type: Optional[str] = None\n

    The packaging type for the bundle. Can be cloudpickle or zip.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
    requirements: Optional[List[str]] = None\n

    A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

    All classes here are returned by the get_model_endpoint method and provide a predict function.

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
    AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    An asynchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponseFuture\n

    Runs an asynchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required

    Returns:

    Name Type Description EndpointResponseFuture

    An EndpointResponseFuture such the user can use to query the status of the request.

    Example EndpointResponseFuture EndpointResponseFuture

    .. code-block:: python

    my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
    predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

    (deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

    Parameters:

    Name Type Description Default requests Sequence[EndpointRequest]

    List of EndpointRequests. Request_ids must all be distinct.

    required

    Returns:

    Type Description AsyncEndpointBatchResponse

    an AsyncEndpointResponse keeping track of the inference requests made

    "},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint","title":"SyncEndpoint","text":"
    SyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    A synchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponse\n

    Runs a synchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required"},{"location":"concepts/batch_jobs/","title":"Batch Jobs","text":"

    For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

    Batch jobs are created using the batch_async_request method of the LaunchClient.

    Creating and Following a Batch Job
    import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n}\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
    "},{"location":"concepts/callbacks/","title":"Callbacks","text":"

    Async model endpoints can be configured to send callbacks to a user-defined callback URL. Callbacks are sent as HTTP POST requests with a JSON body. The following code snippet shows how to create an async model endpoint with a callback URL.

    To configure an async endpoint to send callbacks, set the post_inference_hooks field to include launch.PostInferenceHooks.CALLBACK. A callback URL also needs to be specified, and it can be configured as a default using the default_callback_url argument to launch.LaunchClient.create_model_endpoint or as a per-task override using the callback_url field of launch.EndpointRequest.

    Note

    Callbacks will not be sent if the endpoint does not have any post-inference hooks specified, even if a default_callback_url is provided to the endpoint creation method or if the prediction request has a callback_url override.

    Creating an Async Model Endpoint with a Callback URL
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 7\n}\n\"\"\"\nfuture_custom_callback_url = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"}, callback_url=\"https://example.com/custom\"\n),\n)\n\"\"\"\nA callback is sent to https://example.com/custom with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 8\n}\n\"\"\"\n
    "},{"location":"concepts/callbacks/#authentication-for-callbacks","title":"Authentication for callbacks","text":"

    Warning

    This feature is currently in beta, and the API is likely to change.

    Callbacks can be authenticated using shared authentication headers. To enable authentication, set either default_callback_auth_kind when creating the endpoint or callback_auth_kind when making a prediction request.

    Currently, the supported authentication methods are basic and mtls. If basic is used, then the default_callback_auth_username and default_callback_auth_password fields must be specified when creating the endpoint, or the callback_auth_username and callback_auth_password fields must be specified when making a prediction request. If mtls is used, then the same is true for the default_callback_auth_cert and default_callback_auth_key fields, or the callback_auth_cert and callback_auth_key fields.

    Creating an Async Model Endpoint with custom Callback auth
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\ndefault_callback_auth_kind=\"basic\",\ndefault_callback_auth_username=\"user\",\ndefault_callback_auth_password=\"password\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with (\"user\", \"password\") as the basic auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"mtls\", \ncallback_auth_cert=\"cert\", \ncallback_auth_key=\"key\",\n),\n)\n\"\"\"\nA callback is sent with mTLS authentication.\n\"\"\"\n
    "},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

    Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

    Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
    "},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

    Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

    "},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

    There are two methods for creating model bundles: create_model_bundle and create_model_bundle_from_dirs. The former directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The latter takes in directories containing a load_predict_fn and the module path to the load_predict_fn.

    Creating a Model Bundle DirectlyCreating a Model Bundle from Directories
    import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n
    import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\npytest==7.2.1\nnumpy\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"requirements_path\": \"requirements.txt\",\n\"env_params\": ENV_PARAMS,\n\"load_predict_fn\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle_from_dirs(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
    "},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

    The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

    Creating Model Bundles with app_config
    import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Union\nfrom typing_extensions import Literal\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"batched\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)\n
    "},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

    Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes.

    "},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

    To list all the model bundles you own, use list_model_bundles.

    "},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

    Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

    Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

    Info

    "},{"location":"concepts/model_endpoints/#choosing-the-right-inference-mode","title":"Choosing the right inference mode","text":"

    Here are some tips for how to choose between SyncEndpoint, AsyncEndpoint, and BatchJob for deploying your ModelBundle:

    A SyncEndpoint is good if:

    • You have strict latency requirements (e.g. on the order of seconds or less).
    • You are willing to have resources continually allocated.

    An AsyncEndpoint is good if:

    • You want to save on compute costs.
    • Your inference code takes a long time to run.
    • Your latency requirements are on the order of minutes.

    A BatchJob is good if:

    • You know there is a large batch of inputs ahead of time.
    • You want to optimize for throughput instead of latency.
    "},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

    Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

    Creating an Async Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

    Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints.

    Note

    Sync model endpoints require at least 1 min_worker.

    Creating a Sync Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

    Model endpoints can be listed, updated, and deleted using the Launch API.

    Listing Model Endpoints
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
    Updating a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
    Deleting a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
    "},{"location":"concepts/overview/","title":"Overview","text":"

    Creating deployments on Launch generally involves three steps:

    1. Create and upload a ModelBundle. Pass your trained model as well as pre-/post-processing code to the Scale Launch Python client, and we\u2019ll create a model bundle based on the code and store it in our Bundle Store.

    2. Create a ModelEndpoint. Pass a ModelBundle as well as infrastructure settings such as the desired number of GPUs to our client. This provisions resources on Scale\u2019s cluster dedicated to your ModelEndpoint.

    3. Make requests to the ModelEndpoint. You can make requests through the Python client, or make HTTP requests directly to Scale.

    "}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Scale Launch","text":"

    Simple, scalable, and high performance ML service deployment in python.

    "},{"location":"#example","title":"Example","text":"Launch Usage
    import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"MY_TEAM\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

    What's going on here:

    • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
    • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
    • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
    • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
    • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

    Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

    "},{"location":"#installation","title":"Installation","text":"

    To use Scale Launch, first install it using pip:

    Installation
    pip install -U scale-launch\n
    "},{"location":"cli/","title":"CLI","text":"

    Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

    The CLI can be used as scale-launch ....

    "},{"location":"cli/#help","title":"Help","text":"

    Run scale-launch --help for more options.

    scale-launch --help
        This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your API key and other configuration options\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
    "},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
    LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

    Scale Launch Python Client.

    Initializes a Scale Launch Client.

    Parameters:

    Name Type Description Default api_key str

    Your Scale API key

    required endpoint Optional[str]

    The Scale Launch Endpoint (this should not need to be changed)

    None self_hosted bool

    True iff you are connecting to a self-hosted Scale Launch

    False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
    batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

    Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

    Must have exactly one of urls or inputs passed in.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or the name of a the bundle to use for inference.

    required urls List[str]

    A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

    None inputs Optional[List[Dict[str, Any]]]

    A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

    None batch_url_file_location Optional[str]

    In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

    None serialization_format str

    Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

    'JSON' labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None cpus Optional[int]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
    • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains job_id as a key, and the ID as the value.

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
    clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n

    Clones an existing model bundle with changes to its app config. (More fields coming soon)

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The existing bundle or its ID.

    required app_config Optional[Dict]

    The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

    None

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
    create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Uploads and registers a model bundle to Scale Launch.

    A model bundle consists of exactly one of the following:

    • predict_fn_or_cls
    • load_predict_fn + model
    • load_predict_fn + load_model_fn

    Pre/post-processing code can be included inside load_predict_fn/model or in predict_fn_or_cls call.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required predict_fn_or_cls Optional[Callable[[Any], Any]]

    Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

    None model Optional[LaunchModel_T]

    Typically a trained Neural Network, e.g. a Pytorch module.

    Exactly one of model and load_model_fn must be provided.

    None load_model_fn Optional[Callable[[], LaunchModel_T]]

    A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

    Exactly one of model and load_model_fn must be provided.

    None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

    Function that, when called with a model, returns a function that carries out inference.

    If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

    Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

    In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

    None requirements Optional[List[str]]

    A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

    [\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

    If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

    None app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    • Tensorflow fields:

      • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
    required globals_copy Optional[Dict[str, Any]]

    Dictionary of the global symbol table. Normally provided by globals() built-in function.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
    create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

    For example, if you have a directory structure like so, and your current working directory is also my_root:

    .. code-block:: text

    my_root/ my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    then calling create_model_bundle_from_dirs with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

    .. code-block:: text

    my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required base_paths List[str]

    The paths on the local filesystem where the bundle code lives.

    required requirements_path str

    A path on the local filesystem where a requirements.txt file lives.

    required env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    required load_predict_fn_module_path str

    A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

    required load_model_fn_module_path str

    A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

    required app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
    create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

    Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

    required model_bundle Union[ModelBundle, str]

    The ModelBundle that the endpoint should serve.

    required cpus int

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    3 memory str

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    '8Gi' storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus int

    Number of gpus each worker should get, e.g. 0, 1, etc.

    0 min_workers int

    The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

    1 max_workers int

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

    1 per_worker int

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

    Here is our recommendation for computing per_worker:

    1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
    10 gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None endpoint_type str

    Either \"sync\" or \"async\".

    'sync' post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None update_if_exists bool

    If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

    False labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None

    Returns:

    Type Description Optional[Endpoint]

    A Endpoint object that can be used to make requests to the endpoint.

    "},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
    delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Deletes a model endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    A ModelEndpoint object.

    required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
    edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None\n) -> None\n

    Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

    • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

    required model_bundle Optional[Union[ModelBundle, str]]

    The ModelBundle that the endpoint should serve.

    None cpus Optional[float]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None min_workers Optional[int]

    The minimum number of workers. Must be greater than or equal to 0.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
    get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

    Gets inference results from a previously created batch job.

    Parameters:

    Name Type Description Default batch_job_id str

    An id representing the batch task job. This id is the in the response from calling batch_async_request.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains the following fields:

    Dict[str, Any]
    • status: The status of the job.
    Dict[str, Any]
    • result: The url where the result is stored.
    Dict[str, Any]
    • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
    Dict[str, Any]
    • num_tasks_pending: The number of tasks that are still pending.
    Dict[str, Any]
    • num_tasks_completed: The number of tasks that have completed.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
    get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

    Returns a model bundle specified by bundle_name that the user owns.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or its name.

    required

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
    get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

    Gets a model endpoint associated with a name.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the endpoint to retrieve.

    required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
    list_model_bundles() -> List[ModelBundle]\n

    Returns a list of model bundles that the user owns.

    Returns:

    Type Description List[ModelBundle]

    A list of ModelBundle objects

    "},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
    list_model_endpoints() -> List[Endpoint]\n

    Lists all model endpoints that the user owns.

    Returns:

    Type Description List[Endpoint]

    A list of ModelEndpoint objects.

    "},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
    read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Retrieves the logs for the creation of the endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The endpoint or its name.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
    register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

    Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

    Parameters:

    Name Type Description Default batch_csv_location_fn Callable[[], str]

    Function that generates batch_csv_urls for upload_batch_csv_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
    register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

    Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

    Parameters:

    Name Type Description Default bundle_location_fn Callable[[], str]

    Function that generates bundle_urls for upload_bundle_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
    register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

    upload_batch_csv_fn(csv_text, csv_url)\n

    This function should directly write the contents of csv_text as a text string into csv_url.

    Parameters:

    Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

    Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
    register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

    upload_bundle_fn(serialized_bundle, bundle_url)\n

    This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

    See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

    Parameters:

    Name Type Description Default upload_bundle_fn Callable[[str, str], None]

    Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/endpoint_predictions/","title":"Endpoint Predictions","text":""},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"api/hooks/","title":"Hooks","text":""},{"location":"api/hooks/#launch.hooks.PostInferenceHooks","title":"PostInferenceHooks","text":"

    Bases: str, Enum

    Post-inference hooks are functions that are called after inference is complete.

    Attributes:

    Name Type Description CALLBACK str

    The callback hook is called with the inference response and the task ID.

    "},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

    Represents a ModelBundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[Any, Any]] = None\n

    An optional user-specified configuration mapping for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
    env_params: Optional[Dict[str, str]] = None\n

    A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
    id: Optional[str] = None\n

    A globally unique identifier for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
    location: Optional[str] = None\n

    An opaque location for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
    metadata: Optional[Dict[Any, Any]] = None\n

    Arbitrary metadata for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
    name: str\n

    The name of the bundle. Must be unique across all bundles that the user owns.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
    packaging_type: Optional[str] = None\n

    The packaging type for the bundle. Can be cloudpickle or zip.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
    requirements: Optional[List[str]] = None\n

    A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

    All classes here are returned by the get_model_endpoint method and provide a predict function.

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
    AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    An asynchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponseFuture\n

    Runs an asynchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required

    Returns:

    Name Type Description EndpointResponseFuture

    An EndpointResponseFuture such the user can use to query the status of the request.

    Example EndpointResponseFuture EndpointResponseFuture

    .. code-block:: python

    my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
    predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

    (deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

    Parameters:

    Name Type Description Default requests Sequence[EndpointRequest]

    List of EndpointRequests. Request_ids must all be distinct.

    required

    Returns:

    Type Description AsyncEndpointBatchResponse

    an AsyncEndpointResponse keeping track of the inference requests made

    "},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint","title":"SyncEndpoint","text":"
    SyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    A synchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponse\n

    Runs a synchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required"},{"location":"concepts/batch_jobs/","title":"Batch Jobs","text":"

    For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

    Batch jobs are created using the batch_async_request method of the LaunchClient.

    Creating and Following a Batch Job
    import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n}\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
    "},{"location":"concepts/callbacks/","title":"Callbacks","text":"

    Async model endpoints can be configured to send callbacks to a user-defined callback URL. Callbacks are sent as HTTP POST requests with a JSON body. The following code snippet shows how to create an async model endpoint with a callback URL.

    To configure an async endpoint to send callbacks, set the post_inference_hooks field to include launch.PostInferenceHooks.CALLBACK. A callback URL also needs to be specified, and it can be configured as a default using the default_callback_url argument to launch.LaunchClient.create_model_endpoint or as a per-task override using the callback_url field of launch.EndpointRequest.

    Note

    Callbacks will not be sent if the endpoint does not have any post-inference hooks specified, even if a default_callback_url is provided to the endpoint creation method or if the prediction request has a callback_url override.

    Creating an Async Model Endpoint with a Callback URL
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 7\n}\n\"\"\"\nfuture_custom_callback_url = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"}, callback_url=\"https://example.com/custom\"\n),\n)\n\"\"\"\nA callback is sent to https://example.com/custom with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 8\n}\n\"\"\"\n
    "},{"location":"concepts/callbacks/#authentication-for-callbacks","title":"Authentication for callbacks","text":"

    Warning

    This feature is currently in beta, and the API is likely to change.

    Callbacks can be authenticated using shared authentication headers. To enable authentication, set either default_callback_auth_kind when creating the endpoint or callback_auth_kind when making a prediction request.

    Currently, the supported authentication methods are basic and mtls. If basic is used, then the default_callback_auth_username and default_callback_auth_password fields must be specified when creating the endpoint, or the callback_auth_username and callback_auth_password fields must be specified when making a prediction request. If mtls is used, then the same is true for the default_callback_auth_cert and default_callback_auth_key fields, or the callback_auth_cert and callback_auth_key fields.

    Creating an Async Model Endpoint with custom Callback auth
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\ndefault_callback_auth_kind=\"basic\",\ndefault_callback_auth_username=\"user\",\ndefault_callback_auth_password=\"password\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with (\"user\", \"password\") as the basic auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"mtls\", \ncallback_auth_cert=\"cert\", \ncallback_auth_key=\"key\",\n),\n)\n\"\"\"\nA callback is sent with mTLS authentication.\n\"\"\"\nclient.edit_model_endpoint(\nmodel_endpoint=endpoint.model_endpoint,\ndefault_callback_auth_kind=\"mtls\",\ndefault_callback_auth_cert=\"cert\",\ndefault_callback_auth_key=\"key\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent with mTLS auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"basic\",\ncallback_auth_username=\"user\",\ncallback_auth_password=\"pass\",\n),\n)\n\"\"\"\nA callback is sent with (\"user\", \"pass\") as the basic auth.\n\"\"\"\n
    "},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

    Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

    Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
    "},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

    Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

    "},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

    There are two methods for creating model bundles: create_model_bundle and create_model_bundle_from_dirs. The former directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The latter takes in directories containing a load_predict_fn and the module path to the load_predict_fn.

    Creating a Model Bundle DirectlyCreating a Model Bundle from Directories
    import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n
    import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\npytest==7.2.1\nnumpy\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"requirements_path\": \"requirements.txt\",\n\"env_params\": ENV_PARAMS,\n\"load_predict_fn\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle_from_dirs(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
    "},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

    The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

    Creating Model Bundles with app_config
    import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Union\nfrom typing_extensions import Literal\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"batched\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)\n
    "},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

    Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes.

    "},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

    To list all the model bundles you own, use list_model_bundles.

    "},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

    Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

    Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

    Info

    "},{"location":"concepts/model_endpoints/#choosing-the-right-inference-mode","title":"Choosing the right inference mode","text":"

    Here are some tips for how to choose between SyncEndpoint, AsyncEndpoint, and BatchJob for deploying your ModelBundle:

    A SyncEndpoint is good if:

    • You have strict latency requirements (e.g. on the order of seconds or less).
    • You are willing to have resources continually allocated.

    An AsyncEndpoint is good if:

    • You want to save on compute costs.
    • Your inference code takes a long time to run.
    • Your latency requirements are on the order of minutes.

    A BatchJob is good if:

    • You know there is a large batch of inputs ahead of time.
    • You want to optimize for throughput instead of latency.
    "},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

    Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

    Creating an Async Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

    Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints.

    Note

    Sync model endpoints require at least 1 min_worker.

    Creating a Sync Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

    Model endpoints can be listed, updated, and deleted using the Launch API.

    Listing Model Endpoints
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
    Updating a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
    Deleting a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
    "},{"location":"concepts/overview/","title":"Overview","text":"

    Creating deployments on Launch generally involves three steps:

    1. Create and upload a ModelBundle. Pass your trained model as well as pre-/post-processing code to the Scale Launch Python client, and we\u2019ll create a model bundle based on the code and store it in our Bundle Store.

    2. Create a ModelEndpoint. Pass a ModelBundle as well as infrastructure settings such as the desired number of GPUs to our client. This provisions resources on Scale\u2019s cluster dedicated to your ModelEndpoint.

    3. Make requests to the ModelEndpoint. You can make requests through the Python client, or make HTTP requests directly to Scale.

    "}]} \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index 4f65f5acd4907c53b4e05f4d143f454539fb0b93..fdbb5e46db3a16850d6701f2426b3096c770c5c2 100644 GIT binary patch delta 16 Xcmdnbw4aGxzMF&NpCso-b_+%TDM$oW delta 16 Xcmdnbw4aGxzMF%?&4*(ny9FZvC2a%G From da423be46107f21c930cb5cd2a9f0960c737d741 Mon Sep 17 00:00:00 2001 From: Phil Chen Date: Tue, 14 Mar 2023 15:50:26 -0700 Subject: [PATCH 07/28] Deployed 3fbbc36 with MkDocs version: 1.4.2 --- 404.html | 2 +- api/client/index.html | 2 +- api/endpoint_predictions/index.html | 2 +- api/hooks/index.html | 2 +- api/model_bundles/index.html | 2 +- api/model_endpoints/index.html | 2 +- cli/index.html | 2 +- concepts/batch_jobs/index.html | 2 +- concepts/callbacks/index.html | 2 +- concepts/endpoint_predictions/index.html | 2 +- concepts/model_bundles/index.html | 2 +- concepts/model_endpoints/index.html | 2 +- concepts/overview/index.html | 2 +- index.html | 2 +- sitemap.xml | 26 +++++++++++------------ sitemap.xml.gz | Bin 319 -> 321 bytes 16 files changed, 27 insertions(+), 27 deletions(-) diff --git a/404.html b/404.html index e174bd99..1cc2c937 100644 --- a/404.html +++ b/404.html @@ -538,7 +538,7 @@

    404 - Not found

    - + diff --git a/api/client/index.html b/api/client/index.html index bdd3f96a..c566eec2 100644 --- a/api/client/index.html +++ b/api/client/index.html @@ -2839,7 +2839,7 @@

    - + diff --git a/api/endpoint_predictions/index.html b/api/endpoint_predictions/index.html index 1f89282f..2bc159d0 100644 --- a/api/endpoint_predictions/index.html +++ b/api/endpoint_predictions/index.html @@ -1106,7 +1106,7 @@

    - + diff --git a/api/hooks/index.html b/api/hooks/index.html index 9c22d181..76c675e5 100644 --- a/api/hooks/index.html +++ b/api/hooks/index.html @@ -669,7 +669,7 @@

    - + diff --git a/api/model_bundles/index.html b/api/model_bundles/index.html index cf3d560c..f0a89c8e 100644 --- a/api/model_bundles/index.html +++ b/api/model_bundles/index.html @@ -970,7 +970,7 @@

    - + diff --git a/api/model_endpoints/index.html b/api/model_endpoints/index.html index 47323783..0b8144b3 100644 --- a/api/model_endpoints/index.html +++ b/api/model_endpoints/index.html @@ -1037,7 +1037,7 @@

    - + diff --git a/cli/index.html b/cli/index.html index 7e221c0f..fe728f9b 100644 --- a/cli/index.html +++ b/cli/index.html @@ -636,7 +636,7 @@

    Help&par
    - + diff --git a/concepts/batch_jobs/index.html b/concepts/batch_jobs/index.html index 07e046d4..dcbd4fd6 100644 --- a/concepts/batch_jobs/index.html +++ b/concepts/batch_jobs/index.html @@ -606,7 +606,7 @@

    Batch Jobs - + diff --git a/concepts/callbacks/index.html b/concepts/callbacks/index.html index d27c19b0..002bbad3 100644 --- a/concepts/callbacks/index.html +++ b/concepts/callbacks/index.html @@ -771,7 +771,7 @@

    Authentication for callbacks - + diff --git a/concepts/endpoint_predictions/index.html b/concepts/endpoint_predictions/index.html index 2a140022..123e5b5b 100644 --- a/concepts/endpoint_predictions/index.html +++ b/concepts/endpoint_predictions/index.html @@ -1133,7 +1133,7 @@

    - + diff --git a/concepts/model_bundles/index.html b/concepts/model_bundles/index.html index 339faeee..943beb01 100644 --- a/concepts/model_bundles/index.html +++ b/concepts/model_bundles/index.html @@ -893,7 +893,7 @@

    Listing Model Bundles - + diff --git a/concepts/model_endpoints/index.html b/concepts/model_endpoints/index.html index 8b79291c..59c3b39a 100644 --- a/concepts/model_endpoints/index.html +++ b/concepts/model_endpoints/index.html @@ -681,7 +681,7 @@

    Managing Model Endpoints - + diff --git a/concepts/overview/index.html b/concepts/overview/index.html index ed3c7516..0e4fb450 100644 --- a/concepts/overview/index.html +++ b/concepts/overview/index.html @@ -588,7 +588,7 @@

    Overview - + diff --git a/index.html b/index.html index 70b8b52c..4fbea706 100644 --- a/index.html +++ b/index.html @@ -741,7 +741,7 @@

    Installation - + diff --git a/sitemap.xml b/sitemap.xml index e434d218..d411d5cb 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -2,67 +2,67 @@ https://scaleapi.github.io/launch-python-client/ - 2023-03-08 + 2023-03-14 daily https://scaleapi.github.io/launch-python-client/cli/ - 2023-03-08 + 2023-03-14 daily https://scaleapi.github.io/launch-python-client/api/client/ - 2023-03-08 + 2023-03-14 daily https://scaleapi.github.io/launch-python-client/api/endpoint_predictions/ - 2023-03-08 + 2023-03-14 daily https://scaleapi.github.io/launch-python-client/api/hooks/ - 2023-03-08 + 2023-03-14 daily https://scaleapi.github.io/launch-python-client/api/model_bundles/ - 2023-03-08 + 2023-03-14 daily https://scaleapi.github.io/launch-python-client/api/model_endpoints/ - 2023-03-08 + 2023-03-14 daily https://scaleapi.github.io/launch-python-client/concepts/batch_jobs/ - 2023-03-08 + 2023-03-14 daily https://scaleapi.github.io/launch-python-client/concepts/callbacks/ - 2023-03-08 + 2023-03-14 daily https://scaleapi.github.io/launch-python-client/concepts/endpoint_predictions/ - 2023-03-08 + 2023-03-14 daily https://scaleapi.github.io/launch-python-client/concepts/model_bundles/ - 2023-03-08 + 2023-03-14 daily https://scaleapi.github.io/launch-python-client/concepts/model_endpoints/ - 2023-03-08 + 2023-03-14 daily https://scaleapi.github.io/launch-python-client/concepts/overview/ - 2023-03-08 + 2023-03-14 daily \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index fdbb5e46db3a16850d6701f2426b3096c770c5c2..14dbab9beebf049f434492fd07eeabbda1c9dd64 100644 GIT binary patch delta 303 zcmV+~0nq-x0>J_YABzYGG5QdZ2OWRf?yyZsdfO9h=ZJt8SP5oGO{JXb#<}IqHLBdfzkviEC_Fk-b6ihg+YIA#pI;U z{W)rMxwHmcqk&VM(W>?Rs|aIm>4oKfNi_UDGN!W|8z}4@DiN_PsE*w zQnw%2r3g=Y+X;D0kv;9F=3XC0qQm=(KjjHV`e>aD%>R#mar9$rz5$JF9zWp;006)< Bj5`1T delta 301 zcmV+|0n+}#0>1(WABzYG{uv382OWRbUAifyw>`mjjtF>xm0%V~v%dYDwyUC@w*wZE z!TPa2BaCPcUxO=7Fh+}h&mO9p72p+W>-#->dwnT)>>xJHG`a|>AhC~oW>N~zoX_)I zMVnxdAyzo{JSszr$ZtVjS5HiA3bG}^b#}4Fp%P1$NNJ*y4rH)ZZHp2Fo?&@kck0Y+f80O$P)eM)?@^)&?^W;+{vU& z`+;4K@T7O0RL30I^L}dXWn>-NyubK!?qH;k*2%*B|L7M-KQ{3VjQ`Xl;Ryf${$!8b From 9776f6a100decb5e3fb75712aca054c1adbb3dca Mon Sep 17 00:00:00 2001 From: Phil Chen Date: Mon, 27 Mar 2023 18:14:55 -0700 Subject: [PATCH 08/28] Deployed 21e34f3 with MkDocs version: 1.4.2 --- api/client/index.html | 768 +++++++++++++++++++++++++++++++++++---- objects.inv | Bin 533 -> 557 bytes search/search_index.json | 2 +- sitemap.xml | 26 +- sitemap.xml.gz | Bin 321 -> 320 bytes 5 files changed, 709 insertions(+), 87 deletions(-) diff --git a/api/client/index.html b/api/client/index.html index c566eec2..df1d7dea 100644 --- a/api/client/index.html +++ b/api/client/index.html @@ -478,6 +478,13 @@ create_model_bundle() + + +
  • + + create_model_bundle_from_callable_v2() + +
  • @@ -485,6 +492,20 @@ create_model_bundle_from_dirs() +
  • + +
  • + + create_model_bundle_from_dirs_v2() + + +
  • + +
  • + + create_model_bundle_from_runnable_image_v2() + +
  • @@ -707,6 +728,13 @@ create_model_bundle() +
  • + +
  • + + create_model_bundle_from_callable_v2() + +
  • @@ -714,6 +742,20 @@ create_model_bundle_from_dirs() +
  • + +
  • + + create_model_bundle_from_dirs_v2() + + +
  • + +
  • + + create_model_bundle_from_runnable_image_v2() + +
  • @@ -1242,16 +1284,12 @@

    -

    Uploads and registers a model bundle to Scale Launch.

    -

    A model bundle consists of exactly one of the following:

    -
      -
    • predict_fn_or_cls
    • -
    • load_predict_fn + model
    • -
    • load_predict_fn + load_model_fn
    • -
    -

    Pre/post-processing code can be included inside load_predict_fn/model or in -predict_fn_or_cls call.

    +
    + Warning +

    This method is deprecated. Use +create_model_bundle_from_callable_v2 instead.

    +

    Parameters:

    @@ -1428,6 +1466,217 @@

    +

    + create_model_bundle_from_callable_v2 + + +

    +
    create_model_bundle_from_callable_v2(
    +    *,
    +    model_bundle_name: str,
    +    load_predict_fn: Callable[
    +        [LaunchModel_T], Callable[[Any], Any]
    +    ],
    +    load_model_fn: Callable[[], LaunchModel_T],
    +    request_schema: Type[BaseModel],
    +    response_schema: Type[BaseModel],
    +    requirements: Optional[List[str]] = None,
    +    pytorch_image_tag: Optional[str] = None,
    +    tensorflow_version: Optional[str] = None,
    +    custom_base_image_repository: Optional[str] = None,
    +    custom_base_image_tag: Optional[str] = None,
    +    app_config: Optional[Union[Dict[str, Any], str]] = None
    +) -> Dict[str, Any]
    +
    + +
    + +

    Uploads and registers a model bundle to Scale Launch.

    + +

    Parameters:

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    model_bundle_name + str +

    Name of the model bundle.

    + required +
    load_predict_fn + Callable[[LaunchModel_T], Callable[[Any], Any]] +

    Function that takes in a model and returns a predict function. +When your model bundle is deployed, this predict function will be called as follows: +

    input = {"input": "some input"} # or whatever your request schema is.
    +
    +def load_model_fn():
    +    # load model
    +    return model
    +
    +def load_predict_fn(model, app_config=None):
    +    def predict_fn(input):
    +        # do pre-processing
    +        output = model(input)
    +        # do post-processing
    +        return output
    +    return predict_fn
    +
    +predict_fn = load_predict_fn(load_model_fn(), app_config=optional_app_config)
    +response = predict_fn(input)
    +

    + required +
    load_model_fn + Callable[[], LaunchModel_T] +

    A function that, when run, loads a model.

    + required +
    request_schema + Type[BaseModel] +

    A pydantic model that represents the request schema for the model +bundle. This is used to validate the request body for the model bundle's endpoint.

    + required +
    response_schema + Type[BaseModel] +

    A pydantic model that represents the request schema for the model +bundle. This is used to validate the response for the model bundle's endpoint.

    + required +
    requirements + Optional[List[str]] +

    List of pip requirements.

    + None +
    pytorch_image_tag + Optional[str] +

    The image tag for the PyTorch image that will be used to run the +bundle. Exactly one of pytorch_image_tag, tensorflow_version, or +custom_base_image_repository must be specified.

    + None +
    tensorflow_version + Optional[str] +

    The version of TensorFlow that will be used to run the bundle. +If not specified, the default version will be used. Exactly one of +pytorch_image_tag, tensorflow_version, or custom_base_image_repository +must be specified.

    + None +
    custom_base_image_repository + Optional[str] +

    The repository for a custom base image that will be +used to run the bundle. If not specified, the default base image will be used. +Exactly one of pytorch_image_tag, tensorflow_version, or +custom_base_image_repository must be specified.

    + None +
    custom_base_image_tag + Optional[str] +

    The tag for a custom base image that will be used to run the +bundle. Must be specified if custom_base_image_repository is specified.

    + None +
    app_config + Optional[Union[Dict[str, Any], str]] +

    An optional dictionary of configuration values that will be passed to the +bundle when it is run. These values can be accessed by the bundle via the +app_config global variable.

    + None +
    + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + Dict[str, Any] +

    A dictionary containing the following keys:

    +
      +
    • model_bundle_id: The ID of the created model bundle.
    • +
    + +
    + + + +
    + + +

    create_model_bundle_from_dirs @@ -1449,34 +1698,13 @@

    -

    Packages up code from one or more local filesystem folders and uploads them as a bundle -to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

    -

    For example, if you have a directory structure like so, and your current working -directory is also my_root:

    -

    .. code-block:: text

    -

    my_root/ - my_module1/ - init.py - ...files and directories - my_inference_file.py - my_module2/ - init.py - ...files and directories

    -

    then calling create_model_bundle_from_dirs with base_paths=["my_module1", -"my_module2"] essentially creates a zip file without the root directory, e.g.:

    -

    .. code-block:: text

    -

    my_module1/ - init.py - ...files and directories - my_inference_file.py - my_module2/ - init.py - ...files and directories

    -

    and these contents will be unzipped relative to the server side application root. Bear -these points in mind when referencing Python module paths for this bundle. For instance, -if my_inference_file.py has def f(...) as the desired inference loading function, -then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

    +
    + Warning +

    This method is deprecated. Use +create_model_bundle_from_dirs_v2 +instead.

    +

    Parameters:

    @@ -1529,18 +1757,19 @@

    +
  • framework_type: either tensorflow or pytorch.
  • +
  • PyTorch fields:
      +
    • pytorch_image_tag: An image tag for the pytorch docker base image. The + list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags
    • +
  • - + +

    Example: +

    {
    +    "framework_type": "pytorch",
    +    "pytorch_image_tag": "1.10.0-cuda11.3-cudnn8-runtime",
    +}
    +

    @@ -1613,6 +1842,375 @@

    + create_model_bundle_from_dirs_v2 + + +

    +
    create_model_bundle_from_dirs_v2(
    +    *,
    +    model_bundle_name: str,
    +    base_paths: List[str],
    +    load_predict_fn_module_path: str,
    +    load_model_fn_module_path: str,
    +    request_schema: Type[BaseModel],
    +    response_schema: Type[BaseModel],
    +    requirements_path: str,
    +    pytorch_image_tag: Optional[str] = None,
    +    tensorflow_version: Optional[str] = None,
    +    custom_base_image_repository: Optional[str] = None,
    +    custom_base_image_tag: Optional[str] = None,
    +    app_config: Optional[Dict[str, Any]] = None
    +) -> Dict[str, Any]
    +
    + +
    + +

    Packages up code from one or more local filesystem folders and uploads them as a bundle +to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

    +

    For example, if you have a directory structure like so, and your current working +directory is my_root:

    +
       my_root/
    +       my_module1/
    +           __init__.py
    +           ...files and directories
    +           my_inference_file.py
    +       my_module2/
    +           __init__.py
    +           ...files and directories
    +
    +

    then calling create_model_bundle_from_dirs_v2 with base_paths=["my_module1", +"my_module2"] essentially creates a zip file without the root directory, e.g.:

    +
       my_module1/
    +       __init__.py
    +       ...files and directories
    +       my_inference_file.py
    +   my_module2/
    +       __init__.py
    +       ...files and directories
    +
    +

    and these contents will be unzipped relative to the server side application root. Bear +these points in mind when referencing Python module paths for this bundle. For instance, +if my_inference_file.py has def f(...) as the desired inference loading function, +then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

    + +

    Parameters:

    +
    required
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    model_bundle_name + str +

    The name of the model bundle you want to create.

    + required +
    base_paths + List[str] +

    A list of paths to directories that will be zipped up and uploaded +as a bundle. Each path must be relative to the current working directory.

    + required +
    load_predict_fn_module_path + str +

    The Python module path to the function that will be +used to load the model for inference. This function should take in a path to a +model directory, and return a model object. The model object should be pickleable.

    + required +
    load_model_fn_module_path + str +

    The Python module path to the function that will be +used to load the model for training. This function should take in a path to a +model directory, and return a model object. The model object should be pickleable.

    + required +
    request_schema + Type[BaseModel] +

    A Pydantic model that defines the request schema for the bundle.

    + required +
    response_schema + Type[BaseModel] +

    A Pydantic model that defines the response schema for the bundle.

    + required +
    requirements_path + str +

    Path to a requirements.txt file that will be used to install +dependencies for the bundle. This file must be relative to the current working +directory.

    + required +
    pytorch_image_tag + Optional[str] +

    The image tag for the PyTorch image that will be used to run the +bundle. Exactly one of pytorch_image_tag, tensorflow_version, or +custom_base_image_repository must be specified.

    + None +
    tensorflow_version + Optional[str] +

    The version of TensorFlow that will be used to run the bundle. +If not specified, the default version will be used. Exactly one of +pytorch_image_tag, tensorflow_version, or custom_base_image_repository +must be specified.

    + None +
    custom_base_image_repository + Optional[str] +

    The repository for a custom base image that will be +used to run the bundle. If not specified, the default base image will be used. +Exactly one of pytorch_image_tag, tensorflow_version, or +custom_base_image_repository must be specified.

    + None +
    custom_base_image_tag + Optional[str] +

    The tag for a custom base image that will be used to run the +bundle. Must be specified if custom_base_image_repository is specified.

    + None +
    app_config + Optional[Dict[str, Any]] +

    An optional dictionary of configuration values that will be passed to the +bundle when it is run. These values can be accessed by the bundle via the +app_config global variable.

    + None +
    + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + Dict[str, Any] +

    A dictionary containing the following keys:

    +
      +
    • model_bundle_id: The ID of the created model bundle.
    • +
    + +

    + + + +
    + + + +

    + create_model_bundle_from_runnable_image_v2 + + +

    +
    create_model_bundle_from_runnable_image_v2(
    +    *,
    +    model_bundle_name: str,
    +    request_schema: Type[BaseModel],
    +    response_schema: Type[BaseModel],
    +    repository: str,
    +    tag: str,
    +    command: List[str],
    +    env: Dict[str, str]
    +) -> Dict[str, Any]
    +
    + +
    + +

    Create a model bundle from a runnable image. The specified command must start a process +that will listen for requests on port 5005 using HTTP.

    + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    model_bundle_name + str +

    The name of the model bundle you want to create.

    + required +
    request_schema + Type[BaseModel] +

    A Pydantic model that defines the request schema for the bundle.

    + required +
    response_schema + Type[BaseModel] +

    A Pydantic model that defines the response schema for the bundle.

    + required +
    repository + str +

    The name of the Docker repository for the runnable image.

    + required +
    tag + str +

    The tag for the runnable image.

    + required +
    command + List[str] +

    The command that will be used to start the process that listens for requests.

    + required +
    env + Dict[str, str] +

    A dictionary of environment variables that will be passed to the bundle when it +is run.

    + required +
    + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + Dict[str, Any] +

    A dictionary containing the following keys:

    +
      +
    • model_bundle_id: The ID of the created model bundle.
    • +
    + +
    + +
    + +
    + + +

    create_model_endpoint @@ -1631,20 +2229,21 @@

    per_worker: int = 10, gpu_type: Optional[str] = None, endpoint_type: str = "sync", - post_inference_hooks: Optional[ - List[PostInferenceHooks] - ] = None, - default_callback_url: Optional[str] = None, - default_callback_auth_kind: Optional[ - Literal[basic, mtls] - ] = None, - default_callback_auth_username: Optional[str] = None, - default_callback_auth_password: Optional[str] = None, - default_callback_auth_cert: Optional[str] = None, - default_callback_auth_key: Optional[str] = None, - update_if_exists: bool = False, - labels: Optional[Dict[str, str]] = None -) -> Optional[Endpoint] + high_priority: Optional[bool] = False, + post_inference_hooks: Optional[ + List[PostInferenceHooks] + ] = None, + default_callback_url: Optional[str] = None, + default_callback_auth_kind: Optional[ + Literal[basic, mtls] + ] = None, + default_callback_auth_username: Optional[str] = None, + default_callback_auth_password: Optional[str] = None, + default_callback_auth_cert: Optional[str] = None, + default_callback_auth_key: Optional[str] = None, + update_if_exists: bool = False, + labels: Optional[Dict[str, str]] = None +) -> Optional[Endpoint]

    @@ -1806,6 +2405,17 @@

    Optional[bool] + +

    Either True or False. Enabling this will allow the created +endpoint to leverage the shared pool of prewarmed nodes for faster spinup time.

    + + False + + post_inference_hooks @@ -2003,18 +2613,19 @@

    max_workers: Optional[int] = None, per_worker: Optional[int] = None, gpu_type: Optional[str] = None, - post_inference_hooks: Optional[ - List[PostInferenceHooks] - ] = None, - default_callback_url: Optional[str] = None, - default_callback_auth_kind: Optional[ - Literal[basic, mtls] - ] = None, - default_callback_auth_username: Optional[str] = None, - default_callback_auth_password: Optional[str] = None, - default_callback_auth_cert: Optional[str] = None, - default_callback_auth_key: Optional[str] = None -) -> None + high_priority: Optional[bool] = None, + post_inference_hooks: Optional[ + List[PostInferenceHooks] + ] = None, + default_callback_url: Optional[str] = None, + default_callback_auth_kind: Optional[ + Literal[basic, mtls] + ] = None, + default_callback_auth_username: Optional[str] = None, + default_callback_auth_password: Optional[str] = None, + default_callback_auth_cert: Optional[str] = None, + default_callback_auth_key: Optional[str] = None +) -> None

    @@ -2156,6 +2767,17 @@

    None + + high_priority + + Optional[bool] + +

    Either True or False. Enabling this will allow the created +endpoint to leverage the shared pool of prewarmed nodes for faster spinup time.

    + + None + + post_inference_hooks diff --git a/objects.inv b/objects.inv index e43ed22faff7f5befaa9ffd329ff598edc3168bd..e23a45dc4d4323f94d81beaf2a874e662ba434b2 100644 GIT binary patch delta 444 zcmV;t0Ym1*41Y#WK*-Ej%lCN~LavFN%iF0Yd73;FA)bPbM| z4D60LGx%AfZKd3IaYE7GFfJ7#t5k-Pt!v68vM=FE#!H|AZGQl45ZqLbim}|NigAz< z*1om9J%gSJW6#8%Cty<(waXzYC?YNjQl^!lfOF;*jL2aoTr{je$EHbTwIYjQVw{sd zO5yXA!cN1oQLKGn0h&K++2FAD=y`)lRRp1h4-!qkx7=<$$U8Zw7;cw&anV{!u%uxaa28@$W&~??i0frlxOA<6$T_ha)FBKTAkKYv!kri=x56IrD!D zY0ESisBE|;vT$Rcu;EgL4l-~ME)i51u4v#JCvGyWCp< delta 420 zcmV;V0bBm91eFAkdw*X~!ypg<@OM8&6MdD%SKrjkXrhU6AAsEGwI!nm0-f2nm;PC| z&Y4ufx3R!)2ge;#(2%H@P!h?rmu~dX4KlO46$+foZZa@((N9@iUS-!8>c>@V4PI0n z+>Qjd_|c&2q#{i5Qq%7+p)?_{b&iU!8_E^(Pw6WzDxeZw1b=K1{8Ubg@xtnw=hCK% z5h*uXQp8yX1ru_ZOP>rY(evrWaYmEFI5ACj4^sR-m2}gvToP*^ScDetT0T0wyL!Rk zN|#Y+8G=MRE_eCV|Gg z#h656LydO6n}25>YA!kY*!af&C*79m$&t?gg-Yv=jaULvS5 zUNImxP)aJf-ztF~txoh9l<y3j~ OX|}wI*zp(6BO?;jR@IsS diff --git a/search/search_index.json b/search/search_index.json index 3de1619b..58c75d30 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Scale Launch","text":"

    Simple, scalable, and high performance ML service deployment in python.

    "},{"location":"#example","title":"Example","text":"Launch Usage
    import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"MY_TEAM\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

    What's going on here:

    • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
    • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
    • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
    • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
    • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

    Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

    "},{"location":"#installation","title":"Installation","text":"

    To use Scale Launch, first install it using pip:

    Installation
    pip install -U scale-launch\n
    "},{"location":"cli/","title":"CLI","text":"

    Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

    The CLI can be used as scale-launch ....

    "},{"location":"cli/#help","title":"Help","text":"

    Run scale-launch --help for more options.

    scale-launch --help
        This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your API key and other configuration options\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
    "},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
    LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

    Scale Launch Python Client.

    Initializes a Scale Launch Client.

    Parameters:

    Name Type Description Default api_key str

    Your Scale API key

    required endpoint Optional[str]

    The Scale Launch Endpoint (this should not need to be changed)

    None self_hosted bool

    True iff you are connecting to a self-hosted Scale Launch

    False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
    batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

    Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

    Must have exactly one of urls or inputs passed in.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or the name of a the bundle to use for inference.

    required urls List[str]

    A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

    None inputs Optional[List[Dict[str, Any]]]

    A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

    None batch_url_file_location Optional[str]

    In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

    None serialization_format str

    Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

    'JSON' labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None cpus Optional[int]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
    • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains job_id as a key, and the ID as the value.

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
    clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n

    Clones an existing model bundle with changes to its app config. (More fields coming soon)

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The existing bundle or its ID.

    required app_config Optional[Dict]

    The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

    None

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
    create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Uploads and registers a model bundle to Scale Launch.

    A model bundle consists of exactly one of the following:

    • predict_fn_or_cls
    • load_predict_fn + model
    • load_predict_fn + load_model_fn

    Pre/post-processing code can be included inside load_predict_fn/model or in predict_fn_or_cls call.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required predict_fn_or_cls Optional[Callable[[Any], Any]]

    Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

    None model Optional[LaunchModel_T]

    Typically a trained Neural Network, e.g. a Pytorch module.

    Exactly one of model and load_model_fn must be provided.

    None load_model_fn Optional[Callable[[], LaunchModel_T]]

    A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

    Exactly one of model and load_model_fn must be provided.

    None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

    Function that, when called with a model, returns a function that carries out inference.

    If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

    Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

    In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

    None requirements Optional[List[str]]

    A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

    [\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

    If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

    None app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    • Tensorflow fields:

      • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
    required globals_copy Optional[Dict[str, Any]]

    Dictionary of the global symbol table. Normally provided by globals() built-in function.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
    create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n

    Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

    For example, if you have a directory structure like so, and your current working directory is also my_root:

    .. code-block:: text

    my_root/ my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    then calling create_model_bundle_from_dirs with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

    .. code-block:: text

    my_module1/ init.py ...files and directories my_inference_file.py my_module2/ init.py ...files and directories

    and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required base_paths List[str]

    The paths on the local filesystem where the bundle code lives.

    required requirements_path str

    A path on the local filesystem where a requirements.txt file lives.

    required env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    required load_predict_fn_module_path str

    A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

    required load_model_fn_module_path str

    A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

    required app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
    create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

    Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

    required model_bundle Union[ModelBundle, str]

    The ModelBundle that the endpoint should serve.

    required cpus int

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    3 memory str

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    '8Gi' storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus int

    Number of gpus each worker should get, e.g. 0, 1, etc.

    0 min_workers int

    The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

    1 max_workers int

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

    1 per_worker int

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

    Here is our recommendation for computing per_worker:

    1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
    10 gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None endpoint_type str

    Either \"sync\" or \"async\".

    'sync' post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None update_if_exists bool

    If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

    False labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None

    Returns:

    Type Description Optional[Endpoint]

    A Endpoint object that can be used to make requests to the endpoint.

    "},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
    delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Deletes a model endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    A ModelEndpoint object.

    required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
    edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None\n) -> None\n

    Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

    • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

    required model_bundle Optional[Union[ModelBundle, str]]

    The ModelBundle that the endpoint should serve.

    None cpus Optional[float]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None min_workers Optional[int]

    The minimum number of workers. Must be greater than or equal to 0.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
    get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

    Gets inference results from a previously created batch job.

    Parameters:

    Name Type Description Default batch_job_id str

    An id representing the batch task job. This id is the in the response from calling batch_async_request.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains the following fields:

    Dict[str, Any]
    • status: The status of the job.
    Dict[str, Any]
    • result: The url where the result is stored.
    Dict[str, Any]
    • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
    Dict[str, Any]
    • num_tasks_pending: The number of tasks that are still pending.
    Dict[str, Any]
    • num_tasks_completed: The number of tasks that have completed.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
    get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

    Returns a model bundle specified by bundle_name that the user owns.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or its name.

    required

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
    get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

    Gets a model endpoint associated with a name.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the endpoint to retrieve.

    required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
    list_model_bundles() -> List[ModelBundle]\n

    Returns a list of model bundles that the user owns.

    Returns:

    Type Description List[ModelBundle]

    A list of ModelBundle objects

    "},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
    list_model_endpoints() -> List[Endpoint]\n

    Lists all model endpoints that the user owns.

    Returns:

    Type Description List[Endpoint]

    A list of ModelEndpoint objects.

    "},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
    read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Retrieves the logs for the creation of the endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The endpoint or its name.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
    register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

    Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

    Parameters:

    Name Type Description Default batch_csv_location_fn Callable[[], str]

    Function that generates batch_csv_urls for upload_batch_csv_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
    register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

    Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

    Parameters:

    Name Type Description Default bundle_location_fn Callable[[], str]

    Function that generates bundle_urls for upload_bundle_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
    register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

    upload_batch_csv_fn(csv_text, csv_url)\n

    This function should directly write the contents of csv_text as a text string into csv_url.

    Parameters:

    Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

    Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
    register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

    upload_bundle_fn(serialized_bundle, bundle_url)\n

    This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

    See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

    Parameters:

    Name Type Description Default upload_bundle_fn Callable[[str, str], None]

    Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/endpoint_predictions/","title":"Endpoint Predictions","text":""},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"api/hooks/","title":"Hooks","text":""},{"location":"api/hooks/#launch.hooks.PostInferenceHooks","title":"PostInferenceHooks","text":"

    Bases: str, Enum

    Post-inference hooks are functions that are called after inference is complete.

    Attributes:

    Name Type Description CALLBACK str

    The callback hook is called with the inference response and the task ID.

    "},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

    Represents a ModelBundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[Any, Any]] = None\n

    An optional user-specified configuration mapping for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
    env_params: Optional[Dict[str, str]] = None\n

    A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
    id: Optional[str] = None\n

    A globally unique identifier for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
    location: Optional[str] = None\n

    An opaque location for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
    metadata: Optional[Dict[Any, Any]] = None\n

    Arbitrary metadata for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
    name: str\n

    The name of the bundle. Must be unique across all bundles that the user owns.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
    packaging_type: Optional[str] = None\n

    The packaging type for the bundle. Can be cloudpickle or zip.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
    requirements: Optional[List[str]] = None\n

    A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

    All classes here are returned by the get_model_endpoint method and provide a predict function.

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
    AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    An asynchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponseFuture\n

    Runs an asynchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required

    Returns:

    Name Type Description EndpointResponseFuture

    An EndpointResponseFuture such the user can use to query the status of the request.

    Example EndpointResponseFuture EndpointResponseFuture

    .. code-block:: python

    my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
    predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

    (deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

    Parameters:

    Name Type Description Default requests Sequence[EndpointRequest]

    List of EndpointRequests. Request_ids must all be distinct.

    required

    Returns:

    Type Description AsyncEndpointBatchResponse

    an AsyncEndpointResponse keeping track of the inference requests made

    "},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint","title":"SyncEndpoint","text":"
    SyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    A synchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponse\n

    Runs a synchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required"},{"location":"concepts/batch_jobs/","title":"Batch Jobs","text":"

    For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

    Batch jobs are created using the batch_async_request method of the LaunchClient.

    Creating and Following a Batch Job
    import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n}\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
    "},{"location":"concepts/callbacks/","title":"Callbacks","text":"

    Async model endpoints can be configured to send callbacks to a user-defined callback URL. Callbacks are sent as HTTP POST requests with a JSON body. The following code snippet shows how to create an async model endpoint with a callback URL.

    To configure an async endpoint to send callbacks, set the post_inference_hooks field to include launch.PostInferenceHooks.CALLBACK. A callback URL also needs to be specified, and it can be configured as a default using the default_callback_url argument to launch.LaunchClient.create_model_endpoint or as a per-task override using the callback_url field of launch.EndpointRequest.

    Note

    Callbacks will not be sent if the endpoint does not have any post-inference hooks specified, even if a default_callback_url is provided to the endpoint creation method or if the prediction request has a callback_url override.

    Creating an Async Model Endpoint with a Callback URL
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 7\n}\n\"\"\"\nfuture_custom_callback_url = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"}, callback_url=\"https://example.com/custom\"\n),\n)\n\"\"\"\nA callback is sent to https://example.com/custom with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 8\n}\n\"\"\"\n
    "},{"location":"concepts/callbacks/#authentication-for-callbacks","title":"Authentication for callbacks","text":"

    Warning

    This feature is currently in beta, and the API is likely to change.

    Callbacks can be authenticated using shared authentication headers. To enable authentication, set either default_callback_auth_kind when creating the endpoint or callback_auth_kind when making a prediction request.

    Currently, the supported authentication methods are basic and mtls. If basic is used, then the default_callback_auth_username and default_callback_auth_password fields must be specified when creating the endpoint, or the callback_auth_username and callback_auth_password fields must be specified when making a prediction request. If mtls is used, then the same is true for the default_callback_auth_cert and default_callback_auth_key fields, or the callback_auth_cert and callback_auth_key fields.

    Creating an Async Model Endpoint with custom Callback auth
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\ndefault_callback_auth_kind=\"basic\",\ndefault_callback_auth_username=\"user\",\ndefault_callback_auth_password=\"password\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with (\"user\", \"password\") as the basic auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"mtls\", \ncallback_auth_cert=\"cert\", \ncallback_auth_key=\"key\",\n),\n)\n\"\"\"\nA callback is sent with mTLS authentication.\n\"\"\"\nclient.edit_model_endpoint(\nmodel_endpoint=endpoint.model_endpoint,\ndefault_callback_auth_kind=\"mtls\",\ndefault_callback_auth_cert=\"cert\",\ndefault_callback_auth_key=\"key\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent with mTLS auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"basic\",\ncallback_auth_username=\"user\",\ncallback_auth_password=\"pass\",\n),\n)\n\"\"\"\nA callback is sent with (\"user\", \"pass\") as the basic auth.\n\"\"\"\n
    "},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

    Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

    Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
    "},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

    Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

    "},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

    There are two methods for creating model bundles: create_model_bundle and create_model_bundle_from_dirs. The former directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The latter takes in directories containing a load_predict_fn and the module path to the load_predict_fn.

    Creating a Model Bundle DirectlyCreating a Model Bundle from Directories
    import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n
    import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\npytest==7.2.1\nnumpy\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"requirements_path\": \"requirements.txt\",\n\"env_params\": ENV_PARAMS,\n\"load_predict_fn\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle_from_dirs(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
    "},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

    The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

    Creating Model Bundles with app_config
    import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Union\nfrom typing_extensions import Literal\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"batched\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)\n
    "},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

    Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes.

    "},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

    To list all the model bundles you own, use list_model_bundles.

    "},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

    Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

    Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

    Info

    "},{"location":"concepts/model_endpoints/#choosing-the-right-inference-mode","title":"Choosing the right inference mode","text":"

    Here are some tips for how to choose between SyncEndpoint, AsyncEndpoint, and BatchJob for deploying your ModelBundle:

    A SyncEndpoint is good if:

    • You have strict latency requirements (e.g. on the order of seconds or less).
    • You are willing to have resources continually allocated.

    An AsyncEndpoint is good if:

    • You want to save on compute costs.
    • Your inference code takes a long time to run.
    • Your latency requirements are on the order of minutes.

    A BatchJob is good if:

    • You know there is a large batch of inputs ahead of time.
    • You want to optimize for throughput instead of latency.
    "},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

    Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

    Creating an Async Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

    Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints.

    Note

    Sync model endpoints require at least 1 min_worker.

    Creating a Sync Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

    Model endpoints can be listed, updated, and deleted using the Launch API.

    Listing Model Endpoints
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
    Updating a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
    Deleting a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
    "},{"location":"concepts/overview/","title":"Overview","text":"

    Creating deployments on Launch generally involves three steps:

    1. Create and upload a ModelBundle. Pass your trained model as well as pre-/post-processing code to the Scale Launch Python client, and we\u2019ll create a model bundle based on the code and store it in our Bundle Store.

    2. Create a ModelEndpoint. Pass a ModelBundle as well as infrastructure settings such as the desired number of GPUs to our client. This provisions resources on Scale\u2019s cluster dedicated to your ModelEndpoint.

    3. Make requests to the ModelEndpoint. You can make requests through the Python client, or make HTTP requests directly to Scale.

    "}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Scale Launch","text":"

    Simple, scalable, and high performance ML service deployment in python.

    "},{"location":"#example","title":"Example","text":"Launch Usage
    import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"MY_TEAM\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

    What's going on here:

    • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
    • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
    • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
    • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
    • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

    Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

    "},{"location":"#installation","title":"Installation","text":"

    To use Scale Launch, first install it using pip:

    Installation
    pip install -U scale-launch\n
    "},{"location":"cli/","title":"CLI","text":"

    Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

    The CLI can be used as scale-launch ....

    "},{"location":"cli/#help","title":"Help","text":"

    Run scale-launch --help for more options.

    scale-launch --help
        This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your API key and other configuration options\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
    "},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
    LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

    Scale Launch Python Client.

    Initializes a Scale Launch Client.

    Parameters:

    Name Type Description Default api_key str

    Your Scale API key

    required endpoint Optional[str]

    The Scale Launch Endpoint (this should not need to be changed)

    None self_hosted bool

    True iff you are connecting to a self-hosted Scale Launch

    False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
    batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

    Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

    Must have exactly one of urls or inputs passed in.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or the name of a the bundle to use for inference.

    required urls List[str]

    A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

    None inputs Optional[List[Dict[str, Any]]]

    A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

    None batch_url_file_location Optional[str]

    In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

    None serialization_format str

    Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

    'JSON' labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None cpus Optional[int]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
    • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains job_id as a key, and the ID as the value.

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
    clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n

    Clones an existing model bundle with changes to its app config. (More fields coming soon)

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The existing bundle or its ID.

    required app_config Optional[Dict]

    The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

    None

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
    create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n
    Warning

    This method is deprecated. Use create_model_bundle_from_callable_v2 instead.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required predict_fn_or_cls Optional[Callable[[Any], Any]]

    Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

    None model Optional[LaunchModel_T]

    Typically a trained Neural Network, e.g. a Pytorch module.

    Exactly one of model and load_model_fn must be provided.

    None load_model_fn Optional[Callable[[], LaunchModel_T]]

    A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

    Exactly one of model and load_model_fn must be provided.

    None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

    Function that, when called with a model, returns a function that carries out inference.

    If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

    Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

    In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

    None requirements Optional[List[str]]

    A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

    [\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

    If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

    None app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    • Tensorflow fields:

      • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
    required globals_copy Optional[Dict[str, Any]]

    Dictionary of the global symbol table. Normally provided by globals() built-in function.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_callable_v2","title":"create_model_bundle_from_callable_v2","text":"
    create_model_bundle_from_callable_v2(\n*,\nmodel_bundle_name: str,\nload_predict_fn: Callable[\n[LaunchModel_T], Callable[[Any], Any]\n],\nload_model_fn: Callable[[], LaunchModel_T],\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrequirements: Optional[List[str]] = None,\npytorch_image_tag: Optional[str] = None,\ntensorflow_version: Optional[str] = None,\ncustom_base_image_repository: Optional[str] = None,\ncustom_base_image_tag: Optional[str] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None\n) -> Dict[str, Any]\n

    Uploads and registers a model bundle to Scale Launch.

    Parameters:

    Name Type Description Default model_bundle_name str

    Name of the model bundle.

    required load_predict_fn Callable[[LaunchModel_T], Callable[[Any], Any]]

    Function that takes in a model and returns a predict function. When your model bundle is deployed, this predict function will be called as follows:

    input = {\"input\": \"some input\"} # or whatever your request schema is.\n\ndef load_model_fn():\n    # load model\n    return model\n\ndef load_predict_fn(model, app_config=None):\n    def predict_fn(input):\n        # do pre-processing\n        output = model(input)\n        # do post-processing\n        return output\n    return predict_fn\n\npredict_fn = load_predict_fn(load_model_fn(), app_config=optional_app_config)\nresponse = predict_fn(input)\n

    required load_model_fn Callable[[], LaunchModel_T]

    A function that, when run, loads a model.

    required request_schema Type[BaseModel]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    required response_schema Type[BaseModel]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint.

    required requirements Optional[List[str]]

    List of pip requirements.

    None pytorch_image_tag Optional[str]

    The image tag for the PyTorch image that will be used to run the bundle. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None tensorflow_version Optional[str]

    The version of TensorFlow that will be used to run the bundle. If not specified, the default version will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_repository Optional[str]

    The repository for a custom base image that will be used to run the bundle. If not specified, the default base image will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_tag Optional[str]

    The tag for a custom base image that will be used to run the bundle. Must be specified if custom_base_image_repository is specified.

    None app_config Optional[Union[Dict[str, Any], str]]

    An optional dictionary of configuration values that will be passed to the bundle when it is run. These values can be accessed by the bundle via the app_config global variable.

    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
    create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n
    Warning

    This method is deprecated. Use create_model_bundle_from_dirs_v2 instead.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required base_paths List[str]

    The paths on the local filesystem where the bundle code lives.

    required requirements_path str

    A path on the local filesystem where a requirements.txt file lives.

    required env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch.
    • PyTorch fields:
      • pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags

    Example:

    {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\",\n}\n

    required load_predict_fn_module_path str

    A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

    required load_model_fn_module_path str

    A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

    required app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs_v2","title":"create_model_bundle_from_dirs_v2","text":"
    create_model_bundle_from_dirs_v2(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrequirements_path: str,\npytorch_image_tag: Optional[str] = None,\ntensorflow_version: Optional[str] = None,\ncustom_base_image_repository: Optional[str] = None,\ncustom_base_image_tag: Optional[str] = None,\napp_config: Optional[Dict[str, Any]] = None\n) -> Dict[str, Any]\n

    Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

    For example, if you have a directory structure like so, and your current working directory is my_root:

       my_root/\n       my_module1/\n           __init__.py\n           ...files and directories\n           my_inference_file.py\n       my_module2/\n           __init__.py\n           ...files and directories\n

    then calling create_model_bundle_from_dirs_v2 with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

       my_module1/\n       __init__.py\n       ...files and directories\n       my_inference_file.py\n   my_module2/\n       __init__.py\n       ...files and directories\n

    and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create.

    required base_paths List[str]

    A list of paths to directories that will be zipped up and uploaded as a bundle. Each path must be relative to the current working directory.

    required load_predict_fn_module_path str

    The Python module path to the function that will be used to load the model for inference. This function should take in a path to a model directory, and return a model object. The model object should be pickleable.

    required load_model_fn_module_path str

    The Python module path to the function that will be used to load the model for training. This function should take in a path to a model directory, and return a model object. The model object should be pickleable.

    required request_schema Type[BaseModel]

    A Pydantic model that defines the request schema for the bundle.

    required response_schema Type[BaseModel]

    A Pydantic model that defines the response schema for the bundle.

    required requirements_path str

    Path to a requirements.txt file that will be used to install dependencies for the bundle. This file must be relative to the current working directory.

    required pytorch_image_tag Optional[str]

    The image tag for the PyTorch image that will be used to run the bundle. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None tensorflow_version Optional[str]

    The version of TensorFlow that will be used to run the bundle. If not specified, the default version will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_repository Optional[str]

    The repository for a custom base image that will be used to run the bundle. If not specified, the default base image will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_tag Optional[str]

    The tag for a custom base image that will be used to run the bundle. Must be specified if custom_base_image_repository is specified.

    None app_config Optional[Dict[str, Any]]

    An optional dictionary of configuration values that will be passed to the bundle when it is run. These values can be accessed by the bundle via the app_config global variable.

    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_runnable_image_v2","title":"create_model_bundle_from_runnable_image_v2","text":"
    create_model_bundle_from_runnable_image_v2(\n*,\nmodel_bundle_name: str,\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrepository: str,\ntag: str,\ncommand: List[str],\nenv: Dict[str, str]\n) -> Dict[str, Any]\n

    Create a model bundle from a runnable image. The specified command must start a process that will listen for requests on port 5005 using HTTP.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create.

    required request_schema Type[BaseModel]

    A Pydantic model that defines the request schema for the bundle.

    required response_schema Type[BaseModel]

    A Pydantic model that defines the response schema for the bundle.

    required repository str

    The name of the Docker repository for the runnable image.

    required tag str

    The tag for the runnable image.

    required command List[str]

    The command that will be used to start the process that listens for requests.

    required env Dict[str, str]

    A dictionary of environment variables that will be passed to the bundle when it is run.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
    create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\nhigh_priority: Optional[bool] = False,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

    Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

    required model_bundle Union[ModelBundle, str]

    The ModelBundle that the endpoint should serve.

    required cpus int

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    3 memory str

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    '8Gi' storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus int

    Number of gpus each worker should get, e.g. 0, 1, etc.

    0 min_workers int

    The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

    1 max_workers int

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

    1 per_worker int

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

    Here is our recommendation for computing per_worker:

    1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
    10 gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None endpoint_type str

    Either \"sync\" or \"async\".

    'sync' high_priority Optional[bool]

    Either True or False. Enabling this will allow the created endpoint to leverage the shared pool of prewarmed nodes for faster spinup time.

    False post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None update_if_exists bool

    If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

    False labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None

    Returns:

    Type Description Optional[Endpoint]

    A Endpoint object that can be used to make requests to the endpoint.

    "},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
    delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Deletes a model endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    A ModelEndpoint object.

    required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
    edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\nhigh_priority: Optional[bool] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None\n) -> None\n

    Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

    • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

    required model_bundle Optional[Union[ModelBundle, str]]

    The ModelBundle that the endpoint should serve.

    None cpus Optional[float]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None min_workers Optional[int]

    The minimum number of workers. Must be greater than or equal to 0.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None high_priority Optional[bool]

    Either True or False. Enabling this will allow the created endpoint to leverage the shared pool of prewarmed nodes for faster spinup time.

    None post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
    get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

    Gets inference results from a previously created batch job.

    Parameters:

    Name Type Description Default batch_job_id str

    An id representing the batch task job. This id is the in the response from calling batch_async_request.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains the following fields:

    Dict[str, Any]
    • status: The status of the job.
    Dict[str, Any]
    • result: The url where the result is stored.
    Dict[str, Any]
    • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
    Dict[str, Any]
    • num_tasks_pending: The number of tasks that are still pending.
    Dict[str, Any]
    • num_tasks_completed: The number of tasks that have completed.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
    get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

    Returns a model bundle specified by bundle_name that the user owns.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or its name.

    required

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
    get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

    Gets a model endpoint associated with a name.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the endpoint to retrieve.

    required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
    list_model_bundles() -> List[ModelBundle]\n

    Returns a list of model bundles that the user owns.

    Returns:

    Type Description List[ModelBundle]

    A list of ModelBundle objects

    "},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
    list_model_endpoints() -> List[Endpoint]\n

    Lists all model endpoints that the user owns.

    Returns:

    Type Description List[Endpoint]

    A list of ModelEndpoint objects.

    "},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
    read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Retrieves the logs for the creation of the endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The endpoint or its name.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
    register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

    Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

    Parameters:

    Name Type Description Default batch_csv_location_fn Callable[[], str]

    Function that generates batch_csv_urls for upload_batch_csv_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
    register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

    Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

    Parameters:

    Name Type Description Default bundle_location_fn Callable[[], str]

    Function that generates bundle_urls for upload_bundle_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
    register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

    upload_batch_csv_fn(csv_text, csv_url)\n

    This function should directly write the contents of csv_text as a text string into csv_url.

    Parameters:

    Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

    Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
    register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

    upload_bundle_fn(serialized_bundle, bundle_url)\n

    This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

    See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

    Parameters:

    Name Type Description Default upload_bundle_fn Callable[[str, str], None]

    Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/endpoint_predictions/","title":"Endpoint Predictions","text":""},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"api/hooks/","title":"Hooks","text":""},{"location":"api/hooks/#launch.hooks.PostInferenceHooks","title":"PostInferenceHooks","text":"

    Bases: str, Enum

    Post-inference hooks are functions that are called after inference is complete.

    Attributes:

    Name Type Description CALLBACK str

    The callback hook is called with the inference response and the task ID.

    "},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

    Represents a ModelBundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[Any, Any]] = None\n

    An optional user-specified configuration mapping for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
    env_params: Optional[Dict[str, str]] = None\n

    A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
    id: Optional[str] = None\n

    A globally unique identifier for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
    location: Optional[str] = None\n

    An opaque location for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
    metadata: Optional[Dict[Any, Any]] = None\n

    Arbitrary metadata for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
    name: str\n

    The name of the bundle. Must be unique across all bundles that the user owns.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
    packaging_type: Optional[str] = None\n

    The packaging type for the bundle. Can be cloudpickle or zip.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
    requirements: Optional[List[str]] = None\n

    A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

    All classes here are returned by the get_model_endpoint method and provide a predict function.

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
    AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    An asynchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponseFuture\n

    Runs an asynchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required

    Returns:

    Name Type Description EndpointResponseFuture

    An EndpointResponseFuture such the user can use to query the status of the request.

    Example EndpointResponseFuture EndpointResponseFuture

    .. code-block:: python

    my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
    predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

    (deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

    Parameters:

    Name Type Description Default requests Sequence[EndpointRequest]

    List of EndpointRequests. Request_ids must all be distinct.

    required

    Returns:

    Type Description AsyncEndpointBatchResponse

    an AsyncEndpointResponse keeping track of the inference requests made

    "},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint","title":"SyncEndpoint","text":"
    SyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    A synchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponse\n

    Runs a synchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required"},{"location":"concepts/batch_jobs/","title":"Batch Jobs","text":"

    For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

    Batch jobs are created using the batch_async_request method of the LaunchClient.

    Creating and Following a Batch Job
    import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n}\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
    "},{"location":"concepts/callbacks/","title":"Callbacks","text":"

    Async model endpoints can be configured to send callbacks to a user-defined callback URL. Callbacks are sent as HTTP POST requests with a JSON body. The following code snippet shows how to create an async model endpoint with a callback URL.

    To configure an async endpoint to send callbacks, set the post_inference_hooks field to include launch.PostInferenceHooks.CALLBACK. A callback URL also needs to be specified, and it can be configured as a default using the default_callback_url argument to launch.LaunchClient.create_model_endpoint or as a per-task override using the callback_url field of launch.EndpointRequest.

    Note

    Callbacks will not be sent if the endpoint does not have any post-inference hooks specified, even if a default_callback_url is provided to the endpoint creation method or if the prediction request has a callback_url override.

    Creating an Async Model Endpoint with a Callback URL
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 7\n}\n\"\"\"\nfuture_custom_callback_url = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"}, callback_url=\"https://example.com/custom\"\n),\n)\n\"\"\"\nA callback is sent to https://example.com/custom with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 8\n}\n\"\"\"\n
    "},{"location":"concepts/callbacks/#authentication-for-callbacks","title":"Authentication for callbacks","text":"

    Warning

    This feature is currently in beta, and the API is likely to change.

    Callbacks can be authenticated using shared authentication headers. To enable authentication, set either default_callback_auth_kind when creating the endpoint or callback_auth_kind when making a prediction request.

    Currently, the supported authentication methods are basic and mtls. If basic is used, then the default_callback_auth_username and default_callback_auth_password fields must be specified when creating the endpoint, or the callback_auth_username and callback_auth_password fields must be specified when making a prediction request. If mtls is used, then the same is true for the default_callback_auth_cert and default_callback_auth_key fields, or the callback_auth_cert and callback_auth_key fields.

    Creating an Async Model Endpoint with custom Callback auth
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\ndefault_callback_auth_kind=\"basic\",\ndefault_callback_auth_username=\"user\",\ndefault_callback_auth_password=\"password\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with (\"user\", \"password\") as the basic auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"mtls\", \ncallback_auth_cert=\"cert\", \ncallback_auth_key=\"key\",\n),\n)\n\"\"\"\nA callback is sent with mTLS authentication.\n\"\"\"\nclient.edit_model_endpoint(\nmodel_endpoint=endpoint.model_endpoint,\ndefault_callback_auth_kind=\"mtls\",\ndefault_callback_auth_cert=\"cert\",\ndefault_callback_auth_key=\"key\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent with mTLS auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"basic\",\ncallback_auth_username=\"user\",\ncallback_auth_password=\"pass\",\n),\n)\n\"\"\"\nA callback is sent with (\"user\", \"pass\") as the basic auth.\n\"\"\"\n
    "},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

    Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

    Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
    "},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

    Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

    "},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

    There are two methods for creating model bundles: create_model_bundle and create_model_bundle_from_dirs. The former directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The latter takes in directories containing a load_predict_fn and the module path to the load_predict_fn.

    Creating a Model Bundle DirectlyCreating a Model Bundle from Directories
    import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n
    import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\npytest==7.2.1\nnumpy\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"requirements_path\": \"requirements.txt\",\n\"env_params\": ENV_PARAMS,\n\"load_predict_fn\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle_from_dirs(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
    "},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

    The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

    Creating Model Bundles with app_config
    import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Union\nfrom typing_extensions import Literal\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"batched\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)\n
    "},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

    Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes.

    "},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

    To list all the model bundles you own, use list_model_bundles.

    "},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

    Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

    Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

    Info

    "},{"location":"concepts/model_endpoints/#choosing-the-right-inference-mode","title":"Choosing the right inference mode","text":"

    Here are some tips for how to choose between SyncEndpoint, AsyncEndpoint, and BatchJob for deploying your ModelBundle:

    A SyncEndpoint is good if:

    • You have strict latency requirements (e.g. on the order of seconds or less).
    • You are willing to have resources continually allocated.

    An AsyncEndpoint is good if:

    • You want to save on compute costs.
    • Your inference code takes a long time to run.
    • Your latency requirements are on the order of minutes.

    A BatchJob is good if:

    • You know there is a large batch of inputs ahead of time.
    • You want to optimize for throughput instead of latency.
    "},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

    Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

    Creating an Async Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

    Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints.

    Note

    Sync model endpoints require at least 1 min_worker.

    Creating a Sync Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

    Model endpoints can be listed, updated, and deleted using the Launch API.

    Listing Model Endpoints
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
    Updating a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
    Deleting a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
    "},{"location":"concepts/overview/","title":"Overview","text":"

    Creating deployments on Launch generally involves three steps:

    1. Create and upload a ModelBundle. Pass your trained model as well as pre-/post-processing code to the Scale Launch Python client, and we\u2019ll create a model bundle based on the code and store it in our Bundle Store.

    2. Create a ModelEndpoint. Pass a ModelBundle as well as infrastructure settings such as the desired number of GPUs to our client. This provisions resources on Scale\u2019s cluster dedicated to your ModelEndpoint.

    3. Make requests to the ModelEndpoint. You can make requests through the Python client, or make HTTP requests directly to Scale.

    "}]} \ No newline at end of file diff --git a/sitemap.xml b/sitemap.xml index d411d5cb..673827e7 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -2,67 +2,67 @@ https://scaleapi.github.io/launch-python-client/ - 2023-03-14 + 2023-03-28 daily https://scaleapi.github.io/launch-python-client/cli/ - 2023-03-14 + 2023-03-28 daily https://scaleapi.github.io/launch-python-client/api/client/ - 2023-03-14 + 2023-03-28 daily https://scaleapi.github.io/launch-python-client/api/endpoint_predictions/ - 2023-03-14 + 2023-03-28 daily https://scaleapi.github.io/launch-python-client/api/hooks/ - 2023-03-14 + 2023-03-28 daily https://scaleapi.github.io/launch-python-client/api/model_bundles/ - 2023-03-14 + 2023-03-28 daily https://scaleapi.github.io/launch-python-client/api/model_endpoints/ - 2023-03-14 + 2023-03-28 daily https://scaleapi.github.io/launch-python-client/concepts/batch_jobs/ - 2023-03-14 + 2023-03-28 daily https://scaleapi.github.io/launch-python-client/concepts/callbacks/ - 2023-03-14 + 2023-03-28 daily https://scaleapi.github.io/launch-python-client/concepts/endpoint_predictions/ - 2023-03-14 + 2023-03-28 daily https://scaleapi.github.io/launch-python-client/concepts/model_bundles/ - 2023-03-14 + 2023-03-28 daily https://scaleapi.github.io/launch-python-client/concepts/model_endpoints/ - 2023-03-14 + 2023-03-28 daily https://scaleapi.github.io/launch-python-client/concepts/overview/ - 2023-03-14 + 2023-03-28 daily \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index 14dbab9beebf049f434492fd07eeabbda1c9dd64..fe7ecb745652149944546894991df571ef9b32b2 100644 GIT binary patch literal 320 zcmV-G0l)qqiwFpgKO$rT|8r?{Wo=<_E_iKh0M(YkZo?o9hVOlfh`mj zjtKDrE5R&~W_|lPZC6D*ZwGuaSU=WhWFxBM*I=_VjKQEguq`iG22NpTTz_D1uP^zY z9qUasjW$5cNbJIa=@|X95c53qU?L3C2aaPeg3`1J;vN(Qe`56}BU=*OR#&Sms(Q&1 zC{0k(g7k*>ChDo>28ETAQ#$vTsL|!h8gNlmVmY-=B10UotIML?<;5;9_awQ;Rx+if z>*0Nb&$^SwUMjJQ+~~vu?=L{fr2|V6k=g|>%-}kY#>K{u&>0n}e?wXoXv9-u$ix7) zX(!iNND}?0YZ8K2=oEM&Ze>)u`M@?sc+%Tes#A*WX+JfOG7=r$U;HUgFw#fsY+(L> S^sA#ETm22&1L(Tp2><{^WtXJ@ literal 321 zcmV-H0lxkpiwFoY`VeFS|8r?{Wo=<_E_iKh0M(YkZo?o9hVOlfhGO{JXb#<}IqHLBd zfzkviEC_Fk-b6ihg+Xq`+i* z3)jQ@2%n7-#-1y_id^aV9q%td$)y8J5}w)xFU;VSN8@7aM^Hva>fex71sd^~7&0+{ zZM(@S3rV8?bWK9=5}gE3#GQyzw;$N02v2(333*JBJ?*FFUPhwB`-?y22}b&8oea$X TkA89VV{5(vjcgu2;Ryf$7l4)j From d6b9b7d9a20ef651cf4a81e553d547ff0f73e7b5 Mon Sep 17 00:00:00 2001 From: Phil Chen Date: Mon, 27 Mar 2023 18:27:51 -0700 Subject: [PATCH 09/28] Deployed 21e34f3 with MkDocs version: 1.4.2 --- api/client/index.html | 239 +++++++++++++++++++++++++++++++++++++++ objects.inv | Bin 557 -> 574 bytes search/search_index.json | 2 +- sitemap.xml.gz | Bin 320 -> 320 bytes 4 files changed, 240 insertions(+), 1 deletion(-) diff --git a/api/client/index.html b/api/client/index.html index df1d7dea..e4594f02 100644 --- a/api/client/index.html +++ b/api/client/index.html @@ -534,6 +534,13 @@ get_batch_async_response() +

  • + +
  • + + get_latest_model_bundle_v2() + +
  • @@ -541,6 +548,13 @@ get_model_bundle() +
  • + +
  • + + get_model_bundle_v2() + +
  • @@ -555,6 +569,13 @@ list_model_bundles() +
  • + +
  • + + list_model_bundles_v2() + +
  • @@ -784,6 +805,13 @@ get_batch_async_response() +
  • + +
  • + + get_latest_model_bundle_v2() + +
  • @@ -791,6 +819,13 @@ get_model_bundle() +
  • + +
  • + + get_model_bundle_v2() + +
  • @@ -805,6 +840,13 @@ list_model_bundles() +
  • + +
  • + + list_model_bundles_v2() + +
  • @@ -2977,6 +3019,81 @@

    + get_latest_model_bundle_v2 + + +

    +
    get_latest_model_bundle_v2(
    +    model_bundle_name: str,
    +) -> Dict[str, Any]
    +
    + +
    + +

    Get the latest version of a model bundle.

    + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    model_bundle_name + str +

    The name of the model bundle you want to get.

    + required +
    + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + Dict[str, Any] +

    A dictionary containing the following keys:

    +
      +
    • id: The ID of the model bundle.
    • +
    • name: The name of the model bundle.
    • +
    • schema_location: The location of the schema for the model bundle.
    • +
    • flavor: The flavor of the model bundle. Either RunnableImage, + CloudpickleArtifact, or ZipArtifact.
    • +
    • created_at: The time the model bundle was created.
    • +
    • metadata: A dictionary of metadata associated with the model bundle.
    • +
    • model_artifact_ids: A list of IDs of model artifacts associated with the + bundle.
    • +
    + +
    + + + +
    + + +

    get_model_bundle @@ -3041,6 +3158,79 @@

    +

    + get_model_bundle_v2 + + +

    +
    get_model_bundle_v2(model_bundle_id: str) -> Dict[str, Any]
    +
    + +
    + +

    Get a model bundle.

    + +

    Parameters:

    + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    model_bundle_id + str +

    The ID of the model bundle you want to get.

    + required +
    + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + Dict[str, Any] +

    A dictionary containing the following keys:

    +
      +
    • id: The ID of the model bundle.
    • +
    • name: The name of the model bundle.
    • +
    • schema_location: The location of the schema for the model bundle.
    • +
    • flavor: The flavor of the model bundle. Either RunnableImage, + CloudpickleArtifact, or ZipArtifact.
    • +
    • created_at: The time the model bundle was created.
    • +
    • metadata: A dictionary of metadata associated with the model bundle.
    • +
    • model_artifact_ids: A list of IDs of model artifacts associated with the + bundle.
    • +
    + +
    + +
    + +
    + + +

    get_model_endpoint @@ -3125,6 +3315,55 @@

    +

    + list_model_bundles_v2 + + +

    +
    list_model_bundles_v2() -> List[Dict[str, Any]]
    +
    + +
    + +

    List all model bundles.

    + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + List[Dict[str, Any]] +

    A list of dictionaries containing the following keys:

    +
      +
    • id: The ID of the model bundle.
    • +
    • name: The name of the model bundle.
    • +
    • schema_location: The location of the schema for the model bundle.
    • +
    • flavor: The flavor of the model bundle. Either RunnableImage, + CloudpickleArtifact, or ZipArtifact.
    • +
    • created_at: The time the model bundle was created.
    • +
    • metadata: A dictionary of metadata associated with the model bundle.
    • +
    • model_artifact_ids: A list of IDs of model artifacts associated with the + bundle.
    • +
    + +
    + +
    + +
    + + +

    list_model_endpoints diff --git a/objects.inv b/objects.inv index e23a45dc4d4323f94d81beaf2a874e662ba434b2..815c81f8af2b479a7cd9d4454117f6f2a1795c4e 100644 GIT binary patch delta 461 zcmV;;0W$ur1il22dw*X~!ypg<@OM8&6MeOdKKiC+MiWhp`vBxduPqrp5a`Ulz4Xtz zwa%mpdm9V<3I}%}p(b9YTnZ$YzP7E$wvp)F9hYEja+81-i>}M!@+!H$kiU*f*Wh@` z!0w1MgP%3pR?2-BClvh+<5Cf_N@Xb7x~5Db`x35XyaX!H27kZ?!Hwmp7|V^S7zZg~ z?OWU1Gw7Kx_Dt+~CTwb=HXNdYB4SXGGOYv!oHMUrL=H3IqG1I(Hcl$568Rk9OfKV?Q7#qa=gFkvj6dMxMcU&HCMz@JG&S*Q5#>ATHnqy z4>cw_`c%8xoRe;{eiG98UnrH@*z{dl_d+=u^y8kJzoyTjw%>`lb(@;LHI0X%6dsQp zrTr`+1+AH1LN1C11Lw^DEu<~eV4$+$mdL`5eZq!I6-GM9z(Ke~P+_>Dfp4G?R4}*G z5xnL(EeuxJSNA_?L&n@UZ;0j5UHJ244mZebC+(BzL>&tyyV4s5ui`9u6|mxOF_7XY DOU>W! delta 444 zcmV;t0Ym=21g!*+dw)w#!!Qs4&^@P!1Y1(Uk{zHTkU&E80M^u*BvzfVv7Msc9_Q1f zDMbp{-NljpGXBgs5^CaQ%B4VZ>1*41Y#WK*-Ej%lCN~LavFN%iF0Yd73;FA)bPbM| z4D60LGx%AfZKd3IaYE7GFfJ7#t5k-Pt!v68vM=FE#!H|AZGQl45ZqLbim}|NigAz< z*1om9J%gSJW6#8%Cty<(waXzYC?YNjQl^!lfOF;*jL2aoTr{je$EHbTwIYjQVw{sd zO5yXA!cN1oQLKGn0h&K++2FAD=y`)lRRp1h4-!qkx7=<$$U8Zw7;cw&anV{!u%uxaa28@$W&~??i0frlxOA<6$T_ha)FBKTAkKYv!kri=x56IrD!D zY0ESisBE|;vT$Rcu;EgL4l-~ME)i51u4v#JCt1=G=q; diff --git a/search/search_index.json b/search/search_index.json index 58c75d30..58e77c1d 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Scale Launch","text":"

    Simple, scalable, and high performance ML service deployment in python.

    "},{"location":"#example","title":"Example","text":"Launch Usage
    import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"MY_TEAM\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

    What's going on here:

    • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
    • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
    • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
    • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
    • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

    Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

    "},{"location":"#installation","title":"Installation","text":"

    To use Scale Launch, first install it using pip:

    Installation
    pip install -U scale-launch\n
    "},{"location":"cli/","title":"CLI","text":"

    Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

    The CLI can be used as scale-launch ....

    "},{"location":"cli/#help","title":"Help","text":"

    Run scale-launch --help for more options.

    scale-launch --help
        This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your API key and other configuration options\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
    "},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
    LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

    Scale Launch Python Client.

    Initializes a Scale Launch Client.

    Parameters:

    Name Type Description Default api_key str

    Your Scale API key

    required endpoint Optional[str]

    The Scale Launch Endpoint (this should not need to be changed)

    None self_hosted bool

    True iff you are connecting to a self-hosted Scale Launch

    False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
    batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

    Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

    Must have exactly one of urls or inputs passed in.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or the name of a the bundle to use for inference.

    required urls List[str]

    A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

    None inputs Optional[List[Dict[str, Any]]]

    A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

    None batch_url_file_location Optional[str]

    In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

    None serialization_format str

    Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

    'JSON' labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None cpus Optional[int]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
    • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains job_id as a key, and the ID as the value.

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
    clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n

    Clones an existing model bundle with changes to its app config. (More fields coming soon)

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The existing bundle or its ID.

    required app_config Optional[Dict]

    The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

    None

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
    create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n
    Warning

    This method is deprecated. Use create_model_bundle_from_callable_v2 instead.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required predict_fn_or_cls Optional[Callable[[Any], Any]]

    Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

    None model Optional[LaunchModel_T]

    Typically a trained Neural Network, e.g. a Pytorch module.

    Exactly one of model and load_model_fn must be provided.

    None load_model_fn Optional[Callable[[], LaunchModel_T]]

    A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

    Exactly one of model and load_model_fn must be provided.

    None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

    Function that, when called with a model, returns a function that carries out inference.

    If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

    Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

    In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

    None requirements Optional[List[str]]

    A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

    [\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

    If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

    None app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    • Tensorflow fields:

      • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
    required globals_copy Optional[Dict[str, Any]]

    Dictionary of the global symbol table. Normally provided by globals() built-in function.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_callable_v2","title":"create_model_bundle_from_callable_v2","text":"
    create_model_bundle_from_callable_v2(\n*,\nmodel_bundle_name: str,\nload_predict_fn: Callable[\n[LaunchModel_T], Callable[[Any], Any]\n],\nload_model_fn: Callable[[], LaunchModel_T],\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrequirements: Optional[List[str]] = None,\npytorch_image_tag: Optional[str] = None,\ntensorflow_version: Optional[str] = None,\ncustom_base_image_repository: Optional[str] = None,\ncustom_base_image_tag: Optional[str] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None\n) -> Dict[str, Any]\n

    Uploads and registers a model bundle to Scale Launch.

    Parameters:

    Name Type Description Default model_bundle_name str

    Name of the model bundle.

    required load_predict_fn Callable[[LaunchModel_T], Callable[[Any], Any]]

    Function that takes in a model and returns a predict function. When your model bundle is deployed, this predict function will be called as follows:

    input = {\"input\": \"some input\"} # or whatever your request schema is.\n\ndef load_model_fn():\n    # load model\n    return model\n\ndef load_predict_fn(model, app_config=None):\n    def predict_fn(input):\n        # do pre-processing\n        output = model(input)\n        # do post-processing\n        return output\n    return predict_fn\n\npredict_fn = load_predict_fn(load_model_fn(), app_config=optional_app_config)\nresponse = predict_fn(input)\n

    required load_model_fn Callable[[], LaunchModel_T]

    A function that, when run, loads a model.

    required request_schema Type[BaseModel]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    required response_schema Type[BaseModel]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint.

    required requirements Optional[List[str]]

    List of pip requirements.

    None pytorch_image_tag Optional[str]

    The image tag for the PyTorch image that will be used to run the bundle. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None tensorflow_version Optional[str]

    The version of TensorFlow that will be used to run the bundle. If not specified, the default version will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_repository Optional[str]

    The repository for a custom base image that will be used to run the bundle. If not specified, the default base image will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_tag Optional[str]

    The tag for a custom base image that will be used to run the bundle. Must be specified if custom_base_image_repository is specified.

    None app_config Optional[Union[Dict[str, Any], str]]

    An optional dictionary of configuration values that will be passed to the bundle when it is run. These values can be accessed by the bundle via the app_config global variable.

    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
    create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n
    Warning

    This method is deprecated. Use create_model_bundle_from_dirs_v2 instead.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required base_paths List[str]

    The paths on the local filesystem where the bundle code lives.

    required requirements_path str

    A path on the local filesystem where a requirements.txt file lives.

    required env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch.
    • PyTorch fields:
      • pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags

    Example:

    {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\",\n}\n

    required load_predict_fn_module_path str

    A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

    required load_model_fn_module_path str

    A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

    required app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs_v2","title":"create_model_bundle_from_dirs_v2","text":"
    create_model_bundle_from_dirs_v2(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrequirements_path: str,\npytorch_image_tag: Optional[str] = None,\ntensorflow_version: Optional[str] = None,\ncustom_base_image_repository: Optional[str] = None,\ncustom_base_image_tag: Optional[str] = None,\napp_config: Optional[Dict[str, Any]] = None\n) -> Dict[str, Any]\n

    Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

    For example, if you have a directory structure like so, and your current working directory is my_root:

       my_root/\n       my_module1/\n           __init__.py\n           ...files and directories\n           my_inference_file.py\n       my_module2/\n           __init__.py\n           ...files and directories\n

    then calling create_model_bundle_from_dirs_v2 with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

       my_module1/\n       __init__.py\n       ...files and directories\n       my_inference_file.py\n   my_module2/\n       __init__.py\n       ...files and directories\n

    and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create.

    required base_paths List[str]

    A list of paths to directories that will be zipped up and uploaded as a bundle. Each path must be relative to the current working directory.

    required load_predict_fn_module_path str

    The Python module path to the function that will be used to load the model for inference. This function should take in a path to a model directory, and return a model object. The model object should be pickleable.

    required load_model_fn_module_path str

    The Python module path to the function that will be used to load the model for training. This function should take in a path to a model directory, and return a model object. The model object should be pickleable.

    required request_schema Type[BaseModel]

    A Pydantic model that defines the request schema for the bundle.

    required response_schema Type[BaseModel]

    A Pydantic model that defines the response schema for the bundle.

    required requirements_path str

    Path to a requirements.txt file that will be used to install dependencies for the bundle. This file must be relative to the current working directory.

    required pytorch_image_tag Optional[str]

    The image tag for the PyTorch image that will be used to run the bundle. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None tensorflow_version Optional[str]

    The version of TensorFlow that will be used to run the bundle. If not specified, the default version will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_repository Optional[str]

    The repository for a custom base image that will be used to run the bundle. If not specified, the default base image will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_tag Optional[str]

    The tag for a custom base image that will be used to run the bundle. Must be specified if custom_base_image_repository is specified.

    None app_config Optional[Dict[str, Any]]

    An optional dictionary of configuration values that will be passed to the bundle when it is run. These values can be accessed by the bundle via the app_config global variable.

    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_runnable_image_v2","title":"create_model_bundle_from_runnable_image_v2","text":"
    create_model_bundle_from_runnable_image_v2(\n*,\nmodel_bundle_name: str,\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrepository: str,\ntag: str,\ncommand: List[str],\nenv: Dict[str, str]\n) -> Dict[str, Any]\n

    Create a model bundle from a runnable image. The specified command must start a process that will listen for requests on port 5005 using HTTP.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create.

    required request_schema Type[BaseModel]

    A Pydantic model that defines the request schema for the bundle.

    required response_schema Type[BaseModel]

    A Pydantic model that defines the response schema for the bundle.

    required repository str

    The name of the Docker repository for the runnable image.

    required tag str

    The tag for the runnable image.

    required command List[str]

    The command that will be used to start the process that listens for requests.

    required env Dict[str, str]

    A dictionary of environment variables that will be passed to the bundle when it is run.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
    create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\nhigh_priority: Optional[bool] = False,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

    Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

    required model_bundle Union[ModelBundle, str]

    The ModelBundle that the endpoint should serve.

    required cpus int

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    3 memory str

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    '8Gi' storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus int

    Number of gpus each worker should get, e.g. 0, 1, etc.

    0 min_workers int

    The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

    1 max_workers int

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

    1 per_worker int

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

    Here is our recommendation for computing per_worker:

    1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
    10 gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None endpoint_type str

    Either \"sync\" or \"async\".

    'sync' high_priority Optional[bool]

    Either True or False. Enabling this will allow the created endpoint to leverage the shared pool of prewarmed nodes for faster spinup time.

    False post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None update_if_exists bool

    If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

    False labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None

    Returns:

    Type Description Optional[Endpoint]

    A Endpoint object that can be used to make requests to the endpoint.

    "},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
    delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Deletes a model endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    A ModelEndpoint object.

    required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
    edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\nhigh_priority: Optional[bool] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None\n) -> None\n

    Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

    • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

    required model_bundle Optional[Union[ModelBundle, str]]

    The ModelBundle that the endpoint should serve.

    None cpus Optional[float]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None min_workers Optional[int]

    The minimum number of workers. Must be greater than or equal to 0.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None high_priority Optional[bool]

    Either True or False. Enabling this will allow the created endpoint to leverage the shared pool of prewarmed nodes for faster spinup time.

    None post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
    get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

    Gets inference results from a previously created batch job.

    Parameters:

    Name Type Description Default batch_job_id str

    An id representing the batch task job. This id is the in the response from calling batch_async_request.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains the following fields:

    Dict[str, Any]
    • status: The status of the job.
    Dict[str, Any]
    • result: The url where the result is stored.
    Dict[str, Any]
    • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
    Dict[str, Any]
    • num_tasks_pending: The number of tasks that are still pending.
    Dict[str, Any]
    • num_tasks_completed: The number of tasks that have completed.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
    get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

    Returns a model bundle specified by bundle_name that the user owns.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or its name.

    required

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
    get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

    Gets a model endpoint associated with a name.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the endpoint to retrieve.

    required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
    list_model_bundles() -> List[ModelBundle]\n

    Returns a list of model bundles that the user owns.

    Returns:

    Type Description List[ModelBundle]

    A list of ModelBundle objects

    "},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
    list_model_endpoints() -> List[Endpoint]\n

    Lists all model endpoints that the user owns.

    Returns:

    Type Description List[Endpoint]

    A list of ModelEndpoint objects.

    "},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
    read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Retrieves the logs for the creation of the endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The endpoint or its name.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
    register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

    Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

    Parameters:

    Name Type Description Default batch_csv_location_fn Callable[[], str]

    Function that generates batch_csv_urls for upload_batch_csv_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
    register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

    Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

    Parameters:

    Name Type Description Default bundle_location_fn Callable[[], str]

    Function that generates bundle_urls for upload_bundle_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
    register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

    upload_batch_csv_fn(csv_text, csv_url)\n

    This function should directly write the contents of csv_text as a text string into csv_url.

    Parameters:

    Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

    Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
    register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

    upload_bundle_fn(serialized_bundle, bundle_url)\n

    This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

    See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

    Parameters:

    Name Type Description Default upload_bundle_fn Callable[[str, str], None]

    Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/endpoint_predictions/","title":"Endpoint Predictions","text":""},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"api/hooks/","title":"Hooks","text":""},{"location":"api/hooks/#launch.hooks.PostInferenceHooks","title":"PostInferenceHooks","text":"

    Bases: str, Enum

    Post-inference hooks are functions that are called after inference is complete.

    Attributes:

    Name Type Description CALLBACK str

    The callback hook is called with the inference response and the task ID.

    "},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

    Represents a ModelBundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[Any, Any]] = None\n

    An optional user-specified configuration mapping for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
    env_params: Optional[Dict[str, str]] = None\n

    A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
    id: Optional[str] = None\n

    A globally unique identifier for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
    location: Optional[str] = None\n

    An opaque location for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
    metadata: Optional[Dict[Any, Any]] = None\n

    Arbitrary metadata for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
    name: str\n

    The name of the bundle. Must be unique across all bundles that the user owns.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
    packaging_type: Optional[str] = None\n

    The packaging type for the bundle. Can be cloudpickle or zip.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
    requirements: Optional[List[str]] = None\n

    A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

    All classes here are returned by the get_model_endpoint method and provide a predict function.

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
    AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    An asynchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponseFuture\n

    Runs an asynchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required

    Returns:

    Name Type Description EndpointResponseFuture

    An EndpointResponseFuture such the user can use to query the status of the request.

    Example EndpointResponseFuture EndpointResponseFuture

    .. code-block:: python

    my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
    predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

    (deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

    Parameters:

    Name Type Description Default requests Sequence[EndpointRequest]

    List of EndpointRequests. Request_ids must all be distinct.

    required

    Returns:

    Type Description AsyncEndpointBatchResponse

    an AsyncEndpointResponse keeping track of the inference requests made

    "},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint","title":"SyncEndpoint","text":"
    SyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    A synchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponse\n

    Runs a synchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required"},{"location":"concepts/batch_jobs/","title":"Batch Jobs","text":"

    For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

    Batch jobs are created using the batch_async_request method of the LaunchClient.

    Creating and Following a Batch Job
    import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n}\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
    "},{"location":"concepts/callbacks/","title":"Callbacks","text":"

    Async model endpoints can be configured to send callbacks to a user-defined callback URL. Callbacks are sent as HTTP POST requests with a JSON body. The following code snippet shows how to create an async model endpoint with a callback URL.

    To configure an async endpoint to send callbacks, set the post_inference_hooks field to include launch.PostInferenceHooks.CALLBACK. A callback URL also needs to be specified, and it can be configured as a default using the default_callback_url argument to launch.LaunchClient.create_model_endpoint or as a per-task override using the callback_url field of launch.EndpointRequest.

    Note

    Callbacks will not be sent if the endpoint does not have any post-inference hooks specified, even if a default_callback_url is provided to the endpoint creation method or if the prediction request has a callback_url override.

    Creating an Async Model Endpoint with a Callback URL
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 7\n}\n\"\"\"\nfuture_custom_callback_url = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"}, callback_url=\"https://example.com/custom\"\n),\n)\n\"\"\"\nA callback is sent to https://example.com/custom with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 8\n}\n\"\"\"\n
    "},{"location":"concepts/callbacks/#authentication-for-callbacks","title":"Authentication for callbacks","text":"

    Warning

    This feature is currently in beta, and the API is likely to change.

    Callbacks can be authenticated using shared authentication headers. To enable authentication, set either default_callback_auth_kind when creating the endpoint or callback_auth_kind when making a prediction request.

    Currently, the supported authentication methods are basic and mtls. If basic is used, then the default_callback_auth_username and default_callback_auth_password fields must be specified when creating the endpoint, or the callback_auth_username and callback_auth_password fields must be specified when making a prediction request. If mtls is used, then the same is true for the default_callback_auth_cert and default_callback_auth_key fields, or the callback_auth_cert and callback_auth_key fields.

    Creating an Async Model Endpoint with custom Callback auth
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\ndefault_callback_auth_kind=\"basic\",\ndefault_callback_auth_username=\"user\",\ndefault_callback_auth_password=\"password\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with (\"user\", \"password\") as the basic auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"mtls\", \ncallback_auth_cert=\"cert\", \ncallback_auth_key=\"key\",\n),\n)\n\"\"\"\nA callback is sent with mTLS authentication.\n\"\"\"\nclient.edit_model_endpoint(\nmodel_endpoint=endpoint.model_endpoint,\ndefault_callback_auth_kind=\"mtls\",\ndefault_callback_auth_cert=\"cert\",\ndefault_callback_auth_key=\"key\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent with mTLS auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"basic\",\ncallback_auth_username=\"user\",\ncallback_auth_password=\"pass\",\n),\n)\n\"\"\"\nA callback is sent with (\"user\", \"pass\") as the basic auth.\n\"\"\"\n
    "},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

    Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

    Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
    "},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

    Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

    "},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

    There are two methods for creating model bundles: create_model_bundle and create_model_bundle_from_dirs. The former directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The latter takes in directories containing a load_predict_fn and the module path to the load_predict_fn.

    Creating a Model Bundle DirectlyCreating a Model Bundle from Directories
    import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n
    import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\npytest==7.2.1\nnumpy\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"requirements_path\": \"requirements.txt\",\n\"env_params\": ENV_PARAMS,\n\"load_predict_fn\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle_from_dirs(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
    "},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

    The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

    Creating Model Bundles with app_config
    import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Union\nfrom typing_extensions import Literal\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"batched\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)\n
    "},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

    Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes.

    "},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

    To list all the model bundles you own, use list_model_bundles.

    "},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

    Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

    Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

    Info

    "},{"location":"concepts/model_endpoints/#choosing-the-right-inference-mode","title":"Choosing the right inference mode","text":"

    Here are some tips for how to choose between SyncEndpoint, AsyncEndpoint, and BatchJob for deploying your ModelBundle:

    A SyncEndpoint is good if:

    • You have strict latency requirements (e.g. on the order of seconds or less).
    • You are willing to have resources continually allocated.

    An AsyncEndpoint is good if:

    • You want to save on compute costs.
    • Your inference code takes a long time to run.
    • Your latency requirements are on the order of minutes.

    A BatchJob is good if:

    • You know there is a large batch of inputs ahead of time.
    • You want to optimize for throughput instead of latency.
    "},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

    Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

    Creating an Async Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

    Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints.

    Note

    Sync model endpoints require at least 1 min_worker.

    Creating a Sync Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

    Model endpoints can be listed, updated, and deleted using the Launch API.

    Listing Model Endpoints
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
    Updating a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
    Deleting a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
    "},{"location":"concepts/overview/","title":"Overview","text":"

    Creating deployments on Launch generally involves three steps:

    1. Create and upload a ModelBundle. Pass your trained model as well as pre-/post-processing code to the Scale Launch Python client, and we\u2019ll create a model bundle based on the code and store it in our Bundle Store.

    2. Create a ModelEndpoint. Pass a ModelBundle as well as infrastructure settings such as the desired number of GPUs to our client. This provisions resources on Scale\u2019s cluster dedicated to your ModelEndpoint.

    3. Make requests to the ModelEndpoint. You can make requests through the Python client, or make HTTP requests directly to Scale.

    "}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Scale Launch","text":"

    Simple, scalable, and high performance ML service deployment in python.

    "},{"location":"#example","title":"Example","text":"Launch Usage
    import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"MY_TEAM\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

    What's going on here:

    • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
    • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
    • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
    • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
    • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

    Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

    "},{"location":"#installation","title":"Installation","text":"

    To use Scale Launch, first install it using pip:

    Installation
    pip install -U scale-launch\n
    "},{"location":"cli/","title":"CLI","text":"

    Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

    The CLI can be used as scale-launch ....

    "},{"location":"cli/#help","title":"Help","text":"

    Run scale-launch --help for more options.

    scale-launch --help
        This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your API key and other configuration options\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
    "},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
    LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

    Scale Launch Python Client.

    Initializes a Scale Launch Client.

    Parameters:

    Name Type Description Default api_key str

    Your Scale API key

    required endpoint Optional[str]

    The Scale Launch Endpoint (this should not need to be changed)

    None self_hosted bool

    True iff you are connecting to a self-hosted Scale Launch

    False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
    batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

    Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

    Must have exactly one of urls or inputs passed in.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or the name of a the bundle to use for inference.

    required urls List[str]

    A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

    None inputs Optional[List[Dict[str, Any]]]

    A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

    None batch_url_file_location Optional[str]

    In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

    None serialization_format str

    Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

    'JSON' labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None cpus Optional[int]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
    • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains job_id as a key, and the ID as the value.

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
    clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n

    Clones an existing model bundle with changes to its app config. (More fields coming soon)

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The existing bundle or its ID.

    required app_config Optional[Dict]

    The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

    None

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
    create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n
    Warning

    This method is deprecated. Use create_model_bundle_from_callable_v2 instead.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required predict_fn_or_cls Optional[Callable[[Any], Any]]

    Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

    None model Optional[LaunchModel_T]

    Typically a trained Neural Network, e.g. a Pytorch module.

    Exactly one of model and load_model_fn must be provided.

    None load_model_fn Optional[Callable[[], LaunchModel_T]]

    A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

    Exactly one of model and load_model_fn must be provided.

    None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

    Function that, when called with a model, returns a function that carries out inference.

    If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

    Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

    In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

    None requirements Optional[List[str]]

    A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

    [\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

    If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

    None app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    • Tensorflow fields:

      • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
    required globals_copy Optional[Dict[str, Any]]

    Dictionary of the global symbol table. Normally provided by globals() built-in function.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_callable_v2","title":"create_model_bundle_from_callable_v2","text":"
    create_model_bundle_from_callable_v2(\n*,\nmodel_bundle_name: str,\nload_predict_fn: Callable[\n[LaunchModel_T], Callable[[Any], Any]\n],\nload_model_fn: Callable[[], LaunchModel_T],\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrequirements: Optional[List[str]] = None,\npytorch_image_tag: Optional[str] = None,\ntensorflow_version: Optional[str] = None,\ncustom_base_image_repository: Optional[str] = None,\ncustom_base_image_tag: Optional[str] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None\n) -> Dict[str, Any]\n

    Uploads and registers a model bundle to Scale Launch.

    Parameters:

    Name Type Description Default model_bundle_name str

    Name of the model bundle.

    required load_predict_fn Callable[[LaunchModel_T], Callable[[Any], Any]]

    Function that takes in a model and returns a predict function. When your model bundle is deployed, this predict function will be called as follows:

    input = {\"input\": \"some input\"} # or whatever your request schema is.\n\ndef load_model_fn():\n    # load model\n    return model\n\ndef load_predict_fn(model, app_config=None):\n    def predict_fn(input):\n        # do pre-processing\n        output = model(input)\n        # do post-processing\n        return output\n    return predict_fn\n\npredict_fn = load_predict_fn(load_model_fn(), app_config=optional_app_config)\nresponse = predict_fn(input)\n

    required load_model_fn Callable[[], LaunchModel_T]

    A function that, when run, loads a model.

    required request_schema Type[BaseModel]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    required response_schema Type[BaseModel]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint.

    required requirements Optional[List[str]]

    List of pip requirements.

    None pytorch_image_tag Optional[str]

    The image tag for the PyTorch image that will be used to run the bundle. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None tensorflow_version Optional[str]

    The version of TensorFlow that will be used to run the bundle. If not specified, the default version will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_repository Optional[str]

    The repository for a custom base image that will be used to run the bundle. If not specified, the default base image will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_tag Optional[str]

    The tag for a custom base image that will be used to run the bundle. Must be specified if custom_base_image_repository is specified.

    None app_config Optional[Union[Dict[str, Any], str]]

    An optional dictionary of configuration values that will be passed to the bundle when it is run. These values can be accessed by the bundle via the app_config global variable.

    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
    create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n
    Warning

    This method is deprecated. Use create_model_bundle_from_dirs_v2 instead.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required base_paths List[str]

    The paths on the local filesystem where the bundle code lives.

    required requirements_path str

    A path on the local filesystem where a requirements.txt file lives.

    required env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch.
    • PyTorch fields:
      • pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags

    Example:

    {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\",\n}\n

    required load_predict_fn_module_path str

    A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

    required load_model_fn_module_path str

    A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

    required app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs_v2","title":"create_model_bundle_from_dirs_v2","text":"
    create_model_bundle_from_dirs_v2(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrequirements_path: str,\npytorch_image_tag: Optional[str] = None,\ntensorflow_version: Optional[str] = None,\ncustom_base_image_repository: Optional[str] = None,\ncustom_base_image_tag: Optional[str] = None,\napp_config: Optional[Dict[str, Any]] = None\n) -> Dict[str, Any]\n

    Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

    For example, if you have a directory structure like so, and your current working directory is my_root:

       my_root/\n       my_module1/\n           __init__.py\n           ...files and directories\n           my_inference_file.py\n       my_module2/\n           __init__.py\n           ...files and directories\n

    then calling create_model_bundle_from_dirs_v2 with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

       my_module1/\n       __init__.py\n       ...files and directories\n       my_inference_file.py\n   my_module2/\n       __init__.py\n       ...files and directories\n

    and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create.

    required base_paths List[str]

    A list of paths to directories that will be zipped up and uploaded as a bundle. Each path must be relative to the current working directory.

    required load_predict_fn_module_path str

    The Python module path to the function that will be used to load the model for inference. This function should take in a path to a model directory, and return a model object. The model object should be pickleable.

    required load_model_fn_module_path str

    The Python module path to the function that will be used to load the model for training. This function should take in a path to a model directory, and return a model object. The model object should be pickleable.

    required request_schema Type[BaseModel]

    A Pydantic model that defines the request schema for the bundle.

    required response_schema Type[BaseModel]

    A Pydantic model that defines the response schema for the bundle.

    required requirements_path str

    Path to a requirements.txt file that will be used to install dependencies for the bundle. This file must be relative to the current working directory.

    required pytorch_image_tag Optional[str]

    The image tag for the PyTorch image that will be used to run the bundle. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None tensorflow_version Optional[str]

    The version of TensorFlow that will be used to run the bundle. If not specified, the default version will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_repository Optional[str]

    The repository for a custom base image that will be used to run the bundle. If not specified, the default base image will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_tag Optional[str]

    The tag for a custom base image that will be used to run the bundle. Must be specified if custom_base_image_repository is specified.

    None app_config Optional[Dict[str, Any]]

    An optional dictionary of configuration values that will be passed to the bundle when it is run. These values can be accessed by the bundle via the app_config global variable.

    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_runnable_image_v2","title":"create_model_bundle_from_runnable_image_v2","text":"
    create_model_bundle_from_runnable_image_v2(\n*,\nmodel_bundle_name: str,\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrepository: str,\ntag: str,\ncommand: List[str],\nenv: Dict[str, str]\n) -> Dict[str, Any]\n

    Create a model bundle from a runnable image. The specified command must start a process that will listen for requests on port 5005 using HTTP.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create.

    required request_schema Type[BaseModel]

    A Pydantic model that defines the request schema for the bundle.

    required response_schema Type[BaseModel]

    A Pydantic model that defines the response schema for the bundle.

    required repository str

    The name of the Docker repository for the runnable image.

    required tag str

    The tag for the runnable image.

    required command List[str]

    The command that will be used to start the process that listens for requests.

    required env Dict[str, str]

    A dictionary of environment variables that will be passed to the bundle when it is run.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
    create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\nhigh_priority: Optional[bool] = False,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

    Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

    required model_bundle Union[ModelBundle, str]

    The ModelBundle that the endpoint should serve.

    required cpus int

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    3 memory str

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    '8Gi' storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus int

    Number of gpus each worker should get, e.g. 0, 1, etc.

    0 min_workers int

    The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

    1 max_workers int

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

    1 per_worker int

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

    Here is our recommendation for computing per_worker:

    1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
    10 gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None endpoint_type str

    Either \"sync\" or \"async\".

    'sync' high_priority Optional[bool]

    Either True or False. Enabling this will allow the created endpoint to leverage the shared pool of prewarmed nodes for faster spinup time.

    False post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None update_if_exists bool

    If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

    False labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None

    Returns:

    Type Description Optional[Endpoint]

    A Endpoint object that can be used to make requests to the endpoint.

    "},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
    delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Deletes a model endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    A ModelEndpoint object.

    required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
    edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\nhigh_priority: Optional[bool] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None\n) -> None\n

    Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

    • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

    required model_bundle Optional[Union[ModelBundle, str]]

    The ModelBundle that the endpoint should serve.

    None cpus Optional[float]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None min_workers Optional[int]

    The minimum number of workers. Must be greater than or equal to 0.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None high_priority Optional[bool]

    Either True or False. Enabling this will allow the created endpoint to leverage the shared pool of prewarmed nodes for faster spinup time.

    None post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
    get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

    Gets inference results from a previously created batch job.

    Parameters:

    Name Type Description Default batch_job_id str

    An id representing the batch task job. This id is the in the response from calling batch_async_request.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains the following fields:

    Dict[str, Any]
    • status: The status of the job.
    Dict[str, Any]
    • result: The url where the result is stored.
    Dict[str, Any]
    • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
    Dict[str, Any]
    • num_tasks_pending: The number of tasks that are still pending.
    Dict[str, Any]
    • num_tasks_completed: The number of tasks that have completed.
    "},{"location":"api/client/#launch.client.LaunchClient.get_latest_model_bundle_v2","title":"get_latest_model_bundle_v2","text":"
    get_latest_model_bundle_v2(\nmodel_bundle_name: str,\n) -> Dict[str, Any]\n

    Get the latest version of a model bundle.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to get.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • id: The ID of the model bundle.
    • name: The name of the model bundle.
    • schema_location: The location of the schema for the model bundle.
    • flavor: The flavor of the model bundle. Either RunnableImage, CloudpickleArtifact, or ZipArtifact.
    • created_at: The time the model bundle was created.
    • metadata: A dictionary of metadata associated with the model bundle.
    • model_artifact_ids: A list of IDs of model artifacts associated with the bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
    get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

    Returns a model bundle specified by bundle_name that the user owns.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or its name.

    required

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle_v2","title":"get_model_bundle_v2","text":"
    get_model_bundle_v2(model_bundle_id: str) -> Dict[str, Any]\n

    Get a model bundle.

    Parameters:

    Name Type Description Default model_bundle_id str

    The ID of the model bundle you want to get.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • id: The ID of the model bundle.
    • name: The name of the model bundle.
    • schema_location: The location of the schema for the model bundle.
    • flavor: The flavor of the model bundle. Either RunnableImage, CloudpickleArtifact, or ZipArtifact.
    • created_at: The time the model bundle was created.
    • metadata: A dictionary of metadata associated with the model bundle.
    • model_artifact_ids: A list of IDs of model artifacts associated with the bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
    get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

    Gets a model endpoint associated with a name.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the endpoint to retrieve.

    required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
    list_model_bundles() -> List[ModelBundle]\n

    Returns a list of model bundles that the user owns.

    Returns:

    Type Description List[ModelBundle]

    A list of ModelBundle objects

    "},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles_v2","title":"list_model_bundles_v2","text":"
    list_model_bundles_v2() -> List[Dict[str, Any]]\n

    List all model bundles.

    Returns:

    Type Description List[Dict[str, Any]]

    A list of dictionaries containing the following keys:

    • id: The ID of the model bundle.
    • name: The name of the model bundle.
    • schema_location: The location of the schema for the model bundle.
    • flavor: The flavor of the model bundle. Either RunnableImage, CloudpickleArtifact, or ZipArtifact.
    • created_at: The time the model bundle was created.
    • metadata: A dictionary of metadata associated with the model bundle.
    • model_artifact_ids: A list of IDs of model artifacts associated with the bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
    list_model_endpoints() -> List[Endpoint]\n

    Lists all model endpoints that the user owns.

    Returns:

    Type Description List[Endpoint]

    A list of ModelEndpoint objects.

    "},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
    read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Retrieves the logs for the creation of the endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The endpoint or its name.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
    register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

    Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

    Parameters:

    Name Type Description Default batch_csv_location_fn Callable[[], str]

    Function that generates batch_csv_urls for upload_batch_csv_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
    register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

    Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

    Parameters:

    Name Type Description Default bundle_location_fn Callable[[], str]

    Function that generates bundle_urls for upload_bundle_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
    register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

    upload_batch_csv_fn(csv_text, csv_url)\n

    This function should directly write the contents of csv_text as a text string into csv_url.

    Parameters:

    Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

    Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
    register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

    upload_bundle_fn(serialized_bundle, bundle_url)\n

    This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

    See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

    Parameters:

    Name Type Description Default upload_bundle_fn Callable[[str, str], None]

    Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/endpoint_predictions/","title":"Endpoint Predictions","text":""},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"api/hooks/","title":"Hooks","text":""},{"location":"api/hooks/#launch.hooks.PostInferenceHooks","title":"PostInferenceHooks","text":"

    Bases: str, Enum

    Post-inference hooks are functions that are called after inference is complete.

    Attributes:

    Name Type Description CALLBACK str

    The callback hook is called with the inference response and the task ID.

    "},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

    Represents a ModelBundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[Any, Any]] = None\n

    An optional user-specified configuration mapping for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
    env_params: Optional[Dict[str, str]] = None\n

    A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
    id: Optional[str] = None\n

    A globally unique identifier for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
    location: Optional[str] = None\n

    An opaque location for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
    metadata: Optional[Dict[Any, Any]] = None\n

    Arbitrary metadata for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
    name: str\n

    The name of the bundle. Must be unique across all bundles that the user owns.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
    packaging_type: Optional[str] = None\n

    The packaging type for the bundle. Can be cloudpickle or zip.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
    requirements: Optional[List[str]] = None\n

    A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

    All classes here are returned by the get_model_endpoint method and provide a predict function.

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
    AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    An asynchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponseFuture\n

    Runs an asynchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required

    Returns:

    Name Type Description EndpointResponseFuture

    An EndpointResponseFuture such the user can use to query the status of the request.

    Example EndpointResponseFuture EndpointResponseFuture

    .. code-block:: python

    my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
    predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

    (deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

    Parameters:

    Name Type Description Default requests Sequence[EndpointRequest]

    List of EndpointRequests. Request_ids must all be distinct.

    required

    Returns:

    Type Description AsyncEndpointBatchResponse

    an AsyncEndpointResponse keeping track of the inference requests made

    "},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint","title":"SyncEndpoint","text":"
    SyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    A synchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponse\n

    Runs a synchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required"},{"location":"concepts/batch_jobs/","title":"Batch Jobs","text":"

    For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

    Batch jobs are created using the batch_async_request method of the LaunchClient.

    Creating and Following a Batch Job
    import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n}\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
    "},{"location":"concepts/callbacks/","title":"Callbacks","text":"

    Async model endpoints can be configured to send callbacks to a user-defined callback URL. Callbacks are sent as HTTP POST requests with a JSON body. The following code snippet shows how to create an async model endpoint with a callback URL.

    To configure an async endpoint to send callbacks, set the post_inference_hooks field to include launch.PostInferenceHooks.CALLBACK. A callback URL also needs to be specified, and it can be configured as a default using the default_callback_url argument to launch.LaunchClient.create_model_endpoint or as a per-task override using the callback_url field of launch.EndpointRequest.

    Note

    Callbacks will not be sent if the endpoint does not have any post-inference hooks specified, even if a default_callback_url is provided to the endpoint creation method or if the prediction request has a callback_url override.

    Creating an Async Model Endpoint with a Callback URL
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 7\n}\n\"\"\"\nfuture_custom_callback_url = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"}, callback_url=\"https://example.com/custom\"\n),\n)\n\"\"\"\nA callback is sent to https://example.com/custom with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 8\n}\n\"\"\"\n
    "},{"location":"concepts/callbacks/#authentication-for-callbacks","title":"Authentication for callbacks","text":"

    Warning

    This feature is currently in beta, and the API is likely to change.

    Callbacks can be authenticated using shared authentication headers. To enable authentication, set either default_callback_auth_kind when creating the endpoint or callback_auth_kind when making a prediction request.

    Currently, the supported authentication methods are basic and mtls. If basic is used, then the default_callback_auth_username and default_callback_auth_password fields must be specified when creating the endpoint, or the callback_auth_username and callback_auth_password fields must be specified when making a prediction request. If mtls is used, then the same is true for the default_callback_auth_cert and default_callback_auth_key fields, or the callback_auth_cert and callback_auth_key fields.

    Creating an Async Model Endpoint with custom Callback auth
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\ndefault_callback_auth_kind=\"basic\",\ndefault_callback_auth_username=\"user\",\ndefault_callback_auth_password=\"password\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with (\"user\", \"password\") as the basic auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"mtls\", \ncallback_auth_cert=\"cert\", \ncallback_auth_key=\"key\",\n),\n)\n\"\"\"\nA callback is sent with mTLS authentication.\n\"\"\"\nclient.edit_model_endpoint(\nmodel_endpoint=endpoint.model_endpoint,\ndefault_callback_auth_kind=\"mtls\",\ndefault_callback_auth_cert=\"cert\",\ndefault_callback_auth_key=\"key\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent with mTLS auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"basic\",\ncallback_auth_username=\"user\",\ncallback_auth_password=\"pass\",\n),\n)\n\"\"\"\nA callback is sent with (\"user\", \"pass\") as the basic auth.\n\"\"\"\n
    "},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

    Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

    Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
    "},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

    Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

    "},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

    There are two methods for creating model bundles: create_model_bundle and create_model_bundle_from_dirs. The former directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The latter takes in directories containing a load_predict_fn and the module path to the load_predict_fn.

    Creating a Model Bundle DirectlyCreating a Model Bundle from Directories
    import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n
    import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\npytest==7.2.1\nnumpy\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"requirements_path\": \"requirements.txt\",\n\"env_params\": ENV_PARAMS,\n\"load_predict_fn\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle_from_dirs(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
    "},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

    The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

    Creating Model Bundles with app_config
    import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Union\nfrom typing_extensions import Literal\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"batched\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)\n
    "},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

    Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes.

    "},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

    To list all the model bundles you own, use list_model_bundles.

    "},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

    Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

    Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

    Info

    "},{"location":"concepts/model_endpoints/#choosing-the-right-inference-mode","title":"Choosing the right inference mode","text":"

    Here are some tips for how to choose between SyncEndpoint, AsyncEndpoint, and BatchJob for deploying your ModelBundle:

    A SyncEndpoint is good if:

    • You have strict latency requirements (e.g. on the order of seconds or less).
    • You are willing to have resources continually allocated.

    An AsyncEndpoint is good if:

    • You want to save on compute costs.
    • Your inference code takes a long time to run.
    • Your latency requirements are on the order of minutes.

    A BatchJob is good if:

    • You know there is a large batch of inputs ahead of time.
    • You want to optimize for throughput instead of latency.
    "},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

    Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

    Creating an Async Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

    Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints.

    Note

    Sync model endpoints require at least 1 min_worker.

    Creating a Sync Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

    Model endpoints can be listed, updated, and deleted using the Launch API.

    Listing Model Endpoints
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
    Updating a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
    Deleting a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
    "},{"location":"concepts/overview/","title":"Overview","text":"

    Creating deployments on Launch generally involves three steps:

    1. Create and upload a ModelBundle. Pass your trained model as well as pre-/post-processing code to the Scale Launch Python client, and we\u2019ll create a model bundle based on the code and store it in our Bundle Store.

    2. Create a ModelEndpoint. Pass a ModelBundle as well as infrastructure settings such as the desired number of GPUs to our client. This provisions resources on Scale\u2019s cluster dedicated to your ModelEndpoint.

    3. Make requests to the ModelEndpoint. You can make requests through the Python client, or make HTTP requests directly to Scale.

    "}]} \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index fe7ecb745652149944546894991df571ef9b32b2..8854b4163a06e90c19f8d6bf1becc439a8c31de6 100644 GIT binary patch delta 15 WcmX@WbbyIXzMF$%n$t!$D@Fh$F9Z(& delta 15 WcmX@WbbyIXzMF%i&weAD6(ay6@B{<^ From 3b254d68ad2c72a55eef0cc4c30c0a7f4dcddae1 Mon Sep 17 00:00:00 2001 From: Phil Chen Date: Mon, 27 Mar 2023 18:35:21 -0700 Subject: [PATCH 10/28] Deployed 3bff553 with MkDocs version: 1.4.2 --- api/client/index.html | 92 +++++++++++++++++++++++++++++++++++++++ objects.inv | Bin 574 -> 579 bytes search/search_index.json | 2 +- sitemap.xml.gz | Bin 320 -> 320 bytes 4 files changed, 93 insertions(+), 1 deletion(-) diff --git a/api/client/index.html b/api/client/index.html index e4594f02..2dea3927 100644 --- a/api/client/index.html +++ b/api/client/index.html @@ -471,6 +471,13 @@ clone_model_bundle_with_changes() +

  • + +
  • + + clone_model_bundle_with_changes_v2() + +
  • @@ -742,6 +749,13 @@ clone_model_bundle_with_changes() +
  • + +
  • + + clone_model_bundle_with_changes_v2() + +
  • @@ -1297,6 +1311,84 @@

    + clone_model_bundle_with_changes_v2 + + +

    +
    clone_model_bundle_with_changes_v2(
    +    original_model_bundle_id: str,
    +    new_app_config: Optional[Dict[str, Any]] = None,
    +) -> Dict[str, Any]
    +
    + +
    + +

    Clone a model bundle with an optional new app_config.

    + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    original_model_bundle_id + str +

    The ID of the model bundle you want to clone.

    + required +
    new_app_config + Optional[Dict[str, Any]] +

    A dictionary of new app config values to use for the cloned model.

    + None +
    + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + Dict[str, Any] +

    A dictionary containing the following keys:

    +
      +
    • model_bundle_id: The ID of the cloned model bundle.
    • +
    + +
    + + + +
    + + +

    create_model_bundle diff --git a/objects.inv b/objects.inv index 815c81f8af2b479a7cd9d4454117f6f2a1795c4e..2b28fa7e1ff6f99124c9e7209cf14c780041cd23 100644 GIT binary patch delta 392 zcmV;30eAks1j7W7dw<l9IHBlo7?+BWRVqWt)-`1k*_Uu7<0Vjm_J3?J+ujD)2EmQ-s2IzQ zsu%|;VeMOyL+$iT7<(r6JOP`Us9g?GK@o9LkTR_V1)O28U_=fx;i6#$IyO#Ns})%c z6Qy51>&BZDvLTHbC!3~Hq_Dy_LW;?P*_c+)G>^FbJOhIBxs?qLYg5e|OsXOXEqst@ z`m@aK)`Ps0b8Cv>cBdsST5GBNVjNT;I{H+*+MJVavVO9p^S@9kwXx~DvhIa)H0Z}YH-Al^T5Z1*v2~l8zBP@9 mp%fmE9Hsp%AqB0OpOfDKE&{18lMezV3QTzwFyn8TrvvyjO}Z)o delta 364 zcmV-y0h9j21il22dw*X~!ypg<@OM8&6MeOdKKiC+MiWhp`vBxduPqrp5a`Ulz4Xtz zwa%mpdm9V<3I}%}p(b9YTnZ$YzP7E$wvp)F9hYEja+81-i>}M!@+!H$kiU*f*Wh@` z!0w1MgP%3pR?2-BClvh+<5Cf_N@Xb7x~5Db`x35XyaX!H27kZ?!Hwmp7|V^S7zZg~ z?OWU1Gw7Kx_Dt+~CTwb=HXNdYB4SXGGOYv!oHMUrL=H3IqG1I(Hcl$568Rk9OfKV?Q7#qa=gFkvj6dMxMcU&HItbE94`{m`CllN+Sv46 zS@%LY8ua6yo4=;dp|;;11 diff --git a/search/search_index.json b/search/search_index.json index 58e77c1d..9829d95a 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Scale Launch","text":"

    Simple, scalable, and high performance ML service deployment in python.

    "},{"location":"#example","title":"Example","text":"Launch Usage
    import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"MY_TEAM\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

    What's going on here:

    • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
    • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
    • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
    • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
    • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

    Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

    "},{"location":"#installation","title":"Installation","text":"

    To use Scale Launch, first install it using pip:

    Installation
    pip install -U scale-launch\n
    "},{"location":"cli/","title":"CLI","text":"

    Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

    The CLI can be used as scale-launch ....

    "},{"location":"cli/#help","title":"Help","text":"

    Run scale-launch --help for more options.

    scale-launch --help
        This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your API key and other configuration options\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
    "},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
    LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

    Scale Launch Python Client.

    Initializes a Scale Launch Client.

    Parameters:

    Name Type Description Default api_key str

    Your Scale API key

    required endpoint Optional[str]

    The Scale Launch Endpoint (this should not need to be changed)

    None self_hosted bool

    True iff you are connecting to a self-hosted Scale Launch

    False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
    batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

    Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

    Must have exactly one of urls or inputs passed in.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or the name of a the bundle to use for inference.

    required urls List[str]

    A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

    None inputs Optional[List[Dict[str, Any]]]

    A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

    None batch_url_file_location Optional[str]

    In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

    None serialization_format str

    Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

    'JSON' labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None cpus Optional[int]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
    • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains job_id as a key, and the ID as the value.

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
    clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n

    Clones an existing model bundle with changes to its app config. (More fields coming soon)

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The existing bundle or its ID.

    required app_config Optional[Dict]

    The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

    None

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
    create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n
    Warning

    This method is deprecated. Use create_model_bundle_from_callable_v2 instead.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required predict_fn_or_cls Optional[Callable[[Any], Any]]

    Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

    None model Optional[LaunchModel_T]

    Typically a trained Neural Network, e.g. a Pytorch module.

    Exactly one of model and load_model_fn must be provided.

    None load_model_fn Optional[Callable[[], LaunchModel_T]]

    A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

    Exactly one of model and load_model_fn must be provided.

    None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

    Function that, when called with a model, returns a function that carries out inference.

    If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

    Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

    In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

    None requirements Optional[List[str]]

    A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

    [\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

    If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

    None app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    • Tensorflow fields:

      • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
    required globals_copy Optional[Dict[str, Any]]

    Dictionary of the global symbol table. Normally provided by globals() built-in function.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_callable_v2","title":"create_model_bundle_from_callable_v2","text":"
    create_model_bundle_from_callable_v2(\n*,\nmodel_bundle_name: str,\nload_predict_fn: Callable[\n[LaunchModel_T], Callable[[Any], Any]\n],\nload_model_fn: Callable[[], LaunchModel_T],\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrequirements: Optional[List[str]] = None,\npytorch_image_tag: Optional[str] = None,\ntensorflow_version: Optional[str] = None,\ncustom_base_image_repository: Optional[str] = None,\ncustom_base_image_tag: Optional[str] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None\n) -> Dict[str, Any]\n

    Uploads and registers a model bundle to Scale Launch.

    Parameters:

    Name Type Description Default model_bundle_name str

    Name of the model bundle.

    required load_predict_fn Callable[[LaunchModel_T], Callable[[Any], Any]]

    Function that takes in a model and returns a predict function. When your model bundle is deployed, this predict function will be called as follows:

    input = {\"input\": \"some input\"} # or whatever your request schema is.\n\ndef load_model_fn():\n    # load model\n    return model\n\ndef load_predict_fn(model, app_config=None):\n    def predict_fn(input):\n        # do pre-processing\n        output = model(input)\n        # do post-processing\n        return output\n    return predict_fn\n\npredict_fn = load_predict_fn(load_model_fn(), app_config=optional_app_config)\nresponse = predict_fn(input)\n

    required load_model_fn Callable[[], LaunchModel_T]

    A function that, when run, loads a model.

    required request_schema Type[BaseModel]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    required response_schema Type[BaseModel]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint.

    required requirements Optional[List[str]]

    List of pip requirements.

    None pytorch_image_tag Optional[str]

    The image tag for the PyTorch image that will be used to run the bundle. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None tensorflow_version Optional[str]

    The version of TensorFlow that will be used to run the bundle. If not specified, the default version will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_repository Optional[str]

    The repository for a custom base image that will be used to run the bundle. If not specified, the default base image will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_tag Optional[str]

    The tag for a custom base image that will be used to run the bundle. Must be specified if custom_base_image_repository is specified.

    None app_config Optional[Union[Dict[str, Any], str]]

    An optional dictionary of configuration values that will be passed to the bundle when it is run. These values can be accessed by the bundle via the app_config global variable.

    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
    create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n
    Warning

    This method is deprecated. Use create_model_bundle_from_dirs_v2 instead.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required base_paths List[str]

    The paths on the local filesystem where the bundle code lives.

    required requirements_path str

    A path on the local filesystem where a requirements.txt file lives.

    required env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch.
    • PyTorch fields:
      • pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags

    Example:

    {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\",\n}\n

    required load_predict_fn_module_path str

    A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

    required load_model_fn_module_path str

    A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

    required app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs_v2","title":"create_model_bundle_from_dirs_v2","text":"
    create_model_bundle_from_dirs_v2(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrequirements_path: str,\npytorch_image_tag: Optional[str] = None,\ntensorflow_version: Optional[str] = None,\ncustom_base_image_repository: Optional[str] = None,\ncustom_base_image_tag: Optional[str] = None,\napp_config: Optional[Dict[str, Any]] = None\n) -> Dict[str, Any]\n

    Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

    For example, if you have a directory structure like so, and your current working directory is my_root:

       my_root/\n       my_module1/\n           __init__.py\n           ...files and directories\n           my_inference_file.py\n       my_module2/\n           __init__.py\n           ...files and directories\n

    then calling create_model_bundle_from_dirs_v2 with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

       my_module1/\n       __init__.py\n       ...files and directories\n       my_inference_file.py\n   my_module2/\n       __init__.py\n       ...files and directories\n

    and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create.

    required base_paths List[str]

    A list of paths to directories that will be zipped up and uploaded as a bundle. Each path must be relative to the current working directory.

    required load_predict_fn_module_path str

    The Python module path to the function that will be used to load the model for inference. This function should take in a path to a model directory, and return a model object. The model object should be pickleable.

    required load_model_fn_module_path str

    The Python module path to the function that will be used to load the model for training. This function should take in a path to a model directory, and return a model object. The model object should be pickleable.

    required request_schema Type[BaseModel]

    A Pydantic model that defines the request schema for the bundle.

    required response_schema Type[BaseModel]

    A Pydantic model that defines the response schema for the bundle.

    required requirements_path str

    Path to a requirements.txt file that will be used to install dependencies for the bundle. This file must be relative to the current working directory.

    required pytorch_image_tag Optional[str]

    The image tag for the PyTorch image that will be used to run the bundle. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None tensorflow_version Optional[str]

    The version of TensorFlow that will be used to run the bundle. If not specified, the default version will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_repository Optional[str]

    The repository for a custom base image that will be used to run the bundle. If not specified, the default base image will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_tag Optional[str]

    The tag for a custom base image that will be used to run the bundle. Must be specified if custom_base_image_repository is specified.

    None app_config Optional[Dict[str, Any]]

    An optional dictionary of configuration values that will be passed to the bundle when it is run. These values can be accessed by the bundle via the app_config global variable.

    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_runnable_image_v2","title":"create_model_bundle_from_runnable_image_v2","text":"
    create_model_bundle_from_runnable_image_v2(\n*,\nmodel_bundle_name: str,\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrepository: str,\ntag: str,\ncommand: List[str],\nenv: Dict[str, str]\n) -> Dict[str, Any]\n

    Create a model bundle from a runnable image. The specified command must start a process that will listen for requests on port 5005 using HTTP.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create.

    required request_schema Type[BaseModel]

    A Pydantic model that defines the request schema for the bundle.

    required response_schema Type[BaseModel]

    A Pydantic model that defines the response schema for the bundle.

    required repository str

    The name of the Docker repository for the runnable image.

    required tag str

    The tag for the runnable image.

    required command List[str]

    The command that will be used to start the process that listens for requests.

    required env Dict[str, str]

    A dictionary of environment variables that will be passed to the bundle when it is run.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
    create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\nhigh_priority: Optional[bool] = False,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

    Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

    required model_bundle Union[ModelBundle, str]

    The ModelBundle that the endpoint should serve.

    required cpus int

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    3 memory str

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    '8Gi' storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus int

    Number of gpus each worker should get, e.g. 0, 1, etc.

    0 min_workers int

    The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

    1 max_workers int

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

    1 per_worker int

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

    Here is our recommendation for computing per_worker:

    1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
    10 gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None endpoint_type str

    Either \"sync\" or \"async\".

    'sync' high_priority Optional[bool]

    Either True or False. Enabling this will allow the created endpoint to leverage the shared pool of prewarmed nodes for faster spinup time.

    False post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None update_if_exists bool

    If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

    False labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None

    Returns:

    Type Description Optional[Endpoint]

    A Endpoint object that can be used to make requests to the endpoint.

    "},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
    delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Deletes a model endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    A ModelEndpoint object.

    required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
    edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\nhigh_priority: Optional[bool] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None\n) -> None\n

    Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

    • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

    required model_bundle Optional[Union[ModelBundle, str]]

    The ModelBundle that the endpoint should serve.

    None cpus Optional[float]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None min_workers Optional[int]

    The minimum number of workers. Must be greater than or equal to 0.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None high_priority Optional[bool]

    Either True or False. Enabling this will allow the created endpoint to leverage the shared pool of prewarmed nodes for faster spinup time.

    None post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
    get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

    Gets inference results from a previously created batch job.

    Parameters:

    Name Type Description Default batch_job_id str

    An id representing the batch task job. This id is the in the response from calling batch_async_request.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains the following fields:

    Dict[str, Any]
    • status: The status of the job.
    Dict[str, Any]
    • result: The url where the result is stored.
    Dict[str, Any]
    • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
    Dict[str, Any]
    • num_tasks_pending: The number of tasks that are still pending.
    Dict[str, Any]
    • num_tasks_completed: The number of tasks that have completed.
    "},{"location":"api/client/#launch.client.LaunchClient.get_latest_model_bundle_v2","title":"get_latest_model_bundle_v2","text":"
    get_latest_model_bundle_v2(\nmodel_bundle_name: str,\n) -> Dict[str, Any]\n

    Get the latest version of a model bundle.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to get.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • id: The ID of the model bundle.
    • name: The name of the model bundle.
    • schema_location: The location of the schema for the model bundle.
    • flavor: The flavor of the model bundle. Either RunnableImage, CloudpickleArtifact, or ZipArtifact.
    • created_at: The time the model bundle was created.
    • metadata: A dictionary of metadata associated with the model bundle.
    • model_artifact_ids: A list of IDs of model artifacts associated with the bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
    get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

    Returns a model bundle specified by bundle_name that the user owns.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or its name.

    required

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle_v2","title":"get_model_bundle_v2","text":"
    get_model_bundle_v2(model_bundle_id: str) -> Dict[str, Any]\n

    Get a model bundle.

    Parameters:

    Name Type Description Default model_bundle_id str

    The ID of the model bundle you want to get.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • id: The ID of the model bundle.
    • name: The name of the model bundle.
    • schema_location: The location of the schema for the model bundle.
    • flavor: The flavor of the model bundle. Either RunnableImage, CloudpickleArtifact, or ZipArtifact.
    • created_at: The time the model bundle was created.
    • metadata: A dictionary of metadata associated with the model bundle.
    • model_artifact_ids: A list of IDs of model artifacts associated with the bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
    get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

    Gets a model endpoint associated with a name.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the endpoint to retrieve.

    required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
    list_model_bundles() -> List[ModelBundle]\n

    Returns a list of model bundles that the user owns.

    Returns:

    Type Description List[ModelBundle]

    A list of ModelBundle objects

    "},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles_v2","title":"list_model_bundles_v2","text":"
    list_model_bundles_v2() -> List[Dict[str, Any]]\n

    List all model bundles.

    Returns:

    Type Description List[Dict[str, Any]]

    A list of dictionaries containing the following keys:

    • id: The ID of the model bundle.
    • name: The name of the model bundle.
    • schema_location: The location of the schema for the model bundle.
    • flavor: The flavor of the model bundle. Either RunnableImage, CloudpickleArtifact, or ZipArtifact.
    • created_at: The time the model bundle was created.
    • metadata: A dictionary of metadata associated with the model bundle.
    • model_artifact_ids: A list of IDs of model artifacts associated with the bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
    list_model_endpoints() -> List[Endpoint]\n

    Lists all model endpoints that the user owns.

    Returns:

    Type Description List[Endpoint]

    A list of ModelEndpoint objects.

    "},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
    read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Retrieves the logs for the creation of the endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The endpoint or its name.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
    register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

    Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

    Parameters:

    Name Type Description Default batch_csv_location_fn Callable[[], str]

    Function that generates batch_csv_urls for upload_batch_csv_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
    register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

    Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

    Parameters:

    Name Type Description Default bundle_location_fn Callable[[], str]

    Function that generates bundle_urls for upload_bundle_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
    register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

    upload_batch_csv_fn(csv_text, csv_url)\n

    This function should directly write the contents of csv_text as a text string into csv_url.

    Parameters:

    Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

    Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
    register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

    upload_bundle_fn(serialized_bundle, bundle_url)\n

    This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

    See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

    Parameters:

    Name Type Description Default upload_bundle_fn Callable[[str, str], None]

    Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/endpoint_predictions/","title":"Endpoint Predictions","text":""},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"api/hooks/","title":"Hooks","text":""},{"location":"api/hooks/#launch.hooks.PostInferenceHooks","title":"PostInferenceHooks","text":"

    Bases: str, Enum

    Post-inference hooks are functions that are called after inference is complete.

    Attributes:

    Name Type Description CALLBACK str

    The callback hook is called with the inference response and the task ID.

    "},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

    Represents a ModelBundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[Any, Any]] = None\n

    An optional user-specified configuration mapping for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
    env_params: Optional[Dict[str, str]] = None\n

    A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
    id: Optional[str] = None\n

    A globally unique identifier for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
    location: Optional[str] = None\n

    An opaque location for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
    metadata: Optional[Dict[Any, Any]] = None\n

    Arbitrary metadata for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
    name: str\n

    The name of the bundle. Must be unique across all bundles that the user owns.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
    packaging_type: Optional[str] = None\n

    The packaging type for the bundle. Can be cloudpickle or zip.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
    requirements: Optional[List[str]] = None\n

    A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

    All classes here are returned by the get_model_endpoint method and provide a predict function.

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
    AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    An asynchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponseFuture\n

    Runs an asynchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required

    Returns:

    Name Type Description EndpointResponseFuture

    An EndpointResponseFuture such the user can use to query the status of the request.

    Example EndpointResponseFuture EndpointResponseFuture

    .. code-block:: python

    my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
    predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

    (deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

    Parameters:

    Name Type Description Default requests Sequence[EndpointRequest]

    List of EndpointRequests. Request_ids must all be distinct.

    required

    Returns:

    Type Description AsyncEndpointBatchResponse

    an AsyncEndpointResponse keeping track of the inference requests made

    "},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint","title":"SyncEndpoint","text":"
    SyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    A synchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponse\n

    Runs a synchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required"},{"location":"concepts/batch_jobs/","title":"Batch Jobs","text":"

    For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

    Batch jobs are created using the batch_async_request method of the LaunchClient.

    Creating and Following a Batch Job
    import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n}\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
    "},{"location":"concepts/callbacks/","title":"Callbacks","text":"

    Async model endpoints can be configured to send callbacks to a user-defined callback URL. Callbacks are sent as HTTP POST requests with a JSON body. The following code snippet shows how to create an async model endpoint with a callback URL.

    To configure an async endpoint to send callbacks, set the post_inference_hooks field to include launch.PostInferenceHooks.CALLBACK. A callback URL also needs to be specified, and it can be configured as a default using the default_callback_url argument to launch.LaunchClient.create_model_endpoint or as a per-task override using the callback_url field of launch.EndpointRequest.

    Note

    Callbacks will not be sent if the endpoint does not have any post-inference hooks specified, even if a default_callback_url is provided to the endpoint creation method or if the prediction request has a callback_url override.

    Creating an Async Model Endpoint with a Callback URL
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 7\n}\n\"\"\"\nfuture_custom_callback_url = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"}, callback_url=\"https://example.com/custom\"\n),\n)\n\"\"\"\nA callback is sent to https://example.com/custom with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 8\n}\n\"\"\"\n
    "},{"location":"concepts/callbacks/#authentication-for-callbacks","title":"Authentication for callbacks","text":"

    Warning

    This feature is currently in beta, and the API is likely to change.

    Callbacks can be authenticated using shared authentication headers. To enable authentication, set either default_callback_auth_kind when creating the endpoint or callback_auth_kind when making a prediction request.

    Currently, the supported authentication methods are basic and mtls. If basic is used, then the default_callback_auth_username and default_callback_auth_password fields must be specified when creating the endpoint, or the callback_auth_username and callback_auth_password fields must be specified when making a prediction request. If mtls is used, then the same is true for the default_callback_auth_cert and default_callback_auth_key fields, or the callback_auth_cert and callback_auth_key fields.

    Creating an Async Model Endpoint with custom Callback auth
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\ndefault_callback_auth_kind=\"basic\",\ndefault_callback_auth_username=\"user\",\ndefault_callback_auth_password=\"password\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with (\"user\", \"password\") as the basic auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"mtls\", \ncallback_auth_cert=\"cert\", \ncallback_auth_key=\"key\",\n),\n)\n\"\"\"\nA callback is sent with mTLS authentication.\n\"\"\"\nclient.edit_model_endpoint(\nmodel_endpoint=endpoint.model_endpoint,\ndefault_callback_auth_kind=\"mtls\",\ndefault_callback_auth_cert=\"cert\",\ndefault_callback_auth_key=\"key\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent with mTLS auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"basic\",\ncallback_auth_username=\"user\",\ncallback_auth_password=\"pass\",\n),\n)\n\"\"\"\nA callback is sent with (\"user\", \"pass\") as the basic auth.\n\"\"\"\n
    "},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

    Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

    Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
    "},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

    Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

    "},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

    There are two methods for creating model bundles: create_model_bundle and create_model_bundle_from_dirs. The former directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The latter takes in directories containing a load_predict_fn and the module path to the load_predict_fn.

    Creating a Model Bundle DirectlyCreating a Model Bundle from Directories
    import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n
    import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\npytest==7.2.1\nnumpy\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"requirements_path\": \"requirements.txt\",\n\"env_params\": ENV_PARAMS,\n\"load_predict_fn\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle_from_dirs(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
    "},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

    The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

    Creating Model Bundles with app_config
    import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Union\nfrom typing_extensions import Literal\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"batched\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)\n
    "},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

    Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes.

    "},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

    To list all the model bundles you own, use list_model_bundles.

    "},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

    Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

    Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

    Info

    "},{"location":"concepts/model_endpoints/#choosing-the-right-inference-mode","title":"Choosing the right inference mode","text":"

    Here are some tips for how to choose between SyncEndpoint, AsyncEndpoint, and BatchJob for deploying your ModelBundle:

    A SyncEndpoint is good if:

    • You have strict latency requirements (e.g. on the order of seconds or less).
    • You are willing to have resources continually allocated.

    An AsyncEndpoint is good if:

    • You want to save on compute costs.
    • Your inference code takes a long time to run.
    • Your latency requirements are on the order of minutes.

    A BatchJob is good if:

    • You know there is a large batch of inputs ahead of time.
    • You want to optimize for throughput instead of latency.
    "},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

    Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

    Creating an Async Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

    Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints.

    Note

    Sync model endpoints require at least 1 min_worker.

    Creating a Sync Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

    Model endpoints can be listed, updated, and deleted using the Launch API.

    Listing Model Endpoints
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
    Updating a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
    Deleting a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
    "},{"location":"concepts/overview/","title":"Overview","text":"

    Creating deployments on Launch generally involves three steps:

    1. Create and upload a ModelBundle. Pass your trained model as well as pre-/post-processing code to the Scale Launch Python client, and we\u2019ll create a model bundle based on the code and store it in our Bundle Store.

    2. Create a ModelEndpoint. Pass a ModelBundle as well as infrastructure settings such as the desired number of GPUs to our client. This provisions resources on Scale\u2019s cluster dedicated to your ModelEndpoint.

    3. Make requests to the ModelEndpoint. You can make requests through the Python client, or make HTTP requests directly to Scale.

    "}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Scale Launch","text":"

    Simple, scalable, and high performance ML service deployment in python.

    "},{"location":"#example","title":"Example","text":"Launch Usage
    import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"MY_TEAM\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

    What's going on here:

    • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
    • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
    • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
    • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
    • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

    Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

    "},{"location":"#installation","title":"Installation","text":"

    To use Scale Launch, first install it using pip:

    Installation
    pip install -U scale-launch\n
    "},{"location":"cli/","title":"CLI","text":"

    Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

    The CLI can be used as scale-launch ....

    "},{"location":"cli/#help","title":"Help","text":"

    Run scale-launch --help for more options.

    scale-launch --help
        This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your API key and other configuration options\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
    "},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
    LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

    Scale Launch Python Client.

    Initializes a Scale Launch Client.

    Parameters:

    Name Type Description Default api_key str

    Your Scale API key

    required endpoint Optional[str]

    The Scale Launch Endpoint (this should not need to be changed)

    None self_hosted bool

    True iff you are connecting to a self-hosted Scale Launch

    False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
    batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

    Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

    Must have exactly one of urls or inputs passed in.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or the name of a the bundle to use for inference.

    required urls List[str]

    A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

    None inputs Optional[List[Dict[str, Any]]]

    A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

    None batch_url_file_location Optional[str]

    In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

    None serialization_format str

    Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

    'JSON' labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None cpus Optional[int]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
    • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains job_id as a key, and the ID as the value.

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
    clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n

    Clones an existing model bundle with changes to its app config. (More fields coming soon)

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The existing bundle or its ID.

    required app_config Optional[Dict]

    The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

    None

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes_v2","title":"clone_model_bundle_with_changes_v2","text":"
    clone_model_bundle_with_changes_v2(\noriginal_model_bundle_id: str,\nnew_app_config: Optional[Dict[str, Any]] = None,\n) -> Dict[str, Any]\n

    Clone a model bundle with an optional new app_config.

    Parameters:

    Name Type Description Default original_model_bundle_id str

    The ID of the model bundle you want to clone.

    required new_app_config Optional[Dict[str, Any]]

    A dictionary of new app config values to use for the cloned model.

    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • model_bundle_id: The ID of the cloned model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
    create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n
    Warning

    This method is deprecated. Use create_model_bundle_from_callable_v2 instead.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required predict_fn_or_cls Optional[Callable[[Any], Any]]

    Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

    None model Optional[LaunchModel_T]

    Typically a trained Neural Network, e.g. a Pytorch module.

    Exactly one of model and load_model_fn must be provided.

    None load_model_fn Optional[Callable[[], LaunchModel_T]]

    A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

    Exactly one of model and load_model_fn must be provided.

    None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

    Function that, when called with a model, returns a function that carries out inference.

    If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

    Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

    In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

    None requirements Optional[List[str]]

    A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

    [\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

    If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

    None app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    • Tensorflow fields:

      • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
    required globals_copy Optional[Dict[str, Any]]

    Dictionary of the global symbol table. Normally provided by globals() built-in function.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_callable_v2","title":"create_model_bundle_from_callable_v2","text":"
    create_model_bundle_from_callable_v2(\n*,\nmodel_bundle_name: str,\nload_predict_fn: Callable[\n[LaunchModel_T], Callable[[Any], Any]\n],\nload_model_fn: Callable[[], LaunchModel_T],\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrequirements: Optional[List[str]] = None,\npytorch_image_tag: Optional[str] = None,\ntensorflow_version: Optional[str] = None,\ncustom_base_image_repository: Optional[str] = None,\ncustom_base_image_tag: Optional[str] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None\n) -> Dict[str, Any]\n

    Uploads and registers a model bundle to Scale Launch.

    Parameters:

    Name Type Description Default model_bundle_name str

    Name of the model bundle.

    required load_predict_fn Callable[[LaunchModel_T], Callable[[Any], Any]]

    Function that takes in a model and returns a predict function. When your model bundle is deployed, this predict function will be called as follows:

    input = {\"input\": \"some input\"} # or whatever your request schema is.\n\ndef load_model_fn():\n    # load model\n    return model\n\ndef load_predict_fn(model, app_config=None):\n    def predict_fn(input):\n        # do pre-processing\n        output = model(input)\n        # do post-processing\n        return output\n    return predict_fn\n\npredict_fn = load_predict_fn(load_model_fn(), app_config=optional_app_config)\nresponse = predict_fn(input)\n

    required load_model_fn Callable[[], LaunchModel_T]

    A function that, when run, loads a model.

    required request_schema Type[BaseModel]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    required response_schema Type[BaseModel]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint.

    required requirements Optional[List[str]]

    List of pip requirements.

    None pytorch_image_tag Optional[str]

    The image tag for the PyTorch image that will be used to run the bundle. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None tensorflow_version Optional[str]

    The version of TensorFlow that will be used to run the bundle. If not specified, the default version will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_repository Optional[str]

    The repository for a custom base image that will be used to run the bundle. If not specified, the default base image will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_tag Optional[str]

    The tag for a custom base image that will be used to run the bundle. Must be specified if custom_base_image_repository is specified.

    None app_config Optional[Union[Dict[str, Any], str]]

    An optional dictionary of configuration values that will be passed to the bundle when it is run. These values can be accessed by the bundle via the app_config global variable.

    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
    create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n
    Warning

    This method is deprecated. Use create_model_bundle_from_dirs_v2 instead.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required base_paths List[str]

    The paths on the local filesystem where the bundle code lives.

    required requirements_path str

    A path on the local filesystem where a requirements.txt file lives.

    required env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch.
    • PyTorch fields:
      • pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags

    Example:

    {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\",\n}\n

    required load_predict_fn_module_path str

    A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

    required load_model_fn_module_path str

    A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

    required app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs_v2","title":"create_model_bundle_from_dirs_v2","text":"
    create_model_bundle_from_dirs_v2(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrequirements_path: str,\npytorch_image_tag: Optional[str] = None,\ntensorflow_version: Optional[str] = None,\ncustom_base_image_repository: Optional[str] = None,\ncustom_base_image_tag: Optional[str] = None,\napp_config: Optional[Dict[str, Any]] = None\n) -> Dict[str, Any]\n

    Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

    For example, if you have a directory structure like so, and your current working directory is my_root:

       my_root/\n       my_module1/\n           __init__.py\n           ...files and directories\n           my_inference_file.py\n       my_module2/\n           __init__.py\n           ...files and directories\n

    then calling create_model_bundle_from_dirs_v2 with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

       my_module1/\n       __init__.py\n       ...files and directories\n       my_inference_file.py\n   my_module2/\n       __init__.py\n       ...files and directories\n

    and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create.

    required base_paths List[str]

    A list of paths to directories that will be zipped up and uploaded as a bundle. Each path must be relative to the current working directory.

    required load_predict_fn_module_path str

    The Python module path to the function that will be used to load the model for inference. This function should take in a path to a model directory, and return a model object. The model object should be pickleable.

    required load_model_fn_module_path str

    The Python module path to the function that will be used to load the model for training. This function should take in a path to a model directory, and return a model object. The model object should be pickleable.

    required request_schema Type[BaseModel]

    A Pydantic model that defines the request schema for the bundle.

    required response_schema Type[BaseModel]

    A Pydantic model that defines the response schema for the bundle.

    required requirements_path str

    Path to a requirements.txt file that will be used to install dependencies for the bundle. This file must be relative to the current working directory.

    required pytorch_image_tag Optional[str]

    The image tag for the PyTorch image that will be used to run the bundle. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None tensorflow_version Optional[str]

    The version of TensorFlow that will be used to run the bundle. If not specified, the default version will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_repository Optional[str]

    The repository for a custom base image that will be used to run the bundle. If not specified, the default base image will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_tag Optional[str]

    The tag for a custom base image that will be used to run the bundle. Must be specified if custom_base_image_repository is specified.

    None app_config Optional[Dict[str, Any]]

    An optional dictionary of configuration values that will be passed to the bundle when it is run. These values can be accessed by the bundle via the app_config global variable.

    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_runnable_image_v2","title":"create_model_bundle_from_runnable_image_v2","text":"
    create_model_bundle_from_runnable_image_v2(\n*,\nmodel_bundle_name: str,\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrepository: str,\ntag: str,\ncommand: List[str],\nenv: Dict[str, str]\n) -> Dict[str, Any]\n

    Create a model bundle from a runnable image. The specified command must start a process that will listen for requests on port 5005 using HTTP.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create.

    required request_schema Type[BaseModel]

    A Pydantic model that defines the request schema for the bundle.

    required response_schema Type[BaseModel]

    A Pydantic model that defines the response schema for the bundle.

    required repository str

    The name of the Docker repository for the runnable image.

    required tag str

    The tag for the runnable image.

    required command List[str]

    The command that will be used to start the process that listens for requests.

    required env Dict[str, str]

    A dictionary of environment variables that will be passed to the bundle when it is run.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
    create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\nhigh_priority: Optional[bool] = False,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

    Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

    required model_bundle Union[ModelBundle, str]

    The ModelBundle that the endpoint should serve.

    required cpus int

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    3 memory str

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    '8Gi' storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus int

    Number of gpus each worker should get, e.g. 0, 1, etc.

    0 min_workers int

    The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

    1 max_workers int

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

    1 per_worker int

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

    Here is our recommendation for computing per_worker:

    1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
    10 gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None endpoint_type str

    Either \"sync\" or \"async\".

    'sync' high_priority Optional[bool]

    Either True or False. Enabling this will allow the created endpoint to leverage the shared pool of prewarmed nodes for faster spinup time.

    False post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None update_if_exists bool

    If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

    False labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None

    Returns:

    Type Description Optional[Endpoint]

    A Endpoint object that can be used to make requests to the endpoint.

    "},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
    delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Deletes a model endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    A ModelEndpoint object.

    required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
    edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\nhigh_priority: Optional[bool] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None\n) -> None\n

    Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

    • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

    required model_bundle Optional[Union[ModelBundle, str]]

    The ModelBundle that the endpoint should serve.

    None cpus Optional[float]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None min_workers Optional[int]

    The minimum number of workers. Must be greater than or equal to 0.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None high_priority Optional[bool]

    Either True or False. Enabling this will allow the created endpoint to leverage the shared pool of prewarmed nodes for faster spinup time.

    None post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
    get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

    Gets inference results from a previously created batch job.

    Parameters:

    Name Type Description Default batch_job_id str

    An id representing the batch task job. This id is the in the response from calling batch_async_request.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains the following fields:

    Dict[str, Any]
    • status: The status of the job.
    Dict[str, Any]
    • result: The url where the result is stored.
    Dict[str, Any]
    • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
    Dict[str, Any]
    • num_tasks_pending: The number of tasks that are still pending.
    Dict[str, Any]
    • num_tasks_completed: The number of tasks that have completed.
    "},{"location":"api/client/#launch.client.LaunchClient.get_latest_model_bundle_v2","title":"get_latest_model_bundle_v2","text":"
    get_latest_model_bundle_v2(\nmodel_bundle_name: str,\n) -> Dict[str, Any]\n

    Get the latest version of a model bundle.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to get.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • id: The ID of the model bundle.
    • name: The name of the model bundle.
    • schema_location: The location of the schema for the model bundle.
    • flavor: The flavor of the model bundle. Either RunnableImage, CloudpickleArtifact, or ZipArtifact.
    • created_at: The time the model bundle was created.
    • metadata: A dictionary of metadata associated with the model bundle.
    • model_artifact_ids: A list of IDs of model artifacts associated with the bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
    get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

    Returns a model bundle specified by bundle_name that the user owns.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or its name.

    required

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle_v2","title":"get_model_bundle_v2","text":"
    get_model_bundle_v2(model_bundle_id: str) -> Dict[str, Any]\n

    Get a model bundle.

    Parameters:

    Name Type Description Default model_bundle_id str

    The ID of the model bundle you want to get.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary containing the following keys:

    • id: The ID of the model bundle.
    • name: The name of the model bundle.
    • schema_location: The location of the schema for the model bundle.
    • flavor: The flavor of the model bundle. Either RunnableImage, CloudpickleArtifact, or ZipArtifact.
    • created_at: The time the model bundle was created.
    • metadata: A dictionary of metadata associated with the model bundle.
    • model_artifact_ids: A list of IDs of model artifacts associated with the bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
    get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

    Gets a model endpoint associated with a name.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the endpoint to retrieve.

    required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
    list_model_bundles() -> List[ModelBundle]\n

    Returns a list of model bundles that the user owns.

    Returns:

    Type Description List[ModelBundle]

    A list of ModelBundle objects

    "},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles_v2","title":"list_model_bundles_v2","text":"
    list_model_bundles_v2() -> List[Dict[str, Any]]\n

    List all model bundles.

    Returns:

    Type Description List[Dict[str, Any]]

    A list of dictionaries containing the following keys:

    • id: The ID of the model bundle.
    • name: The name of the model bundle.
    • schema_location: The location of the schema for the model bundle.
    • flavor: The flavor of the model bundle. Either RunnableImage, CloudpickleArtifact, or ZipArtifact.
    • created_at: The time the model bundle was created.
    • metadata: A dictionary of metadata associated with the model bundle.
    • model_artifact_ids: A list of IDs of model artifacts associated with the bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
    list_model_endpoints() -> List[Endpoint]\n

    Lists all model endpoints that the user owns.

    Returns:

    Type Description List[Endpoint]

    A list of ModelEndpoint objects.

    "},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
    read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Retrieves the logs for the creation of the endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The endpoint or its name.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
    register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

    Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

    Parameters:

    Name Type Description Default batch_csv_location_fn Callable[[], str]

    Function that generates batch_csv_urls for upload_batch_csv_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
    register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

    Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

    Parameters:

    Name Type Description Default bundle_location_fn Callable[[], str]

    Function that generates bundle_urls for upload_bundle_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
    register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

    upload_batch_csv_fn(csv_text, csv_url)\n

    This function should directly write the contents of csv_text as a text string into csv_url.

    Parameters:

    Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

    Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
    register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

    upload_bundle_fn(serialized_bundle, bundle_url)\n

    This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

    See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

    Parameters:

    Name Type Description Default upload_bundle_fn Callable[[str, str], None]

    Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/endpoint_predictions/","title":"Endpoint Predictions","text":""},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"api/hooks/","title":"Hooks","text":""},{"location":"api/hooks/#launch.hooks.PostInferenceHooks","title":"PostInferenceHooks","text":"

    Bases: str, Enum

    Post-inference hooks are functions that are called after inference is complete.

    Attributes:

    Name Type Description CALLBACK str

    The callback hook is called with the inference response and the task ID.

    "},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

    Represents a ModelBundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[Any, Any]] = None\n

    An optional user-specified configuration mapping for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
    env_params: Optional[Dict[str, str]] = None\n

    A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
    id: Optional[str] = None\n

    A globally unique identifier for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
    location: Optional[str] = None\n

    An opaque location for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
    metadata: Optional[Dict[Any, Any]] = None\n

    Arbitrary metadata for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
    name: str\n

    The name of the bundle. Must be unique across all bundles that the user owns.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
    packaging_type: Optional[str] = None\n

    The packaging type for the bundle. Can be cloudpickle or zip.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
    requirements: Optional[List[str]] = None\n

    A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

    All classes here are returned by the get_model_endpoint method and provide a predict function.

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
    AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    An asynchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponseFuture\n

    Runs an asynchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required

    Returns:

    Name Type Description EndpointResponseFuture

    An EndpointResponseFuture such the user can use to query the status of the request.

    Example EndpointResponseFuture EndpointResponseFuture

    .. code-block:: python

    my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
    predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

    (deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

    Parameters:

    Name Type Description Default requests Sequence[EndpointRequest]

    List of EndpointRequests. Request_ids must all be distinct.

    required

    Returns:

    Type Description AsyncEndpointBatchResponse

    an AsyncEndpointResponse keeping track of the inference requests made

    "},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint","title":"SyncEndpoint","text":"
    SyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    A synchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponse\n

    Runs a synchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required"},{"location":"concepts/batch_jobs/","title":"Batch Jobs","text":"

    For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

    Batch jobs are created using the batch_async_request method of the LaunchClient.

    Creating and Following a Batch Job
    import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n}\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
    "},{"location":"concepts/callbacks/","title":"Callbacks","text":"

    Async model endpoints can be configured to send callbacks to a user-defined callback URL. Callbacks are sent as HTTP POST requests with a JSON body. The following code snippet shows how to create an async model endpoint with a callback URL.

    To configure an async endpoint to send callbacks, set the post_inference_hooks field to include launch.PostInferenceHooks.CALLBACK. A callback URL also needs to be specified, and it can be configured as a default using the default_callback_url argument to launch.LaunchClient.create_model_endpoint or as a per-task override using the callback_url field of launch.EndpointRequest.

    Note

    Callbacks will not be sent if the endpoint does not have any post-inference hooks specified, even if a default_callback_url is provided to the endpoint creation method or if the prediction request has a callback_url override.

    Creating an Async Model Endpoint with a Callback URL
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 7\n}\n\"\"\"\nfuture_custom_callback_url = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"}, callback_url=\"https://example.com/custom\"\n),\n)\n\"\"\"\nA callback is sent to https://example.com/custom with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 8\n}\n\"\"\"\n
    "},{"location":"concepts/callbacks/#authentication-for-callbacks","title":"Authentication for callbacks","text":"

    Warning

    This feature is currently in beta, and the API is likely to change.

    Callbacks can be authenticated using shared authentication headers. To enable authentication, set either default_callback_auth_kind when creating the endpoint or callback_auth_kind when making a prediction request.

    Currently, the supported authentication methods are basic and mtls. If basic is used, then the default_callback_auth_username and default_callback_auth_password fields must be specified when creating the endpoint, or the callback_auth_username and callback_auth_password fields must be specified when making a prediction request. If mtls is used, then the same is true for the default_callback_auth_cert and default_callback_auth_key fields, or the callback_auth_cert and callback_auth_key fields.

    Creating an Async Model Endpoint with custom Callback auth
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\ndefault_callback_auth_kind=\"basic\",\ndefault_callback_auth_username=\"user\",\ndefault_callback_auth_password=\"password\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with (\"user\", \"password\") as the basic auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"mtls\", \ncallback_auth_cert=\"cert\", \ncallback_auth_key=\"key\",\n),\n)\n\"\"\"\nA callback is sent with mTLS authentication.\n\"\"\"\nclient.edit_model_endpoint(\nmodel_endpoint=endpoint.model_endpoint,\ndefault_callback_auth_kind=\"mtls\",\ndefault_callback_auth_cert=\"cert\",\ndefault_callback_auth_key=\"key\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent with mTLS auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"basic\",\ncallback_auth_username=\"user\",\ncallback_auth_password=\"pass\",\n),\n)\n\"\"\"\nA callback is sent with (\"user\", \"pass\") as the basic auth.\n\"\"\"\n
    "},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

    Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

    Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
    "},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

    Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

    "},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

    There are two methods for creating model bundles: create_model_bundle and create_model_bundle_from_dirs. The former directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The latter takes in directories containing a load_predict_fn and the module path to the load_predict_fn.

    Creating a Model Bundle DirectlyCreating a Model Bundle from Directories
    import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n
    import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\npytest==7.2.1\nnumpy\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"requirements_path\": \"requirements.txt\",\n\"env_params\": ENV_PARAMS,\n\"load_predict_fn\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle_from_dirs(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
    "},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

    The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

    Creating Model Bundles with app_config
    import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Union\nfrom typing_extensions import Literal\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"batched\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)\n
    "},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

    Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes.

    "},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

    To list all the model bundles you own, use list_model_bundles.

    "},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

    Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

    Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

    Info

    "},{"location":"concepts/model_endpoints/#choosing-the-right-inference-mode","title":"Choosing the right inference mode","text":"

    Here are some tips for how to choose between SyncEndpoint, AsyncEndpoint, and BatchJob for deploying your ModelBundle:

    A SyncEndpoint is good if:

    • You have strict latency requirements (e.g. on the order of seconds or less).
    • You are willing to have resources continually allocated.

    An AsyncEndpoint is good if:

    • You want to save on compute costs.
    • Your inference code takes a long time to run.
    • Your latency requirements are on the order of minutes.

    A BatchJob is good if:

    • You know there is a large batch of inputs ahead of time.
    • You want to optimize for throughput instead of latency.
    "},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

    Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

    Creating an Async Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

    Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints.

    Note

    Sync model endpoints require at least 1 min_worker.

    Creating a Sync Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

    Model endpoints can be listed, updated, and deleted using the Launch API.

    Listing Model Endpoints
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
    Updating a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
    Deleting a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
    "},{"location":"concepts/overview/","title":"Overview","text":"

    Creating deployments on Launch generally involves three steps:

    1. Create and upload a ModelBundle. Pass your trained model as well as pre-/post-processing code to the Scale Launch Python client, and we\u2019ll create a model bundle based on the code and store it in our Bundle Store.

    2. Create a ModelEndpoint. Pass a ModelBundle as well as infrastructure settings such as the desired number of GPUs to our client. This provisions resources on Scale\u2019s cluster dedicated to your ModelEndpoint.

    3. Make requests to the ModelEndpoint. You can make requests through the Python client, or make HTTP requests directly to Scale.

    "}]} \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index 8854b4163a06e90c19f8d6bf1becc439a8c31de6..b2789220c7adf9d04d2adec048c651132fab938f 100644 GIT binary patch delta 15 WcmX@WbbyIXzMF$1(q$u?6(ay5%LCK^ delta 15 WcmX@WbbyIXzMF$%n$t!$D@Fh$F9Z(& From 4cf1494644d483479a7d35d0340fdcf7149bb56e Mon Sep 17 00:00:00 2001 From: Phil Chen Date: Mon, 27 Mar 2023 19:22:44 -0700 Subject: [PATCH 11/28] Deployed 7cf0303 with MkDocs version: 1.4.2 --- api/client/index.html | 61 +- api/model_bundles/index.html | 1725 ++++++++++++++++++++++++++++++++-- objects.inv | Bin 579 -> 842 bytes search/search_index.json | 2 +- sitemap.xml.gz | Bin 320 -> 320 bytes 5 files changed, 1673 insertions(+), 115 deletions(-) diff --git a/api/client/index.html b/api/client/index.html index 2dea3927..adbb8fc3 100644 --- a/api/client/index.html +++ b/api/client/index.html @@ -1248,8 +1248,12 @@

    -

    Clones an existing model bundle with changes to its app config. (More fields coming soon)

    +
    + Warning +

    This method is deprecated. Use +clone_model_bundle_with_changes_v2 instead.

    +

    Parameters:

    @@ -1319,7 +1323,7 @@

    clone_model_bundle_with_changes_v2(
         original_model_bundle_id: str,
         new_app_config: Optional[Dict[str, Any]] = None,
    -) -> Dict[str, Any]
    +) -> CreateModelBundleV2Response
     
    @@ -1371,9 +1375,9 @@

    Dict[str, Any] + CreateModelBundleV2Response -

    @@ -1620,7 +1624,7 @@

    custom_base_image_repository: Optional[str] = None, custom_base_image_tag: Optional[str] = None, app_config: Optional[Union[Dict[str, Any], str]] = None -) -> Dict[str, Any] +) -> CreateModelBundleV2Response
    @@ -1793,9 +1797,9 @@

    Dict[str, Any] + CreateModelBundleV2Response -

    @@ -1995,7 +1999,7 @@

    custom_base_image_repository: Optional[str] = None, custom_base_image_tag: Optional[str] = None, app_config: Optional[Dict[str, Any]] = None -) -> Dict[str, Any] +) -> CreateModelBundleV2Response
    @@ -2191,9 +2195,9 @@

    Dict[str, Any] + CreateModelBundleV2Response -

    @@ -2223,7 +2227,7 @@

    tag: str, command: List[str], env: Dict[str, str] -) -> Dict[str, Any] +) -> CreateModelBundleV2Response
    @@ -2327,9 +2331,9 @@

    - @@ -3118,7 +3122,7 @@

    get_latest_model_bundle_v2(
         model_bundle_name: str,
    -) -> Dict[str, Any]
    +) -> ModelBundleV2Response
     
    @@ -3160,9 +3164,9 @@

    Dict[str, Any] + ModelBundleV2Response -

    - - diff --git a/api/model_bundles/index.html b/api/model_bundles/index.html index f0a89c8e..1c47fb94 100644 --- a/api/model_bundles/index.html +++ b/api/model_bundles/index.html @@ -465,6 +465,121 @@ + + +
  • + + ModelBundleV2Response + + + + +
  • + +
  • + + PytorchFramework + + + + +
  • + +
  • + + RunnableImageFlavor + + + + +
  • + +
  • + + TensorflowFramework + + + + +
  • + +
  • + + ZipArtifactFlavor + + + +
  • @@ -618,65 +917,364 @@
    • - - ModelBundle + + CloudpickleArtifactFlavor -
    • - -
    • - - packaging_type + +
    • + + CreateModelBundleV2Response -
    • + + + + +
    • + + CustomFramework + + + + +
    • + +
    • + + ListModelBundlesV2Response + + + + +
    • + +
    • + + ModelBundle + + + + +
    • + +
    • + + ModelBundleV2Response + + + + +
    • + +
    • + + PytorchFramework + + + + +
    • + +
    • + + RunnableImageFlavor + + + + +
    • + +
    • + + TensorflowFramework + + + + +
    • + +
    • + + ZipArtifactFlavor + + + - - - - - - -
      -
      - - + +
      + + + + + +
      +
      + + + + +

      Model Bundles

      + + +
      + + + +

      + CloudpickleArtifactFlavor + + +

      + + +
      +

      + Bases: BaseModel

      + + + + + + +
      + + + + + + + +
      + + + +

      + app_config + + + + class-attribute + + +

      +
      app_config: Optional[Dict[str, Any]]
      +
      + +
      + +

      Optional configuration for the application.

      +
      + +
      + +
      + + + +

      + framework + + + + class-attribute + + +

      +
      framework: Union[
      +    PytorchFramework, TensorflowFramework, CustomFramework
      +] = Field(Ellipsis, discriminator="framework_type")
      +
      + +
      + +

      Machine Learning framework specification. Either +PytorchFramework, +TensorflowFramework, or +CustomFramework.

      +
      + +
      + +
      + + + +

      + load_model_fn + + + + class-attribute + + +

      +
      load_model_fn: str
      +
      + +
      + +

      Function which, when called, returns the model object.

      +
      + +
      + +
      + + + +

      + load_predict_fn + + + + class-attribute + + +

      +
      load_predict_fn: str
      +
      + +
      + +

      Function which, when called, returns the prediction function.

      +
      + +
      + +
      + + + +

      + requirements + + + + class-attribute + + +

      +
      requirements: List[str]
      +
      + +
      + +

      List of requirements to install in the environment before running the model.

      +
      + +
      + + + + + +
      + +
      + +
      + +
      + + + +

      + CreateModelBundleV2Response + + +

      + + +
      +

      + Bases: BaseModel

      + + +

      Response object for creating a Model Bundle.

      + + + + + +
      + + + + + + + +
      + + + +

      + model_bundle_id + + + + class-attribute + + +

      +
      model_bundle_id: str
      +
      + +
      + +

      ID of the Model Bundle.

      +
      + +
      + + + + + +
      + +
      + +
      + +
      + + + +

      + CustomFramework + + +

      + + +
      +

      + Bases: BaseModel

      + + + + + + +
      + + + + + + + +
      + + + +

      + image_repository + + + + class-attribute + + +

      +
      image_repository: str
      +
      + +
      + +

      Docker image repository to use as the base image.

      +
      + +
      + +
      + + + +

      + image_tag + + + + class-attribute + + +

      +
      image_tag: str
      +
      + +
      + +

      Docker image tag to use as the base image.

      +
      + +
      + + + + + +
      + +
      + +
      + +
      + + + +

      + ListModelBundlesV2Response + + +

      + + +
      +

      + Bases: BaseModel

      + + +

      Response object for listing Model Bundles.

      + + + + + +
      + + + + + + + +
      + + + +

      + model_bundles + + + + class-attribute + + +

      +
      model_bundles: List[ModelBundleV2Response]
      +
      + +
      + +

      A list of Model Bundles.

      +
      + +
      + + + + + +
      + +
      + +
      + +
      + + + +

      + ModelBundle + + + + dataclass + + +

      + + +
      + + +

      Represents a ModelBundle.

      + + + + + +
      + + + + + + + +
      + + + +

      + app_config + + + + class-attribute + + +

      +
      app_config: Optional[Dict[Any, Any]] = None
      +
      + +
      + +

      An optional user-specified configuration mapping for the bundle.

      +
      + +
      + +
      + + + +

      + env_params + + + + class-attribute + + +

      +
      env_params: Optional[Dict[str, str]] = None
      +
      + +
      + +

      A dictionary that dictates environment information. See LaunchClient.create_model_bundle +for more information.

      +
      + +
      + +
      + + + +

      + id + + + + class-attribute + + +

      +
      id: Optional[str] = None
      +
      + +
      + +

      A globally unique identifier for the bundle.

      +
      + +
      + +
      + + + +

      + location + + + + class-attribute + + +

      +
      location: Optional[str] = None
      +
      + +
      + +

      An opaque location for the bundle.

      +
      + +
      + +
      + + + +

      + metadata + + + + class-attribute + + +

      +
      metadata: Optional[Dict[Any, Any]] = None
      +
      + +
      + +

      Arbitrary metadata for the bundle.

      +
      + +
      + +
      + + + +

      + name + + + + class-attribute + + +

      +
      name: str
      +
      + +
      + +

      The name of the bundle. Must be unique across all bundles that the user owns.

      +
      + +
      + +
      + + + +

      + packaging_type + + + + class-attribute + + +

      +
      packaging_type: Optional[str] = None
      +
      + +
      + +

      The packaging type for the bundle. Can be cloudpickle or zip.

      +
      + +
      + +
      + + + +

      + requirements + + + + class-attribute + + +

      +
      requirements: Optional[List[str]] = None
      +
      + +
      + +

      A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle +for more information.

      +
      + +
      + + + + + +
      + +
      + +
      + +
      + + + +

      + ModelBundleV2Response + + +

      + + +
      +

      + Bases: BaseModel

      + + +

      Response object for a single Model Bundle.

      + + + + + +
      + + + + + + + +
      + + + +

      + created_at + + + + class-attribute + + +

      +
      created_at: datetime.datetime
      +
      + +
      + +

      Timestamp of when the Model Bundle was created.

      +
      + +
      + +
      + + + +

      + flavor + + + + class-attribute + + +

      +
      flavor: Union[
      +    CloudpickleArtifactFlavor,
      +    ZipArtifactFlavor,
      +    RunnableImageFlavor,
      +] = Field(Ellipsis, discriminator="flavor")
      +
      + +
      + +

      Flavor of the Model Bundle, representing how the model bundle was packaged. Either +CloudpickleArtifactFlavor, +ZipArtifactFlavor, or +RunnableImageFlavor.

      +
      + +
      + +
      + + + +

      + id + + + + class-attribute + + +

      +
      id: str
      +
      + +
      + +

      ID of the Model Bundle.

      +
      + +
      + +
      + + + +

      + metadata + + + + class-attribute + + +

      +
      metadata: Dict[str, Any]
      +
      + +
      + +

      Metadata associated with the Model Bundle.

      +
      + +
      + +
      + + + +

      + model_artifact_ids + + + + class-attribute + +

      +
      model_artifact_ids: List[str]
      +
      -

      Model Bundles

      +
      + +

      IDs of the Model Artifacts associated with the Model Bundle.

      +
      +
      -
      +
      -

      - ModelBundle +

      + name - dataclass + class-attribute -

      + +
      name: str
      +
      + +
      + +

      Name of the Model Bundle.

      +
      + +
      + + + + + +
      + +
      + +
      + +
      + + + +

      + PytorchFramework + + +

      +

      + Bases: BaseModel

      + + + -

      Represents a ModelBundle.

      + +
      + + + + + + + +
      + + + +

      + pytorch_image_tag + + + + class-attribute + + +

      +
      pytorch_image_tag: str
      +
      + +
      + +

      Image tag of the Pytorch image to use.

      +
      + +
      + + + + + +
      + +
      + +
      + +
      + + + +

      + RunnableImageFlavor + + +

      + + +
      +

      + Bases: BaseModel

      + @@ -740,21 +2176,21 @@

      -

      - app_config +

      + command class-attribute -

      -
      app_config: Optional[Dict[Any, Any]] = None
      +
      +
      command: List[str]
       
      -

      An optional user-specified configuration mapping for the bundle.

      +

      Command to run the image.

      @@ -763,22 +2199,21 @@

      -

      - env_params +

      + env class-attribute -

      -
      env_params: Optional[Dict[str, str]] = None
      +
      +
      env: Optional[Dict[str, str]]
       
      -

      A dictionary that dictates environment information. See LaunchClient.create_model_bundle -for more information.

      +

      Environment variables to set when running the image.

      @@ -787,21 +2222,21 @@

      -

      - id +

      + repository class-attribute -

      -
      id: Optional[str] = None
      +
      +
      repository: str
       
      -

      A globally unique identifier for the bundle.

      +

      Docker repository of the image.

      @@ -810,44 +2245,143 @@

      -

      - location +

      + tag class-attribute -

      -
      location: Optional[str] = None
      +
      +
      tag: str
       
      -

      An opaque location for the bundle.

      +

      Docker tag of the image.

      +
      + +
      + + + + + +
      +
      +
      + + + +

      + TensorflowFramework + + +

      + + +
      +

      + Bases: BaseModel

      + + + + + + +
      + + + + + + +
      -

      - metadata +

      + tensorflow_version class-attribute -

      -
      metadata: Optional[Dict[Any, Any]] = None
      +
      +
      tensorflow_version: str
       
      -

      Arbitrary metadata for the bundle.

      +

      Tensorflow version to use.

      +
      + +
      + + + + + +
      + +
      + +
      + +
      + + + +

      + ZipArtifactFlavor + + +

      + + +
      +

      + Bases: BaseModel

      + + + + + + +
      + + + + + + + +
      + + + +

      + app_config + + + + class-attribute + + +

      +
      app_config: Optional[Dict[str, Any]]
      +
      + +
      + +

      Optional configuration for the application.

      @@ -856,21 +2390,26 @@

      -

      - name +

      + framework class-attribute -

      -
      name: str
      +
      +
      framework: Union[
      +    PytorchFramework, TensorflowFramework, CustomFramework
      +] = Field(Ellipsis, discriminator="framework_type")
       
      -

      The name of the bundle. Must be unique across all bundles that the user owns.

      +

      Machine Learning framework specification. Either +PytorchFramework, +TensorflowFramework, or +CustomFramework.

      @@ -879,21 +2418,21 @@

      -

      - packaging_type +

      + load_model_fn_module_path class-attribute -

      -
      packaging_type: Optional[str] = None
      +
      +
      load_model_fn_module_path: str
       
      -

      The packaging type for the bundle. Can be cloudpickle or zip.

      +

      Path to the module to load the model object.

      @@ -902,7 +2441,30 @@

      -

      +

      + load_predict_fn_module_path + + + + class-attribute + + +

      +
      load_predict_fn_module_path: str
      +
      + +
      + +

      Path to the module to load the prediction function.

      +
      + +
      + +
      + + + +

      requirements @@ -910,14 +2472,13 @@

      class-attribute -

      -
      requirements: Optional[List[str]] = None
      +
      +
      requirements: List[str]
       
      -

      A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle -for more information.

      +

      List of requirements to install in the environment before running the model.

      diff --git a/objects.inv b/objects.inv index 2b28fa7e1ff6f99124c9e7209cf14c780041cd23..33e012644310301a98924b5b9913177dbe721229 100644 GIT binary patch delta 732 zcmV<20wevy1j+`GdViQZZ`&{sfcO3i1MONG&DbpsVl+Ss1WD1M3vs3>i7-X7BxS?@ zzSP6EWGjH9J8u#}eY*D@si8KaWI`)xB71J%9@>|M+kY1tLRfrTfK$tE%kuM=#n(^z z-LKdhq9{3py%F5Yf3*xPDNkFXvgTtjp{c$;d8 z!L=<=&>{&beSaUzB5V^-bmZJnaJy)sh1O2nWQ>!{q}0APUWpw0mp%3mucron7zKni zLb@21M<+U;YEsJ&*D+5uh8()8W9@H=ZnFN&q}TtUw00BNiw*I~zniUtiadMa}6p^`i6H`L%Z z`n$bd@RP%P@7@64%*)ElO7&WVgrRT1&@12z{8g~%HlR%*17{=#vu|)$ns;0 zrXmtV?yz7`Mczdbg1*b87D4HAM1;TWQ%?{jw&|Q>nClievQNDBml;nD1~uAEkeIMl z1tudCt*ORzFl@`7V$OENZ)t+{xwboOs7#PpJXNmot@L4b|M;sM$vNPHgYMavMC9Cm z2^`J)%|o4LQ3tUk{lRJGzr`;QP4ReKy>Bk?9tRgumjQ6RzPXyidc7wu5wOVa-UA1I Oqfz+{q49r87B!4H?qkgW delta 467 zcmV;^0WAK?2Ezo9dVkj4PQxG+0N{I{qKV$xMK8TmGoy(n#ytQzqo*wyJs{ATy}k5j z-CAc-h24z>z8-$g0SPtnGUZYrx%9PdJ+_TR@9ww+Ym=J&@_*@{X7GL^SPA`4r^1*8%(Mq2rYb& zX!^6v?bd_5lYeuH;dZAbE?R4;{9+tpj;i*xaV9z5-*nmk_&8kP`=ON^95xI|E4xT1k? zpb%6rx6={4=BX|WR@hhfKWIb7+&6EC<rL3 diff --git a/search/search_index.json b/search/search_index.json index 9829d95a..c73a0521 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Scale Launch","text":"

      Simple, scalable, and high performance ML service deployment in python.

      "},{"location":"#example","title":"Example","text":"Launch Usage
      import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"MY_TEAM\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

      What's going on here:

      • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
      • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
      • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
      • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
      • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

      Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

      "},{"location":"#installation","title":"Installation","text":"

      To use Scale Launch, first install it using pip:

      Installation
      pip install -U scale-launch\n
      "},{"location":"cli/","title":"CLI","text":"

      Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

      The CLI can be used as scale-launch ....

      "},{"location":"cli/#help","title":"Help","text":"

      Run scale-launch --help for more options.

      scale-launch --help
          This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your API key and other configuration options\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
      "},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
      LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

      Scale Launch Python Client.

      Initializes a Scale Launch Client.

      Parameters:

      Name Type Description Default api_key str

      Your Scale API key

      required endpoint Optional[str]

      The Scale Launch Endpoint (this should not need to be changed)

      None self_hosted bool

      True iff you are connecting to a self-hosted Scale Launch

      False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
      batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

      Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

      Must have exactly one of urls or inputs passed in.

      Parameters:

      Name Type Description Default model_bundle Union[ModelBundle, str]

      The bundle or the name of a the bundle to use for inference.

      required urls List[str]

      A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

      None inputs Optional[List[Dict[str, Any]]]

      A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

      None batch_url_file_location Optional[str]

      In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

      None serialization_format str

      Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

      'JSON' labels Optional[Dict[str, str]]

      An optional dictionary of key/value pairs to associate with this endpoint.

      None cpus Optional[int]

      Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

      None memory Optional[str]

      Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

      None storage Optional[str]

      Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

      None gpus Optional[int]

      Number of gpus each worker should get, e.g. 0, 1, etc.

      None max_workers Optional[int]

      The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

      None per_worker Optional[int]

      The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

      • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
      • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
      None gpu_type Optional[str]

      If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

      • nvidia-tesla-t4
      • nvidia-ampere-a10
      None

      Returns:

      Type Description Dict[str, Any]

      A dictionary that contains job_id as a key, and the ID as the value.

      "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
      clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n

      Clones an existing model bundle with changes to its app config. (More fields coming soon)

      Parameters:

      Name Type Description Default model_bundle Union[ModelBundle, str]

      The existing bundle or its ID.

      required app_config Optional[Dict]

      The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

      None

      Returns:

      Type Description ModelBundle

      A ModelBundle object

      "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes_v2","title":"clone_model_bundle_with_changes_v2","text":"
      clone_model_bundle_with_changes_v2(\noriginal_model_bundle_id: str,\nnew_app_config: Optional[Dict[str, Any]] = None,\n) -> Dict[str, Any]\n

      Clone a model bundle with an optional new app_config.

      Parameters:

      Name Type Description Default original_model_bundle_id str

      The ID of the model bundle you want to clone.

      required new_app_config Optional[Dict[str, Any]]

      A dictionary of new app config values to use for the cloned model.

      None

      Returns:

      Type Description Dict[str, Any]

      A dictionary containing the following keys:

      • model_bundle_id: The ID of the cloned model bundle.
      "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
      create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n
      Warning

      This method is deprecated. Use create_model_bundle_from_callable_v2 instead.

      Parameters:

      Name Type Description Default model_bundle_name str

      The name of the model bundle you want to create. The name must be unique across all bundles that you own.

      required predict_fn_or_cls Optional[Callable[[Any], Any]]

      Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

      None model Optional[LaunchModel_T]

      Typically a trained Neural Network, e.g. a Pytorch module.

      Exactly one of model and load_model_fn must be provided.

      None load_model_fn Optional[Callable[[], LaunchModel_T]]

      A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

      Exactly one of model and load_model_fn must be provided.

      None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

      Function that, when called with a model, returns a function that carries out inference.

      If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

      Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

      In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

      None requirements Optional[List[str]]

      A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

      [\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

      If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

      None app_config Optional[Union[Dict[str, Any], str]]

      Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

      None env_params Dict[str, str]

      A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

      • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

        .. code-block:: python

        { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

      • Tensorflow fields:

        • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
      required globals_copy Optional[Dict[str, Any]]

      Dictionary of the global symbol table. Normally provided by globals() built-in function.

      None request_schema Optional[Type[BaseModel]]

      A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

      None response_schema Optional[Type[BaseModel]]

      A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

      None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_callable_v2","title":"create_model_bundle_from_callable_v2","text":"
      create_model_bundle_from_callable_v2(\n*,\nmodel_bundle_name: str,\nload_predict_fn: Callable[\n[LaunchModel_T], Callable[[Any], Any]\n],\nload_model_fn: Callable[[], LaunchModel_T],\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrequirements: Optional[List[str]] = None,\npytorch_image_tag: Optional[str] = None,\ntensorflow_version: Optional[str] = None,\ncustom_base_image_repository: Optional[str] = None,\ncustom_base_image_tag: Optional[str] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None\n) -> Dict[str, Any]\n

      Uploads and registers a model bundle to Scale Launch.

      Parameters:

      Name Type Description Default model_bundle_name str

      Name of the model bundle.

      required load_predict_fn Callable[[LaunchModel_T], Callable[[Any], Any]]

      Function that takes in a model and returns a predict function. When your model bundle is deployed, this predict function will be called as follows:

      input = {\"input\": \"some input\"} # or whatever your request schema is.\n\ndef load_model_fn():\n    # load model\n    return model\n\ndef load_predict_fn(model, app_config=None):\n    def predict_fn(input):\n        # do pre-processing\n        output = model(input)\n        # do post-processing\n        return output\n    return predict_fn\n\npredict_fn = load_predict_fn(load_model_fn(), app_config=optional_app_config)\nresponse = predict_fn(input)\n

      required load_model_fn Callable[[], LaunchModel_T]

      A function that, when run, loads a model.

      required request_schema Type[BaseModel]

      A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

      required response_schema Type[BaseModel]

      A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint.

      required requirements Optional[List[str]]

      List of pip requirements.

      None pytorch_image_tag Optional[str]

      The image tag for the PyTorch image that will be used to run the bundle. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

      None tensorflow_version Optional[str]

      The version of TensorFlow that will be used to run the bundle. If not specified, the default version will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

      None custom_base_image_repository Optional[str]

      The repository for a custom base image that will be used to run the bundle. If not specified, the default base image will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

      None custom_base_image_tag Optional[str]

      The tag for a custom base image that will be used to run the bundle. Must be specified if custom_base_image_repository is specified.

      None app_config Optional[Union[Dict[str, Any], str]]

      An optional dictionary of configuration values that will be passed to the bundle when it is run. These values can be accessed by the bundle via the app_config global variable.

      None

      Returns:

      Type Description Dict[str, Any]

      A dictionary containing the following keys:

      • model_bundle_id: The ID of the created model bundle.
      "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
      create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n
      Warning

      This method is deprecated. Use create_model_bundle_from_dirs_v2 instead.

      Parameters:

      Name Type Description Default model_bundle_name str

      The name of the model bundle you want to create. The name must be unique across all bundles that you own.

      required base_paths List[str]

      The paths on the local filesystem where the bundle code lives.

      required requirements_path str

      A path on the local filesystem where a requirements.txt file lives.

      required env_params Dict[str, str]

      A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

      • framework_type: either tensorflow or pytorch.
      • PyTorch fields:
        • pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags

      Example:

      {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\",\n}\n

      required load_predict_fn_module_path str

      A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

      required load_model_fn_module_path str

      A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

      required app_config Optional[Union[Dict[str, Any], str]]

      Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

      None request_schema Optional[Type[BaseModel]]

      A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

      None response_schema Optional[Type[BaseModel]]

      A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

      None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs_v2","title":"create_model_bundle_from_dirs_v2","text":"
      create_model_bundle_from_dirs_v2(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrequirements_path: str,\npytorch_image_tag: Optional[str] = None,\ntensorflow_version: Optional[str] = None,\ncustom_base_image_repository: Optional[str] = None,\ncustom_base_image_tag: Optional[str] = None,\napp_config: Optional[Dict[str, Any]] = None\n) -> Dict[str, Any]\n

      Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

      For example, if you have a directory structure like so, and your current working directory is my_root:

         my_root/\n       my_module1/\n           __init__.py\n           ...files and directories\n           my_inference_file.py\n       my_module2/\n           __init__.py\n           ...files and directories\n

      then calling create_model_bundle_from_dirs_v2 with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

         my_module1/\n       __init__.py\n       ...files and directories\n       my_inference_file.py\n   my_module2/\n       __init__.py\n       ...files and directories\n

      and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

      Parameters:

      Name Type Description Default model_bundle_name str

      The name of the model bundle you want to create.

      required base_paths List[str]

      A list of paths to directories that will be zipped up and uploaded as a bundle. Each path must be relative to the current working directory.

      required load_predict_fn_module_path str

      The Python module path to the function that will be used to load the model for inference. This function should take in a path to a model directory, and return a model object. The model object should be pickleable.

      required load_model_fn_module_path str

      The Python module path to the function that will be used to load the model for training. This function should take in a path to a model directory, and return a model object. The model object should be pickleable.

      required request_schema Type[BaseModel]

      A Pydantic model that defines the request schema for the bundle.

      required response_schema Type[BaseModel]

      A Pydantic model that defines the response schema for the bundle.

      required requirements_path str

      Path to a requirements.txt file that will be used to install dependencies for the bundle. This file must be relative to the current working directory.

      required pytorch_image_tag Optional[str]

      The image tag for the PyTorch image that will be used to run the bundle. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

      None tensorflow_version Optional[str]

      The version of TensorFlow that will be used to run the bundle. If not specified, the default version will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

      None custom_base_image_repository Optional[str]

      The repository for a custom base image that will be used to run the bundle. If not specified, the default base image will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

      None custom_base_image_tag Optional[str]

      The tag for a custom base image that will be used to run the bundle. Must be specified if custom_base_image_repository is specified.

      None app_config Optional[Dict[str, Any]]

      An optional dictionary of configuration values that will be passed to the bundle when it is run. These values can be accessed by the bundle via the app_config global variable.

      None

      Returns:

      Type Description Dict[str, Any]

      A dictionary containing the following keys:

      • model_bundle_id: The ID of the created model bundle.
      "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_runnable_image_v2","title":"create_model_bundle_from_runnable_image_v2","text":"
      create_model_bundle_from_runnable_image_v2(\n*,\nmodel_bundle_name: str,\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrepository: str,\ntag: str,\ncommand: List[str],\nenv: Dict[str, str]\n) -> Dict[str, Any]\n

      Create a model bundle from a runnable image. The specified command must start a process that will listen for requests on port 5005 using HTTP.

      Parameters:

      Name Type Description Default model_bundle_name str

      The name of the model bundle you want to create.

      required request_schema Type[BaseModel]

      A Pydantic model that defines the request schema for the bundle.

      required response_schema Type[BaseModel]

      A Pydantic model that defines the response schema for the bundle.

      required repository str

      The name of the Docker repository for the runnable image.

      required tag str

      The tag for the runnable image.

      required command List[str]

      The command that will be used to start the process that listens for requests.

      required env Dict[str, str]

      A dictionary of environment variables that will be passed to the bundle when it is run.

      required

      Returns:

      Type Description Dict[str, Any]

      A dictionary containing the following keys:

      • model_bundle_id: The ID of the created model bundle.
      "},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
      create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\nhigh_priority: Optional[bool] = False,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

      Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

      Parameters:

      Name Type Description Default endpoint_name str

      The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

      required model_bundle Union[ModelBundle, str]

      The ModelBundle that the endpoint should serve.

      required cpus int

      Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

      3 memory str

      Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

      '8Gi' storage Optional[str]

      Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

      None gpus int

      Number of gpus each worker should get, e.g. 0, 1, etc.

      0 min_workers int

      The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

      1 max_workers int

      The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

      1 per_worker int

      The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

      • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

      Here is our recommendation for computing per_worker:

      1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
      10 gpu_type Optional[str]

      If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

      • nvidia-tesla-t4
      • nvidia-ampere-a10
      None endpoint_type str

      Either \"sync\" or \"async\".

      'sync' high_priority Optional[bool]

      Either True or False. Enabling this will allow the created endpoint to leverage the shared pool of prewarmed nodes for faster spinup time.

      False post_inference_hooks Optional[List[PostInferenceHooks]]

      List of hooks to trigger after inference tasks are served.

      None default_callback_url Optional[str]

      The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

      None default_callback_auth_kind Optional[Literal[basic, mtls]]

      The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

      None default_callback_auth_username Optional[str]

      The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

      None default_callback_auth_password Optional[str]

      The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

      None default_callback_auth_cert Optional[str]

      The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

      None default_callback_auth_key Optional[str]

      The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

      None update_if_exists bool

      If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

      False labels Optional[Dict[str, str]]

      An optional dictionary of key/value pairs to associate with this endpoint.

      None

      Returns:

      Type Description Optional[Endpoint]

      A Endpoint object that can be used to make requests to the endpoint.

      "},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
      delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

      Deletes a model endpoint.

      Parameters:

      Name Type Description Default model_endpoint Union[ModelEndpoint, str]

      A ModelEndpoint object.

      required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
      edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\nhigh_priority: Optional[bool] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None\n) -> None\n

      Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

      • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

      Parameters:

      Name Type Description Default model_endpoint Union[ModelEndpoint, str]

      The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

      required model_bundle Optional[Union[ModelBundle, str]]

      The ModelBundle that the endpoint should serve.

      None cpus Optional[float]

      Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

      None memory Optional[str]

      Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

      None storage Optional[str]

      Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

      None gpus Optional[int]

      Number of gpus each worker should get, e.g. 0, 1, etc.

      None min_workers Optional[int]

      The minimum number of workers. Must be greater than or equal to 0.

      None max_workers Optional[int]

      The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

      None per_worker Optional[int]

      The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

      • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
      None gpu_type Optional[str]

      If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

      • nvidia-tesla-t4
      • nvidia-ampere-a10
      None high_priority Optional[bool]

      Either True or False. Enabling this will allow the created endpoint to leverage the shared pool of prewarmed nodes for faster spinup time.

      None post_inference_hooks Optional[List[PostInferenceHooks]]

      List of hooks to trigger after inference tasks are served.

      None default_callback_url Optional[str]

      The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

      None default_callback_auth_kind Optional[Literal[basic, mtls]]

      The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

      None default_callback_auth_username Optional[str]

      The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

      None default_callback_auth_password Optional[str]

      The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

      None default_callback_auth_cert Optional[str]

      The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

      None default_callback_auth_key Optional[str]

      The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

      None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
      get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

      Gets inference results from a previously created batch job.

      Parameters:

      Name Type Description Default batch_job_id str

      An id representing the batch task job. This id is the in the response from calling batch_async_request.

      required

      Returns:

      Type Description Dict[str, Any]

      A dictionary that contains the following fields:

      Dict[str, Any]
      • status: The status of the job.
      Dict[str, Any]
      • result: The url where the result is stored.
      Dict[str, Any]
      • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
      Dict[str, Any]
      • num_tasks_pending: The number of tasks that are still pending.
      Dict[str, Any]
      • num_tasks_completed: The number of tasks that have completed.
      "},{"location":"api/client/#launch.client.LaunchClient.get_latest_model_bundle_v2","title":"get_latest_model_bundle_v2","text":"
      get_latest_model_bundle_v2(\nmodel_bundle_name: str,\n) -> Dict[str, Any]\n

      Get the latest version of a model bundle.

      Parameters:

      Name Type Description Default model_bundle_name str

      The name of the model bundle you want to get.

      required

      Returns:

      Type Description Dict[str, Any]

      A dictionary containing the following keys:

      • id: The ID of the model bundle.
      • name: The name of the model bundle.
      • schema_location: The location of the schema for the model bundle.
      • flavor: The flavor of the model bundle. Either RunnableImage, CloudpickleArtifact, or ZipArtifact.
      • created_at: The time the model bundle was created.
      • metadata: A dictionary of metadata associated with the model bundle.
      • model_artifact_ids: A list of IDs of model artifacts associated with the bundle.
      "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
      get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

      Returns a model bundle specified by bundle_name that the user owns.

      Parameters:

      Name Type Description Default model_bundle Union[ModelBundle, str]

      The bundle or its name.

      required

      Returns:

      Type Description ModelBundle

      A ModelBundle object

      "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle_v2","title":"get_model_bundle_v2","text":"
      get_model_bundle_v2(model_bundle_id: str) -> Dict[str, Any]\n

      Get a model bundle.

      Parameters:

      Name Type Description Default model_bundle_id str

      The ID of the model bundle you want to get.

      required

      Returns:

      Type Description Dict[str, Any]

      A dictionary containing the following keys:

      • id: The ID of the model bundle.
      • name: The name of the model bundle.
      • schema_location: The location of the schema for the model bundle.
      • flavor: The flavor of the model bundle. Either RunnableImage, CloudpickleArtifact, or ZipArtifact.
      • created_at: The time the model bundle was created.
      • metadata: A dictionary of metadata associated with the model bundle.
      • model_artifact_ids: A list of IDs of model artifacts associated with the bundle.
      "},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
      get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

      Gets a model endpoint associated with a name.

      Parameters:

      Name Type Description Default endpoint_name str

      The name of the endpoint to retrieve.

      required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
      list_model_bundles() -> List[ModelBundle]\n

      Returns a list of model bundles that the user owns.

      Returns:

      Type Description List[ModelBundle]

      A list of ModelBundle objects

      "},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles_v2","title":"list_model_bundles_v2","text":"
      list_model_bundles_v2() -> List[Dict[str, Any]]\n

      List all model bundles.

      Returns:

      Type Description List[Dict[str, Any]]

      A list of dictionaries containing the following keys:

      • id: The ID of the model bundle.
      • name: The name of the model bundle.
      • schema_location: The location of the schema for the model bundle.
      • flavor: The flavor of the model bundle. Either RunnableImage, CloudpickleArtifact, or ZipArtifact.
      • created_at: The time the model bundle was created.
      • metadata: A dictionary of metadata associated with the model bundle.
      • model_artifact_ids: A list of IDs of model artifacts associated with the bundle.
      "},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
      list_model_endpoints() -> List[Endpoint]\n

      Lists all model endpoints that the user owns.

      Returns:

      Type Description List[Endpoint]

      A list of ModelEndpoint objects.

      "},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
      read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

      Retrieves the logs for the creation of the endpoint.

      Parameters:

      Name Type Description Default model_endpoint Union[ModelEndpoint, str]

      The endpoint or its name.

      required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
      register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

      For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

      Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

      Parameters:

      Name Type Description Default batch_csv_location_fn Callable[[], str]

      Function that generates batch_csv_urls for upload_batch_csv_fn.

      required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
      register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

      For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

      Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

      Parameters:

      Name Type Description Default bundle_location_fn Callable[[], str]

      Function that generates bundle_urls for upload_bundle_fn.

      required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
      register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

      For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

      upload_batch_csv_fn(csv_text, csv_url)\n

      This function should directly write the contents of csv_text as a text string into csv_url.

      Parameters:

      Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

      Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

      required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
      register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

      For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

      upload_bundle_fn(serialized_bundle, bundle_url)\n

      This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

      See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

      Parameters:

      Name Type Description Default upload_bundle_fn Callable[[str, str], None]

      Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

      required"},{"location":"api/endpoint_predictions/","title":"Endpoint Predictions","text":""},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
      EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

      Represents a single request to either a SyncEndpoint or AsyncEndpoint.

      Parameters:

      Name Type Description Default url Optional[str]

      A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

      Exactly one of url and args must be specified.

      None args Optional[Dict]

      A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

      Exactly one of url and args must be specified.

      None return_pickled Optional[bool]

      Whether the output should be a pickled python object, or directly returned serialized json.

      False callback_url Optional[str]

      The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

      None callback_auth_kind Optional[Literal[basic, mtls]]

      The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

      None callback_auth_username Optional[str]

      The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

      None callback_auth_password Optional[str]

      The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

      None callback_auth_cert Optional[str]

      The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

      None callback_auth_key Optional[str]

      The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

      None request_id Optional[str]

      (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

      None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
      EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

      Represents a response received from a Endpoint.

      Parameters:

      Name Type Description Default client

      An instance of LaunchClient.

      required status str

      A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

      required result_url Optional[str]

      A string that is a url containing the pickled python object from the Endpoint's predict function.

      Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

      None result Optional[str]

      A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

      Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

      None traceback Optional[str]

      The stack trace if the inference endpoint raised an error. Can be used for debugging

      None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
      EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

      Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

      This object should not be directly instantiated by the user.

      Parameters:

      Name Type Description Default client

      An instance of LaunchClient.

      required endpoint_name str

      The name of the endpoint.

      required async_task_id str

      An async task id.

      required"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
      get(timeout: Optional[float] = None) -> EndpointResponse\n

      Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

      Parameters:

      Name Type Description Default timeout Optional[float]

      The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

      None"},{"location":"api/hooks/","title":"Hooks","text":""},{"location":"api/hooks/#launch.hooks.PostInferenceHooks","title":"PostInferenceHooks","text":"

      Bases: str, Enum

      Post-inference hooks are functions that are called after inference is complete.

      Attributes:

      Name Type Description CALLBACK str

      The callback hook is called with the inference response and the task ID.

      "},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

      Represents a ModelBundle.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
      app_config: Optional[Dict[Any, Any]] = None\n

      An optional user-specified configuration mapping for the bundle.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
      env_params: Optional[Dict[str, str]] = None\n

      A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
      id: Optional[str] = None\n

      A globally unique identifier for the bundle.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
      location: Optional[str] = None\n

      An opaque location for the bundle.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
      metadata: Optional[Dict[Any, Any]] = None\n

      Arbitrary metadata for the bundle.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
      name: str\n

      The name of the bundle. Must be unique across all bundles that the user owns.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
      packaging_type: Optional[str] = None\n

      The packaging type for the bundle. Can be cloudpickle or zip.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
      requirements: Optional[List[str]] = None\n

      A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

      "},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

      All classes here are returned by the get_model_endpoint method and provide a predict function.

      "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
      AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

      Bases: Endpoint

      An asynchronous model endpoint.

      Parameters:

      Name Type Description Default model_endpoint ModelEndpoint

      ModelEndpoint object.

      required client

      A LaunchClient object

      required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
      predict(request: EndpointRequest) -> EndpointResponseFuture\n

      Runs an asynchronous prediction request.

      Parameters:

      Name Type Description Default request EndpointRequest

      The EndpointRequest object that contains the payload.

      required

      Returns:

      Name Type Description EndpointResponseFuture

      An EndpointResponseFuture such the user can use to query the status of the request.

      Example EndpointResponseFuture EndpointResponseFuture

      .. code-block:: python

      my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

      "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
      predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

      (deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

      Parameters:

      Name Type Description Default requests Sequence[EndpointRequest]

      List of EndpointRequests. Request_ids must all be distinct.

      required

      Returns:

      Type Description AsyncEndpointBatchResponse

      an AsyncEndpointResponse keeping track of the inference requests made

      "},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint","title":"SyncEndpoint","text":"
      SyncEndpoint(model_endpoint: ModelEndpoint, client)\n

      Bases: Endpoint

      A synchronous model endpoint.

      Parameters:

      Name Type Description Default model_endpoint ModelEndpoint

      ModelEndpoint object.

      required client

      A LaunchClient object

      required"},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint.predict","title":"predict","text":"
      predict(request: EndpointRequest) -> EndpointResponse\n

      Runs a synchronous prediction request.

      Parameters:

      Name Type Description Default request EndpointRequest

      The EndpointRequest object that contains the payload.

      required"},{"location":"concepts/batch_jobs/","title":"Batch Jobs","text":"

      For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

      Batch jobs are created using the batch_async_request method of the LaunchClient.

      Creating and Following a Batch Job
      import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n}\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
      "},{"location":"concepts/callbacks/","title":"Callbacks","text":"

      Async model endpoints can be configured to send callbacks to a user-defined callback URL. Callbacks are sent as HTTP POST requests with a JSON body. The following code snippet shows how to create an async model endpoint with a callback URL.

      To configure an async endpoint to send callbacks, set the post_inference_hooks field to include launch.PostInferenceHooks.CALLBACK. A callback URL also needs to be specified, and it can be configured as a default using the default_callback_url argument to launch.LaunchClient.create_model_endpoint or as a per-task override using the callback_url field of launch.EndpointRequest.

      Note

      Callbacks will not be sent if the endpoint does not have any post-inference hooks specified, even if a default_callback_url is provided to the endpoint creation method or if the prediction request has a callback_url override.

      Creating an Async Model Endpoint with a Callback URL
      import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 7\n}\n\"\"\"\nfuture_custom_callback_url = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"}, callback_url=\"https://example.com/custom\"\n),\n)\n\"\"\"\nA callback is sent to https://example.com/custom with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 8\n}\n\"\"\"\n
      "},{"location":"concepts/callbacks/#authentication-for-callbacks","title":"Authentication for callbacks","text":"

      Warning

      This feature is currently in beta, and the API is likely to change.

      Callbacks can be authenticated using shared authentication headers. To enable authentication, set either default_callback_auth_kind when creating the endpoint or callback_auth_kind when making a prediction request.

      Currently, the supported authentication methods are basic and mtls. If basic is used, then the default_callback_auth_username and default_callback_auth_password fields must be specified when creating the endpoint, or the callback_auth_username and callback_auth_password fields must be specified when making a prediction request. If mtls is used, then the same is true for the default_callback_auth_cert and default_callback_auth_key fields, or the callback_auth_cert and callback_auth_key fields.

      Creating an Async Model Endpoint with custom Callback auth
      import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\ndefault_callback_auth_kind=\"basic\",\ndefault_callback_auth_username=\"user\",\ndefault_callback_auth_password=\"password\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with (\"user\", \"password\") as the basic auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"mtls\", \ncallback_auth_cert=\"cert\", \ncallback_auth_key=\"key\",\n),\n)\n\"\"\"\nA callback is sent with mTLS authentication.\n\"\"\"\nclient.edit_model_endpoint(\nmodel_endpoint=endpoint.model_endpoint,\ndefault_callback_auth_kind=\"mtls\",\ndefault_callback_auth_cert=\"cert\",\ndefault_callback_auth_key=\"key\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent with mTLS auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"basic\",\ncallback_auth_username=\"user\",\ncallback_auth_password=\"pass\",\n),\n)\n\"\"\"\nA callback is sent with (\"user\", \"pass\") as the basic auth.\n\"\"\"\n
      "},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

      Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

      Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
      import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
      import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
      "},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
      EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

      Represents a single request to either a SyncEndpoint or AsyncEndpoint.

      Parameters:

      Name Type Description Default url Optional[str]

      A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

      Exactly one of url and args must be specified.

      None args Optional[Dict]

      A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

      Exactly one of url and args must be specified.

      None return_pickled Optional[bool]

      Whether the output should be a pickled python object, or directly returned serialized json.

      False callback_url Optional[str]

      The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

      None callback_auth_kind Optional[Literal[basic, mtls]]

      The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

      None callback_auth_username Optional[str]

      The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

      None callback_auth_password Optional[str]

      The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

      None callback_auth_cert Optional[str]

      The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

      None callback_auth_key Optional[str]

      The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

      None request_id Optional[str]

      (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

      None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
      EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

      Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

      This object should not be directly instantiated by the user.

      Parameters:

      Name Type Description Default client

      An instance of LaunchClient.

      required endpoint_name str

      The name of the endpoint.

      required async_task_id str

      An async task id.

      required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
      get(timeout: Optional[float] = None) -> EndpointResponse\n

      Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

      Parameters:

      Name Type Description Default timeout Optional[float]

      The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

      None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
      EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

      Represents a response received from a Endpoint.

      Parameters:

      Name Type Description Default client

      An instance of LaunchClient.

      required status str

      A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

      required result_url Optional[str]

      A string that is a url containing the pickled python object from the Endpoint's predict function.

      Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

      None result Optional[str]

      A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

      Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

      None traceback Optional[str]

      The stack trace if the inference endpoint raised an error. Can be used for debugging

      None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

      Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

      "},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

      There are two methods for creating model bundles: create_model_bundle and create_model_bundle_from_dirs. The former directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The latter takes in directories containing a load_predict_fn and the module path to the load_predict_fn.

      Creating a Model Bundle DirectlyCreating a Model Bundle from Directories
      import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n
      import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\npytest==7.2.1\nnumpy\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"requirements_path\": \"requirements.txt\",\n\"env_params\": ENV_PARAMS,\n\"load_predict_fn\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle_from_dirs(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
      "},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

      The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

      Creating Model Bundles with app_config
      import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Union\nfrom typing_extensions import Literal\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"batched\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)\n
      "},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

      Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes.

      "},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

      To list all the model bundles you own, use list_model_bundles.

      "},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

      Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

      Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

      Info

      "},{"location":"concepts/model_endpoints/#choosing-the-right-inference-mode","title":"Choosing the right inference mode","text":"

      Here are some tips for how to choose between SyncEndpoint, AsyncEndpoint, and BatchJob for deploying your ModelBundle:

      A SyncEndpoint is good if:

      • You have strict latency requirements (e.g. on the order of seconds or less).
      • You are willing to have resources continually allocated.

      An AsyncEndpoint is good if:

      • You want to save on compute costs.
      • Your inference code takes a long time to run.
      • Your latency requirements are on the order of minutes.

      A BatchJob is good if:

      • You know there is a large batch of inputs ahead of time.
      • You want to optimize for throughput instead of latency.
      "},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

      Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

      Creating an Async Model Endpoint
      import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
      "},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

      Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints.

      Note

      Sync model endpoints require at least 1 min_worker.

      Creating a Sync Model Endpoint
      import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
      "},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

      Model endpoints can be listed, updated, and deleted using the Launch API.

      Listing Model Endpoints
      import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
      Updating a Model Endpoint
      import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
      Deleting a Model Endpoint
      import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
      "},{"location":"concepts/overview/","title":"Overview","text":"

      Creating deployments on Launch generally involves three steps:

      1. Create and upload a ModelBundle. Pass your trained model as well as pre-/post-processing code to the Scale Launch Python client, and we\u2019ll create a model bundle based on the code and store it in our Bundle Store.

      2. Create a ModelEndpoint. Pass a ModelBundle as well as infrastructure settings such as the desired number of GPUs to our client. This provisions resources on Scale\u2019s cluster dedicated to your ModelEndpoint.

      3. Make requests to the ModelEndpoint. You can make requests through the Python client, or make HTTP requests directly to Scale.

      "}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Scale Launch","text":"

      Simple, scalable, and high performance ML service deployment in python.

      "},{"location":"#example","title":"Example","text":"Launch Usage
      import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"MY_TEAM\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

      What's going on here:

      • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
      • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
      • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
      • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
      • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

      Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

      "},{"location":"#installation","title":"Installation","text":"

      To use Scale Launch, first install it using pip:

      Installation
      pip install -U scale-launch\n
      "},{"location":"cli/","title":"CLI","text":"

      Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

      The CLI can be used as scale-launch ....

      "},{"location":"cli/#help","title":"Help","text":"

      Run scale-launch --help for more options.

      scale-launch --help
          This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your API key and other configuration options\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
      "},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
      LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

      Scale Launch Python Client.

      Initializes a Scale Launch Client.

      Parameters:

      Name Type Description Default api_key str

      Your Scale API key

      required endpoint Optional[str]

      The Scale Launch Endpoint (this should not need to be changed)

      None self_hosted bool

      True iff you are connecting to a self-hosted Scale Launch

      False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
      batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

      Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

      Must have exactly one of urls or inputs passed in.

      Parameters:

      Name Type Description Default model_bundle Union[ModelBundle, str]

      The bundle or the name of a the bundle to use for inference.

      required urls List[str]

      A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

      None inputs Optional[List[Dict[str, Any]]]

      A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

      None batch_url_file_location Optional[str]

      In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

      None serialization_format str

      Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

      'JSON' labels Optional[Dict[str, str]]

      An optional dictionary of key/value pairs to associate with this endpoint.

      None cpus Optional[int]

      Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

      None memory Optional[str]

      Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

      None storage Optional[str]

      Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

      None gpus Optional[int]

      Number of gpus each worker should get, e.g. 0, 1, etc.

      None max_workers Optional[int]

      The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

      None per_worker Optional[int]

      The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

      • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
      • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
      None gpu_type Optional[str]

      If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

      • nvidia-tesla-t4
      • nvidia-ampere-a10
      None

      Returns:

      Type Description Dict[str, Any]

      A dictionary that contains job_id as a key, and the ID as the value.

      "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
      clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n
      Warning

      This method is deprecated. Use clone_model_bundle_with_changes_v2 instead.

      Parameters:

      Name Type Description Default model_bundle Union[ModelBundle, str]

      The existing bundle or its ID.

      required app_config Optional[Dict]

      The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

      None

      Returns:

      Type Description ModelBundle

      A ModelBundle object

      "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes_v2","title":"clone_model_bundle_with_changes_v2","text":"
      clone_model_bundle_with_changes_v2(\noriginal_model_bundle_id: str,\nnew_app_config: Optional[Dict[str, Any]] = None,\n) -> CreateModelBundleV2Response\n

      Clone a model bundle with an optional new app_config.

      Parameters:

      Name Type Description Default original_model_bundle_id str

      The ID of the model bundle you want to clone.

      required new_app_config Optional[Dict[str, Any]]

      A dictionary of new app config values to use for the cloned model.

      None

      Returns:

      Type Description CreateModelBundleV2Response

      An object containing the following keys:

      • model_bundle_id: The ID of the cloned model bundle.
      "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
      create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n
      Warning

      This method is deprecated. Use create_model_bundle_from_callable_v2 instead.

      Parameters:

      Name Type Description Default model_bundle_name str

      The name of the model bundle you want to create. The name must be unique across all bundles that you own.

      required predict_fn_or_cls Optional[Callable[[Any], Any]]

      Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

      None model Optional[LaunchModel_T]

      Typically a trained Neural Network, e.g. a Pytorch module.

      Exactly one of model and load_model_fn must be provided.

      None load_model_fn Optional[Callable[[], LaunchModel_T]]

      A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

      Exactly one of model and load_model_fn must be provided.

      None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

      Function that, when called with a model, returns a function that carries out inference.

      If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

      Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

      In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

      None requirements Optional[List[str]]

      A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

      [\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

      If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

      None app_config Optional[Union[Dict[str, Any], str]]

      Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

      None env_params Dict[str, str]

      A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

      • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

        .. code-block:: python

        { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

      • Tensorflow fields:

        • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
      required globals_copy Optional[Dict[str, Any]]

      Dictionary of the global symbol table. Normally provided by globals() built-in function.

      None request_schema Optional[Type[BaseModel]]

      A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

      None response_schema Optional[Type[BaseModel]]

      A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

      None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_callable_v2","title":"create_model_bundle_from_callable_v2","text":"
      create_model_bundle_from_callable_v2(\n*,\nmodel_bundle_name: str,\nload_predict_fn: Callable[\n[LaunchModel_T], Callable[[Any], Any]\n],\nload_model_fn: Callable[[], LaunchModel_T],\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrequirements: Optional[List[str]] = None,\npytorch_image_tag: Optional[str] = None,\ntensorflow_version: Optional[str] = None,\ncustom_base_image_repository: Optional[str] = None,\ncustom_base_image_tag: Optional[str] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None\n) -> CreateModelBundleV2Response\n

      Uploads and registers a model bundle to Scale Launch.

      Parameters:

      Name Type Description Default model_bundle_name str

      Name of the model bundle.

      required load_predict_fn Callable[[LaunchModel_T], Callable[[Any], Any]]

      Function that takes in a model and returns a predict function. When your model bundle is deployed, this predict function will be called as follows:

      input = {\"input\": \"some input\"} # or whatever your request schema is.\n\ndef load_model_fn():\n    # load model\n    return model\n\ndef load_predict_fn(model, app_config=None):\n    def predict_fn(input):\n        # do pre-processing\n        output = model(input)\n        # do post-processing\n        return output\n    return predict_fn\n\npredict_fn = load_predict_fn(load_model_fn(), app_config=optional_app_config)\nresponse = predict_fn(input)\n

      required load_model_fn Callable[[], LaunchModel_T]

      A function that, when run, loads a model.

      required request_schema Type[BaseModel]

      A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

      required response_schema Type[BaseModel]

      A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint.

      required requirements Optional[List[str]]

      List of pip requirements.

      None pytorch_image_tag Optional[str]

      The image tag for the PyTorch image that will be used to run the bundle. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

      None tensorflow_version Optional[str]

      The version of TensorFlow that will be used to run the bundle. If not specified, the default version will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

      None custom_base_image_repository Optional[str]

      The repository for a custom base image that will be used to run the bundle. If not specified, the default base image will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

      None custom_base_image_tag Optional[str]

      The tag for a custom base image that will be used to run the bundle. Must be specified if custom_base_image_repository is specified.

      None app_config Optional[Union[Dict[str, Any], str]]

      An optional dictionary of configuration values that will be passed to the bundle when it is run. These values can be accessed by the bundle via the app_config global variable.

      None

      Returns:

      Type Description CreateModelBundleV2Response

      An object containing the following keys:

      • model_bundle_id: The ID of the created model bundle.
      "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
      create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n
      Warning

      This method is deprecated. Use create_model_bundle_from_dirs_v2 instead.

      Parameters:

      Name Type Description Default model_bundle_name str

      The name of the model bundle you want to create. The name must be unique across all bundles that you own.

      required base_paths List[str]

      The paths on the local filesystem where the bundle code lives.

      required requirements_path str

      A path on the local filesystem where a requirements.txt file lives.

      required env_params Dict[str, str]

      A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

      • framework_type: either tensorflow or pytorch.
      • PyTorch fields:
        • pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags

      Example:

      {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\",\n}\n

      required load_predict_fn_module_path str

      A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

      required load_model_fn_module_path str

      A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

      required app_config Optional[Union[Dict[str, Any], str]]

      Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

      None request_schema Optional[Type[BaseModel]]

      A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

      None response_schema Optional[Type[BaseModel]]

      A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

      None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs_v2","title":"create_model_bundle_from_dirs_v2","text":"
      create_model_bundle_from_dirs_v2(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrequirements_path: str,\npytorch_image_tag: Optional[str] = None,\ntensorflow_version: Optional[str] = None,\ncustom_base_image_repository: Optional[str] = None,\ncustom_base_image_tag: Optional[str] = None,\napp_config: Optional[Dict[str, Any]] = None\n) -> CreateModelBundleV2Response\n

      Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

      For example, if you have a directory structure like so, and your current working directory is my_root:

         my_root/\n       my_module1/\n           __init__.py\n           ...files and directories\n           my_inference_file.py\n       my_module2/\n           __init__.py\n           ...files and directories\n

      then calling create_model_bundle_from_dirs_v2 with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

         my_module1/\n       __init__.py\n       ...files and directories\n       my_inference_file.py\n   my_module2/\n       __init__.py\n       ...files and directories\n

      and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

      Parameters:

      Name Type Description Default model_bundle_name str

      The name of the model bundle you want to create.

      required base_paths List[str]

      A list of paths to directories that will be zipped up and uploaded as a bundle. Each path must be relative to the current working directory.

      required load_predict_fn_module_path str

      The Python module path to the function that will be used to load the model for inference. This function should take in a path to a model directory, and return a model object. The model object should be pickleable.

      required load_model_fn_module_path str

      The Python module path to the function that will be used to load the model for training. This function should take in a path to a model directory, and return a model object. The model object should be pickleable.

      required request_schema Type[BaseModel]

      A Pydantic model that defines the request schema for the bundle.

      required response_schema Type[BaseModel]

      A Pydantic model that defines the response schema for the bundle.

      required requirements_path str

      Path to a requirements.txt file that will be used to install dependencies for the bundle. This file must be relative to the current working directory.

      required pytorch_image_tag Optional[str]

      The image tag for the PyTorch image that will be used to run the bundle. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

      None tensorflow_version Optional[str]

      The version of TensorFlow that will be used to run the bundle. If not specified, the default version will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

      None custom_base_image_repository Optional[str]

      The repository for a custom base image that will be used to run the bundle. If not specified, the default base image will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

      None custom_base_image_tag Optional[str]

      The tag for a custom base image that will be used to run the bundle. Must be specified if custom_base_image_repository is specified.

      None app_config Optional[Dict[str, Any]]

      An optional dictionary of configuration values that will be passed to the bundle when it is run. These values can be accessed by the bundle via the app_config global variable.

      None

      Returns:

      Type Description CreateModelBundleV2Response

      An object containing the following keys:

      • model_bundle_id: The ID of the created model bundle.
      "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_runnable_image_v2","title":"create_model_bundle_from_runnable_image_v2","text":"
      create_model_bundle_from_runnable_image_v2(\n*,\nmodel_bundle_name: str,\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrepository: str,\ntag: str,\ncommand: List[str],\nenv: Dict[str, str]\n) -> CreateModelBundleV2Response\n

      Create a model bundle from a runnable image. The specified command must start a process that will listen for requests on port 5005 using HTTP.

      Parameters:

      Name Type Description Default model_bundle_name str

      The name of the model bundle you want to create.

      required request_schema Type[BaseModel]

      A Pydantic model that defines the request schema for the bundle.

      required response_schema Type[BaseModel]

      A Pydantic model that defines the response schema for the bundle.

      required repository str

      The name of the Docker repository for the runnable image.

      required tag str

      The tag for the runnable image.

      required command List[str]

      The command that will be used to start the process that listens for requests.

      required env Dict[str, str]

      A dictionary of environment variables that will be passed to the bundle when it is run.

      required

      Returns:

      Type Description CreateModelBundleV2Response

      An object containing the following keys:

      • model_bundle_id: The ID of the created model bundle.
      "},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
      create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\nhigh_priority: Optional[bool] = False,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

      Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

      Parameters:

      Name Type Description Default endpoint_name str

      The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

      required model_bundle Union[ModelBundle, str]

      The ModelBundle that the endpoint should serve.

      required cpus int

      Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

      3 memory str

      Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

      '8Gi' storage Optional[str]

      Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

      None gpus int

      Number of gpus each worker should get, e.g. 0, 1, etc.

      0 min_workers int

      The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

      1 max_workers int

      The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

      1 per_worker int

      The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

      • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

      Here is our recommendation for computing per_worker:

      1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
      10 gpu_type Optional[str]

      If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

      • nvidia-tesla-t4
      • nvidia-ampere-a10
      None endpoint_type str

      Either \"sync\" or \"async\".

      'sync' high_priority Optional[bool]

      Either True or False. Enabling this will allow the created endpoint to leverage the shared pool of prewarmed nodes for faster spinup time.

      False post_inference_hooks Optional[List[PostInferenceHooks]]

      List of hooks to trigger after inference tasks are served.

      None default_callback_url Optional[str]

      The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

      None default_callback_auth_kind Optional[Literal[basic, mtls]]

      The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

      None default_callback_auth_username Optional[str]

      The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

      None default_callback_auth_password Optional[str]

      The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

      None default_callback_auth_cert Optional[str]

      The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

      None default_callback_auth_key Optional[str]

      The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

      None update_if_exists bool

      If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

      False labels Optional[Dict[str, str]]

      An optional dictionary of key/value pairs to associate with this endpoint.

      None

      Returns:

      Type Description Optional[Endpoint]

      A Endpoint object that can be used to make requests to the endpoint.

      "},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
      delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

      Deletes a model endpoint.

      Parameters:

      Name Type Description Default model_endpoint Union[ModelEndpoint, str]

      A ModelEndpoint object.

      required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
      edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\nhigh_priority: Optional[bool] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None\n) -> None\n

      Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

      • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

      Parameters:

      Name Type Description Default model_endpoint Union[ModelEndpoint, str]

      The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

      required model_bundle Optional[Union[ModelBundle, str]]

      The ModelBundle that the endpoint should serve.

      None cpus Optional[float]

      Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

      None memory Optional[str]

      Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

      None storage Optional[str]

      Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

      None gpus Optional[int]

      Number of gpus each worker should get, e.g. 0, 1, etc.

      None min_workers Optional[int]

      The minimum number of workers. Must be greater than or equal to 0.

      None max_workers Optional[int]

      The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

      None per_worker Optional[int]

      The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

      • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
      None gpu_type Optional[str]

      If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

      • nvidia-tesla-t4
      • nvidia-ampere-a10
      None high_priority Optional[bool]

      Either True or False. Enabling this will allow the created endpoint to leverage the shared pool of prewarmed nodes for faster spinup time.

      None post_inference_hooks Optional[List[PostInferenceHooks]]

      List of hooks to trigger after inference tasks are served.

      None default_callback_url Optional[str]

      The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

      None default_callback_auth_kind Optional[Literal[basic, mtls]]

      The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

      None default_callback_auth_username Optional[str]

      The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

      None default_callback_auth_password Optional[str]

      The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

      None default_callback_auth_cert Optional[str]

      The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

      None default_callback_auth_key Optional[str]

      The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

      None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
      get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

      Gets inference results from a previously created batch job.

      Parameters:

      Name Type Description Default batch_job_id str

      An id representing the batch task job. This id is the in the response from calling batch_async_request.

      required

      Returns:

      Type Description Dict[str, Any]

      A dictionary that contains the following fields:

      Dict[str, Any]
      • status: The status of the job.
      Dict[str, Any]
      • result: The url where the result is stored.
      Dict[str, Any]
      • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
      Dict[str, Any]
      • num_tasks_pending: The number of tasks that are still pending.
      Dict[str, Any]
      • num_tasks_completed: The number of tasks that have completed.
      "},{"location":"api/client/#launch.client.LaunchClient.get_latest_model_bundle_v2","title":"get_latest_model_bundle_v2","text":"
      get_latest_model_bundle_v2(\nmodel_bundle_name: str,\n) -> ModelBundleV2Response\n

      Get the latest version of a model bundle.

      Parameters:

      Name Type Description Default model_bundle_name str

      The name of the model bundle you want to get.

      required

      Returns:

      Type Description ModelBundleV2Response

      An object containing the following keys:

      • id: The ID of the model bundle.
      • name: The name of the model bundle.
      • schema_location: The location of the schema for the model bundle.
      • flavor: The flavor of the model bundle. Either RunnableImage, CloudpickleArtifact, or ZipArtifact.
      • created_at: The time the model bundle was created.
      • metadata: A dictionary of metadata associated with the model bundle.
      • model_artifact_ids: A list of IDs of model artifacts associated with the bundle.
      "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
      get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

      Returns a model bundle specified by bundle_name that the user owns.

      Parameters:

      Name Type Description Default model_bundle Union[ModelBundle, str]

      The bundle or its name.

      required

      Returns:

      Type Description ModelBundle

      A ModelBundle object

      "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle_v2","title":"get_model_bundle_v2","text":"
      get_model_bundle_v2(\nmodel_bundle_id: str,\n) -> ModelBundleV2Response\n

      Get a model bundle.

      Parameters:

      Name Type Description Default model_bundle_id str

      The ID of the model bundle you want to get.

      required

      Returns:

      Type Description ModelBundleV2Response

      An object containing the following fields:

      • id: The ID of the model bundle.
      • name: The name of the model bundle.
      • flavor: The flavor of the model bundle. Either RunnableImage, CloudpickleArtifact, or ZipArtifact.
      • created_at: The time the model bundle was created.
      • metadata: A dictionary of metadata associated with the model bundle.
      • model_artifact_ids: A list of IDs of model artifacts associated with the bundle.
      "},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
      get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

      Gets a model endpoint associated with a name.

      Parameters:

      Name Type Description Default endpoint_name str

      The name of the endpoint to retrieve.

      required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
      list_model_bundles() -> List[ModelBundle]\n

      Returns a list of model bundles that the user owns.

      Returns:

      Type Description List[ModelBundle]

      A list of ModelBundle objects

      "},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles_v2","title":"list_model_bundles_v2","text":"
      list_model_bundles_v2() -> ListModelBundlesV2Response\n

      List all model bundles.

      Returns:

      Type Description ListModelBundlesV2Response

      An object containing the following keys:

      • model_bundles: A list of model bundles. Each model bundle is an object.
      "},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
      list_model_endpoints() -> List[Endpoint]\n

      Lists all model endpoints that the user owns.

      Returns:

      Type Description List[Endpoint]

      A list of ModelEndpoint objects.

      "},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
      read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

      Retrieves the logs for the creation of the endpoint.

      Parameters:

      Name Type Description Default model_endpoint Union[ModelEndpoint, str]

      The endpoint or its name.

      required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
      register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

      For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

      Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

      Parameters:

      Name Type Description Default batch_csv_location_fn Callable[[], str]

      Function that generates batch_csv_urls for upload_batch_csv_fn.

      required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
      register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

      For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

      Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

      Parameters:

      Name Type Description Default bundle_location_fn Callable[[], str]

      Function that generates bundle_urls for upload_bundle_fn.

      required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
      register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

      For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

      upload_batch_csv_fn(csv_text, csv_url)\n

      This function should directly write the contents of csv_text as a text string into csv_url.

      Parameters:

      Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

      Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

      required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
      register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

      For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

      upload_bundle_fn(serialized_bundle, bundle_url)\n

      This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

      See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

      Parameters:

      Name Type Description Default upload_bundle_fn Callable[[str, str], None]

      Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

      required"},{"location":"api/endpoint_predictions/","title":"Endpoint Predictions","text":""},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
      EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

      Represents a single request to either a SyncEndpoint or AsyncEndpoint.

      Parameters:

      Name Type Description Default url Optional[str]

      A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

      Exactly one of url and args must be specified.

      None args Optional[Dict]

      A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

      Exactly one of url and args must be specified.

      None return_pickled Optional[bool]

      Whether the output should be a pickled python object, or directly returned serialized json.

      False callback_url Optional[str]

      The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

      None callback_auth_kind Optional[Literal[basic, mtls]]

      The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

      None callback_auth_username Optional[str]

      The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

      None callback_auth_password Optional[str]

      The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

      None callback_auth_cert Optional[str]

      The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

      None callback_auth_key Optional[str]

      The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

      None request_id Optional[str]

      (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

      None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
      EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

      Represents a response received from a Endpoint.

      Parameters:

      Name Type Description Default client

      An instance of LaunchClient.

      required status str

      A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

      required result_url Optional[str]

      A string that is a url containing the pickled python object from the Endpoint's predict function.

      Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

      None result Optional[str]

      A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

      Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

      None traceback Optional[str]

      The stack trace if the inference endpoint raised an error. Can be used for debugging

      None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
      EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

      Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

      This object should not be directly instantiated by the user.

      Parameters:

      Name Type Description Default client

      An instance of LaunchClient.

      required endpoint_name str

      The name of the endpoint.

      required async_task_id str

      An async task id.

      required"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
      get(timeout: Optional[float] = None) -> EndpointResponse\n

      Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

      Parameters:

      Name Type Description Default timeout Optional[float]

      The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

      None"},{"location":"api/hooks/","title":"Hooks","text":""},{"location":"api/hooks/#launch.hooks.PostInferenceHooks","title":"PostInferenceHooks","text":"

      Bases: str, Enum

      Post-inference hooks are functions that are called after inference is complete.

      Attributes:

      Name Type Description CALLBACK str

      The callback hook is called with the inference response and the task ID.

      "},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.CloudpickleArtifactFlavor","title":"CloudpickleArtifactFlavor","text":"

      Bases: BaseModel

      "},{"location":"api/model_bundles/#launch.model_bundle.CloudpickleArtifactFlavor.app_config","title":"app_config class-attribute","text":"
      app_config: Optional[Dict[str, Any]]\n

      Optional configuration for the application.

      "},{"location":"api/model_bundles/#launch.model_bundle.CloudpickleArtifactFlavor.framework","title":"framework class-attribute","text":"
      framework: Union[\nPytorchFramework, TensorflowFramework, CustomFramework\n] = Field(Ellipsis, discriminator=\"framework_type\")\n

      Machine Learning framework specification. Either PytorchFramework, TensorflowFramework, or CustomFramework.

      "},{"location":"api/model_bundles/#launch.model_bundle.CloudpickleArtifactFlavor.load_model_fn","title":"load_model_fn class-attribute","text":"
      load_model_fn: str\n

      Function which, when called, returns the model object.

      "},{"location":"api/model_bundles/#launch.model_bundle.CloudpickleArtifactFlavor.load_predict_fn","title":"load_predict_fn class-attribute","text":"
      load_predict_fn: str\n

      Function which, when called, returns the prediction function.

      "},{"location":"api/model_bundles/#launch.model_bundle.CloudpickleArtifactFlavor.requirements","title":"requirements class-attribute","text":"
      requirements: List[str]\n

      List of requirements to install in the environment before running the model.

      "},{"location":"api/model_bundles/#launch.model_bundle.CreateModelBundleV2Response","title":"CreateModelBundleV2Response","text":"

      Bases: BaseModel

      Response object for creating a Model Bundle.

      "},{"location":"api/model_bundles/#launch.model_bundle.CreateModelBundleV2Response.model_bundle_id","title":"model_bundle_id class-attribute","text":"
      model_bundle_id: str\n

      ID of the Model Bundle.

      "},{"location":"api/model_bundles/#launch.model_bundle.CustomFramework","title":"CustomFramework","text":"

      Bases: BaseModel

      "},{"location":"api/model_bundles/#launch.model_bundle.CustomFramework.image_repository","title":"image_repository class-attribute","text":"
      image_repository: str\n

      Docker image repository to use as the base image.

      "},{"location":"api/model_bundles/#launch.model_bundle.CustomFramework.image_tag","title":"image_tag class-attribute","text":"
      image_tag: str\n

      Docker image tag to use as the base image.

      "},{"location":"api/model_bundles/#launch.model_bundle.ListModelBundlesV2Response","title":"ListModelBundlesV2Response","text":"

      Bases: BaseModel

      Response object for listing Model Bundles.

      "},{"location":"api/model_bundles/#launch.model_bundle.ListModelBundlesV2Response.model_bundles","title":"model_bundles class-attribute","text":"
      model_bundles: List[ModelBundleV2Response]\n

      A list of Model Bundles.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

      Represents a ModelBundle.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
      app_config: Optional[Dict[Any, Any]] = None\n

      An optional user-specified configuration mapping for the bundle.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
      env_params: Optional[Dict[str, str]] = None\n

      A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
      id: Optional[str] = None\n

      A globally unique identifier for the bundle.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
      location: Optional[str] = None\n

      An opaque location for the bundle.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
      metadata: Optional[Dict[Any, Any]] = None\n

      Arbitrary metadata for the bundle.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
      name: str\n

      The name of the bundle. Must be unique across all bundles that the user owns.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
      packaging_type: Optional[str] = None\n

      The packaging type for the bundle. Can be cloudpickle or zip.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
      requirements: Optional[List[str]] = None\n

      A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response","title":"ModelBundleV2Response","text":"

      Bases: BaseModel

      Response object for a single Model Bundle.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response.created_at","title":"created_at class-attribute","text":"
      created_at: datetime.datetime\n

      Timestamp of when the Model Bundle was created.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response.flavor","title":"flavor class-attribute","text":"
      flavor: Union[\nCloudpickleArtifactFlavor,\nZipArtifactFlavor,\nRunnableImageFlavor,\n] = Field(Ellipsis, discriminator=\"flavor\")\n

      Flavor of the Model Bundle, representing how the model bundle was packaged. Either CloudpickleArtifactFlavor, ZipArtifactFlavor, or RunnableImageFlavor.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response.id","title":"id class-attribute","text":"
      id: str\n

      ID of the Model Bundle.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response.metadata","title":"metadata class-attribute","text":"
      metadata: Dict[str, Any]\n

      Metadata associated with the Model Bundle.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response.model_artifact_ids","title":"model_artifact_ids class-attribute","text":"
      model_artifact_ids: List[str]\n

      IDs of the Model Artifacts associated with the Model Bundle.

      "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response.name","title":"name class-attribute","text":"
      name: str\n

      Name of the Model Bundle.

      "},{"location":"api/model_bundles/#launch.model_bundle.PytorchFramework","title":"PytorchFramework","text":"

      Bases: BaseModel

      "},{"location":"api/model_bundles/#launch.model_bundle.PytorchFramework.pytorch_image_tag","title":"pytorch_image_tag class-attribute","text":"
      pytorch_image_tag: str\n

      Image tag of the Pytorch image to use.

      "},{"location":"api/model_bundles/#launch.model_bundle.RunnableImageFlavor","title":"RunnableImageFlavor","text":"

      Bases: BaseModel

      "},{"location":"api/model_bundles/#launch.model_bundle.RunnableImageFlavor.command","title":"command class-attribute","text":"
      command: List[str]\n

      Command to run the image.

      "},{"location":"api/model_bundles/#launch.model_bundle.RunnableImageFlavor.env","title":"env class-attribute","text":"
      env: Optional[Dict[str, str]]\n

      Environment variables to set when running the image.

      "},{"location":"api/model_bundles/#launch.model_bundle.RunnableImageFlavor.repository","title":"repository class-attribute","text":"
      repository: str\n

      Docker repository of the image.

      "},{"location":"api/model_bundles/#launch.model_bundle.RunnableImageFlavor.tag","title":"tag class-attribute","text":"
      tag: str\n

      Docker tag of the image.

      "},{"location":"api/model_bundles/#launch.model_bundle.TensorflowFramework","title":"TensorflowFramework","text":"

      Bases: BaseModel

      "},{"location":"api/model_bundles/#launch.model_bundle.TensorflowFramework.tensorflow_version","title":"tensorflow_version class-attribute","text":"
      tensorflow_version: str\n

      Tensorflow version to use.

      "},{"location":"api/model_bundles/#launch.model_bundle.ZipArtifactFlavor","title":"ZipArtifactFlavor","text":"

      Bases: BaseModel

      "},{"location":"api/model_bundles/#launch.model_bundle.ZipArtifactFlavor.app_config","title":"app_config class-attribute","text":"
      app_config: Optional[Dict[str, Any]]\n

      Optional configuration for the application.

      "},{"location":"api/model_bundles/#launch.model_bundle.ZipArtifactFlavor.framework","title":"framework class-attribute","text":"
      framework: Union[\nPytorchFramework, TensorflowFramework, CustomFramework\n] = Field(Ellipsis, discriminator=\"framework_type\")\n

      Machine Learning framework specification. Either PytorchFramework, TensorflowFramework, or CustomFramework.

      "},{"location":"api/model_bundles/#launch.model_bundle.ZipArtifactFlavor.load_model_fn_module_path","title":"load_model_fn_module_path class-attribute","text":"
      load_model_fn_module_path: str\n

      Path to the module to load the model object.

      "},{"location":"api/model_bundles/#launch.model_bundle.ZipArtifactFlavor.load_predict_fn_module_path","title":"load_predict_fn_module_path class-attribute","text":"
      load_predict_fn_module_path: str\n

      Path to the module to load the prediction function.

      "},{"location":"api/model_bundles/#launch.model_bundle.ZipArtifactFlavor.requirements","title":"requirements class-attribute","text":"
      requirements: List[str]\n

      List of requirements to install in the environment before running the model.

      "},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

      All classes here are returned by the get_model_endpoint method and provide a predict function.

      "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
      AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

      Bases: Endpoint

      An asynchronous model endpoint.

      Parameters:

      Name Type Description Default model_endpoint ModelEndpoint

      ModelEndpoint object.

      required client

      A LaunchClient object

      required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
      predict(request: EndpointRequest) -> EndpointResponseFuture\n

      Runs an asynchronous prediction request.

      Parameters:

      Name Type Description Default request EndpointRequest

      The EndpointRequest object that contains the payload.

      required

      Returns:

      Name Type Description EndpointResponseFuture

      An EndpointResponseFuture such the user can use to query the status of the request.

      Example EndpointResponseFuture EndpointResponseFuture

      .. code-block:: python

      my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

      "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
      predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

      (deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

      Parameters:

      Name Type Description Default requests Sequence[EndpointRequest]

      List of EndpointRequests. Request_ids must all be distinct.

      required

      Returns:

      Type Description AsyncEndpointBatchResponse

      an AsyncEndpointResponse keeping track of the inference requests made

      "},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint","title":"SyncEndpoint","text":"
      SyncEndpoint(model_endpoint: ModelEndpoint, client)\n

      Bases: Endpoint

      A synchronous model endpoint.

      Parameters:

      Name Type Description Default model_endpoint ModelEndpoint

      ModelEndpoint object.

      required client

      A LaunchClient object

      required"},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint.predict","title":"predict","text":"
      predict(request: EndpointRequest) -> EndpointResponse\n

      Runs a synchronous prediction request.

      Parameters:

      Name Type Description Default request EndpointRequest

      The EndpointRequest object that contains the payload.

      required"},{"location":"concepts/batch_jobs/","title":"Batch Jobs","text":"

      For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

      Batch jobs are created using the batch_async_request method of the LaunchClient.

      Creating and Following a Batch Job
      import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n}\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
      "},{"location":"concepts/callbacks/","title":"Callbacks","text":"

      Async model endpoints can be configured to send callbacks to a user-defined callback URL. Callbacks are sent as HTTP POST requests with a JSON body. The following code snippet shows how to create an async model endpoint with a callback URL.

      To configure an async endpoint to send callbacks, set the post_inference_hooks field to include launch.PostInferenceHooks.CALLBACK. A callback URL also needs to be specified, and it can be configured as a default using the default_callback_url argument to launch.LaunchClient.create_model_endpoint or as a per-task override using the callback_url field of launch.EndpointRequest.

      Note

      Callbacks will not be sent if the endpoint does not have any post-inference hooks specified, even if a default_callback_url is provided to the endpoint creation method or if the prediction request has a callback_url override.

      Creating an Async Model Endpoint with a Callback URL
      import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 7\n}\n\"\"\"\nfuture_custom_callback_url = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"}, callback_url=\"https://example.com/custom\"\n),\n)\n\"\"\"\nA callback is sent to https://example.com/custom with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 8\n}\n\"\"\"\n
      "},{"location":"concepts/callbacks/#authentication-for-callbacks","title":"Authentication for callbacks","text":"

      Warning

      This feature is currently in beta, and the API is likely to change.

      Callbacks can be authenticated using shared authentication headers. To enable authentication, set either default_callback_auth_kind when creating the endpoint or callback_auth_kind when making a prediction request.

      Currently, the supported authentication methods are basic and mtls. If basic is used, then the default_callback_auth_username and default_callback_auth_password fields must be specified when creating the endpoint, or the callback_auth_username and callback_auth_password fields must be specified when making a prediction request. If mtls is used, then the same is true for the default_callback_auth_cert and default_callback_auth_key fields, or the callback_auth_cert and callback_auth_key fields.

      Creating an Async Model Endpoint with custom Callback auth
      import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\ndefault_callback_auth_kind=\"basic\",\ndefault_callback_auth_username=\"user\",\ndefault_callback_auth_password=\"password\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with (\"user\", \"password\") as the basic auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"mtls\", \ncallback_auth_cert=\"cert\", \ncallback_auth_key=\"key\",\n),\n)\n\"\"\"\nA callback is sent with mTLS authentication.\n\"\"\"\nclient.edit_model_endpoint(\nmodel_endpoint=endpoint.model_endpoint,\ndefault_callback_auth_kind=\"mtls\",\ndefault_callback_auth_cert=\"cert\",\ndefault_callback_auth_key=\"key\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent with mTLS auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"basic\",\ncallback_auth_username=\"user\",\ncallback_auth_password=\"pass\",\n),\n)\n\"\"\"\nA callback is sent with (\"user\", \"pass\") as the basic auth.\n\"\"\"\n
      "},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

      Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

      Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
      import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
      import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
      "},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
      EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

      Represents a single request to either a SyncEndpoint or AsyncEndpoint.

      Parameters:

      Name Type Description Default url Optional[str]

      A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

      Exactly one of url and args must be specified.

      None args Optional[Dict]

      A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

      Exactly one of url and args must be specified.

      None return_pickled Optional[bool]

      Whether the output should be a pickled python object, or directly returned serialized json.

      False callback_url Optional[str]

      The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

      None callback_auth_kind Optional[Literal[basic, mtls]]

      The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

      None callback_auth_username Optional[str]

      The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

      None callback_auth_password Optional[str]

      The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

      None callback_auth_cert Optional[str]

      The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

      None callback_auth_key Optional[str]

      The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

      None request_id Optional[str]

      (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

      None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
      EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

      Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

      This object should not be directly instantiated by the user.

      Parameters:

      Name Type Description Default client

      An instance of LaunchClient.

      required endpoint_name str

      The name of the endpoint.

      required async_task_id str

      An async task id.

      required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
      get(timeout: Optional[float] = None) -> EndpointResponse\n

      Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

      Parameters:

      Name Type Description Default timeout Optional[float]

      The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

      None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
      EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

      Represents a response received from a Endpoint.

      Parameters:

      Name Type Description Default client

      An instance of LaunchClient.

      required status str

      A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

      required result_url Optional[str]

      A string that is a url containing the pickled python object from the Endpoint's predict function.

      Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

      None result Optional[str]

      A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

      Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

      None traceback Optional[str]

      The stack trace if the inference endpoint raised an error. Can be used for debugging

      None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

      Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

      "},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

      There are two methods for creating model bundles: create_model_bundle and create_model_bundle_from_dirs. The former directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The latter takes in directories containing a load_predict_fn and the module path to the load_predict_fn.

      Creating a Model Bundle DirectlyCreating a Model Bundle from Directories
      import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n
      import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\npytest==7.2.1\nnumpy\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"requirements_path\": \"requirements.txt\",\n\"env_params\": ENV_PARAMS,\n\"load_predict_fn\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle_from_dirs(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
      "},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

      The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

      Creating Model Bundles with app_config
      import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Union\nfrom typing_extensions import Literal\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"batched\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)\n
      "},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

      Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes.

      "},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

      To list all the model bundles you own, use list_model_bundles.

      "},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

      Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

      Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

      Info

      "},{"location":"concepts/model_endpoints/#choosing-the-right-inference-mode","title":"Choosing the right inference mode","text":"

      Here are some tips for how to choose between SyncEndpoint, AsyncEndpoint, and BatchJob for deploying your ModelBundle:

      A SyncEndpoint is good if:

      • You have strict latency requirements (e.g. on the order of seconds or less).
      • You are willing to have resources continually allocated.

      An AsyncEndpoint is good if:

      • You want to save on compute costs.
      • Your inference code takes a long time to run.
      • Your latency requirements are on the order of minutes.

      A BatchJob is good if:

      • You know there is a large batch of inputs ahead of time.
      • You want to optimize for throughput instead of latency.
      "},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

      Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

      Creating an Async Model Endpoint
      import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
      "},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

      Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints.

      Note

      Sync model endpoints require at least 1 min_worker.

      Creating a Sync Model Endpoint
      import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
      "},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

      Model endpoints can be listed, updated, and deleted using the Launch API.

      Listing Model Endpoints
      import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
      Updating a Model Endpoint
      import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
      Deleting a Model Endpoint
      import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
      "},{"location":"concepts/overview/","title":"Overview","text":"

      Creating deployments on Launch generally involves three steps:

      1. Create and upload a ModelBundle. Pass your trained model as well as pre-/post-processing code to the Scale Launch Python client, and we\u2019ll create a model bundle based on the code and store it in our Bundle Store.

      2. Create a ModelEndpoint. Pass a ModelBundle as well as infrastructure settings such as the desired number of GPUs to our client. This provisions resources on Scale\u2019s cluster dedicated to your ModelEndpoint.

      3. Make requests to the ModelEndpoint. You can make requests through the Python client, or make HTTP requests directly to Scale.

      "}]} \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index b2789220c7adf9d04d2adec048c651132fab938f..9da3509e425d56c786b081cabe4da8f90624e755 100644 GIT binary patch delta 15 WcmX@WbbyIXzMF%i*ncCN6(ay6o&)&+ delta 15 WcmX@WbbyIXzMF$1(q$u?6(ay5%LCK^ From afb7af7c10c0be193ad8d54a136eae6f0a9391f4 Mon Sep 17 00:00:00 2001 From: Phil Chen Date: Tue, 28 Mar 2023 15:45:16 -0700 Subject: [PATCH 12/28] Deployed 467b4eb with MkDocs version: 1.4.2 --- api/client/index.html | 6 +- concepts/model_bundles/index.html | 368 ++++++++++++++++-------------- search/search_index.json | 2 +- sitemap.xml.gz | Bin 320 -> 320 bytes 4 files changed, 197 insertions(+), 179 deletions(-) diff --git a/api/client/index.html b/api/client/index.html index adbb8fc3..c6b46bee 100644 --- a/api/client/index.html +++ b/api/client/index.html @@ -1993,7 +1993,7 @@

      load_model_fn_module_path: str, request_schema: Type[BaseModel], response_schema: Type[BaseModel], - requirements_path: str, + requirements_path: Optional[str] = None, pytorch_image_tag: Optional[str] = None, tensorflow_version: Optional[str] = None, custom_base_image_repository: Optional[str] = None, @@ -2111,13 +2111,13 @@

      Optional[str]

    diff --git a/concepts/model_bundles/index.html b/concepts/model_bundles/index.html index 943beb01..7640dfdb 100644 --- a/concepts/model_bundles/index.html +++ b/concepts/model_bundles/index.html @@ -351,27 +351,6 @@ Creating Model Bundles - - -
  • - - Configuring Model Bundles - - -
  • - -
  • - - Updating Model Bundles - - -
  • - -
  • - - Listing Model Bundles - -
  • @@ -581,27 +560,6 @@ Creating Model Bundles - - -
  • - - Configuring Model Bundles - - -
  • - -
  • - - Updating Model Bundles - - -
  • - -
  • - - Listing Model Bundles - -
  • @@ -623,15 +581,42 @@

    Model BundlesModel Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

    Creating Model Bundles

    -

    There are two methods for creating model bundles: -create_model_bundle +

    There are three methods for creating model bundles: +create_model_bundle_from_callable_v2 and -create_model_bundle_from_dirs. -The former directly pickles a user-specified load_predict_fn, a function which +create_model_bundle_from_dirs_v2. +create_model_bundle_from_runnable_image_v2. +The first directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. -The latter takes in directories containing a load_predict_fn and the -module path to the load_predict_fn.

    -
    +The second takes in directories containing a load_predict_fn and the +module path to the load_predict_fn. +The third takes a Docker image that contains an entrypoint that starts a process +listening for requests at port 5005 using HTTP and exposes POST /predict and +GET /healthz endpoints.

    +

    Each of these modes of creating a model bundle is called a "Flavor".

    +
    +

    Info

    +

    Choosing the right model bundle flavor

    +

    Here are some tips for how to choose between the different flavors of ModelBundle:

    +

    A CloudpickleArtifactFlavor (creating from callable) is good if:

    +
      +
    • You are creating the model bundle from a Jupyter notebook.
    • +
    • The model bundle is small without too many dependencies.
    • +
    +

    A ZipArtifactFlavor (creating from directories) is good if:

    +
      +
    • You have a relatively constant set of dependencies.
    • +
    • You have a lot of custom code that you want to include in the model bundle.
    • +
    • You do not want to build a web server and Docker image to serve your model.
    • +
    +

    A RunnableImageArtifactFlavor (creating from runnable image) is good if:

    +
      +
    • You have a lot of dependencies.
    • +
    • You have a lot of custom code that you want to include in the model bundle.
    • +
    • You are comfortable with building a web server and Docker image to serve your model.
    • +
    +
    +
    import os
    @@ -656,26 +641,24 @@ 

    Creating Model Bundles return returns_model_of_x_plus_len_of_y -def my_model(x): - return x * 2 - -ENV_PARAMS = { - "framework_type": "pytorch", - "pytorch_image_tag": "1.7.1-cuda11.0-cudnn8-runtime", -} - -BUNDLE_PARAMS = { - "model_bundle_name": "test-bundle", - "model": my_model, - "load_predict_fn": my_load_predict_fn, - "env_params": ENV_PARAMS, - "requirements": ["pytest==7.2.1", "numpy"], # list your requirements here - "request_schema": MyRequestSchema, - "response_schema": MyResponseSchema, -} - -client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY")) -client.create_model_bundle(**BUNDLE_PARAMS) +def my_load_model_fn(): + def my_model(x): + return x * 2 + + return my_model + +BUNDLE_PARAMS = { + "model_bundle_name": "test-bundle", + "load_model_fn": my_load_model_fn, + "load_predict_fn": my_load_predict_fn, + "request_schema": MyRequestSchema, + "response_schema": MyResponseSchema, + "requirements": ["pytest==7.2.1", "numpy"], # list your requirements here + "pytorch_image_tag": "1.7.1-cuda11.0-cudnn8-runtime", +} + +client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY")) +client.create_model_bundle_from_callable_v2(**BUNDLE_PARAMS)

    @@ -731,29 +714,69 @@

    Creating Model Bundlesclass MyResponseSchema(BaseModel): __root__: int -ENV_PARAMS = { - "framework_type": "pytorch", - "pytorch_image_tag": "1.7.1-cuda11.0-cudnn8-runtime", -} - -BUNDLE_PARAMS = { - "model_bundle_name": "test-bundle", - "base_paths": [directory], - "requirements_path": "requirements.txt", - "env_params": ENV_PARAMS, - "load_predict_fn": "predict.my_load_predict_fn", - "load_model_fn_module_path": "model.my_load_model_fn", - "request_schema": MyRequestSchema, - "response_schema": MyResponseSchema, -} - -client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY")) -client.create_model_bundle_from_dirs(**BUNDLE_PARAMS) - -# Clean up files from demo -os.remove(model_filename) -os.remove(predict_filename) -os.rmdir(directory) +BUNDLE_PARAMS = { + "model_bundle_name": "test-bundle", + "base_paths": [directory], + "load_predict_fn_module_path": "predict.my_load_predict_fn", + "load_model_fn_module_path": "model.my_load_model_fn", + "request_schema": MyRequestSchema, + "response_schema": MyResponseSchema, + "requirements_path": "requirements.txt", + "pytorch_image_tag": "1.7.1-cuda11.0-cudnn8-runtime", +} + +client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY")) +client.create_model_bundle_from_dirs_v2(**BUNDLE_PARAMS) + +# Clean up files from demo +os.remove(model_filename) +os.remove(predict_filename) +os.rmdir(directory) +

    +
    +
    +
    import os
    +from pydantic import BaseModel
    +from launch import LaunchClient
    +
    +
    +class MyRequestSchema(BaseModel):
    +    x: int
    +    y: str
    +
    +class MyResponseSchema(BaseModel):
    +    __root__: int
    +
    +
    +BUNDLE_PARAMS = {
    +    "model_bundle_name": "test-bundle",
    +    "load_model_fn": my_load_model_fn,
    +    "load_predict_fn": my_load_predict_fn,
    +    "request_schema": MyRequestSchema,
    +    "response_schema": MyResponseSchema,
    +    "repository": "launch_rearch",
    +    "tag": "12b9131c5a1489c76592cddd186962cce965f0f6-cpu",
    +    "command": [
    +        "dumb-init",
    +        "--",
    +        "ddtrace-run",
    +        "run-service",
    +        "--config",
    +        "/install/launch_rearch/config/service--user_defined_code.yaml",
    +        "--concurrency",
    +        "1",
    +        "--http",
    +        "production",
    +        "--port",
    +        "5005",
    +    ],
    +    "env": {
    +        "TEST_KEY": "test_value",
    +    },
    +}
    +
    +client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
    +client.create_model_bundle_from_runnable_image_v2(**BUNDLE_PARAMS)
     
    @@ -764,96 +787,91 @@

    Configuring Model BundlesCreating Model Bundles with app_config
    import os
    -from launch import LaunchClient
    -from pydantic import BaseModel
    -from typing import List, Union
    -from typing_extensions import Literal
    -
    -
    -class MyRequestSchemaSingle(BaseModel):
    -    kind: Literal['single']
    -    x: int
    -    y: str
    -
    -class MyRequestSchemaBatched(BaseModel):
    -    kind: Literal['batched']
    -    x: List[int]
    -    y: List[str]
    -
    -class MyRequestSchema(BaseModel):
    -    __root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]
    -
    -class MyResponseSchema(BaseModel):
    -    __root__: Union[int, List[int]]
    -
    -
    -def my_load_predict_fn(app_config, model):
    -    def returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:
    -        """MyRequestSchema -> MyResponseSchema"""
    -        if app_config["mode"] == "single":
    -            assert isinstance(x, int) and isinstance(y, str)
    -            return model(x) + len(y)
    -
    -        result = []
    -        for x_i, y_i in zip(x, y):
    -            result.append(model(x_i) + len(y_i))
    -        return result
    -
    -    return returns_model_of_x_plus_len_of_y
    -
    -
    -def my_load_model_fn(app_config):
    -    def my_model_single(x: int):
    -        return x * 2
    -
    -    def my_model_batched(x: List[int]):
    -        return [my_model_single(x_i) for x_i in x]
    -
    -    if app_config["mode"] == "single":
    -        return my_model_single
    -
    -    return my_model_batched
    -
    -
    -ENV_PARAMS = {
    -    "framework_type": "pytorch",
    -    "pytorch_image_tag": "1.7.1-cuda11.0-cudnn8-runtime",
    -}
    -
    -BUNDLE_PARAMS_SINGLE = {
    -    "model_bundle_name": "test-bundle-single",
    -    "load_predict_fn": my_load_predict_fn,
    -    "load_model_fn": my_load_model_fn,
    -    "env_params": ENV_PARAMS,
    -    "requirements": ["pytest==7.2.1", "numpy"],
    -    "request_schema": MyRequestSchema,
    -    "response_schema": MyResponseSchema,
    -    "app_config": {"mode": "single"},
    -}
    -BUNDLE_PARAMS_BATCHED = {
    -    "model_bundle_name": "test-bundle-batched",
    -    "load_predict_fn": my_load_predict_fn,
    -    "load_model_fn": my_load_model_fn,
    -    "env_params": ENV_PARAMS,
    -    "requirements": ["pytest==7.2.1", "numpy"],
    -    "request_schema": MyRequestSchema,
    -    "response_schema": MyResponseSchema,
    -    "app_config": {"mode": "batched"},
    -}
    -
    -client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
    -bundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)
    -bundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)
    +
    Creating Model Bundles with app_config
    import os
    +from launch import LaunchClient
    +from pydantic import BaseModel
    +from typing import List, Union
    +from typing_extensions import Literal
    +
    +
    +class MyRequestSchemaSingle(BaseModel):
    +    kind: Literal['single']
    +    x: int
    +    y: str
    +
    +class MyRequestSchemaBatched(BaseModel):
    +    kind: Literal['batched']
    +    x: List[int]
    +    y: List[str]
    +
    +class MyRequestSchema(BaseModel):
    +    __root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]
    +
    +class MyResponseSchema(BaseModel):
    +    __root__: Union[int, List[int]]
    +
    +
    +def my_load_predict_fn(app_config, model):
    +    def returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:
    +        """MyRequestSchema -> MyResponseSchema"""
    +        if app_config["mode"] == "single":
    +            assert isinstance(x, int) and isinstance(y, str)
    +            return model(x) + len(y)
    +
    +        result = []
    +        for x_i, y_i in zip(x, y):
    +            result.append(model(x_i) + len(y_i))
    +        return result
    +
    +    return returns_model_of_x_plus_len_of_y
    +
    +
    +def my_load_model_fn(app_config):
    +    def my_model_single(x: int):
    +        return x * 2
    +
    +    def my_model_batched(x: List[int]):
    +        return [my_model_single(x_i) for x_i in x]
    +
    +    if app_config["mode"] == "single":
    +        return my_model_single
    +
    +    return my_model_batched
    +
    +
    +BUNDLE_PARAMS_SINGLE = {
    +    "model_bundle_name": "test-bundle-single",
    +    "load_predict_fn": my_load_predict_fn,
    +    "load_model_fn": my_load_model_fn,
    +    "requirements": ["pytest==7.2.1", "numpy"],
    +    "request_schema": MyRequestSchema,
    +    "response_schema": MyResponseSchema,
    +    "pytorch_image_tag": "1.7.1-cuda11.0-cudnn8-runtime",
    +    "app_config": {"mode": "single"},
    +}
    +BUNDLE_PARAMS_BATCHED = {
    +    "model_bundle_name": "test-bundle-batched",
    +    "load_predict_fn": my_load_predict_fn,
    +    "load_model_fn": my_load_model_fn,
    +    "requirements": ["pytest==7.2.1", "numpy"],
    +    "request_schema": MyRequestSchema,
    +    "response_schema": MyResponseSchema,
    +    "pytorch_image_tag": "1.7.1-cuda11.0-cudnn8-runtime",
    +    "app_config": {"mode": "batched"},
    +}
    +
    +client = LaunchClient(api_key=os.getenv("LAUNCH_API_KEY"))
    +bundle_single = client.create_model_bundle_from_callable_v2(**BUNDLE_PARAMS_SINGLE)
    +bundle_batch = client.create_model_bundle_from_callable_v2(**BUNDLE_PARAMS_BATCHED)
     

    Updating Model Bundles

    Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using -clone_model_bundle_with_changes.

    +clone_model_bundle_with_changes_v2.

    Listing Model Bundles

    To list all the model bundles you own, use -list_model_bundles.

    +list_model_bundles_v2.

    diff --git a/search/search_index.json b/search/search_index.json index c73a0521..de67d37c 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Scale Launch","text":"

    Simple, scalable, and high performance ML service deployment in python.

    "},{"location":"#example","title":"Example","text":"Launch Usage
    import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"MY_TEAM\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

    What's going on here:

    • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
    • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
    • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
    • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
    • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

    Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

    "},{"location":"#installation","title":"Installation","text":"

    To use Scale Launch, first install it using pip:

    Installation
    pip install -U scale-launch\n
    "},{"location":"cli/","title":"CLI","text":"

    Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

    The CLI can be used as scale-launch ....

    "},{"location":"cli/#help","title":"Help","text":"

    Run scale-launch --help for more options.

    scale-launch --help
        This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your API key and other configuration options\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
    "},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
    LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

    Scale Launch Python Client.

    Initializes a Scale Launch Client.

    Parameters:

    Name Type Description Default api_key str

    Your Scale API key

    required endpoint Optional[str]

    The Scale Launch Endpoint (this should not need to be changed)

    None self_hosted bool

    True iff you are connecting to a self-hosted Scale Launch

    False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
    batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

    Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

    Must have exactly one of urls or inputs passed in.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or the name of a the bundle to use for inference.

    required urls List[str]

    A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

    None inputs Optional[List[Dict[str, Any]]]

    A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

    None batch_url_file_location Optional[str]

    In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

    None serialization_format str

    Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

    'JSON' labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None cpus Optional[int]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
    • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains job_id as a key, and the ID as the value.

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
    clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n
    Warning

    This method is deprecated. Use clone_model_bundle_with_changes_v2 instead.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The existing bundle or its ID.

    required app_config Optional[Dict]

    The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

    None

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes_v2","title":"clone_model_bundle_with_changes_v2","text":"
    clone_model_bundle_with_changes_v2(\noriginal_model_bundle_id: str,\nnew_app_config: Optional[Dict[str, Any]] = None,\n) -> CreateModelBundleV2Response\n

    Clone a model bundle with an optional new app_config.

    Parameters:

    Name Type Description Default original_model_bundle_id str

    The ID of the model bundle you want to clone.

    required new_app_config Optional[Dict[str, Any]]

    A dictionary of new app config values to use for the cloned model.

    None

    Returns:

    Type Description CreateModelBundleV2Response

    An object containing the following keys:

    • model_bundle_id: The ID of the cloned model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
    create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n
    Warning

    This method is deprecated. Use create_model_bundle_from_callable_v2 instead.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required predict_fn_or_cls Optional[Callable[[Any], Any]]

    Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

    None model Optional[LaunchModel_T]

    Typically a trained Neural Network, e.g. a Pytorch module.

    Exactly one of model and load_model_fn must be provided.

    None load_model_fn Optional[Callable[[], LaunchModel_T]]

    A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

    Exactly one of model and load_model_fn must be provided.

    None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

    Function that, when called with a model, returns a function that carries out inference.

    If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

    Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

    In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

    None requirements Optional[List[str]]

    A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

    [\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

    If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

    None app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    • Tensorflow fields:

      • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
    required globals_copy Optional[Dict[str, Any]]

    Dictionary of the global symbol table. Normally provided by globals() built-in function.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_callable_v2","title":"create_model_bundle_from_callable_v2","text":"
    create_model_bundle_from_callable_v2(\n*,\nmodel_bundle_name: str,\nload_predict_fn: Callable[\n[LaunchModel_T], Callable[[Any], Any]\n],\nload_model_fn: Callable[[], LaunchModel_T],\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrequirements: Optional[List[str]] = None,\npytorch_image_tag: Optional[str] = None,\ntensorflow_version: Optional[str] = None,\ncustom_base_image_repository: Optional[str] = None,\ncustom_base_image_tag: Optional[str] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None\n) -> CreateModelBundleV2Response\n

    Uploads and registers a model bundle to Scale Launch.

    Parameters:

    Name Type Description Default model_bundle_name str

    Name of the model bundle.

    required load_predict_fn Callable[[LaunchModel_T], Callable[[Any], Any]]

    Function that takes in a model and returns a predict function. When your model bundle is deployed, this predict function will be called as follows:

    input = {\"input\": \"some input\"} # or whatever your request schema is.\n\ndef load_model_fn():\n    # load model\n    return model\n\ndef load_predict_fn(model, app_config=None):\n    def predict_fn(input):\n        # do pre-processing\n        output = model(input)\n        # do post-processing\n        return output\n    return predict_fn\n\npredict_fn = load_predict_fn(load_model_fn(), app_config=optional_app_config)\nresponse = predict_fn(input)\n

    required load_model_fn Callable[[], LaunchModel_T]

    A function that, when run, loads a model.

    required request_schema Type[BaseModel]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    required response_schema Type[BaseModel]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint.

    required requirements Optional[List[str]]

    List of pip requirements.

    None pytorch_image_tag Optional[str]

    The image tag for the PyTorch image that will be used to run the bundle. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None tensorflow_version Optional[str]

    The version of TensorFlow that will be used to run the bundle. If not specified, the default version will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_repository Optional[str]

    The repository for a custom base image that will be used to run the bundle. If not specified, the default base image will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_tag Optional[str]

    The tag for a custom base image that will be used to run the bundle. Must be specified if custom_base_image_repository is specified.

    None app_config Optional[Union[Dict[str, Any], str]]

    An optional dictionary of configuration values that will be passed to the bundle when it is run. These values can be accessed by the bundle via the app_config global variable.

    None

    Returns:

    Type Description CreateModelBundleV2Response

    An object containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
    create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n
    Warning

    This method is deprecated. Use create_model_bundle_from_dirs_v2 instead.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required base_paths List[str]

    The paths on the local filesystem where the bundle code lives.

    required requirements_path str

    A path on the local filesystem where a requirements.txt file lives.

    required env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch.
    • PyTorch fields:
      • pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags

    Example:

    {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\",\n}\n

    required load_predict_fn_module_path str

    A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

    required load_model_fn_module_path str

    A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

    required app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs_v2","title":"create_model_bundle_from_dirs_v2","text":"
    create_model_bundle_from_dirs_v2(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrequirements_path: str,\npytorch_image_tag: Optional[str] = None,\ntensorflow_version: Optional[str] = None,\ncustom_base_image_repository: Optional[str] = None,\ncustom_base_image_tag: Optional[str] = None,\napp_config: Optional[Dict[str, Any]] = None\n) -> CreateModelBundleV2Response\n

    Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

    For example, if you have a directory structure like so, and your current working directory is my_root:

       my_root/\n       my_module1/\n           __init__.py\n           ...files and directories\n           my_inference_file.py\n       my_module2/\n           __init__.py\n           ...files and directories\n

    then calling create_model_bundle_from_dirs_v2 with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

       my_module1/\n       __init__.py\n       ...files and directories\n       my_inference_file.py\n   my_module2/\n       __init__.py\n       ...files and directories\n

    and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create.

    required base_paths List[str]

    A list of paths to directories that will be zipped up and uploaded as a bundle. Each path must be relative to the current working directory.

    required load_predict_fn_module_path str

    The Python module path to the function that will be used to load the model for inference. This function should take in a path to a model directory, and return a model object. The model object should be pickleable.

    required load_model_fn_module_path str

    The Python module path to the function that will be used to load the model for training. This function should take in a path to a model directory, and return a model object. The model object should be pickleable.

    required request_schema Type[BaseModel]

    A Pydantic model that defines the request schema for the bundle.

    required response_schema Type[BaseModel]

    A Pydantic model that defines the response schema for the bundle.

    required requirements_path str

    Path to a requirements.txt file that will be used to install dependencies for the bundle. This file must be relative to the current working directory.

    required pytorch_image_tag Optional[str]

    The image tag for the PyTorch image that will be used to run the bundle. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None tensorflow_version Optional[str]

    The version of TensorFlow that will be used to run the bundle. If not specified, the default version will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_repository Optional[str]

    The repository for a custom base image that will be used to run the bundle. If not specified, the default base image will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_tag Optional[str]

    The tag for a custom base image that will be used to run the bundle. Must be specified if custom_base_image_repository is specified.

    None app_config Optional[Dict[str, Any]]

    An optional dictionary of configuration values that will be passed to the bundle when it is run. These values can be accessed by the bundle via the app_config global variable.

    None

    Returns:

    Type Description CreateModelBundleV2Response

    An object containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_runnable_image_v2","title":"create_model_bundle_from_runnable_image_v2","text":"
    create_model_bundle_from_runnable_image_v2(\n*,\nmodel_bundle_name: str,\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrepository: str,\ntag: str,\ncommand: List[str],\nenv: Dict[str, str]\n) -> CreateModelBundleV2Response\n

    Create a model bundle from a runnable image. The specified command must start a process that will listen for requests on port 5005 using HTTP.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create.

    required request_schema Type[BaseModel]

    A Pydantic model that defines the request schema for the bundle.

    required response_schema Type[BaseModel]

    A Pydantic model that defines the response schema for the bundle.

    required repository str

    The name of the Docker repository for the runnable image.

    required tag str

    The tag for the runnable image.

    required command List[str]

    The command that will be used to start the process that listens for requests.

    required env Dict[str, str]

    A dictionary of environment variables that will be passed to the bundle when it is run.

    required

    Returns:

    Type Description CreateModelBundleV2Response

    An object containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
    create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\nhigh_priority: Optional[bool] = False,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

    Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

    required model_bundle Union[ModelBundle, str]

    The ModelBundle that the endpoint should serve.

    required cpus int

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    3 memory str

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    '8Gi' storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus int

    Number of gpus each worker should get, e.g. 0, 1, etc.

    0 min_workers int

    The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

    1 max_workers int

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

    1 per_worker int

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

    Here is our recommendation for computing per_worker:

    1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
    10 gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None endpoint_type str

    Either \"sync\" or \"async\".

    'sync' high_priority Optional[bool]

    Either True or False. Enabling this will allow the created endpoint to leverage the shared pool of prewarmed nodes for faster spinup time.

    False post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None update_if_exists bool

    If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

    False labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None

    Returns:

    Type Description Optional[Endpoint]

    A Endpoint object that can be used to make requests to the endpoint.

    "},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
    delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Deletes a model endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    A ModelEndpoint object.

    required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
    edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\nhigh_priority: Optional[bool] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None\n) -> None\n

    Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

    • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

    required model_bundle Optional[Union[ModelBundle, str]]

    The ModelBundle that the endpoint should serve.

    None cpus Optional[float]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None min_workers Optional[int]

    The minimum number of workers. Must be greater than or equal to 0.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None high_priority Optional[bool]

    Either True or False. Enabling this will allow the created endpoint to leverage the shared pool of prewarmed nodes for faster spinup time.

    None post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
    get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

    Gets inference results from a previously created batch job.

    Parameters:

    Name Type Description Default batch_job_id str

    An id representing the batch task job. This id is the in the response from calling batch_async_request.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains the following fields:

    Dict[str, Any]
    • status: The status of the job.
    Dict[str, Any]
    • result: The url where the result is stored.
    Dict[str, Any]
    • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
    Dict[str, Any]
    • num_tasks_pending: The number of tasks that are still pending.
    Dict[str, Any]
    • num_tasks_completed: The number of tasks that have completed.
    "},{"location":"api/client/#launch.client.LaunchClient.get_latest_model_bundle_v2","title":"get_latest_model_bundle_v2","text":"
    get_latest_model_bundle_v2(\nmodel_bundle_name: str,\n) -> ModelBundleV2Response\n

    Get the latest version of a model bundle.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to get.

    required

    Returns:

    Type Description ModelBundleV2Response

    An object containing the following keys:

    • id: The ID of the model bundle.
    • name: The name of the model bundle.
    • schema_location: The location of the schema for the model bundle.
    • flavor: The flavor of the model bundle. Either RunnableImage, CloudpickleArtifact, or ZipArtifact.
    • created_at: The time the model bundle was created.
    • metadata: A dictionary of metadata associated with the model bundle.
    • model_artifact_ids: A list of IDs of model artifacts associated with the bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
    get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

    Returns a model bundle specified by bundle_name that the user owns.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or its name.

    required

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle_v2","title":"get_model_bundle_v2","text":"
    get_model_bundle_v2(\nmodel_bundle_id: str,\n) -> ModelBundleV2Response\n

    Get a model bundle.

    Parameters:

    Name Type Description Default model_bundle_id str

    The ID of the model bundle you want to get.

    required

    Returns:

    Type Description ModelBundleV2Response

    An object containing the following fields:

    • id: The ID of the model bundle.
    • name: The name of the model bundle.
    • flavor: The flavor of the model bundle. Either RunnableImage, CloudpickleArtifact, or ZipArtifact.
    • created_at: The time the model bundle was created.
    • metadata: A dictionary of metadata associated with the model bundle.
    • model_artifact_ids: A list of IDs of model artifacts associated with the bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
    get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

    Gets a model endpoint associated with a name.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the endpoint to retrieve.

    required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
    list_model_bundles() -> List[ModelBundle]\n

    Returns a list of model bundles that the user owns.

    Returns:

    Type Description List[ModelBundle]

    A list of ModelBundle objects

    "},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles_v2","title":"list_model_bundles_v2","text":"
    list_model_bundles_v2() -> ListModelBundlesV2Response\n

    List all model bundles.

    Returns:

    Type Description ListModelBundlesV2Response

    An object containing the following keys:

    • model_bundles: A list of model bundles. Each model bundle is an object.
    "},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
    list_model_endpoints() -> List[Endpoint]\n

    Lists all model endpoints that the user owns.

    Returns:

    Type Description List[Endpoint]

    A list of ModelEndpoint objects.

    "},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
    read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Retrieves the logs for the creation of the endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The endpoint or its name.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
    register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

    Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

    Parameters:

    Name Type Description Default batch_csv_location_fn Callable[[], str]

    Function that generates batch_csv_urls for upload_batch_csv_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
    register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

    Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

    Parameters:

    Name Type Description Default bundle_location_fn Callable[[], str]

    Function that generates bundle_urls for upload_bundle_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
    register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

    upload_batch_csv_fn(csv_text, csv_url)\n

    This function should directly write the contents of csv_text as a text string into csv_url.

    Parameters:

    Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

    Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
    register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

    upload_bundle_fn(serialized_bundle, bundle_url)\n

    This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

    See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

    Parameters:

    Name Type Description Default upload_bundle_fn Callable[[str, str], None]

    Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/endpoint_predictions/","title":"Endpoint Predictions","text":""},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"api/hooks/","title":"Hooks","text":""},{"location":"api/hooks/#launch.hooks.PostInferenceHooks","title":"PostInferenceHooks","text":"

    Bases: str, Enum

    Post-inference hooks are functions that are called after inference is complete.

    Attributes:

    Name Type Description CALLBACK str

    The callback hook is called with the inference response and the task ID.

    "},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.CloudpickleArtifactFlavor","title":"CloudpickleArtifactFlavor","text":"

    Bases: BaseModel

    "},{"location":"api/model_bundles/#launch.model_bundle.CloudpickleArtifactFlavor.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[str, Any]]\n

    Optional configuration for the application.

    "},{"location":"api/model_bundles/#launch.model_bundle.CloudpickleArtifactFlavor.framework","title":"framework class-attribute","text":"
    framework: Union[\nPytorchFramework, TensorflowFramework, CustomFramework\n] = Field(Ellipsis, discriminator=\"framework_type\")\n

    Machine Learning framework specification. Either PytorchFramework, TensorflowFramework, or CustomFramework.

    "},{"location":"api/model_bundles/#launch.model_bundle.CloudpickleArtifactFlavor.load_model_fn","title":"load_model_fn class-attribute","text":"
    load_model_fn: str\n

    Function which, when called, returns the model object.

    "},{"location":"api/model_bundles/#launch.model_bundle.CloudpickleArtifactFlavor.load_predict_fn","title":"load_predict_fn class-attribute","text":"
    load_predict_fn: str\n

    Function which, when called, returns the prediction function.

    "},{"location":"api/model_bundles/#launch.model_bundle.CloudpickleArtifactFlavor.requirements","title":"requirements class-attribute","text":"
    requirements: List[str]\n

    List of requirements to install in the environment before running the model.

    "},{"location":"api/model_bundles/#launch.model_bundle.CreateModelBundleV2Response","title":"CreateModelBundleV2Response","text":"

    Bases: BaseModel

    Response object for creating a Model Bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.CreateModelBundleV2Response.model_bundle_id","title":"model_bundle_id class-attribute","text":"
    model_bundle_id: str\n

    ID of the Model Bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.CustomFramework","title":"CustomFramework","text":"

    Bases: BaseModel

    "},{"location":"api/model_bundles/#launch.model_bundle.CustomFramework.image_repository","title":"image_repository class-attribute","text":"
    image_repository: str\n

    Docker image repository to use as the base image.

    "},{"location":"api/model_bundles/#launch.model_bundle.CustomFramework.image_tag","title":"image_tag class-attribute","text":"
    image_tag: str\n

    Docker image tag to use as the base image.

    "},{"location":"api/model_bundles/#launch.model_bundle.ListModelBundlesV2Response","title":"ListModelBundlesV2Response","text":"

    Bases: BaseModel

    Response object for listing Model Bundles.

    "},{"location":"api/model_bundles/#launch.model_bundle.ListModelBundlesV2Response.model_bundles","title":"model_bundles class-attribute","text":"
    model_bundles: List[ModelBundleV2Response]\n

    A list of Model Bundles.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

    Represents a ModelBundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[Any, Any]] = None\n

    An optional user-specified configuration mapping for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
    env_params: Optional[Dict[str, str]] = None\n

    A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
    id: Optional[str] = None\n

    A globally unique identifier for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
    location: Optional[str] = None\n

    An opaque location for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
    metadata: Optional[Dict[Any, Any]] = None\n

    Arbitrary metadata for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
    name: str\n

    The name of the bundle. Must be unique across all bundles that the user owns.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
    packaging_type: Optional[str] = None\n

    The packaging type for the bundle. Can be cloudpickle or zip.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
    requirements: Optional[List[str]] = None\n

    A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response","title":"ModelBundleV2Response","text":"

    Bases: BaseModel

    Response object for a single Model Bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response.created_at","title":"created_at class-attribute","text":"
    created_at: datetime.datetime\n

    Timestamp of when the Model Bundle was created.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response.flavor","title":"flavor class-attribute","text":"
    flavor: Union[\nCloudpickleArtifactFlavor,\nZipArtifactFlavor,\nRunnableImageFlavor,\n] = Field(Ellipsis, discriminator=\"flavor\")\n

    Flavor of the Model Bundle, representing how the model bundle was packaged. Either CloudpickleArtifactFlavor, ZipArtifactFlavor, or RunnableImageFlavor.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response.id","title":"id class-attribute","text":"
    id: str\n

    ID of the Model Bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response.metadata","title":"metadata class-attribute","text":"
    metadata: Dict[str, Any]\n

    Metadata associated with the Model Bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response.model_artifact_ids","title":"model_artifact_ids class-attribute","text":"
    model_artifact_ids: List[str]\n

    IDs of the Model Artifacts associated with the Model Bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response.name","title":"name class-attribute","text":"
    name: str\n

    Name of the Model Bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.PytorchFramework","title":"PytorchFramework","text":"

    Bases: BaseModel

    "},{"location":"api/model_bundles/#launch.model_bundle.PytorchFramework.pytorch_image_tag","title":"pytorch_image_tag class-attribute","text":"
    pytorch_image_tag: str\n

    Image tag of the Pytorch image to use.

    "},{"location":"api/model_bundles/#launch.model_bundle.RunnableImageFlavor","title":"RunnableImageFlavor","text":"

    Bases: BaseModel

    "},{"location":"api/model_bundles/#launch.model_bundle.RunnableImageFlavor.command","title":"command class-attribute","text":"
    command: List[str]\n

    Command to run the image.

    "},{"location":"api/model_bundles/#launch.model_bundle.RunnableImageFlavor.env","title":"env class-attribute","text":"
    env: Optional[Dict[str, str]]\n

    Environment variables to set when running the image.

    "},{"location":"api/model_bundles/#launch.model_bundle.RunnableImageFlavor.repository","title":"repository class-attribute","text":"
    repository: str\n

    Docker repository of the image.

    "},{"location":"api/model_bundles/#launch.model_bundle.RunnableImageFlavor.tag","title":"tag class-attribute","text":"
    tag: str\n

    Docker tag of the image.

    "},{"location":"api/model_bundles/#launch.model_bundle.TensorflowFramework","title":"TensorflowFramework","text":"

    Bases: BaseModel

    "},{"location":"api/model_bundles/#launch.model_bundle.TensorflowFramework.tensorflow_version","title":"tensorflow_version class-attribute","text":"
    tensorflow_version: str\n

    Tensorflow version to use.

    "},{"location":"api/model_bundles/#launch.model_bundle.ZipArtifactFlavor","title":"ZipArtifactFlavor","text":"

    Bases: BaseModel

    "},{"location":"api/model_bundles/#launch.model_bundle.ZipArtifactFlavor.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[str, Any]]\n

    Optional configuration for the application.

    "},{"location":"api/model_bundles/#launch.model_bundle.ZipArtifactFlavor.framework","title":"framework class-attribute","text":"
    framework: Union[\nPytorchFramework, TensorflowFramework, CustomFramework\n] = Field(Ellipsis, discriminator=\"framework_type\")\n

    Machine Learning framework specification. Either PytorchFramework, TensorflowFramework, or CustomFramework.

    "},{"location":"api/model_bundles/#launch.model_bundle.ZipArtifactFlavor.load_model_fn_module_path","title":"load_model_fn_module_path class-attribute","text":"
    load_model_fn_module_path: str\n

    Path to the module to load the model object.

    "},{"location":"api/model_bundles/#launch.model_bundle.ZipArtifactFlavor.load_predict_fn_module_path","title":"load_predict_fn_module_path class-attribute","text":"
    load_predict_fn_module_path: str\n

    Path to the module to load the prediction function.

    "},{"location":"api/model_bundles/#launch.model_bundle.ZipArtifactFlavor.requirements","title":"requirements class-attribute","text":"
    requirements: List[str]\n

    List of requirements to install in the environment before running the model.

    "},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

    All classes here are returned by the get_model_endpoint method and provide a predict function.

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
    AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    An asynchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponseFuture\n

    Runs an asynchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required

    Returns:

    Name Type Description EndpointResponseFuture

    An EndpointResponseFuture such the user can use to query the status of the request.

    Example EndpointResponseFuture EndpointResponseFuture

    .. code-block:: python

    my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
    predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

    (deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

    Parameters:

    Name Type Description Default requests Sequence[EndpointRequest]

    List of EndpointRequests. Request_ids must all be distinct.

    required

    Returns:

    Type Description AsyncEndpointBatchResponse

    an AsyncEndpointResponse keeping track of the inference requests made

    "},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint","title":"SyncEndpoint","text":"
    SyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    A synchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponse\n

    Runs a synchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required"},{"location":"concepts/batch_jobs/","title":"Batch Jobs","text":"

    For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

    Batch jobs are created using the batch_async_request method of the LaunchClient.

    Creating and Following a Batch Job
    import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n}\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
    "},{"location":"concepts/callbacks/","title":"Callbacks","text":"

    Async model endpoints can be configured to send callbacks to a user-defined callback URL. Callbacks are sent as HTTP POST requests with a JSON body. The following code snippet shows how to create an async model endpoint with a callback URL.

    To configure an async endpoint to send callbacks, set the post_inference_hooks field to include launch.PostInferenceHooks.CALLBACK. A callback URL also needs to be specified, and it can be configured as a default using the default_callback_url argument to launch.LaunchClient.create_model_endpoint or as a per-task override using the callback_url field of launch.EndpointRequest.

    Note

    Callbacks will not be sent if the endpoint does not have any post-inference hooks specified, even if a default_callback_url is provided to the endpoint creation method or if the prediction request has a callback_url override.

    Creating an Async Model Endpoint with a Callback URL
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 7\n}\n\"\"\"\nfuture_custom_callback_url = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"}, callback_url=\"https://example.com/custom\"\n),\n)\n\"\"\"\nA callback is sent to https://example.com/custom with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 8\n}\n\"\"\"\n
    "},{"location":"concepts/callbacks/#authentication-for-callbacks","title":"Authentication for callbacks","text":"

    Warning

    This feature is currently in beta, and the API is likely to change.

    Callbacks can be authenticated using shared authentication headers. To enable authentication, set either default_callback_auth_kind when creating the endpoint or callback_auth_kind when making a prediction request.

    Currently, the supported authentication methods are basic and mtls. If basic is used, then the default_callback_auth_username and default_callback_auth_password fields must be specified when creating the endpoint, or the callback_auth_username and callback_auth_password fields must be specified when making a prediction request. If mtls is used, then the same is true for the default_callback_auth_cert and default_callback_auth_key fields, or the callback_auth_cert and callback_auth_key fields.

    Creating an Async Model Endpoint with custom Callback auth
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\ndefault_callback_auth_kind=\"basic\",\ndefault_callback_auth_username=\"user\",\ndefault_callback_auth_password=\"password\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with (\"user\", \"password\") as the basic auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"mtls\", \ncallback_auth_cert=\"cert\", \ncallback_auth_key=\"key\",\n),\n)\n\"\"\"\nA callback is sent with mTLS authentication.\n\"\"\"\nclient.edit_model_endpoint(\nmodel_endpoint=endpoint.model_endpoint,\ndefault_callback_auth_kind=\"mtls\",\ndefault_callback_auth_cert=\"cert\",\ndefault_callback_auth_key=\"key\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent with mTLS auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"basic\",\ncallback_auth_username=\"user\",\ncallback_auth_password=\"pass\",\n),\n)\n\"\"\"\nA callback is sent with (\"user\", \"pass\") as the basic auth.\n\"\"\"\n
    "},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

    Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

    Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
    "},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

    Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

    "},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

    There are two methods for creating model bundles: create_model_bundle and create_model_bundle_from_dirs. The former directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The latter takes in directories containing a load_predict_fn and the module path to the load_predict_fn.

    Creating a Model Bundle DirectlyCreating a Model Bundle from Directories
    import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\n
    import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\npytest==7.2.1\nnumpy\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"requirements_path\": \"requirements.txt\",\n\"env_params\": ENV_PARAMS,\n\"load_predict_fn\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle_from_dirs(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
    "},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

    The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

    Creating Model Bundles with app_config
    import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Union\nfrom typing_extensions import Literal\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"app_config\": {\"mode\": \"batched\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle(**BUNDLE_PARAMS_BATCHED)\n
    "},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

    Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes.

    "},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

    To list all the model bundles you own, use list_model_bundles.

    "},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

    Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

    Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

    Info

    "},{"location":"concepts/model_endpoints/#choosing-the-right-inference-mode","title":"Choosing the right inference mode","text":"

    Here are some tips for how to choose between SyncEndpoint, AsyncEndpoint, and BatchJob for deploying your ModelBundle:

    A SyncEndpoint is good if:

    • You have strict latency requirements (e.g. on the order of seconds or less).
    • You are willing to have resources continually allocated.

    An AsyncEndpoint is good if:

    • You want to save on compute costs.
    • Your inference code takes a long time to run.
    • Your latency requirements are on the order of minutes.

    A BatchJob is good if:

    • You know there is a large batch of inputs ahead of time.
    • You want to optimize for throughput instead of latency.
    "},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

    Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

    Creating an Async Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

    Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints.

    Note

    Sync model endpoints require at least 1 min_worker.

    Creating a Sync Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

    Model endpoints can be listed, updated, and deleted using the Launch API.

    Listing Model Endpoints
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
    Updating a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
    Deleting a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
    "},{"location":"concepts/overview/","title":"Overview","text":"

    Creating deployments on Launch generally involves three steps:

    1. Create and upload a ModelBundle. Pass your trained model as well as pre-/post-processing code to the Scale Launch Python client, and we\u2019ll create a model bundle based on the code and store it in our Bundle Store.

    2. Create a ModelEndpoint. Pass a ModelBundle as well as infrastructure settings such as the desired number of GPUs to our client. This provisions resources on Scale\u2019s cluster dedicated to your ModelEndpoint.

    3. Make requests to the ModelEndpoint. You can make requests through the Python client, or make HTTP requests directly to Scale.

    "}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Scale Launch","text":"

    Simple, scalable, and high performance ML service deployment in python.

    "},{"location":"#example","title":"Example","text":"Launch Usage
    import os\nimport time\nfrom launch import LaunchClient\nfrom launch import EndpointRequest\nfrom pydantic import BaseModel\nfrom rich import print\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_model(x):\nreturn x * 2\nENV_PARAMS = {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"model\": my_model,\n\"load_predict_fn\": my_load_predict_fn,\n\"env_params\": ENV_PARAMS,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n}\nENDPOINT_PARAMS = {\n\"endpoint_name\": \"demo-endpoint\",\n\"model_bundle\": \"test-bundle\",\n\"cpus\": 1,\n\"min_workers\": 0,\n\"endpoint_type\": \"async\",\n\"update_if_exists\": True,\n\"labels\": {\n\"team\": \"MY_TEAM\",\n\"product\": \"launch\",\n}\n}\ndef predict_on_endpoint(request: MyRequestSchema) -> MyResponseSchema:\n# Wait for the endpoint to be ready first before submitting a task\nendpoint = client.get_model_endpoint(endpoint_name=\"demo-endpoint\")\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nendpoint_request = EndpointRequest(args=request.dict(), return_pickled=False)\nfuture = endpoint.predict(request=endpoint_request)\nraw_response = future.get()\nresponse = MyResponseSchema.parse_raw(raw_response.result)\nreturn response\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle(**BUNDLE_PARAMS)\nendpoint = client.create_model_endpoint(**ENDPOINT_PARAMS)\nrequest = MyRequestSchema(x=5, y=\"hello\")\nresponse = predict_on_endpoint(request)\nprint(response)\n\"\"\"\nMyResponseSchema(__root__=10)\n\"\"\"\n

    What's going on here:

    • First we use pydantic to define our request and response schemas, MyRequestSchema and MyResponseSchema. These schemas are used to generate the API documentation for our models.
    • Next we define the the model and the load_predict_fn, which tells Launch how to load our model and how to make predictions with it. In this case, we're just returning a function that adds the length of the string y to model(x), where model doubles the integer x.
    • We then define the model bundle by specifying the load_predict_fn, the request_schema, and the response_schema. We also specify the env_params, which tell Launch environment settings like the base image to use. In this case, we're using a PyTorch image.
    • Next, we create the model endpoint, which is the API that we'll use to make predictions. We specify the model_bundle that we created above, and we specify the endpoint_type, which tells Launch whether to use a synchronous or asynchronous endpoint. In this case, we're using an asynchronous endpoint, which means that we can make predictions and return immediately with a future object. We can then use the future object to get the prediction result later.
    • Finally, we make a prediction by calling predict_on_endpoint with a MyRequestSchema object. This function first waits for the endpoint to be ready, then it submits a prediction request to the endpoint. It then waits for the prediction result and returns it.

    Notice that we specified min_workers=0, meaning that the endpoint will scale down to 0 workers when it's not being used.

    "},{"location":"#installation","title":"Installation","text":"

    To use Scale Launch, first install it using pip:

    Installation
    pip install -U scale-launch\n
    "},{"location":"cli/","title":"CLI","text":"

    Launch comes with a CLI for listing bundles / endpoints, editing endpoints, and sending tasks to endpoints.

    The CLI can be used as scale-launch ....

    "},{"location":"cli/#help","title":"Help","text":"

    Run scale-launch --help for more options.

    scale-launch --help
        This is the command line interface (CLI) package for Scale Launch.\n\n       \u2588\u2588\u2557      \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557   \u2588\u2588\u2557\u2588\u2588\u2588\u2557   \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557  \u2588\u2588\u2557\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557  \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\n       \u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551   \u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551     \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\n       \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551  \u2588\u2588\u2551\n       \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u255d  \u255a\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d  \u255a\u2550\u255d\n\nUsage: scale-launch [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  batch-jobs  Batch Jobs is a wrapper around batch jobs in Scale Launch\n  bundles     Bundles is a wrapper around model bundles in Scale Launch\n  config      Config is a wrapper around getting and setting your API key and other configuration options\n  endpoints   Endpoints is a wrapper around model endpoints in Scale Launch\n  tasks       Tasks is a wrapper around sending requests to endpoints\n
    "},{"location":"api/client/","title":"Launch Client","text":""},{"location":"api/client/#launch.client.LaunchClient","title":"LaunchClient","text":"
    LaunchClient(\napi_key: str,\nendpoint: Optional[str] = None,\nself_hosted: bool = False,\n)\n

    Scale Launch Python Client.

    Initializes a Scale Launch Client.

    Parameters:

    Name Type Description Default api_key str

    Your Scale API key

    required endpoint Optional[str]

    The Scale Launch Endpoint (this should not need to be changed)

    None self_hosted bool

    True iff you are connecting to a self-hosted Scale Launch

    False"},{"location":"api/client/#launch.client.LaunchClient.batch_async_request","title":"batch_async_request","text":"
    batch_async_request(\n*,\nmodel_bundle: Union[ModelBundle, str],\nurls: List[str] = None,\ninputs: Optional[List[Dict[str, Any]]] = None,\nbatch_url_file_location: Optional[str] = None,\nserialization_format: str = \"JSON\",\nlabels: Optional[Dict[str, str]] = None,\ncpus: Optional[int] = None,\nmemory: Optional[str] = None,\ngpus: Optional[int] = None,\ngpu_type: Optional[str] = None,\nstorage: Optional[str] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None\n) -> Dict[str, Any]\n

    Sends a batch inference request using a given bundle. Returns a key that can be used to retrieve the results of inference at a later time.

    Must have exactly one of urls or inputs passed in.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or the name of a the bundle to use for inference.

    required urls List[str]

    A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

    None inputs Optional[List[Dict[str, Any]]]

    A list of model inputs, if exists, we will upload the inputs and pass it in to Launch.

    None batch_url_file_location Optional[str]

    In self-hosted mode, the input to the batch job will be uploaded to this location if provided. Otherwise, one will be determined from bundle_location_fn()

    None serialization_format str

    Serialization format of output, either 'PICKLE' or 'JSON'. 'pickle' corresponds to pickling results + returning

    'JSON' labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None cpus Optional[int]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced.
    • Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains job_id as a key, and the ID as the value.

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes","title":"clone_model_bundle_with_changes","text":"
    clone_model_bundle_with_changes(\nmodel_bundle: Union[ModelBundle, str],\napp_config: Optional[Dict] = None,\n) -> ModelBundle\n
    Warning

    This method is deprecated. Use clone_model_bundle_with_changes_v2 instead.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The existing bundle or its ID.

    required app_config Optional[Dict]

    The new bundle's app config, if not passed in, the new bundle's app_config will be set to None

    None

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.clone_model_bundle_with_changes_v2","title":"clone_model_bundle_with_changes_v2","text":"
    clone_model_bundle_with_changes_v2(\noriginal_model_bundle_id: str,\nnew_app_config: Optional[Dict[str, Any]] = None,\n) -> CreateModelBundleV2Response\n

    Clone a model bundle with an optional new app_config.

    Parameters:

    Name Type Description Default original_model_bundle_id str

    The ID of the model bundle you want to clone.

    required new_app_config Optional[Dict[str, Any]]

    A dictionary of new app config values to use for the cloned model.

    None

    Returns:

    Type Description CreateModelBundleV2Response

    An object containing the following keys:

    • model_bundle_id: The ID of the cloned model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle","title":"create_model_bundle","text":"
    create_model_bundle(\nmodel_bundle_name: str,\nenv_params: Dict[str, str],\n*,\nload_predict_fn: Optional[\nCallable[[LaunchModel_T], Callable[[Any], Any]]\n] = None,\npredict_fn_or_cls: Optional[\nCallable[[Any], Any]\n] = None,\nrequirements: Optional[List[str]] = None,\nmodel: Optional[LaunchModel_T] = None,\nload_model_fn: Optional[\nCallable[[], LaunchModel_T]\n] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nglobals_copy: Optional[Dict[str, Any]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n
    Warning

    This method is deprecated. Use create_model_bundle_from_callable_v2 instead.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required predict_fn_or_cls Optional[Callable[[Any], Any]]

    Function or a Callable class that runs end-to-end (pre/post processing and model inference) on the call. i.e. predict_fn_or_cls(REQUEST) -> RESPONSE.

    None model Optional[LaunchModel_T]

    Typically a trained Neural Network, e.g. a Pytorch module.

    Exactly one of model and load_model_fn must be provided.

    None load_model_fn Optional[Callable[[], LaunchModel_T]]

    A function that, when run, loads a model. This function is essentially a deferred wrapper around the model argument.

    Exactly one of model and load_model_fn must be provided.

    None load_predict_fn Optional[Callable[[LaunchModel_T], Callable[[Any], Any]]]

    Function that, when called with a model, returns a function that carries out inference.

    If model is specified, then this is equivalent to: load_predict_fn(model, app_config=optional_app_config]) -> predict_fn

    Otherwise, if load_model_fn is specified, then this is equivalent to: load_predict_fn(load_model_fn(), app_config=optional_app_config]) -> predict_fn

    In both cases, predict_fn is then the inference function, i.e.: predict_fn(REQUEST) -> RESPONSE

    None requirements Optional[List[str]]

    A list of python package requirements, where each list element is of the form <package_name>==<package_version>, e.g.

    [\"tensorflow==2.3.0\", \"tensorflow-hub==0.11.0\"]

    If you do not pass in a value for requirements, then you must pass in globals() for the globals_copy argument.

    None app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch. - PyTorch fields: - pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags. - Example:

      .. code-block:: python

      { \"framework_type\": \"pytorch\", \"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\" }

    • Tensorflow fields:

      • tensorflow_version: Version of tensorflow, e.g. \"2.3.0\".
    required globals_copy Optional[Dict[str, Any]]

    Dictionary of the global symbol table. Normally provided by globals() built-in function.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_callable_v2","title":"create_model_bundle_from_callable_v2","text":"
    create_model_bundle_from_callable_v2(\n*,\nmodel_bundle_name: str,\nload_predict_fn: Callable[\n[LaunchModel_T], Callable[[Any], Any]\n],\nload_model_fn: Callable[[], LaunchModel_T],\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrequirements: Optional[List[str]] = None,\npytorch_image_tag: Optional[str] = None,\ntensorflow_version: Optional[str] = None,\ncustom_base_image_repository: Optional[str] = None,\ncustom_base_image_tag: Optional[str] = None,\napp_config: Optional[Union[Dict[str, Any], str]] = None\n) -> CreateModelBundleV2Response\n

    Uploads and registers a model bundle to Scale Launch.

    Parameters:

    Name Type Description Default model_bundle_name str

    Name of the model bundle.

    required load_predict_fn Callable[[LaunchModel_T], Callable[[Any], Any]]

    Function that takes in a model and returns a predict function. When your model bundle is deployed, this predict function will be called as follows:

    input = {\"input\": \"some input\"} # or whatever your request schema is.\n\ndef load_model_fn():\n    # load model\n    return model\n\ndef load_predict_fn(model, app_config=None):\n    def predict_fn(input):\n        # do pre-processing\n        output = model(input)\n        # do post-processing\n        return output\n    return predict_fn\n\npredict_fn = load_predict_fn(load_model_fn(), app_config=optional_app_config)\nresponse = predict_fn(input)\n

    required load_model_fn Callable[[], LaunchModel_T]

    A function that, when run, loads a model.

    required request_schema Type[BaseModel]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    required response_schema Type[BaseModel]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint.

    required requirements Optional[List[str]]

    List of pip requirements.

    None pytorch_image_tag Optional[str]

    The image tag for the PyTorch image that will be used to run the bundle. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None tensorflow_version Optional[str]

    The version of TensorFlow that will be used to run the bundle. If not specified, the default version will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_repository Optional[str]

    The repository for a custom base image that will be used to run the bundle. If not specified, the default base image will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_tag Optional[str]

    The tag for a custom base image that will be used to run the bundle. Must be specified if custom_base_image_repository is specified.

    None app_config Optional[Union[Dict[str, Any], str]]

    An optional dictionary of configuration values that will be passed to the bundle when it is run. These values can be accessed by the bundle via the app_config global variable.

    None

    Returns:

    Type Description CreateModelBundleV2Response

    An object containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs","title":"create_model_bundle_from_dirs","text":"
    create_model_bundle_from_dirs(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nrequirements_path: str,\nenv_params: Dict[str, str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\napp_config: Optional[Union[Dict[str, Any], str]] = None,\nrequest_schema: Optional[Type[BaseModel]] = None,\nresponse_schema: Optional[Type[BaseModel]] = None\n) -> ModelBundle\n
    Warning

    This method is deprecated. Use create_model_bundle_from_dirs_v2 instead.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create. The name must be unique across all bundles that you own.

    required base_paths List[str]

    The paths on the local filesystem where the bundle code lives.

    required requirements_path str

    A path on the local filesystem where a requirements.txt file lives.

    required env_params Dict[str, str]

    A dictionary that dictates environment information e.g. the use of pytorch or tensorflow, which base image tag to use, etc. Specifically, the dictionary should contain the following keys:

    • framework_type: either tensorflow or pytorch.
    • PyTorch fields:
      • pytorch_image_tag: An image tag for the pytorch docker base image. The list of tags can be found from https://hub.docker.com/r/pytorch/pytorch/tags

    Example:

    {\n\"framework_type\": \"pytorch\",\n\"pytorch_image_tag\": \"1.10.0-cuda11.3-cudnn8-runtime\",\n}\n

    required load_predict_fn_module_path str

    A python module path for a function that, when called with the output of load_model_fn_module_path, returns a function that carries out inference.

    required load_model_fn_module_path str

    A python module path for a function that returns a model. The output feeds into the function located at load_predict_fn_module_path.

    required app_config Optional[Union[Dict[str, Any], str]]

    Either a Dictionary that represents a YAML file contents or a local path to a YAML file.

    None request_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the request body for the model bundle's endpoint.

    None response_schema Optional[Type[BaseModel]]

    A pydantic model that represents the request schema for the model bundle. This is used to validate the response for the model bundle's endpoint. Note: If request_schema is specified, then response_schema must also be specified.

    None"},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_dirs_v2","title":"create_model_bundle_from_dirs_v2","text":"
    create_model_bundle_from_dirs_v2(\n*,\nmodel_bundle_name: str,\nbase_paths: List[str],\nload_predict_fn_module_path: str,\nload_model_fn_module_path: str,\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrequirements_path: Optional[str] = None,\npytorch_image_tag: Optional[str] = None,\ntensorflow_version: Optional[str] = None,\ncustom_base_image_repository: Optional[str] = None,\ncustom_base_image_tag: Optional[str] = None,\napp_config: Optional[Dict[str, Any]] = None\n) -> CreateModelBundleV2Response\n

    Packages up code from one or more local filesystem folders and uploads them as a bundle to Scale Launch. In this mode, a bundle is just local code instead of a serialized object.

    For example, if you have a directory structure like so, and your current working directory is my_root:

       my_root/\n       my_module1/\n           __init__.py\n           ...files and directories\n           my_inference_file.py\n       my_module2/\n           __init__.py\n           ...files and directories\n

    then calling create_model_bundle_from_dirs_v2 with base_paths=[\"my_module1\", \"my_module2\"] essentially creates a zip file without the root directory, e.g.:

       my_module1/\n       __init__.py\n       ...files and directories\n       my_inference_file.py\n   my_module2/\n       __init__.py\n       ...files and directories\n

    and these contents will be unzipped relative to the server side application root. Bear these points in mind when referencing Python module paths for this bundle. For instance, if my_inference_file.py has def f(...) as the desired inference loading function, then the load_predict_fn_module_path argument should be my_module1.my_inference_file.f.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create.

    required base_paths List[str]

    A list of paths to directories that will be zipped up and uploaded as a bundle. Each path must be relative to the current working directory.

    required load_predict_fn_module_path str

    The Python module path to the function that will be used to load the model for inference. This function should take in a path to a model directory, and return a model object. The model object should be pickleable.

    required load_model_fn_module_path str

    The Python module path to the function that will be used to load the model for training. This function should take in a path to a model directory, and return a model object. The model object should be pickleable.

    required request_schema Type[BaseModel]

    A Pydantic model that defines the request schema for the bundle.

    required response_schema Type[BaseModel]

    A Pydantic model that defines the response schema for the bundle.

    required requirements_path Optional[str]

    Path to a requirements.txt file that will be used to install dependencies for the bundle. This file must be relative to the current working directory.

    None pytorch_image_tag Optional[str]

    The image tag for the PyTorch image that will be used to run the bundle. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None tensorflow_version Optional[str]

    The version of TensorFlow that will be used to run the bundle. If not specified, the default version will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_repository Optional[str]

    The repository for a custom base image that will be used to run the bundle. If not specified, the default base image will be used. Exactly one of pytorch_image_tag, tensorflow_version, or custom_base_image_repository must be specified.

    None custom_base_image_tag Optional[str]

    The tag for a custom base image that will be used to run the bundle. Must be specified if custom_base_image_repository is specified.

    None app_config Optional[Dict[str, Any]]

    An optional dictionary of configuration values that will be passed to the bundle when it is run. These values can be accessed by the bundle via the app_config global variable.

    None

    Returns:

    Type Description CreateModelBundleV2Response

    An object containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_bundle_from_runnable_image_v2","title":"create_model_bundle_from_runnable_image_v2","text":"
    create_model_bundle_from_runnable_image_v2(\n*,\nmodel_bundle_name: str,\nrequest_schema: Type[BaseModel],\nresponse_schema: Type[BaseModel],\nrepository: str,\ntag: str,\ncommand: List[str],\nenv: Dict[str, str]\n) -> CreateModelBundleV2Response\n

    Create a model bundle from a runnable image. The specified command must start a process that will listen for requests on port 5005 using HTTP.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to create.

    required request_schema Type[BaseModel]

    A Pydantic model that defines the request schema for the bundle.

    required response_schema Type[BaseModel]

    A Pydantic model that defines the response schema for the bundle.

    required repository str

    The name of the Docker repository for the runnable image.

    required tag str

    The tag for the runnable image.

    required command List[str]

    The command that will be used to start the process that listens for requests.

    required env Dict[str, str]

    A dictionary of environment variables that will be passed to the bundle when it is run.

    required

    Returns:

    Type Description CreateModelBundleV2Response

    An object containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.create_model_endpoint","title":"create_model_endpoint","text":"
    create_model_endpoint(\n*,\nendpoint_name: str,\nmodel_bundle: Union[ModelBundle, str],\ncpus: int = 3,\nmemory: str = \"8Gi\",\nstorage: Optional[str] = None,\ngpus: int = 0,\nmin_workers: int = 1,\nmax_workers: int = 1,\nper_worker: int = 10,\ngpu_type: Optional[str] = None,\nendpoint_type: str = \"sync\",\nhigh_priority: Optional[bool] = False,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None,\nupdate_if_exists: bool = False,\nlabels: Optional[Dict[str, str]] = None\n) -> Optional[Endpoint]\n

    Creates and registers a model endpoint in Scale Launch. The returned object is an instance of type Endpoint, which is a base class of either SyncEndpoint or AsyncEndpoint. This is the object to which you sent inference requests.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the model endpoint you want to create. The name must be unique across all endpoints that you own.

    required model_bundle Union[ModelBundle, str]

    The ModelBundle that the endpoint should serve.

    required cpus int

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    3 memory str

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    '8Gi' storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus int

    Number of gpus each worker should get, e.g. 0, 1, etc.

    0 min_workers int

    The minimum number of workers. Must be greater than or equal to 0. This should be determined by computing the minimum throughput of your workload and dividing it by the throughput of a single worker. This field must be at least 1 for synchronous endpoints.

    1 max_workers int

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers. This should be determined by computing the maximum throughput of your workload and dividing it by the throughput of a single worker.

    1 per_worker int

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests, subject to the limits defined by min_workers and max_workers.

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.

    Here is our recommendation for computing per_worker:

    1. Compute min_workers and max_workers per your minimum and maximum throughput requirements. 2. Determine a value for the maximum number of concurrent requests in the workload. Divide this number by max_workers. Doing this ensures that the number of workers will \"climb\" to max_workers.
    10 gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None endpoint_type str

    Either \"sync\" or \"async\".

    'sync' high_priority Optional[bool]

    Either True or False. Enabling this will allow the created endpoint to leverage the shared pool of prewarmed nodes for faster spinup time.

    False post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None update_if_exists bool

    If True, will attempt to update the endpoint if it exists. Otherwise, will unconditionally try to create a new endpoint. Note that endpoint names for a given user must be unique, so attempting to call this function with update_if_exists=False for an existing endpoint will raise an error.

    False labels Optional[Dict[str, str]]

    An optional dictionary of key/value pairs to associate with this endpoint.

    None

    Returns:

    Type Description Optional[Endpoint]

    A Endpoint object that can be used to make requests to the endpoint.

    "},{"location":"api/client/#launch.client.LaunchClient.delete_model_endpoint","title":"delete_model_endpoint","text":"
    delete_model_endpoint(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Deletes a model endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    A ModelEndpoint object.

    required"},{"location":"api/client/#launch.client.LaunchClient.edit_model_endpoint","title":"edit_model_endpoint","text":"
    edit_model_endpoint(\n*,\nmodel_endpoint: Union[ModelEndpoint, str],\nmodel_bundle: Optional[Union[ModelBundle, str]] = None,\ncpus: Optional[float] = None,\nmemory: Optional[str] = None,\nstorage: Optional[str] = None,\ngpus: Optional[int] = None,\nmin_workers: Optional[int] = None,\nmax_workers: Optional[int] = None,\nper_worker: Optional[int] = None,\ngpu_type: Optional[str] = None,\nhigh_priority: Optional[bool] = None,\npost_inference_hooks: Optional[\nList[PostInferenceHooks]\n] = None,\ndefault_callback_url: Optional[str] = None,\ndefault_callback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ndefault_callback_auth_username: Optional[str] = None,\ndefault_callback_auth_password: Optional[str] = None,\ndefault_callback_auth_cert: Optional[str] = None,\ndefault_callback_auth_key: Optional[str] = None\n) -> None\n

    Edits an existing model endpoint. Here are the fields that cannot be edited on an existing endpoint:

    • The endpoint's name. - The endpoint's type (i.e. you cannot go from a SyncEnpdoint to an AsyncEndpoint or vice versa.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The model endpoint (or its name) you want to edit. The name must be unique across all endpoints that you own.

    required model_bundle Optional[Union[ModelBundle, str]]

    The ModelBundle that the endpoint should serve.

    None cpus Optional[float]

    Number of cpus each worker should get, e.g. 1, 2, etc. This must be greater than or equal to 1.

    None memory Optional[str]

    Amount of memory each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of memory.

    None storage Optional[str]

    Amount of local ephemeral storage each worker should get, e.g. \"4Gi\", \"512Mi\", etc. This must be a positive amount of storage.

    None gpus Optional[int]

    Number of gpus each worker should get, e.g. 0, 1, etc.

    None min_workers Optional[int]

    The minimum number of workers. Must be greater than or equal to 0.

    None max_workers Optional[int]

    The maximum number of workers. Must be greater than or equal to 0, and as well as greater than or equal to min_workers.

    None per_worker Optional[int]

    The maximum number of concurrent requests that an individual worker can service. Launch automatically scales the number of workers for the endpoint so that each worker is processing per_worker requests:

    • If the average number of concurrent requests per worker is lower than per_worker, then the number of workers will be reduced. - Otherwise, if the average number of concurrent requests per worker is higher than per_worker, then the number of workers will be increased to meet the elevated traffic.
    None gpu_type Optional[str]

    If specifying a non-zero number of gpus, this controls the type of gpu requested. Here are the supported values:

    • nvidia-tesla-t4
    • nvidia-ampere-a10
    None high_priority Optional[bool]

    Either True or False. Enabling this will allow the created endpoint to leverage the shared pool of prewarmed nodes for faster spinup time.

    None post_inference_hooks Optional[List[PostInferenceHooks]]

    List of hooks to trigger after inference tasks are served.

    None default_callback_url Optional[str]

    The default callback url to use for async endpoints. This can be overridden in the task parameters for each individual task. post_inference_hooks must contain \"callback\" for the callback to be triggered.

    None default_callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if default_callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None default_callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if default_callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None"},{"location":"api/client/#launch.client.LaunchClient.get_batch_async_response","title":"get_batch_async_response","text":"
    get_batch_async_response(\nbatch_job_id: str,\n) -> Dict[str, Any]\n

    Gets inference results from a previously created batch job.

    Parameters:

    Name Type Description Default batch_job_id str

    An id representing the batch task job. This id is the in the response from calling batch_async_request.

    required

    Returns:

    Type Description Dict[str, Any]

    A dictionary that contains the following fields:

    Dict[str, Any]
    • status: The status of the job.
    Dict[str, Any]
    • result: The url where the result is stored.
    Dict[str, Any]
    • duration: A string representation of how long the job took to finish or how long it has been running, for a job current in progress.
    Dict[str, Any]
    • num_tasks_pending: The number of tasks that are still pending.
    Dict[str, Any]
    • num_tasks_completed: The number of tasks that have completed.
    "},{"location":"api/client/#launch.client.LaunchClient.get_latest_model_bundle_v2","title":"get_latest_model_bundle_v2","text":"
    get_latest_model_bundle_v2(\nmodel_bundle_name: str,\n) -> ModelBundleV2Response\n

    Get the latest version of a model bundle.

    Parameters:

    Name Type Description Default model_bundle_name str

    The name of the model bundle you want to get.

    required

    Returns:

    Type Description ModelBundleV2Response

    An object containing the following keys:

    • id: The ID of the model bundle.
    • name: The name of the model bundle.
    • schema_location: The location of the schema for the model bundle.
    • flavor: The flavor of the model bundle. Either RunnableImage, CloudpickleArtifact, or ZipArtifact.
    • created_at: The time the model bundle was created.
    • metadata: A dictionary of metadata associated with the model bundle.
    • model_artifact_ids: A list of IDs of model artifacts associated with the bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle","title":"get_model_bundle","text":"
    get_model_bundle(\nmodel_bundle: Union[ModelBundle, str]\n) -> ModelBundle\n

    Returns a model bundle specified by bundle_name that the user owns.

    Parameters:

    Name Type Description Default model_bundle Union[ModelBundle, str]

    The bundle or its name.

    required

    Returns:

    Type Description ModelBundle

    A ModelBundle object

    "},{"location":"api/client/#launch.client.LaunchClient.get_model_bundle_v2","title":"get_model_bundle_v2","text":"
    get_model_bundle_v2(\nmodel_bundle_id: str,\n) -> ModelBundleV2Response\n

    Get a model bundle.

    Parameters:

    Name Type Description Default model_bundle_id str

    The ID of the model bundle you want to get.

    required

    Returns:

    Type Description ModelBundleV2Response

    An object containing the following fields:

    • id: The ID of the model bundle.
    • name: The name of the model bundle.
    • flavor: The flavor of the model bundle. Either RunnableImage, CloudpickleArtifact, or ZipArtifact.
    • created_at: The time the model bundle was created.
    • metadata: A dictionary of metadata associated with the model bundle.
    • model_artifact_ids: A list of IDs of model artifacts associated with the bundle.
    "},{"location":"api/client/#launch.client.LaunchClient.get_model_endpoint","title":"get_model_endpoint","text":"
    get_model_endpoint(\nendpoint_name: str,\n) -> Optional[Union[AsyncEndpoint, SyncEndpoint]]\n

    Gets a model endpoint associated with a name.

    Parameters:

    Name Type Description Default endpoint_name str

    The name of the endpoint to retrieve.

    required"},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles","title":"list_model_bundles","text":"
    list_model_bundles() -> List[ModelBundle]\n

    Returns a list of model bundles that the user owns.

    Returns:

    Type Description List[ModelBundle]

    A list of ModelBundle objects

    "},{"location":"api/client/#launch.client.LaunchClient.list_model_bundles_v2","title":"list_model_bundles_v2","text":"
    list_model_bundles_v2() -> ListModelBundlesV2Response\n

    List all model bundles.

    Returns:

    Type Description ListModelBundlesV2Response

    An object containing the following keys:

    • model_bundles: A list of model bundles. Each model bundle is an object.
    "},{"location":"api/client/#launch.client.LaunchClient.list_model_endpoints","title":"list_model_endpoints","text":"
    list_model_endpoints() -> List[Endpoint]\n

    Lists all model endpoints that the user owns.

    Returns:

    Type Description List[Endpoint]

    A list of ModelEndpoint objects.

    "},{"location":"api/client/#launch.client.LaunchClient.read_endpoint_creation_logs","title":"read_endpoint_creation_logs","text":"
    read_endpoint_creation_logs(\nmodel_endpoint: Union[ModelEndpoint, str]\n)\n

    Retrieves the logs for the creation of the endpoint.

    Parameters:

    Name Type Description Default model_endpoint Union[ModelEndpoint, str]

    The endpoint or its name.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_batch_csv_location_fn","title":"register_batch_csv_location_fn","text":"
    register_batch_csv_location_fn(\nbatch_csv_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for batch CSV inputs. Should give different locations each time. This function is called as batch_csv_location_fn(), and should return a batch_csv_url that upload_batch_csv_fn can take.

    Strictly, batch_csv_location_fn() does not need to return a str. The only requirement is that if batch_csv_location_fn returns a value of type T, then upload_batch_csv_fn() takes in an object of type T as its second argument (i.e. batch_csv_url).

    Parameters:

    Name Type Description Default batch_csv_location_fn Callable[[], str]

    Function that generates batch_csv_urls for upload_batch_csv_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_bundle_location_fn","title":"register_bundle_location_fn","text":"
    register_bundle_location_fn(\nbundle_location_fn: Callable[[], str]\n)\n

    For self-hosted mode only. Registers a function that gives a location for a model bundle. Should give different locations each time. This function is called as bundle_location_fn(), and should return a bundle_url that register_upload_bundle_fn can take.

    Strictly, bundle_location_fn() does not need to return a str. The only requirement is that if bundle_location_fn returns a value of type T, then upload_bundle_fn() takes in an object of type T as its second argument (i.e. bundle_url).

    Parameters:

    Name Type Description Default bundle_location_fn Callable[[], str]

    Function that generates bundle_urls for upload_bundle_fn.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_batch_csv_fn","title":"register_upload_batch_csv_fn","text":"
    register_upload_batch_csv_fn(\nupload_batch_csv_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles batch text upload. This function is called as

    upload_batch_csv_fn(csv_text, csv_url)\n

    This function should directly write the contents of csv_text as a text string into csv_url.

    Parameters:

    Name Type Description Default upload_batch_csv_fn Callable[[str, str], None]

    Function that takes in a csv text (string type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/client/#launch.client.LaunchClient.register_upload_bundle_fn","title":"register_upload_bundle_fn","text":"
    register_upload_bundle_fn(\nupload_bundle_fn: Callable[[str, str], None]\n)\n

    For self-hosted mode only. Registers a function that handles model bundle upload. This function is called as

    upload_bundle_fn(serialized_bundle, bundle_url)\n

    This function should directly write the contents of serialized_bundle as a binary string into bundle_url.

    See register_bundle_location_fn for more notes on the signature of upload_bundle_fn

    Parameters:

    Name Type Description Default upload_bundle_fn Callable[[str, str], None]

    Function that takes in a serialized bundle (bytes type), and uploads that bundle to an appropriate location. Only needed for self-hosted mode.

    required"},{"location":"api/endpoint_predictions/","title":"Endpoint Predictions","text":""},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"api/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"api/hooks/","title":"Hooks","text":""},{"location":"api/hooks/#launch.hooks.PostInferenceHooks","title":"PostInferenceHooks","text":"

    Bases: str, Enum

    Post-inference hooks are functions that are called after inference is complete.

    Attributes:

    Name Type Description CALLBACK str

    The callback hook is called with the inference response and the task ID.

    "},{"location":"api/model_bundles/","title":"Model Bundles","text":""},{"location":"api/model_bundles/#launch.model_bundle.CloudpickleArtifactFlavor","title":"CloudpickleArtifactFlavor","text":"

    Bases: BaseModel

    "},{"location":"api/model_bundles/#launch.model_bundle.CloudpickleArtifactFlavor.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[str, Any]]\n

    Optional configuration for the application.

    "},{"location":"api/model_bundles/#launch.model_bundle.CloudpickleArtifactFlavor.framework","title":"framework class-attribute","text":"
    framework: Union[\nPytorchFramework, TensorflowFramework, CustomFramework\n] = Field(Ellipsis, discriminator=\"framework_type\")\n

    Machine Learning framework specification. Either PytorchFramework, TensorflowFramework, or CustomFramework.

    "},{"location":"api/model_bundles/#launch.model_bundle.CloudpickleArtifactFlavor.load_model_fn","title":"load_model_fn class-attribute","text":"
    load_model_fn: str\n

    Function which, when called, returns the model object.

    "},{"location":"api/model_bundles/#launch.model_bundle.CloudpickleArtifactFlavor.load_predict_fn","title":"load_predict_fn class-attribute","text":"
    load_predict_fn: str\n

    Function which, when called, returns the prediction function.

    "},{"location":"api/model_bundles/#launch.model_bundle.CloudpickleArtifactFlavor.requirements","title":"requirements class-attribute","text":"
    requirements: List[str]\n

    List of requirements to install in the environment before running the model.

    "},{"location":"api/model_bundles/#launch.model_bundle.CreateModelBundleV2Response","title":"CreateModelBundleV2Response","text":"

    Bases: BaseModel

    Response object for creating a Model Bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.CreateModelBundleV2Response.model_bundle_id","title":"model_bundle_id class-attribute","text":"
    model_bundle_id: str\n

    ID of the Model Bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.CustomFramework","title":"CustomFramework","text":"

    Bases: BaseModel

    "},{"location":"api/model_bundles/#launch.model_bundle.CustomFramework.image_repository","title":"image_repository class-attribute","text":"
    image_repository: str\n

    Docker image repository to use as the base image.

    "},{"location":"api/model_bundles/#launch.model_bundle.CustomFramework.image_tag","title":"image_tag class-attribute","text":"
    image_tag: str\n

    Docker image tag to use as the base image.

    "},{"location":"api/model_bundles/#launch.model_bundle.ListModelBundlesV2Response","title":"ListModelBundlesV2Response","text":"

    Bases: BaseModel

    Response object for listing Model Bundles.

    "},{"location":"api/model_bundles/#launch.model_bundle.ListModelBundlesV2Response.model_bundles","title":"model_bundles class-attribute","text":"
    model_bundles: List[ModelBundleV2Response]\n

    A list of Model Bundles.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle","title":"ModelBundle dataclass","text":"

    Represents a ModelBundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[Any, Any]] = None\n

    An optional user-specified configuration mapping for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.env_params","title":"env_params class-attribute","text":"
    env_params: Optional[Dict[str, str]] = None\n

    A dictionary that dictates environment information. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.id","title":"id class-attribute","text":"
    id: Optional[str] = None\n

    A globally unique identifier for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.location","title":"location class-attribute","text":"
    location: Optional[str] = None\n

    An opaque location for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.metadata","title":"metadata class-attribute","text":"
    metadata: Optional[Dict[Any, Any]] = None\n

    Arbitrary metadata for the bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.name","title":"name class-attribute","text":"
    name: str\n

    The name of the bundle. Must be unique across all bundles that the user owns.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.packaging_type","title":"packaging_type class-attribute","text":"
    packaging_type: Optional[str] = None\n

    The packaging type for the bundle. Can be cloudpickle or zip.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundle.requirements","title":"requirements class-attribute","text":"
    requirements: Optional[List[str]] = None\n

    A list of Python package requirements for the bundle. See LaunchClient.create_model_bundle for more information.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response","title":"ModelBundleV2Response","text":"

    Bases: BaseModel

    Response object for a single Model Bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response.created_at","title":"created_at class-attribute","text":"
    created_at: datetime.datetime\n

    Timestamp of when the Model Bundle was created.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response.flavor","title":"flavor class-attribute","text":"
    flavor: Union[\nCloudpickleArtifactFlavor,\nZipArtifactFlavor,\nRunnableImageFlavor,\n] = Field(Ellipsis, discriminator=\"flavor\")\n

    Flavor of the Model Bundle, representing how the model bundle was packaged. Either CloudpickleArtifactFlavor, ZipArtifactFlavor, or RunnableImageFlavor.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response.id","title":"id class-attribute","text":"
    id: str\n

    ID of the Model Bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response.metadata","title":"metadata class-attribute","text":"
    metadata: Dict[str, Any]\n

    Metadata associated with the Model Bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response.model_artifact_ids","title":"model_artifact_ids class-attribute","text":"
    model_artifact_ids: List[str]\n

    IDs of the Model Artifacts associated with the Model Bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.ModelBundleV2Response.name","title":"name class-attribute","text":"
    name: str\n

    Name of the Model Bundle.

    "},{"location":"api/model_bundles/#launch.model_bundle.PytorchFramework","title":"PytorchFramework","text":"

    Bases: BaseModel

    "},{"location":"api/model_bundles/#launch.model_bundle.PytorchFramework.pytorch_image_tag","title":"pytorch_image_tag class-attribute","text":"
    pytorch_image_tag: str\n

    Image tag of the Pytorch image to use.

    "},{"location":"api/model_bundles/#launch.model_bundle.RunnableImageFlavor","title":"RunnableImageFlavor","text":"

    Bases: BaseModel

    "},{"location":"api/model_bundles/#launch.model_bundle.RunnableImageFlavor.command","title":"command class-attribute","text":"
    command: List[str]\n

    Command to run the image.

    "},{"location":"api/model_bundles/#launch.model_bundle.RunnableImageFlavor.env","title":"env class-attribute","text":"
    env: Optional[Dict[str, str]]\n

    Environment variables to set when running the image.

    "},{"location":"api/model_bundles/#launch.model_bundle.RunnableImageFlavor.repository","title":"repository class-attribute","text":"
    repository: str\n

    Docker repository of the image.

    "},{"location":"api/model_bundles/#launch.model_bundle.RunnableImageFlavor.tag","title":"tag class-attribute","text":"
    tag: str\n

    Docker tag of the image.

    "},{"location":"api/model_bundles/#launch.model_bundle.TensorflowFramework","title":"TensorflowFramework","text":"

    Bases: BaseModel

    "},{"location":"api/model_bundles/#launch.model_bundle.TensorflowFramework.tensorflow_version","title":"tensorflow_version class-attribute","text":"
    tensorflow_version: str\n

    Tensorflow version to use.

    "},{"location":"api/model_bundles/#launch.model_bundle.ZipArtifactFlavor","title":"ZipArtifactFlavor","text":"

    Bases: BaseModel

    "},{"location":"api/model_bundles/#launch.model_bundle.ZipArtifactFlavor.app_config","title":"app_config class-attribute","text":"
    app_config: Optional[Dict[str, Any]]\n

    Optional configuration for the application.

    "},{"location":"api/model_bundles/#launch.model_bundle.ZipArtifactFlavor.framework","title":"framework class-attribute","text":"
    framework: Union[\nPytorchFramework, TensorflowFramework, CustomFramework\n] = Field(Ellipsis, discriminator=\"framework_type\")\n

    Machine Learning framework specification. Either PytorchFramework, TensorflowFramework, or CustomFramework.

    "},{"location":"api/model_bundles/#launch.model_bundle.ZipArtifactFlavor.load_model_fn_module_path","title":"load_model_fn_module_path class-attribute","text":"
    load_model_fn_module_path: str\n

    Path to the module to load the model object.

    "},{"location":"api/model_bundles/#launch.model_bundle.ZipArtifactFlavor.load_predict_fn_module_path","title":"load_predict_fn_module_path class-attribute","text":"
    load_predict_fn_module_path: str\n

    Path to the module to load the prediction function.

    "},{"location":"api/model_bundles/#launch.model_bundle.ZipArtifactFlavor.requirements","title":"requirements class-attribute","text":"
    requirements: List[str]\n

    List of requirements to install in the environment before running the model.

    "},{"location":"api/model_endpoints/","title":"Model Endpoints","text":"

    All classes here are returned by the get_model_endpoint method and provide a predict function.

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint","title":"AsyncEndpoint","text":"
    AsyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    An asynchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponseFuture\n

    Runs an asynchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required

    Returns:

    Name Type Description EndpointResponseFuture

    An EndpointResponseFuture such the user can use to query the status of the request.

    Example EndpointResponseFuture EndpointResponseFuture

    .. code-block:: python

    my_endpoint = AsyncEndpoint(...) f: EndpointResponseFuture = my_endpoint.predict(EndpointRequest(...)) result = f.get() # blocks on completion

    "},{"location":"api/model_endpoints/#launch.model_endpoint.AsyncEndpoint.predict_batch","title":"predict_batch","text":"
    predict_batch(\nrequests: Sequence[EndpointRequest],\n) -> AsyncEndpointBatchResponse\n

    (deprecated) Runs inference on the data items specified by urls. Returns a AsyncEndpointResponse.

    Parameters:

    Name Type Description Default requests Sequence[EndpointRequest]

    List of EndpointRequests. Request_ids must all be distinct.

    required

    Returns:

    Type Description AsyncEndpointBatchResponse

    an AsyncEndpointResponse keeping track of the inference requests made

    "},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint","title":"SyncEndpoint","text":"
    SyncEndpoint(model_endpoint: ModelEndpoint, client)\n

    Bases: Endpoint

    A synchronous model endpoint.

    Parameters:

    Name Type Description Default model_endpoint ModelEndpoint

    ModelEndpoint object.

    required client

    A LaunchClient object

    required"},{"location":"api/model_endpoints/#launch.model_endpoint.SyncEndpoint.predict","title":"predict","text":"
    predict(request: EndpointRequest) -> EndpointResponse\n

    Runs a synchronous prediction request.

    Parameters:

    Name Type Description Default request EndpointRequest

    The EndpointRequest object that contains the payload.

    required"},{"location":"concepts/batch_jobs/","title":"Batch Jobs","text":"

    For predicting over a larger set of tasks (> 50) at once, it is recommended to use batch jobs. Batch jobs are a way to send a large number of tasks to a model bundle. The tasks are processed in parallel, and the results are returned as a list of predictions.

    Batch jobs are created using the batch_async_request method of the LaunchClient.

    Creating and Following a Batch Job
    import os\nimport time\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbatch_job = client.batch_async_request(\nmodel_bundle=\"test-bundle\",\ninputs=[\n{\"x\": 2, \"y\": \"hello\"},\n{\"x\": 3, \"y\": \"world\"},\n],\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n}\n)\nstatus = \"PENDING\"\nres = None\nwhile status != \"SUCCESS\" and status != \"FAILURE\" and status != \"CANCELLED\":\ntime.sleep(30)\nres = client.get_batch_async_response(batch_job[\"job_id\"])\nstatus = res[\"status\"]\nprint(f\"the batch job is {status}\")\nprint(res)\n
    "},{"location":"concepts/callbacks/","title":"Callbacks","text":"

    Async model endpoints can be configured to send callbacks to a user-defined callback URL. Callbacks are sent as HTTP POST requests with a JSON body. The following code snippet shows how to create an async model endpoint with a callback URL.

    To configure an async endpoint to send callbacks, set the post_inference_hooks field to include launch.PostInferenceHooks.CALLBACK. A callback URL also needs to be specified, and it can be configured as a default using the default_callback_url argument to launch.LaunchClient.create_model_endpoint or as a per-task override using the callback_url field of launch.EndpointRequest.

    Note

    Callbacks will not be sent if the endpoint does not have any post-inference hooks specified, even if a default_callback_url is provided to the endpoint creation method or if the prediction request has a callback_url override.

    Creating an Async Model Endpoint with a Callback URL
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 7\n}\n\"\"\"\nfuture_custom_callback_url = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"}, callback_url=\"https://example.com/custom\"\n),\n)\n\"\"\"\nA callback is sent to https://example.com/custom with the following JSON body:\n{\n    \"task_id\": \"THE_TASK_ID\",\n    \"result\": 8\n}\n\"\"\"\n
    "},{"location":"concepts/callbacks/#authentication-for-callbacks","title":"Authentication for callbacks","text":"

    Warning

    This feature is currently in beta, and the API is likely to change.

    Callbacks can be authenticated using shared authentication headers. To enable authentication, set either default_callback_auth_kind when creating the endpoint or callback_auth_kind when making a prediction request.

    Currently, the supported authentication methods are basic and mtls. If basic is used, then the default_callback_auth_username and default_callback_auth_password fields must be specified when creating the endpoint, or the callback_auth_username and callback_auth_password fields must be specified when making a prediction request. If mtls is used, then the same is true for the default_callback_auth_cert and default_callback_auth_key fields, or the callback_auth_cert and callback_auth_key fields.

    Creating an Async Model Endpoint with custom Callback auth
    import os\nimport time\nfrom launch import EndpointRequest, LaunchClient, PostInferenceHooks\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-callback\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\npost_inference_hooks=[PostInferenceHooks.CALLBACK],\ndefault_callback_url=\"https://example.com\",\ndefault_callback_auth_kind=\"basic\",\ndefault_callback_auth_username=\"user\",\ndefault_callback_auth_password=\"password\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent to https://example.com with (\"user\", \"password\") as the basic auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"mtls\", \ncallback_auth_cert=\"cert\", \ncallback_auth_key=\"key\",\n),\n)\n\"\"\"\nA callback is sent with mTLS authentication.\n\"\"\"\nclient.edit_model_endpoint(\nmodel_endpoint=endpoint.model_endpoint,\ndefault_callback_auth_kind=\"mtls\",\ndefault_callback_auth_cert=\"cert\",\ndefault_callback_auth_key=\"key\",\n)\nwhile endpoint.status() != \"READY\":\ntime.sleep(10)\nfuture_default = endpoint.predict(\nrequest=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"})\n)\n\"\"\"\nA callback is sent with mTLS auth.\n\"\"\"\nfuture_custom_callback_auth = endpoint.predict(\nrequest=EndpointRequest(\nargs={\"x\": 3, \"y\": \"hello\"},\ncallback_auth_kind=\"basic\",\ncallback_auth_username=\"user\",\ncallback_auth_password=\"pass\",\n),\n)\n\"\"\"\nA callback is sent with (\"user\", \"pass\") as the basic auth.\n\"\"\"\n
    "},{"location":"concepts/endpoint_predictions/","title":"Endpoint Predictions","text":"

    Once endpoints have been created, users can send tasks to them to make predictions. The following code snippet shows how to send tasks to endpoints.

    Sending a Task to an Async EndpointSending a Task to a Sync Endpoint
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-async\")\nfuture = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nresponse = future.get()\nprint(response)\n
    import os\nfrom launch import EndpointRequest, LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.get_model_endpoint(\"demo-endpoint-sync\")\nresponse = endpoint.predict(request=EndpointRequest(args={\"x\": 2, \"y\": \"hello\"}))\nprint(response)\n
    "},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointRequest","title":"EndpointRequest","text":"
    EndpointRequest(\nurl: Optional[str] = None,\nargs: Optional[Dict] = None,\ncallback_url: Optional[str] = None,\ncallback_auth_kind: Optional[\nLiteral[basic, mtls]\n] = None,\ncallback_auth_username: Optional[str] = None,\ncallback_auth_password: Optional[str] = None,\ncallback_auth_cert: Optional[str] = None,\ncallback_auth_key: Optional[str] = None,\nreturn_pickled: Optional[bool] = False,\nrequest_id: Optional[str] = None,\n)\n

    Represents a single request to either a SyncEndpoint or AsyncEndpoint.

    Parameters:

    Name Type Description Default url Optional[str]

    A url to some file that can be read in to a ModelBundle's predict function. Can be an image, raw text, etc. Note: the contents of the file located at url are opened as a sequence of bytes and passed to the predict function. If you instead want to pass the url itself as an input to the predict function, see args.

    Exactly one of url and args must be specified.

    None args Optional[Dict]

    A Dictionary with arguments to a ModelBundle's predict function. If the predict function has signature predict_fn(foo, bar), then the keys in the dictionary should be \"foo\" and \"bar\". Values must be native Python objects.

    Exactly one of url and args must be specified.

    None return_pickled Optional[bool]

    Whether the output should be a pickled python object, or directly returned serialized json.

    False callback_url Optional[str]

    The callback url to use for this task. If None, then the default_callback_url of the endpoint is used. The endpoint must specify \"callback\" as a post-inference hook for the callback to be triggered.

    None callback_auth_kind Optional[Literal[basic, mtls]]

    The default callback auth kind to use for async endpoints. Either \"basic\" or \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_username Optional[str]

    The default callback auth username to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_password Optional[str]

    The default callback auth password to use. This only applies if callback_auth_kind is \"basic\". This can be overridden in the task parameters for each individual task.

    None callback_auth_cert Optional[str]

    The default callback auth cert to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None callback_auth_key Optional[str]

    The default callback auth key to use. This only applies if callback_auth_kind is \"mtls\". This can be overridden in the task parameters for each individual task.

    None request_id Optional[str]

    (deprecated) A user-specifiable id for requests. Should be unique among EndpointRequests made in the same batch call. If one isn't provided the client will generate its own.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture","title":"EndpointResponseFuture","text":"
    EndpointResponseFuture(\nclient, endpoint_name: str, async_task_id: str\n)\n

    Represents a future response from an Endpoint. Specifically, when the EndpointResponseFuture is ready, then its get method will return an actual instance of EndpointResponse.

    This object should not be directly instantiated by the user.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required endpoint_name str

    The name of the endpoint.

    required async_task_id str

    An async task id.

    required"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponseFuture.get","title":"get","text":"
    get(timeout: Optional[float] = None) -> EndpointResponse\n

    Retrieves the EndpointResponse for the prediction request after it completes. This method blocks.

    Parameters:

    Name Type Description Default timeout Optional[float]

    The maximum number of seconds to wait for the response. If None, then the method will block indefinitely until the response is ready.

    None"},{"location":"concepts/endpoint_predictions/#launch.model_endpoint.EndpointResponse","title":"EndpointResponse","text":"
    EndpointResponse(\nclient,\nstatus: str,\nresult_url: Optional[str] = None,\nresult: Optional[str] = None,\ntraceback: Optional[str] = None,\n)\n

    Represents a response received from a Endpoint.

    Parameters:

    Name Type Description Default client

    An instance of LaunchClient.

    required status str

    A string representing the status of the request, i.e. SUCCESS, FAILURE, or PENDING

    required result_url Optional[str]

    A string that is a url containing the pickled python object from the Endpoint's predict function.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None result Optional[str]

    A string that is the serialized return value (in json form) of the Endpoint's predict function. Specifically, one can json.loads() the value of result to get the original python object back.

    Exactly one of result_url or result will be populated, depending on the value of return_pickled in the request.

    None traceback Optional[str]

    The stack trace if the inference endpoint raised an error. Can be used for debugging

    None"},{"location":"concepts/model_bundles/","title":"Model Bundles","text":"

    Model Bundles are deployable models that can be used to make predictions. They are created by packaging a model up into a deployable format.

    "},{"location":"concepts/model_bundles/#creating-model-bundles","title":"Creating Model Bundles","text":"

    There are three methods for creating model bundles: create_model_bundle_from_callable_v2 and create_model_bundle_from_dirs_v2. create_model_bundle_from_runnable_image_v2. The first directly pickles a user-specified load_predict_fn, a function which loads the model and returns a predict_fn, a function which takes in a request. The second takes in directories containing a load_predict_fn and the module path to the load_predict_fn. The third takes a Docker image that contains an entrypoint that starts a process listening for requests at port 5005 using HTTP and exposes POST /predict and GET /healthz endpoints.

    Each of these modes of creating a model bundle is called a \"Flavor\".

    Info

    Creating From CallablesCreating From DirectoriesCreating From a Runnable Image
    import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\ndef my_load_predict_fn(model):\ndef returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn():\ndef my_model(x):\nreturn x * 2\nreturn my_model\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"load_model_fn\": my_load_model_fn,\n\"load_predict_fn\": my_load_predict_fn,\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],  # list your requirements here\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle_from_callable_v2(**BUNDLE_PARAMS)\n
    import os\nimport tempfile\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\ndirectory = tempfile.mkdtemp()\nmodel_filename = os.path.join(directory, \"model.py\")\nwith open(model_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_model_fn():\n    def my_model(x):\n        return x * 2\n    return my_model\n\"\"\")\npredict_filename = os.path.join(directory, \"predict.py\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\ndef my_load_predict_fn(model):\n    def returns_model_of_x_plus_len_of_y(x: int, y: str) -> int:\n        assert isinstance(x, int) and isinstance(y, str)\n        return model(x) + len(y)\n    return returns_model_of_x_plus_len_of_y\n\"\"\")\nrequirements_filename = os.path.join(directory, \"requirements.txt\")\nwith open(predict_filename, \"w\") as f:\nf.write(\"\"\"\npytest==7.2.1\nnumpy\n\"\"\"\n)\n\"\"\"\nThe directory structure should now look like\ndirectory/\n    model.py\n    predict.py\n    requirements.txt\n\"\"\"\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"base_paths\": [directory],\n\"load_predict_fn_module_path\": \"predict.my_load_predict_fn\",\n\"load_model_fn_module_path\": \"model.my_load_model_fn\",\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"requirements_path\": \"requirements.txt\",\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle_from_dirs_v2(**BUNDLE_PARAMS)\n# Clean up files from demo\nos.remove(model_filename)\nos.remove(predict_filename)\nos.rmdir(directory)\n
    import os\nfrom pydantic import BaseModel\nfrom launch import LaunchClient\nclass MyRequestSchema(BaseModel):\nx: int\ny: str\nclass MyResponseSchema(BaseModel):\n__root__: int\nBUNDLE_PARAMS = {\n\"model_bundle_name\": \"test-bundle\",\n\"load_model_fn\": my_load_model_fn,\n\"load_predict_fn\": my_load_predict_fn,\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"repository\": \"launch_rearch\",\n\"tag\": \"12b9131c5a1489c76592cddd186962cce965f0f6-cpu\",\n\"command\": [\n\"dumb-init\",\n\"--\",\n\"ddtrace-run\",\n\"run-service\",\n\"--config\",\n\"/install/launch_rearch/config/service--user_defined_code.yaml\",\n\"--concurrency\",\n\"1\",\n\"--http\",\n\"production\",\n\"--port\",\n\"5005\",\n],\n\"env\": {\n\"TEST_KEY\": \"test_value\",\n},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.create_model_bundle_from_runnable_image_v2(**BUNDLE_PARAMS)\n
    "},{"location":"concepts/model_bundles/#choosing-the-right-model-bundle-flavor","title":"Choosing the right model bundle flavor","text":"

    Here are some tips for how to choose between the different flavors of ModelBundle:

    A CloudpickleArtifactFlavor (creating from callable) is good if:

    • You are creating the model bundle from a Jupyter notebook.
    • The model bundle is small without too many dependencies.

    A ZipArtifactFlavor (creating from directories) is good if:

    • You have a relatively constant set of dependencies.
    • You have a lot of custom code that you want to include in the model bundle.
    • You do not want to build a web server and Docker image to serve your model.

    A RunnableImageArtifactFlavor (creating from runnable image) is good if:

    • You have a lot of dependencies.
    • You have a lot of custom code that you want to include in the model bundle.
    • You are comfortable with building a web server and Docker image to serve your model.
    "},{"location":"concepts/model_bundles/#configuring-model-bundles","title":"Configuring Model Bundles","text":"

    The app_config field of a model bundle is a dictionary that can be used to configure the model bundle. If specified, the app_config is passed to the load_predict_fn when the model bundle is deployed, alongside the model. This can allow for more code reuse between multiple bundles that perform similar tasks.

    Creating Model Bundles with app_config
    import os\nfrom launch import LaunchClient\nfrom pydantic import BaseModel\nfrom typing import List, Union\nfrom typing_extensions import Literal\nclass MyRequestSchemaSingle(BaseModel):\nkind: Literal['single']\nx: int\ny: str\nclass MyRequestSchemaBatched(BaseModel):\nkind: Literal['batched']\nx: List[int]\ny: List[str]\nclass MyRequestSchema(BaseModel):\n__root__: Union[MyRequestSchemaSingle, MyRequestSchemaBatched]\nclass MyResponseSchema(BaseModel):\n__root__: Union[int, List[int]]\ndef my_load_predict_fn(app_config, model):\ndef returns_model_of_x_plus_len_of_y(x: Union[int, List[int]], y: Union[str, List[str]]) -> Union[int, List[int]]:\n\"\"\"MyRequestSchema -> MyResponseSchema\"\"\"\nif app_config[\"mode\"] == \"single\":\nassert isinstance(x, int) and isinstance(y, str)\nreturn model(x) + len(y)\nresult = []\nfor x_i, y_i in zip(x, y):\nresult.append(model(x_i) + len(y_i))\nreturn result\nreturn returns_model_of_x_plus_len_of_y\ndef my_load_model_fn(app_config):\ndef my_model_single(x: int):\nreturn x * 2\ndef my_model_batched(x: List[int]):\nreturn [my_model_single(x_i) for x_i in x]\nif app_config[\"mode\"] == \"single\":\nreturn my_model_single\nreturn my_model_batched\nBUNDLE_PARAMS_SINGLE = {\n\"model_bundle_name\": \"test-bundle-single\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n\"app_config\": {\"mode\": \"single\"},\n}\nBUNDLE_PARAMS_BATCHED = {\n\"model_bundle_name\": \"test-bundle-batched\",\n\"load_predict_fn\": my_load_predict_fn,\n\"load_model_fn\": my_load_model_fn,\n\"requirements\": [\"pytest==7.2.1\", \"numpy\"],\n\"request_schema\": MyRequestSchema,\n\"response_schema\": MyResponseSchema,\n\"pytorch_image_tag\": \"1.7.1-cuda11.0-cudnn8-runtime\",\n\"app_config\": {\"mode\": \"batched\"},\n}\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nbundle_single = client.create_model_bundle_from_callable_v2(**BUNDLE_PARAMS_SINGLE)\nbundle_batch = client.create_model_bundle_from_callable_v2(**BUNDLE_PARAMS_BATCHED)\n
    "},{"location":"concepts/model_bundles/#updating-model-bundles","title":"Updating Model Bundles","text":"

    Model Bundles are immutable, meaning they cannot be edited once created. However, it is possible to clone an existing model bundle with a new app_config using clone_model_bundle_with_changes_v2.

    "},{"location":"concepts/model_bundles/#listing-model-bundles","title":"Listing Model Bundles","text":"

    To list all the model bundles you own, use list_model_bundles_v2.

    "},{"location":"concepts/model_endpoints/","title":"Model Endpoints","text":"

    Model Endpoints are deployments of models that can receive requests and return predictions containing the results of the model's inference. Each model endpoint is associated with a model bundle, which contains the model's code. An endpoint specifies deployment parameters, such as the minimum and maximum number of workers, as well as the requested resources for each worker, such as the number of CPUs, amount of memory, GPU count, and type of GPU.

    Endpoints can be asynchronous or synchronous. Asynchronous endpoints return a future immediately after receiving a request, and the future can be used to retrieve the prediction once it is ready. Synchronous endpoints return the prediction directly after receiving a request.

    Info

    "},{"location":"concepts/model_endpoints/#choosing-the-right-inference-mode","title":"Choosing the right inference mode","text":"

    Here are some tips for how to choose between SyncEndpoint, AsyncEndpoint, and BatchJob for deploying your ModelBundle:

    A SyncEndpoint is good if:

    • You have strict latency requirements (e.g. on the order of seconds or less).
    • You are willing to have resources continually allocated.

    An AsyncEndpoint is good if:

    • You want to save on compute costs.
    • Your inference code takes a long time to run.
    • Your latency requirements are on the order of minutes.

    A BatchJob is good if:

    • You know there is a large batch of inputs ahead of time.
    • You want to optimize for throughput instead of latency.
    "},{"location":"concepts/model_endpoints/#creating-async-model-endpoints","title":"Creating Async Model Endpoints","text":"

    Async model endpoints are the most cost-efficient way to perform inference on tasks that are less latency-sensitive.

    Creating an Async Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-async\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#creating-sync-model-endpoints","title":"Creating Sync Model Endpoints","text":"

    Sync model endpoints are useful for latency-sensitive tasks, such as real-time inference. Sync endpoints are more expensive than async endpoints.

    Note

    Sync model endpoints require at least 1 min_worker.

    Creating a Sync Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-sync\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=1,\nendpoint_type=\"sync\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\n
    "},{"location":"concepts/model_endpoints/#managing-model-endpoints","title":"Managing Model Endpoints","text":"

    Model endpoints can be listed, updated, and deleted using the Launch API.

    Listing Model Endpoints
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoints = client.list_model_endpoints()\n
    Updating a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nclient.edit_model_endpoint(\nmodel_endpoint=\"demo-endpoint\",\nmax_workers=2,\n)\n
    Deleting a Model Endpoint
    import os\nfrom launch import LaunchClient\nclient = LaunchClient(api_key=os.getenv(\"LAUNCH_API_KEY\"))\nendpoint = client.create_model_endpoint(\nendpoint_name=\"demo-endpoint-tmp\",\nmodel_bundle=\"test-bundle\",\ncpus=1,\nmin_workers=0,\nendpoint_type=\"async\",\nupdate_if_exists=True,\nlabels={\n\"team\": \"MY_TEAM\",\n\"product\": \"MY_PRODUCT\",\n},\n)\nclient.delete_model_endpoint(model_endpoint=\"demo-endpoint-tmp\")\n
    "},{"location":"concepts/overview/","title":"Overview","text":"

    Creating deployments on Launch generally involves three steps:

    1. Create and upload a ModelBundle. Pass your trained model as well as pre-/post-processing code to the Scale Launch Python client, and we\u2019ll create a model bundle based on the code and store it in our Bundle Store.

    2. Create a ModelEndpoint. Pass a ModelBundle as well as infrastructure settings such as the desired number of GPUs to our client. This provisions resources on Scale\u2019s cluster dedicated to your ModelEndpoint.

    3. Make requests to the ModelEndpoint. You can make requests through the Python client, or make HTTP requests directly to Scale.

    "}]} \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index 9da3509e425d56c786b081cabe4da8f90624e755..615741f3103acb0103eec480e0b80e10cc0f3761 100644 GIT binary patch delta 16 XcmX@WbbyInzMF&NcdqhAc1uP8E6oJM delta 16 XcmX@WbbyInzMF%i*k5TQyCow4CtL&^ From a538983f7c7c3a1f1bee395e50e307819db7248c Mon Sep 17 00:00:00 2001 From: Phil Chen Date: Tue, 28 Mar 2023 22:37:19 -0700 Subject: [PATCH 13/28] Deployed 527ff16 with MkDocs version: 1.4.2 --- concepts/model_bundles/index.html | 6 +++--- search/search_index.json | 2 +- sitemap.xml | 26 +++++++++++++------------- sitemap.xml.gz | Bin 320 -> 320 bytes 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/concepts/model_bundles/index.html b/concepts/model_bundles/index.html index 7640dfdb..e76ca68b 100644 --- a/concepts/model_bundles/index.html +++ b/concepts/model_bundles/index.html @@ -590,8 +590,8 @@

    Creating Model Bundlespredict_fn, a function which takes in a request. The second takes in directories containing a load_predict_fn and the module path to the load_predict_fn. -The third takes a Docker image that contains an entrypoint that starts a process -listening for requests at port 5005 using HTTP and exposes POST /predict and +The third takes a Docker image and a command that starts a process listening for +requests at port 5005 using HTTP and exposes POST /predict and GET /healthz endpoints.

    Each of these modes of creating a model bundle is called a "Flavor".

    @@ -609,7 +609,7 @@

    Choosing the right model bundle
  • You have a lot of custom code that you want to include in the model bundle.
  • You do not want to build a web server and Docker image to serve your model.
  • -

    A RunnableImageArtifactFlavor (creating from runnable image) is good if:

    +

    A RunnableImageFlavor (creating from runnable image) is good if:

    @@ -2226,14 +2242,16 @@

    repository: str, tag: str, command: List[str], - env: Dict[str, str] -) -> CreateModelBundleV2Response + env: Dict[str, str], + readiness_initial_delay_seconds: int +) -> CreateModelBundleV2Response

    Create a model bundle from a runnable image. The specified command must start a process that will listen for requests on port 5005 using HTTP.

    +

    Inference requests must be served at the POST /predict route while the GET /readyz route is a healthcheck.

    Parameters:

    A dictionary containing the following keys:

    +

    An object containing the following keys:

    • model_bundle_id: The ID of the cloned model bundle.

    A dictionary containing the following keys:

    +

    An object containing the following keys:

    • model_bundle_id: The ID of the created model bundle.

    A dictionary containing the following keys:

    +

    An object containing the following keys:

    • model_bundle_id: The ID of the created model bundle.
    - Dict[str, Any] + CreateModelBundleV2Response

    A dictionary containing the following keys:

    +

    An object containing the following keys:

    • model_bundle_id: The ID of the created model bundle.

    A dictionary containing the following keys:

    +

    An object containing the following keys:

    • id: The ID of the model bundle.
    • name: The name of the model bundle.
    • @@ -3255,7 +3259,9 @@

      -
      get_model_bundle_v2(model_bundle_id: str) -> Dict[str, Any]
      +
      get_model_bundle_v2(
      +    model_bundle_id: str,
      +) -> ModelBundleV2Response
       
      @@ -3297,13 +3303,12 @@

    - Dict[str, Any] + ModelBundleV2Response

    A dictionary containing the following keys:

    +

    An object containing the following fields:

    • id: The ID of the model bundle.
    • name: The name of the model bundle.
    • -
    • schema_location: The location of the schema for the model bundle.
    • flavor: The flavor of the model bundle. Either RunnableImage, CloudpickleArtifact, or ZipArtifact.
    • created_at: The time the model bundle was created.
    • @@ -3412,7 +3417,7 @@

      -
      list_model_bundles_v2() -> List[Dict[str, Any]]
      +
      list_model_bundles_v2() -> ListModelBundlesV2Response
       
      @@ -3430,19 +3435,11 @@

      List[Dict[str, Any]] + ListModelBundlesV2Response

    A list of dictionaries containing the following keys:

    +

    An object containing the following keys:

      -
    • id: The ID of the model bundle.
    • -
    • name: The name of the model bundle.
    • -
    • schema_location: The location of the schema for the model bundle.
    • -
    • flavor: The flavor of the model bundle. Either RunnableImage, - CloudpickleArtifact, or ZipArtifact.
    • -
    • created_at: The time the model bundle was created.
    • -
    • metadata: A dictionary of metadata associated with the model bundle.
    • -
    • model_artifact_ids: A list of IDs of model artifacts associated with the - bundle.
    • +
    • model_bundles: A list of model bundles. Each model bundle is an object.

    Path to a requirements.txt file that will be used to install dependencies for the bundle. This file must be relative to the current working directory.

    - required + None
    urls - List[str] + Optional[List[str]]

    A list of urls, each pointing to a file containing model input. Must be accessible by Scale Launch, hence urls need to either be public or signedURLs.

    @@ -2317,6 +2335,245 @@

    required +

    + + + + + + +
    readiness_initial_delay_seconds + int +

    The number of seconds to wait for the HTTP server to become ready and +successfully respond on its healthcheck.

    + required +
    + +

    Returns:

    + + + + + + + + + + + + + +
    TypeDescription
    + CreateModelBundleV2Response +

    An object containing the following keys:

    +
      +
    • model_bundle_id: The ID of the created model bundle.
    • +
    + +

    + + + +
    + + + +

    + create_model_bundle_from_triton_enhanced_runnable_image_v2 + + +

    +
    create_model_bundle_from_triton_enhanced_runnable_image_v2(
    +    *,
    +    model_bundle_name: str,
    +    request_schema: Type[BaseModel],
    +    response_schema: Type[BaseModel],
    +    repository: str,
    +    tag: str,
    +    command: List[str],
    +    env: Dict[str, str],
    +    readiness_initial_delay_seconds: int,
    +    triton_model_repository: str,
    +    triton_model_replicas: Optional[Dict[str, str]],
    +    triton_num_cpu: float,
    +    triton_commit_tag: str,
    +    triton_storage: Optional[str],
    +    triton_memory: Optional[str],
    +    triton_readiness_initial_delay_seconds: int
    +) -> CreateModelBundleV2Response
    +
    + +
    + +

    Create a model bundle from a runnable image and a tritonserver image.

    +

    Same requirements as :param:create_model_bundle_from_runnable_image_v2 with additional constraints necessary +for configuring tritonserver's execution.

    + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    model_bundle_name + str +

    The name of the model bundle you want to create.

    + required +
    request_schema + Type[BaseModel] +

    A Pydantic model that defines the request schema for the bundle.

    + required +
    response_schema + Type[BaseModel] +

    A Pydantic model that defines the response schema for the bundle.

    + required +
    repository + str +

    The name of the Docker repository for the runnable image.

    + required +
    tag + str +

    The tag for the runnable image.

    + required +
    command + List[str] +

    The command that will be used to start the process that listens for requests.

    + required +
    env + Dict[str, str] +

    A dictionary of environment variables that will be passed to the bundle when it +is run.

    + required +
    readiness_initial_delay_seconds + int +

    The number of seconds to wait for the HTTP server to become ready and +successfully respond on its healthcheck.

    + required +
    triton_model_repository + str +

    The S3 prefix that contains the contents of the model repository, formatted +according to https://github.com/triton-inference-server/server/blob/main/docs/user_guide/model_repository.md

    + required +
    triton_model_replicas + Optional[Dict[str, str]] +

    If supplied, the name and number of replicas to make for each model.

    + required +
    triton_num_cpu + float +

    Number of CPUs, fractional, to allocate to tritonserver.

    + required +
    triton_commit_tag + str +

    The image tag of the specific trionserver version.

    + required +
    triton_storage + Optional[str] +

    Amount of storage space to allocate for the tritonserver container.

    + required +
    triton_memory + Optional[str] +

    Amount of memory to allocate for the tritonserver container.

    + required +
    triton_readiness_initial_delay_seconds + int +

    Like readiness_initial_delay_seconds, but for tritonserver's +own healthcheck.

    + required +
    @@ -3172,7 +3429,7 @@
  • created_at: The time the model bundle was created.
  • metadata: A dictionary of metadata associated with the model bundle.
  • model_artifact_ids: A list of IDs of model artifacts associated with the @@ -3792,7 +4049,7 @@

    {"base": "../..", "features": ["search.suggest", "search.highlight", "content.tabs.link", "content.code.annotate", "content.code.copy"], "search": "../../assets/javascripts/workers/search.208ed371.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}} - + diff --git a/api/endpoint_predictions/index.html b/api/endpoint_predictions/index.html index 2bc159d0..5b6387dc 100644 --- a/api/endpoint_predictions/index.html +++ b/api/endpoint_predictions/index.html @@ -19,7 +19,7 @@ - + @@ -27,7 +27,7 @@ - + @@ -89,7 +89,9 @@ -
    + + +

  • @@ -1180,40 +1148,6 @@ RunnableImageFlavor - -
  • @@ -1964,19 +1898,15 @@

    -
    flavor: Union[
    -    CloudpickleArtifactFlavor,
    -    ZipArtifactFlavor,
    -    RunnableImageFlavor,
    -] = Field(Ellipsis, discriminator="flavor")
    +
    flavor: ModelBundleFlavors = Field(
    +    Ellipsis, discriminator="flavor"
    +)
     
    -

    Flavor of the Model Bundle, representing how the model bundle was packaged. Either -CloudpickleArtifactFlavor, -ZipArtifactFlavor, or -RunnableImageFlavor.

    +

    Flavor of the Model Bundle, representing how the model bundle was packaged.

    +

    See ModelBundleFlavors for details.

    @@ -2157,112 +2087,22 @@

    - Bases: BaseModel

    - - - - - - -
    - - - + Bases: RunnableImageLike

    - - - -
    - - - -

    - command - - - - class-attribute - - -

    -
    command: List[str]
    -
    - -
    -

    Command to run the image.

    -
    - -
    - -
    - - - -

    - env +

    Model bundles that use custom docker images that expose an HTTP server for inference.

    - - - class-attribute - -

    -
    env: Optional[Dict[str, str]]
    -
    -
    -

    Environment variables to set when running the image.

    -
    -
    - -
    - - - -

    - repository - - - - class-attribute - - -

    -
    repository: str
    -
    - -
    - -

    Docker repository of the image.

    -
    - -
    +
    -
    -

    - tag - - - class-attribute - -

    -
    tag: str
    -
    - -
    - -

    Docker tag of the image.

    -
    - -
    @@ -2534,7 +2374,7 @@

    {"base": "../..", "features": ["search.suggest", "search.highlight", "content.tabs.link", "content.code.annotate", "content.code.copy"], "search": "../../assets/javascripts/workers/search.208ed371.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}} - + diff --git a/api/model_endpoints/index.html b/api/model_endpoints/index.html index 0b8144b3..c80d323d 100644 --- a/api/model_endpoints/index.html +++ b/api/model_endpoints/index.html @@ -19,7 +19,7 @@ - + @@ -27,7 +27,7 @@ - + @@ -89,7 +89,9 @@ -
    + + +

  • + +
  • + + create_docker_image_batch_job() + + +
  • + +
  • + + create_docker_image_batch_job_bundle() + +
  • @@ -550,6 +564,27 @@ get_batch_async_response() +
  • + +
  • + + get_docker_image_batch_job() + + +
  • + +
  • + + get_docker_image_batch_job_bundle() + + +
  • + +
  • + + get_latest_docker_image_batch_job_bundle() + +
  • @@ -578,6 +613,13 @@ get_model_endpoint() +
  • + +
  • + + list_docker_image_batch_job_bundles() + +
  • @@ -634,6 +676,13 @@ register_upload_bundle_fn() +
  • + +
  • + + update_docker_image_batch_job() + +
  • @@ -712,6 +761,55 @@ + + + + + + + + +
  • + + + + + + + + + + + +
  • + + + @@ -765,6 +863,20 @@ clone_model_bundle_with_changes_v2() + + +
  • + + create_docker_image_batch_job() + + +
  • + +
  • + + create_docker_image_batch_job_bundle() + +
  • @@ -835,6 +947,27 @@ get_batch_async_response() +
  • + +
  • + + get_docker_image_batch_job() + + +
  • + +
  • + + get_docker_image_batch_job_bundle() + + +
  • + +
  • + + get_latest_docker_image_batch_job_bundle() + +
  • @@ -863,6 +996,13 @@ get_model_endpoint() +
  • + +
  • + + list_docker_image_batch_job_bundles() + +
  • @@ -919,6 +1059,13 @@ register_upload_bundle_fn() +
  • + +
  • + + update_docker_image_batch_job() + +
  • @@ -1048,8 +1195,9 @@

    gpu_type: Optional[str] = None, storage: Optional[str] = None, max_workers: Optional[int] = None, - per_worker: Optional[int] = None -) -> Dict[str, Any] + per_worker: Optional[int] = None, + timeout_seconds: Optional[float] = None +) -> Dict[str, Any]
    @@ -1222,6 +1370,18 @@

    None + + timeout_seconds + + Optional[float] + +

    The maximum amount of time (in seconds) that the batch job can take. +If not specified, the server defaults to 12 hours. This includes the time required +to build the endpoint and the total time required for all the individual tasks.

    + + None + + @@ -1409,6 +1569,324 @@

    + create_docker_image_batch_job + + +

    +
    create_docker_image_batch_job(
    +    *,
    +    labels: Dict[str, str],
    +    docker_image_batch_job_bundle: Optional[
    +        Union[str, DockerImageBatchJobBundleResponse]
    +    ] = None,
    +    docker_image_batch_job_bundle_name: Optional[
    +        str
    +    ] = None,
    +    job_config: Optional[Dict[str, Any]] = None,
    +    cpus: Optional[int] = None,
    +    memory: Optional[str] = None,
    +    gpus: Optional[int] = None,
    +    gpu_type: Optional[str] = None,
    +    storage: Optional[str] = None
    +)
    +
    + +
    + +

    For self hosted mode only.

    + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    docker_image_batch_job_bundle + Optional[Union[str, DockerImageBatchJobBundleResponse]] +

    Specifies the docker image bundle to use for the batch job. +Either the string id of a docker image bundle, or a +DockerImageBatchJobBundleResponse object. +Only one of docker_image_batch_job_bundle and docker_image_batch_job_bundle_name +can be specified.

    + None +
    docker_image_batch_job_bundle_name + Optional[str] +

    The name of a batch job bundle. If specified, +Launch will use the most recent bundle with that name owned by the current user. +Only one of docker_image_batch_job_bundle and docker_image_batch_job_bundle_name +can be specified.

    + None +
    labels + Dict[str, str] +

    Kubernetes labels that are present on the batch job.

    + required +
    job_config + Optional[Dict[str, Any]] +

    A JSON-serializable python object that will get passed to the batch job, +specifically as the contents of a file mounted at mount_location inside the bundle. +You can call python's json.load() on the file to retrieve the contents.

    + None +
    cpus + Optional[int] +

    Optional override for the number of cpus to give to your job. Either the default +must be specified in the bundle, or this must be specified.

    + None +
    memory + Optional[str] +

    Optional override for the amount of memory to give to your job. Either the default +must be specified in the bundle, or this must be specified.

    + None +
    gpus + Optional[int] +

    Optional number of gpus to give to the bundle. If not specified in the bundle or +here, will be interpreted as 0 gpus.

    + None +
    gpu_type + Optional[str] +

    Optional type of gpu. If the final number of gpus is positive, must be specified +either in the bundle or here.

    + None +
    storage + Optional[str] +

    Optional reserved amount of disk to give to your batch job. If not specified, +your job may be evicted if it is using too much disk.

    + None +
    + +
    + +
    + +
    + + + +

    + create_docker_image_batch_job_bundle + + +

    +
    create_docker_image_batch_job_bundle(
    +    *,
    +    name: str,
    +    image_repository: str,
    +    image_tag: str,
    +    command: List[str],
    +    env: Optional[Dict[str, str]],
    +    mount_location: Optional[str],
    +    cpus: Optional[int] = None,
    +    memory: Optional[str] = None,
    +    gpus: Optional[int] = None,
    +    gpu_type: Optional[str] = None,
    +    storage: Optional[str] = None
    +) -> CreateDockerImageBatchJobBundleResponse
    +
    + +
    + +

    For self hosted mode only.

    +

    Creates a Docker Image Batch Job Bundle.

    + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    name + str +

    A user-defined name for the bundle. Does not need to be unique.

    + required +
    image_repository + str +

    The (short) repository of your image. For example, if your image is located at +123456789012.dkr.ecr.us-west-2.amazonaws.com/repo:tag, and your version of Launch +is configured to look at 123456789012.dkr.ecr.us-west-2.amazonaws.com for Docker Images, +you would pass the value repo for the image_repository parameter.

    + required +
    image_tag + str +

    The tag of your image inside of the repo. In the example above, you would pass +the value tag for the image_tag parameter.

    + required +
    command + List[str] +

    The command to run inside the docker image.

    + required +
    env + Optional[Dict[str, str]] +

    A dictionary of environment variables to inject into your docker image.

    + required +
    mount_location + Optional[str] +

    A location in the filesystem where you would like a json-formatted file, controllable +on runtime, to be mounted. This allows behavior to be specified on runtime. +(Specifically, the contents of this file can be read via json.load() inside of the +user-defined code.)

    + required +
    cpus + Optional[int] +

    Optional default value for the number of cpus to give the job.

    + None +
    memory + Optional[str] +

    Optional default value for the amount of memory to give the job.

    + None +
    gpus + Optional[int] +

    Optional default value for the number of gpus to give the job.

    + None +
    gpu_type + Optional[str] +

    Optional default value for the type of gpu to give the job.

    + None +
    storage + Optional[str] +

    Optional default value for the amount of disk to give the job.

    + None +
    + +
    + +
    + +
    + + +

    create_model_bundle @@ -1639,8 +2117,9 @@

    tensorflow_version: Optional[str] = None, custom_base_image_repository: Optional[str] = None, custom_base_image_tag: Optional[str] = None, - app_config: Optional[Union[Dict[str, Any], str]] = None -) -> CreateModelBundleV2Response + app_config: Optional[Union[Dict[str, Any], str]] = None, + metadata: Optional[Dict[str, Any]] = None +) -> CreateModelBundleV2Response

    @@ -1799,6 +2278,16 @@

    Optional[Dict[str, Any]] + +

    Metadata to record with the bundle.

    + + None + + @@ -2014,8 +2503,9 @@

    tensorflow_version: Optional[str] = None, custom_base_image_repository: Optional[str] = None, custom_base_image_tag: Optional[str] = None, - app_config: Optional[Dict[str, Any]] = None -) -> CreateModelBundleV2Response + app_config: Optional[Dict[str, Any]] = None, + metadata: Optional[Dict[str, Any]] = None +) -> CreateModelBundleV2Response

    @@ -2197,6 +2687,16 @@

    Optional[Dict[str, Any]] + +

    Metadata to record with the bundle.

    + + None + + @@ -2243,8 +2743,9 @@

    tag: str, command: List[str], env: Dict[str, str], - readiness_initial_delay_seconds: int -) -> CreateModelBundleV2Response + readiness_initial_delay_seconds: int, + metadata: Optional[Dict[str, Any]] = None +) -> CreateModelBundleV2Response

    @@ -2346,6 +2847,16 @@

    required + + metadata + + Optional[Dict[str, Any]] + +

    Metadata to record with the bundle.

    + + None + + @@ -2399,8 +2910,9 @@

    triton_commit_tag: str, triton_storage: Optional[str], triton_memory: Optional[str], - triton_readiness_initial_delay_seconds: int -) -> CreateModelBundleV2Response + triton_readiness_initial_delay_seconds: int, + metadata: Optional[Dict[str, Any]] = None +) -> CreateModelBundleV2Response

    @@ -2496,8 +3008,8 @@

    str -

    The S3 prefix that contains the contents of the model repository, formatted -according to https://github.com/triton-inference-server/server/blob/main/docs/user_guide/model_repository.md

    +

    The S3 prefix that contains the contents of the model +repository, formatted according to +https://github.com/triton-inference-server/server/blob/main/docs/user_guide/model_repository.md

    required @@ -2518,7 +3031,8 @@

    Optional[Dict[str, str]] -

    If supplied, the name and number of replicas to make for each model.

    +

    If supplied, the name and number of replicas to make for each +model.

    required @@ -2568,12 +3082,22 @@

    Optional[Dict[str, Any]] + +

    Metadata to record with the bundle.

    + + None + + @@ -3372,6 +3896,70 @@

    + get_docker_image_batch_job + + +

    +
    get_docker_image_batch_job(batch_job_id: str)
    +
    + +
    + +

    For self hosted mode only. Gets information about a batch job given a batch job id.

    + +
    + +
    + +
    + + + +

    + get_docker_image_batch_job_bundle + + +

    +
    get_docker_image_batch_job_bundle(
    +    docker_image_batch_job_bundle_id: str,
    +) -> DockerImageBatchJobBundleResponse
    +
    + +
    + +

    For self hosted mode only. Gets information for a single batch job bundle with a given id.

    + +
    + +
    + +
    + + + +

    + get_latest_docker_image_batch_job_bundle + + +

    +
    get_latest_docker_image_batch_job_bundle(
    +    bundle_name: str,
    +) -> DockerImageBatchJobBundleResponse
    +
    + +
    + +

    For self hosted mode only. Gets information for the latest batch job bundle with a given name.

    + +
    + +
    + +
    + + +

    get_latest_model_bundle_v2 @@ -3631,6 +4219,63 @@

    +

    + list_docker_image_batch_job_bundles + + +

    +
    list_docker_image_batch_job_bundles(
    +    bundle_name: Optional[str] = None,
    +    order_by: Optional[Literal[newest, oldest]] = None,
    +) -> ListDockerImageBatchJobBundleResponse
    +
    + +
    + +

    For self hosted mode only. Gets information for multiple bundles.

    + +

    Parameters:

    + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescriptionDefault
    bundle_name + Optional[str] +

    The name of the bundles to retrieve. If not specified, this will retrieve all

    + None +
    order_by + Optional[Literal[newest, oldest]] +

    Either "newest", "oldest", or not specified. Specify to sort by newest/oldest.

    + None +
    + +
    + +
    + +
    + + +

    list_model_bundles @@ -4000,6 +4645,29 @@

    + + + +

    + update_docker_image_batch_job + + +

    +
    update_docker_image_batch_job(
    +    batch_job_id: str, cancel: bool
    +)
    +
    + +
    + +

    For self hosted mode only. Updates a batch job by id. +Use this if you want to cancel/delete a batch job.

    + +
    + +
    + @@ -4049,7 +4717,7 @@

    {"base": "../..", "features": ["search.suggest", "search.highlight", "content.tabs.link", "content.code.annotate", "content.code.copy"], "search": "../../assets/javascripts/workers/search.208ed371.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}} - + diff --git a/api/endpoint_predictions/index.html b/api/endpoint_predictions/index.html index 5b6387dc..6ae20c51 100644 --- a/api/endpoint_predictions/index.html +++ b/api/endpoint_predictions/index.html @@ -19,7 +19,7 @@ - + @@ -27,7 +27,7 @@ - + @@ -558,6 +558,55 @@ + + + + + + + + +
  • + + + + + + + + + + + +
  • + + + @@ -1111,7 +1160,7 @@

    {"base": "../..", "features": ["search.suggest", "search.highlight", "content.tabs.link", "content.code.annotate", "content.code.copy"], "search": "../../assets/javascripts/workers/search.208ed371.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}} - + diff --git a/api/hooks/index.html b/api/hooks/index.html index 0d7acd79..ea6df9d7 100644 --- a/api/hooks/index.html +++ b/api/hooks/index.html @@ -16,8 +16,10 @@ + + - + @@ -25,7 +27,7 @@ - + @@ -525,6 +527,55 @@ + + + + + + + + +
  • + + + + + + + + + + + +
  • + + + @@ -674,7 +725,7 @@

    - + diff --git a/api/model_bundles/index.html b/api/model_bundles/index.html index a0b5c8ba..87700ef4 100644 --- a/api/model_bundles/index.html +++ b/api/model_bundles/index.html @@ -19,7 +19,7 @@ - + @@ -27,7 +27,7 @@ - + @@ -858,6 +858,55 @@ + + + + + + + + +
  • + + + + + + + + + + + +
  • + + + @@ -2374,7 +2423,7 @@

    {"base": "../..", "features": ["search.suggest", "search.highlight", "content.tabs.link", "content.code.annotate", "content.code.copy"], "search": "../../assets/javascripts/workers/search.208ed371.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}} - + diff --git a/api/model_endpoints/index.html b/api/model_endpoints/index.html index c80d323d..a4ee2d9f 100644 --- a/api/model_endpoints/index.html +++ b/api/model_endpoints/index.html @@ -19,7 +19,7 @@ - + @@ -27,7 +27,7 @@ - + @@ -571,6 +571,55 @@ + + + + + + + + +
  • + + + + + + + + + + + +
  • + + + @@ -1042,7 +1091,7 @@

    - + diff --git a/assets/javascripts/bundle.19047be9.min.js.map b/assets/javascripts/bundle.19047be9.min.js.map deleted file mode 100644 index 3ce61e96..00000000 --- a/assets/javascripts/bundle.19047be9.min.js.map +++ /dev/null @@ -1,8 +0,0 @@ -{ - "version": 3, - "sources": ["node_modules/focus-visible/dist/focus-visible.js", "node_modules/url-polyfill/url-polyfill.js", "node_modules/clipboard/dist/clipboard.js", "node_modules/escape-html/index.js", "node_modules/array-flat-polyfill/index.mjs", "src/assets/javascripts/bundle.ts", "node_modules/unfetch/polyfill/index.js", "node_modules/rxjs/node_modules/tslib/tslib.es6.js", "node_modules/rxjs/src/internal/util/isFunction.ts", "node_modules/rxjs/src/internal/util/createErrorClass.ts", "node_modules/rxjs/src/internal/util/UnsubscriptionError.ts", "node_modules/rxjs/src/internal/util/arrRemove.ts", "node_modules/rxjs/src/internal/Subscription.ts", "node_modules/rxjs/src/internal/config.ts", "node_modules/rxjs/src/internal/scheduler/timeoutProvider.ts", "node_modules/rxjs/src/internal/util/reportUnhandledError.ts", "node_modules/rxjs/src/internal/util/noop.ts", "node_modules/rxjs/src/internal/NotificationFactories.ts", "node_modules/rxjs/src/internal/util/errorContext.ts", "node_modules/rxjs/src/internal/Subscriber.ts", "node_modules/rxjs/src/internal/symbol/observable.ts", "node_modules/rxjs/src/internal/util/identity.ts", "node_modules/rxjs/src/internal/util/pipe.ts", "node_modules/rxjs/src/internal/Observable.ts", "node_modules/rxjs/src/internal/util/lift.ts", "node_modules/rxjs/src/internal/operators/OperatorSubscriber.ts", "node_modules/rxjs/src/internal/scheduler/animationFrameProvider.ts", "node_modules/rxjs/src/internal/util/ObjectUnsubscribedError.ts", "node_modules/rxjs/src/internal/Subject.ts", "node_modules/rxjs/src/internal/scheduler/dateTimestampProvider.ts", "node_modules/rxjs/src/internal/ReplaySubject.ts", "node_modules/rxjs/src/internal/scheduler/Action.ts", "node_modules/rxjs/src/internal/scheduler/intervalProvider.ts", "node_modules/rxjs/src/internal/scheduler/AsyncAction.ts", "node_modules/rxjs/src/internal/Scheduler.ts", "node_modules/rxjs/src/internal/scheduler/AsyncScheduler.ts", "node_modules/rxjs/src/internal/scheduler/async.ts", "node_modules/rxjs/src/internal/scheduler/AnimationFrameAction.ts", "node_modules/rxjs/src/internal/scheduler/AnimationFrameScheduler.ts", "node_modules/rxjs/src/internal/scheduler/animationFrame.ts", "node_modules/rxjs/src/internal/observable/empty.ts", "node_modules/rxjs/src/internal/util/isScheduler.ts", "node_modules/rxjs/src/internal/util/args.ts", "node_modules/rxjs/src/internal/util/isArrayLike.ts", "node_modules/rxjs/src/internal/util/isPromise.ts", "node_modules/rxjs/src/internal/util/isInteropObservable.ts", "node_modules/rxjs/src/internal/util/isAsyncIterable.ts", "node_modules/rxjs/src/internal/util/throwUnobservableError.ts", "node_modules/rxjs/src/internal/symbol/iterator.ts", "node_modules/rxjs/src/internal/util/isIterable.ts", "node_modules/rxjs/src/internal/util/isReadableStreamLike.ts", "node_modules/rxjs/src/internal/observable/innerFrom.ts", "node_modules/rxjs/src/internal/util/executeSchedule.ts", "node_modules/rxjs/src/internal/operators/observeOn.ts", "node_modules/rxjs/src/internal/operators/subscribeOn.ts", "node_modules/rxjs/src/internal/scheduled/scheduleObservable.ts", "node_modules/rxjs/src/internal/scheduled/schedulePromise.ts", "node_modules/rxjs/src/internal/scheduled/scheduleArray.ts", "node_modules/rxjs/src/internal/scheduled/scheduleIterable.ts", "node_modules/rxjs/src/internal/scheduled/scheduleAsyncIterable.ts", "node_modules/rxjs/src/internal/scheduled/scheduleReadableStreamLike.ts", "node_modules/rxjs/src/internal/scheduled/scheduled.ts", "node_modules/rxjs/src/internal/observable/from.ts", "node_modules/rxjs/src/internal/observable/of.ts", "node_modules/rxjs/src/internal/observable/throwError.ts", "node_modules/rxjs/src/internal/util/EmptyError.ts", "node_modules/rxjs/src/internal/util/isDate.ts", "node_modules/rxjs/src/internal/operators/map.ts", "node_modules/rxjs/src/internal/util/mapOneOrManyArgs.ts", "node_modules/rxjs/src/internal/util/argsArgArrayOrObject.ts", "node_modules/rxjs/src/internal/util/createObject.ts", "node_modules/rxjs/src/internal/observable/combineLatest.ts", "node_modules/rxjs/src/internal/operators/mergeInternals.ts", "node_modules/rxjs/src/internal/operators/mergeMap.ts", "node_modules/rxjs/src/internal/operators/mergeAll.ts", "node_modules/rxjs/src/internal/operators/concatAll.ts", "node_modules/rxjs/src/internal/observable/concat.ts", "node_modules/rxjs/src/internal/observable/defer.ts", "node_modules/rxjs/src/internal/observable/fromEvent.ts", "node_modules/rxjs/src/internal/observable/fromEventPattern.ts", "node_modules/rxjs/src/internal/observable/timer.ts", "node_modules/rxjs/src/internal/observable/merge.ts", "node_modules/rxjs/src/internal/observable/never.ts", "node_modules/rxjs/src/internal/util/argsOrArgArray.ts", "node_modules/rxjs/src/internal/operators/filter.ts", "node_modules/rxjs/src/internal/observable/zip.ts", "node_modules/rxjs/src/internal/operators/audit.ts", "node_modules/rxjs/src/internal/operators/auditTime.ts", "node_modules/rxjs/src/internal/operators/bufferCount.ts", "node_modules/rxjs/src/internal/operators/catchError.ts", "node_modules/rxjs/src/internal/operators/scanInternals.ts", "node_modules/rxjs/src/internal/operators/combineLatest.ts", "node_modules/rxjs/src/internal/operators/combineLatestWith.ts", "node_modules/rxjs/src/internal/operators/debounceTime.ts", "node_modules/rxjs/src/internal/operators/defaultIfEmpty.ts", "node_modules/rxjs/src/internal/operators/take.ts", "node_modules/rxjs/src/internal/operators/ignoreElements.ts", "node_modules/rxjs/src/internal/operators/mapTo.ts", "node_modules/rxjs/src/internal/operators/delayWhen.ts", "node_modules/rxjs/src/internal/operators/delay.ts", "node_modules/rxjs/src/internal/operators/distinctUntilChanged.ts", "node_modules/rxjs/src/internal/operators/distinctUntilKeyChanged.ts", "node_modules/rxjs/src/internal/operators/throwIfEmpty.ts", "node_modules/rxjs/src/internal/operators/endWith.ts", "node_modules/rxjs/src/internal/operators/finalize.ts", "node_modules/rxjs/src/internal/operators/first.ts", "node_modules/rxjs/src/internal/operators/merge.ts", "node_modules/rxjs/src/internal/operators/mergeWith.ts", "node_modules/rxjs/src/internal/operators/repeat.ts", "node_modules/rxjs/src/internal/operators/scan.ts", "node_modules/rxjs/src/internal/operators/share.ts", "node_modules/rxjs/src/internal/operators/shareReplay.ts", "node_modules/rxjs/src/internal/operators/skip.ts", "node_modules/rxjs/src/internal/operators/skipUntil.ts", "node_modules/rxjs/src/internal/operators/startWith.ts", "node_modules/rxjs/src/internal/operators/switchMap.ts", "node_modules/rxjs/src/internal/operators/takeUntil.ts", "node_modules/rxjs/src/internal/operators/takeWhile.ts", "node_modules/rxjs/src/internal/operators/tap.ts", "node_modules/rxjs/src/internal/operators/throttle.ts", "node_modules/rxjs/src/internal/operators/throttleTime.ts", "node_modules/rxjs/src/internal/operators/withLatestFrom.ts", "node_modules/rxjs/src/internal/operators/zip.ts", "node_modules/rxjs/src/internal/operators/zipWith.ts", "src/assets/javascripts/browser/document/index.ts", "src/assets/javascripts/browser/element/_/index.ts", "src/assets/javascripts/browser/element/focus/index.ts", "src/assets/javascripts/browser/element/offset/_/index.ts", "src/assets/javascripts/browser/element/offset/content/index.ts", "node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js", "src/assets/javascripts/browser/element/size/_/index.ts", "src/assets/javascripts/browser/element/size/content/index.ts", "src/assets/javascripts/browser/element/visibility/index.ts", "src/assets/javascripts/browser/toggle/index.ts", "src/assets/javascripts/browser/keyboard/index.ts", "src/assets/javascripts/browser/location/_/index.ts", "src/assets/javascripts/utilities/h/index.ts", "src/assets/javascripts/utilities/round/index.ts", "src/assets/javascripts/browser/location/hash/index.ts", "src/assets/javascripts/browser/media/index.ts", "src/assets/javascripts/browser/request/index.ts", "src/assets/javascripts/browser/script/index.ts", "src/assets/javascripts/browser/viewport/offset/index.ts", "src/assets/javascripts/browser/viewport/size/index.ts", "src/assets/javascripts/browser/viewport/_/index.ts", "src/assets/javascripts/browser/viewport/at/index.ts", "node_modules/iframe-worker/shim/index.js", "src/assets/javascripts/browser/worker/index.ts", "src/assets/javascripts/_/index.ts", "src/assets/javascripts/components/_/index.ts", "src/assets/javascripts/components/announce/index.ts", "src/assets/javascripts/components/consent/index.ts", "src/assets/javascripts/components/content/code/_/index.ts", "src/assets/javascripts/templates/tooltip/index.tsx", "src/assets/javascripts/templates/annotation/index.tsx", "src/assets/javascripts/templates/clipboard/index.tsx", "src/assets/javascripts/templates/search/index.tsx", "src/assets/javascripts/templates/source/index.tsx", "src/assets/javascripts/templates/tabbed/index.tsx", "src/assets/javascripts/templates/table/index.tsx", "src/assets/javascripts/templates/version/index.tsx", "src/assets/javascripts/components/content/annotation/_/index.ts", "src/assets/javascripts/components/content/annotation/list/index.ts", "src/assets/javascripts/components/content/code/mermaid/index.ts", "src/assets/javascripts/components/content/details/index.ts", "src/assets/javascripts/components/content/table/index.ts", "src/assets/javascripts/components/content/tabs/index.ts", "src/assets/javascripts/components/content/_/index.ts", "src/assets/javascripts/components/dialog/index.ts", "src/assets/javascripts/components/header/_/index.ts", "src/assets/javascripts/components/header/title/index.ts", "src/assets/javascripts/components/main/index.ts", "src/assets/javascripts/components/palette/index.ts", "src/assets/javascripts/integrations/clipboard/index.ts", "src/assets/javascripts/integrations/sitemap/index.ts", "src/assets/javascripts/integrations/instant/index.ts", "src/assets/javascripts/integrations/search/highlighter/index.ts", "src/assets/javascripts/integrations/search/worker/message/index.ts", "src/assets/javascripts/integrations/search/worker/_/index.ts", "src/assets/javascripts/integrations/version/index.ts", "src/assets/javascripts/components/search/query/index.ts", "src/assets/javascripts/components/search/result/index.ts", "src/assets/javascripts/components/search/share/index.ts", "src/assets/javascripts/components/search/suggest/index.ts", "src/assets/javascripts/components/search/_/index.ts", "src/assets/javascripts/components/search/highlight/index.ts", "src/assets/javascripts/components/sidebar/index.ts", "src/assets/javascripts/components/source/facts/github/index.ts", "src/assets/javascripts/components/source/facts/gitlab/index.ts", "src/assets/javascripts/components/source/facts/_/index.ts", "src/assets/javascripts/components/source/_/index.ts", "src/assets/javascripts/components/tabs/index.ts", "src/assets/javascripts/components/toc/index.ts", "src/assets/javascripts/components/top/index.ts", "src/assets/javascripts/patches/indeterminate/index.ts", "src/assets/javascripts/patches/scrollfix/index.ts", "src/assets/javascripts/patches/scrolllock/index.ts", "src/assets/javascripts/polyfills/index.ts"], - "sourceRoot": "../../..", - "sourcesContent": ["(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (factory());\n}(this, (function () { 'use strict';\n\n /**\n * Applies the :focus-visible polyfill at the given scope.\n * A scope in this case is either the top-level Document or a Shadow Root.\n *\n * @param {(Document|ShadowRoot)} scope\n * @see https://github.com/WICG/focus-visible\n */\n function applyFocusVisiblePolyfill(scope) {\n var hadKeyboardEvent = true;\n var hadFocusVisibleRecently = false;\n var hadFocusVisibleRecentlyTimeout = null;\n\n var inputTypesAllowlist = {\n text: true,\n search: true,\n url: true,\n tel: true,\n email: true,\n password: true,\n number: true,\n date: true,\n month: true,\n week: true,\n time: true,\n datetime: true,\n 'datetime-local': true\n };\n\n /**\n * Helper function for legacy browsers and iframes which sometimes focus\n * elements like document, body, and non-interactive SVG.\n * @param {Element} el\n */\n function isValidFocusTarget(el) {\n if (\n el &&\n el !== document &&\n el.nodeName !== 'HTML' &&\n el.nodeName !== 'BODY' &&\n 'classList' in el &&\n 'contains' in el.classList\n ) {\n return true;\n }\n return false;\n }\n\n /**\n * Computes whether the given element should automatically trigger the\n * `focus-visible` class being added, i.e. whether it should always match\n * `:focus-visible` when focused.\n * @param {Element} el\n * @return {boolean}\n */\n function focusTriggersKeyboardModality(el) {\n var type = el.type;\n var tagName = el.tagName;\n\n if (tagName === 'INPUT' && inputTypesAllowlist[type] && !el.readOnly) {\n return true;\n }\n\n if (tagName === 'TEXTAREA' && !el.readOnly) {\n return true;\n }\n\n if (el.isContentEditable) {\n return true;\n }\n\n return false;\n }\n\n /**\n * Add the `focus-visible` class to the given element if it was not added by\n * the author.\n * @param {Element} el\n */\n function addFocusVisibleClass(el) {\n if (el.classList.contains('focus-visible')) {\n return;\n }\n el.classList.add('focus-visible');\n el.setAttribute('data-focus-visible-added', '');\n }\n\n /**\n * Remove the `focus-visible` class from the given element if it was not\n * originally added by the author.\n * @param {Element} el\n */\n function removeFocusVisibleClass(el) {\n if (!el.hasAttribute('data-focus-visible-added')) {\n return;\n }\n el.classList.remove('focus-visible');\n el.removeAttribute('data-focus-visible-added');\n }\n\n /**\n * If the most recent user interaction was via the keyboard;\n * and the key press did not include a meta, alt/option, or control key;\n * then the modality is keyboard. Otherwise, the modality is not keyboard.\n * Apply `focus-visible` to any current active element and keep track\n * of our keyboard modality state with `hadKeyboardEvent`.\n * @param {KeyboardEvent} e\n */\n function onKeyDown(e) {\n if (e.metaKey || e.altKey || e.ctrlKey) {\n return;\n }\n\n if (isValidFocusTarget(scope.activeElement)) {\n addFocusVisibleClass(scope.activeElement);\n }\n\n hadKeyboardEvent = true;\n }\n\n /**\n * If at any point a user clicks with a pointing device, ensure that we change\n * the modality away from keyboard.\n * This avoids the situation where a user presses a key on an already focused\n * element, and then clicks on a different element, focusing it with a\n * pointing device, while we still think we're in keyboard modality.\n * @param {Event} e\n */\n function onPointerDown(e) {\n hadKeyboardEvent = false;\n }\n\n /**\n * On `focus`, add the `focus-visible` class to the target if:\n * - the target received focus as a result of keyboard navigation, or\n * - the event target is an element that will likely require interaction\n * via the keyboard (e.g. a text box)\n * @param {Event} e\n */\n function onFocus(e) {\n // Prevent IE from focusing the document or HTML element.\n if (!isValidFocusTarget(e.target)) {\n return;\n }\n\n if (hadKeyboardEvent || focusTriggersKeyboardModality(e.target)) {\n addFocusVisibleClass(e.target);\n }\n }\n\n /**\n * On `blur`, remove the `focus-visible` class from the target.\n * @param {Event} e\n */\n function onBlur(e) {\n if (!isValidFocusTarget(e.target)) {\n return;\n }\n\n if (\n e.target.classList.contains('focus-visible') ||\n e.target.hasAttribute('data-focus-visible-added')\n ) {\n // To detect a tab/window switch, we look for a blur event followed\n // rapidly by a visibility change.\n // If we don't see a visibility change within 100ms, it's probably a\n // regular focus change.\n hadFocusVisibleRecently = true;\n window.clearTimeout(hadFocusVisibleRecentlyTimeout);\n hadFocusVisibleRecentlyTimeout = window.setTimeout(function() {\n hadFocusVisibleRecently = false;\n }, 100);\n removeFocusVisibleClass(e.target);\n }\n }\n\n /**\n * If the user changes tabs, keep track of whether or not the previously\n * focused element had .focus-visible.\n * @param {Event} e\n */\n function onVisibilityChange(e) {\n if (document.visibilityState === 'hidden') {\n // If the tab becomes active again, the browser will handle calling focus\n // on the element (Safari actually calls it twice).\n // If this tab change caused a blur on an element with focus-visible,\n // re-apply the class when the user switches back to the tab.\n if (hadFocusVisibleRecently) {\n hadKeyboardEvent = true;\n }\n addInitialPointerMoveListeners();\n }\n }\n\n /**\n * Add a group of listeners to detect usage of any pointing devices.\n * These listeners will be added when the polyfill first loads, and anytime\n * the window is blurred, so that they are active when the window regains\n * focus.\n */\n function addInitialPointerMoveListeners() {\n document.addEventListener('mousemove', onInitialPointerMove);\n document.addEventListener('mousedown', onInitialPointerMove);\n document.addEventListener('mouseup', onInitialPointerMove);\n document.addEventListener('pointermove', onInitialPointerMove);\n document.addEventListener('pointerdown', onInitialPointerMove);\n document.addEventListener('pointerup', onInitialPointerMove);\n document.addEventListener('touchmove', onInitialPointerMove);\n document.addEventListener('touchstart', onInitialPointerMove);\n document.addEventListener('touchend', onInitialPointerMove);\n }\n\n function removeInitialPointerMoveListeners() {\n document.removeEventListener('mousemove', onInitialPointerMove);\n document.removeEventListener('mousedown', onInitialPointerMove);\n document.removeEventListener('mouseup', onInitialPointerMove);\n document.removeEventListener('pointermove', onInitialPointerMove);\n document.removeEventListener('pointerdown', onInitialPointerMove);\n document.removeEventListener('pointerup', onInitialPointerMove);\n document.removeEventListener('touchmove', onInitialPointerMove);\n document.removeEventListener('touchstart', onInitialPointerMove);\n document.removeEventListener('touchend', onInitialPointerMove);\n }\n\n /**\n * When the polfyill first loads, assume the user is in keyboard modality.\n * If any event is received from a pointing device (e.g. mouse, pointer,\n * touch), turn off keyboard modality.\n * This accounts for situations where focus enters the page from the URL bar.\n * @param {Event} e\n */\n function onInitialPointerMove(e) {\n // Work around a Safari quirk that fires a mousemove on whenever the\n // window blurs, even if you're tabbing out of the page. \u00AF\\_(\u30C4)_/\u00AF\n if (e.target.nodeName && e.target.nodeName.toLowerCase() === 'html') {\n return;\n }\n\n hadKeyboardEvent = false;\n removeInitialPointerMoveListeners();\n }\n\n // For some kinds of state, we are interested in changes at the global scope\n // only. For example, global pointer input, global key presses and global\n // visibility change should affect the state at every scope:\n document.addEventListener('keydown', onKeyDown, true);\n document.addEventListener('mousedown', onPointerDown, true);\n document.addEventListener('pointerdown', onPointerDown, true);\n document.addEventListener('touchstart', onPointerDown, true);\n document.addEventListener('visibilitychange', onVisibilityChange, true);\n\n addInitialPointerMoveListeners();\n\n // For focus and blur, we specifically care about state changes in the local\n // scope. This is because focus / blur events that originate from within a\n // shadow root are not re-dispatched from the host element if it was already\n // the active element in its own scope:\n scope.addEventListener('focus', onFocus, true);\n scope.addEventListener('blur', onBlur, true);\n\n // We detect that a node is a ShadowRoot by ensuring that it is a\n // DocumentFragment and also has a host property. This check covers native\n // implementation and polyfill implementation transparently. If we only cared\n // about the native implementation, we could just check if the scope was\n // an instance of a ShadowRoot.\n if (scope.nodeType === Node.DOCUMENT_FRAGMENT_NODE && scope.host) {\n // Since a ShadowRoot is a special kind of DocumentFragment, it does not\n // have a root element to add a class to. So, we add this attribute to the\n // host element instead:\n scope.host.setAttribute('data-js-focus-visible', '');\n } else if (scope.nodeType === Node.DOCUMENT_NODE) {\n document.documentElement.classList.add('js-focus-visible');\n document.documentElement.setAttribute('data-js-focus-visible', '');\n }\n }\n\n // It is important to wrap all references to global window and document in\n // these checks to support server-side rendering use cases\n // @see https://github.com/WICG/focus-visible/issues/199\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n // Make the polyfill helper globally available. This can be used as a signal\n // to interested libraries that wish to coordinate with the polyfill for e.g.,\n // applying the polyfill to a shadow root:\n window.applyFocusVisiblePolyfill = applyFocusVisiblePolyfill;\n\n // Notify interested libraries of the polyfill's presence, in case the\n // polyfill was loaded lazily:\n var event;\n\n try {\n event = new CustomEvent('focus-visible-polyfill-ready');\n } catch (error) {\n // IE11 does not support using CustomEvent as a constructor directly:\n event = document.createEvent('CustomEvent');\n event.initCustomEvent('focus-visible-polyfill-ready', false, false, {});\n }\n\n window.dispatchEvent(event);\n }\n\n if (typeof document !== 'undefined') {\n // Apply the polyfill to the global document, so that no JavaScript\n // coordination is required to use the polyfill in the top-level document:\n applyFocusVisiblePolyfill(document);\n }\n\n})));\n", "(function(global) {\r\n /**\r\n * Polyfill URLSearchParams\r\n *\r\n * Inspired from : https://github.com/WebReflection/url-search-params/blob/master/src/url-search-params.js\r\n */\r\n\r\n var checkIfIteratorIsSupported = function() {\r\n try {\r\n return !!Symbol.iterator;\r\n } catch (error) {\r\n return false;\r\n }\r\n };\r\n\r\n\r\n var iteratorSupported = checkIfIteratorIsSupported();\r\n\r\n var createIterator = function(items) {\r\n var iterator = {\r\n next: function() {\r\n var value = items.shift();\r\n return { done: value === void 0, value: value };\r\n }\r\n };\r\n\r\n if (iteratorSupported) {\r\n iterator[Symbol.iterator] = function() {\r\n return iterator;\r\n };\r\n }\r\n\r\n return iterator;\r\n };\r\n\r\n /**\r\n * Search param name and values should be encoded according to https://url.spec.whatwg.org/#urlencoded-serializing\r\n * encodeURIComponent() produces the same result except encoding spaces as `%20` instead of `+`.\r\n */\r\n var serializeParam = function(value) {\r\n return encodeURIComponent(value).replace(/%20/g, '+');\r\n };\r\n\r\n var deserializeParam = function(value) {\r\n return decodeURIComponent(String(value).replace(/\\+/g, ' '));\r\n };\r\n\r\n var polyfillURLSearchParams = function() {\r\n\r\n var URLSearchParams = function(searchString) {\r\n Object.defineProperty(this, '_entries', { writable: true, value: {} });\r\n var typeofSearchString = typeof searchString;\r\n\r\n if (typeofSearchString === 'undefined') {\r\n // do nothing\r\n } else if (typeofSearchString === 'string') {\r\n if (searchString !== '') {\r\n this._fromString(searchString);\r\n }\r\n } else if (searchString instanceof URLSearchParams) {\r\n var _this = this;\r\n searchString.forEach(function(value, name) {\r\n _this.append(name, value);\r\n });\r\n } else if ((searchString !== null) && (typeofSearchString === 'object')) {\r\n if (Object.prototype.toString.call(searchString) === '[object Array]') {\r\n for (var i = 0; i < searchString.length; i++) {\r\n var entry = searchString[i];\r\n if ((Object.prototype.toString.call(entry) === '[object Array]') || (entry.length !== 2)) {\r\n this.append(entry[0], entry[1]);\r\n } else {\r\n throw new TypeError('Expected [string, any] as entry at index ' + i + ' of URLSearchParams\\'s input');\r\n }\r\n }\r\n } else {\r\n for (var key in searchString) {\r\n if (searchString.hasOwnProperty(key)) {\r\n this.append(key, searchString[key]);\r\n }\r\n }\r\n }\r\n } else {\r\n throw new TypeError('Unsupported input\\'s type for URLSearchParams');\r\n }\r\n };\r\n\r\n var proto = URLSearchParams.prototype;\r\n\r\n proto.append = function(name, value) {\r\n if (name in this._entries) {\r\n this._entries[name].push(String(value));\r\n } else {\r\n this._entries[name] = [String(value)];\r\n }\r\n };\r\n\r\n proto.delete = function(name) {\r\n delete this._entries[name];\r\n };\r\n\r\n proto.get = function(name) {\r\n return (name in this._entries) ? this._entries[name][0] : null;\r\n };\r\n\r\n proto.getAll = function(name) {\r\n return (name in this._entries) ? this._entries[name].slice(0) : [];\r\n };\r\n\r\n proto.has = function(name) {\r\n return (name in this._entries);\r\n };\r\n\r\n proto.set = function(name, value) {\r\n this._entries[name] = [String(value)];\r\n };\r\n\r\n proto.forEach = function(callback, thisArg) {\r\n var entries;\r\n for (var name in this._entries) {\r\n if (this._entries.hasOwnProperty(name)) {\r\n entries = this._entries[name];\r\n for (var i = 0; i < entries.length; i++) {\r\n callback.call(thisArg, entries[i], name, this);\r\n }\r\n }\r\n }\r\n };\r\n\r\n proto.keys = function() {\r\n var items = [];\r\n this.forEach(function(value, name) {\r\n items.push(name);\r\n });\r\n return createIterator(items);\r\n };\r\n\r\n proto.values = function() {\r\n var items = [];\r\n this.forEach(function(value) {\r\n items.push(value);\r\n });\r\n return createIterator(items);\r\n };\r\n\r\n proto.entries = function() {\r\n var items = [];\r\n this.forEach(function(value, name) {\r\n items.push([name, value]);\r\n });\r\n return createIterator(items);\r\n };\r\n\r\n if (iteratorSupported) {\r\n proto[Symbol.iterator] = proto.entries;\r\n }\r\n\r\n proto.toString = function() {\r\n var searchArray = [];\r\n this.forEach(function(value, name) {\r\n searchArray.push(serializeParam(name) + '=' + serializeParam(value));\r\n });\r\n return searchArray.join('&');\r\n };\r\n\r\n\r\n global.URLSearchParams = URLSearchParams;\r\n };\r\n\r\n var checkIfURLSearchParamsSupported = function() {\r\n try {\r\n var URLSearchParams = global.URLSearchParams;\r\n\r\n return (\r\n (new URLSearchParams('?a=1').toString() === 'a=1') &&\r\n (typeof URLSearchParams.prototype.set === 'function') &&\r\n (typeof URLSearchParams.prototype.entries === 'function')\r\n );\r\n } catch (e) {\r\n return false;\r\n }\r\n };\r\n\r\n if (!checkIfURLSearchParamsSupported()) {\r\n polyfillURLSearchParams();\r\n }\r\n\r\n var proto = global.URLSearchParams.prototype;\r\n\r\n if (typeof proto.sort !== 'function') {\r\n proto.sort = function() {\r\n var _this = this;\r\n var items = [];\r\n this.forEach(function(value, name) {\r\n items.push([name, value]);\r\n if (!_this._entries) {\r\n _this.delete(name);\r\n }\r\n });\r\n items.sort(function(a, b) {\r\n if (a[0] < b[0]) {\r\n return -1;\r\n } else if (a[0] > b[0]) {\r\n return +1;\r\n } else {\r\n return 0;\r\n }\r\n });\r\n if (_this._entries) { // force reset because IE keeps keys index\r\n _this._entries = {};\r\n }\r\n for (var i = 0; i < items.length; i++) {\r\n this.append(items[i][0], items[i][1]);\r\n }\r\n };\r\n }\r\n\r\n if (typeof proto._fromString !== 'function') {\r\n Object.defineProperty(proto, '_fromString', {\r\n enumerable: false,\r\n configurable: false,\r\n writable: false,\r\n value: function(searchString) {\r\n if (this._entries) {\r\n this._entries = {};\r\n } else {\r\n var keys = [];\r\n this.forEach(function(value, name) {\r\n keys.push(name);\r\n });\r\n for (var i = 0; i < keys.length; i++) {\r\n this.delete(keys[i]);\r\n }\r\n }\r\n\r\n searchString = searchString.replace(/^\\?/, '');\r\n var attributes = searchString.split('&');\r\n var attribute;\r\n for (var i = 0; i < attributes.length; i++) {\r\n attribute = attributes[i].split('=');\r\n this.append(\r\n deserializeParam(attribute[0]),\r\n (attribute.length > 1) ? deserializeParam(attribute[1]) : ''\r\n );\r\n }\r\n }\r\n });\r\n }\r\n\r\n // HTMLAnchorElement\r\n\r\n})(\r\n (typeof global !== 'undefined') ? global\r\n : ((typeof window !== 'undefined') ? window\r\n : ((typeof self !== 'undefined') ? self : this))\r\n);\r\n\r\n(function(global) {\r\n /**\r\n * Polyfill URL\r\n *\r\n * Inspired from : https://github.com/arv/DOM-URL-Polyfill/blob/master/src/url.js\r\n */\r\n\r\n var checkIfURLIsSupported = function() {\r\n try {\r\n var u = new global.URL('b', 'http://a');\r\n u.pathname = 'c d';\r\n return (u.href === 'http://a/c%20d') && u.searchParams;\r\n } catch (e) {\r\n return false;\r\n }\r\n };\r\n\r\n\r\n var polyfillURL = function() {\r\n var _URL = global.URL;\r\n\r\n var URL = function(url, base) {\r\n if (typeof url !== 'string') url = String(url);\r\n if (base && typeof base !== 'string') base = String(base);\r\n\r\n // Only create another document if the base is different from current location.\r\n var doc = document, baseElement;\r\n if (base && (global.location === void 0 || base !== global.location.href)) {\r\n base = base.toLowerCase();\r\n doc = document.implementation.createHTMLDocument('');\r\n baseElement = doc.createElement('base');\r\n baseElement.href = base;\r\n doc.head.appendChild(baseElement);\r\n try {\r\n if (baseElement.href.indexOf(base) !== 0) throw new Error(baseElement.href);\r\n } catch (err) {\r\n throw new Error('URL unable to set base ' + base + ' due to ' + err);\r\n }\r\n }\r\n\r\n var anchorElement = doc.createElement('a');\r\n anchorElement.href = url;\r\n if (baseElement) {\r\n doc.body.appendChild(anchorElement);\r\n anchorElement.href = anchorElement.href; // force href to refresh\r\n }\r\n\r\n var inputElement = doc.createElement('input');\r\n inputElement.type = 'url';\r\n inputElement.value = url;\r\n\r\n if (anchorElement.protocol === ':' || !/:/.test(anchorElement.href) || (!inputElement.checkValidity() && !base)) {\r\n throw new TypeError('Invalid URL');\r\n }\r\n\r\n Object.defineProperty(this, '_anchorElement', {\r\n value: anchorElement\r\n });\r\n\r\n\r\n // create a linked searchParams which reflect its changes on URL\r\n var searchParams = new global.URLSearchParams(this.search);\r\n var enableSearchUpdate = true;\r\n var enableSearchParamsUpdate = true;\r\n var _this = this;\r\n ['append', 'delete', 'set'].forEach(function(methodName) {\r\n var method = searchParams[methodName];\r\n searchParams[methodName] = function() {\r\n method.apply(searchParams, arguments);\r\n if (enableSearchUpdate) {\r\n enableSearchParamsUpdate = false;\r\n _this.search = searchParams.toString();\r\n enableSearchParamsUpdate = true;\r\n }\r\n };\r\n });\r\n\r\n Object.defineProperty(this, 'searchParams', {\r\n value: searchParams,\r\n enumerable: true\r\n });\r\n\r\n var search = void 0;\r\n Object.defineProperty(this, '_updateSearchParams', {\r\n enumerable: false,\r\n configurable: false,\r\n writable: false,\r\n value: function() {\r\n if (this.search !== search) {\r\n search = this.search;\r\n if (enableSearchParamsUpdate) {\r\n enableSearchUpdate = false;\r\n this.searchParams._fromString(this.search);\r\n enableSearchUpdate = true;\r\n }\r\n }\r\n }\r\n });\r\n };\r\n\r\n var proto = URL.prototype;\r\n\r\n var linkURLWithAnchorAttribute = function(attributeName) {\r\n Object.defineProperty(proto, attributeName, {\r\n get: function() {\r\n return this._anchorElement[attributeName];\r\n },\r\n set: function(value) {\r\n this._anchorElement[attributeName] = value;\r\n },\r\n enumerable: true\r\n });\r\n };\r\n\r\n ['hash', 'host', 'hostname', 'port', 'protocol']\r\n .forEach(function(attributeName) {\r\n linkURLWithAnchorAttribute(attributeName);\r\n });\r\n\r\n Object.defineProperty(proto, 'search', {\r\n get: function() {\r\n return this._anchorElement['search'];\r\n },\r\n set: function(value) {\r\n this._anchorElement['search'] = value;\r\n this._updateSearchParams();\r\n },\r\n enumerable: true\r\n });\r\n\r\n Object.defineProperties(proto, {\r\n\r\n 'toString': {\r\n get: function() {\r\n var _this = this;\r\n return function() {\r\n return _this.href;\r\n };\r\n }\r\n },\r\n\r\n 'href': {\r\n get: function() {\r\n return this._anchorElement.href.replace(/\\?$/, '');\r\n },\r\n set: function(value) {\r\n this._anchorElement.href = value;\r\n this._updateSearchParams();\r\n },\r\n enumerable: true\r\n },\r\n\r\n 'pathname': {\r\n get: function() {\r\n return this._anchorElement.pathname.replace(/(^\\/?)/, '/');\r\n },\r\n set: function(value) {\r\n this._anchorElement.pathname = value;\r\n },\r\n enumerable: true\r\n },\r\n\r\n 'origin': {\r\n get: function() {\r\n // get expected port from protocol\r\n var expectedPort = { 'http:': 80, 'https:': 443, 'ftp:': 21 }[this._anchorElement.protocol];\r\n // add port to origin if, expected port is different than actual port\r\n // and it is not empty f.e http://foo:8080\r\n // 8080 != 80 && 8080 != ''\r\n var addPortToOrigin = this._anchorElement.port != expectedPort &&\r\n this._anchorElement.port !== '';\r\n\r\n return this._anchorElement.protocol +\r\n '//' +\r\n this._anchorElement.hostname +\r\n (addPortToOrigin ? (':' + this._anchorElement.port) : '');\r\n },\r\n enumerable: true\r\n },\r\n\r\n 'password': { // TODO\r\n get: function() {\r\n return '';\r\n },\r\n set: function(value) {\r\n },\r\n enumerable: true\r\n },\r\n\r\n 'username': { // TODO\r\n get: function() {\r\n return '';\r\n },\r\n set: function(value) {\r\n },\r\n enumerable: true\r\n },\r\n });\r\n\r\n URL.createObjectURL = function(blob) {\r\n return _URL.createObjectURL.apply(_URL, arguments);\r\n };\r\n\r\n URL.revokeObjectURL = function(url) {\r\n return _URL.revokeObjectURL.apply(_URL, arguments);\r\n };\r\n\r\n global.URL = URL;\r\n\r\n };\r\n\r\n if (!checkIfURLIsSupported()) {\r\n polyfillURL();\r\n }\r\n\r\n if ((global.location !== void 0) && !('origin' in global.location)) {\r\n var getOrigin = function() {\r\n return global.location.protocol + '//' + global.location.hostname + (global.location.port ? (':' + global.location.port) : '');\r\n };\r\n\r\n try {\r\n Object.defineProperty(global.location, 'origin', {\r\n get: getOrigin,\r\n enumerable: true\r\n });\r\n } catch (e) {\r\n setInterval(function() {\r\n global.location.origin = getOrigin();\r\n }, 100);\r\n }\r\n }\r\n\r\n})(\r\n (typeof global !== 'undefined') ? global\r\n : ((typeof window !== 'undefined') ? window\r\n : ((typeof self !== 'undefined') ? self : this))\r\n);\r\n", "/*!\n * clipboard.js v2.0.11\n * https://clipboardjs.com/\n *\n * Licensed MIT \u00A9 Zeno Rocha\n */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ClipboardJS\"] = factory();\n\telse\n\t\troot[\"ClipboardJS\"] = factory();\n})(this, function() {\nreturn /******/ (function() { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 686:\n/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n\n// EXPORTS\n__webpack_require__.d(__webpack_exports__, {\n \"default\": function() { return /* binding */ clipboard; }\n});\n\n// EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js\nvar tiny_emitter = __webpack_require__(279);\nvar tiny_emitter_default = /*#__PURE__*/__webpack_require__.n(tiny_emitter);\n// EXTERNAL MODULE: ./node_modules/good-listener/src/listen.js\nvar listen = __webpack_require__(370);\nvar listen_default = /*#__PURE__*/__webpack_require__.n(listen);\n// EXTERNAL MODULE: ./node_modules/select/src/select.js\nvar src_select = __webpack_require__(817);\nvar select_default = /*#__PURE__*/__webpack_require__.n(src_select);\n;// CONCATENATED MODULE: ./src/common/command.js\n/**\n * Executes a given operation type.\n * @param {String} type\n * @return {Boolean}\n */\nfunction command(type) {\n try {\n return document.execCommand(type);\n } catch (err) {\n return false;\n }\n}\n;// CONCATENATED MODULE: ./src/actions/cut.js\n\n\n/**\n * Cut action wrapper.\n * @param {String|HTMLElement} target\n * @return {String}\n */\n\nvar ClipboardActionCut = function ClipboardActionCut(target) {\n var selectedText = select_default()(target);\n command('cut');\n return selectedText;\n};\n\n/* harmony default export */ var actions_cut = (ClipboardActionCut);\n;// CONCATENATED MODULE: ./src/common/create-fake-element.js\n/**\n * Creates a fake textarea element with a value.\n * @param {String} value\n * @return {HTMLElement}\n */\nfunction createFakeElement(value) {\n var isRTL = document.documentElement.getAttribute('dir') === 'rtl';\n var fakeElement = document.createElement('textarea'); // Prevent zooming on iOS\n\n fakeElement.style.fontSize = '12pt'; // Reset box model\n\n fakeElement.style.border = '0';\n fakeElement.style.padding = '0';\n fakeElement.style.margin = '0'; // Move element out of screen horizontally\n\n fakeElement.style.position = 'absolute';\n fakeElement.style[isRTL ? 'right' : 'left'] = '-9999px'; // Move element to the same position vertically\n\n var yPosition = window.pageYOffset || document.documentElement.scrollTop;\n fakeElement.style.top = \"\".concat(yPosition, \"px\");\n fakeElement.setAttribute('readonly', '');\n fakeElement.value = value;\n return fakeElement;\n}\n;// CONCATENATED MODULE: ./src/actions/copy.js\n\n\n\n/**\n * Create fake copy action wrapper using a fake element.\n * @param {String} target\n * @param {Object} options\n * @return {String}\n */\n\nvar fakeCopyAction = function fakeCopyAction(value, options) {\n var fakeElement = createFakeElement(value);\n options.container.appendChild(fakeElement);\n var selectedText = select_default()(fakeElement);\n command('copy');\n fakeElement.remove();\n return selectedText;\n};\n/**\n * Copy action wrapper.\n * @param {String|HTMLElement} target\n * @param {Object} options\n * @return {String}\n */\n\n\nvar ClipboardActionCopy = function ClipboardActionCopy(target) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n container: document.body\n };\n var selectedText = '';\n\n if (typeof target === 'string') {\n selectedText = fakeCopyAction(target, options);\n } else if (target instanceof HTMLInputElement && !['text', 'search', 'url', 'tel', 'password'].includes(target === null || target === void 0 ? void 0 : target.type)) {\n // If input type doesn't support `setSelectionRange`. Simulate it. https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange\n selectedText = fakeCopyAction(target.value, options);\n } else {\n selectedText = select_default()(target);\n command('copy');\n }\n\n return selectedText;\n};\n\n/* harmony default export */ var actions_copy = (ClipboardActionCopy);\n;// CONCATENATED MODULE: ./src/actions/default.js\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n\n\n/**\n * Inner function which performs selection from either `text` or `target`\n * properties and then executes copy or cut operations.\n * @param {Object} options\n */\n\nvar ClipboardActionDefault = function ClipboardActionDefault() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n // Defines base properties passed from constructor.\n var _options$action = options.action,\n action = _options$action === void 0 ? 'copy' : _options$action,\n container = options.container,\n target = options.target,\n text = options.text; // Sets the `action` to be performed which can be either 'copy' or 'cut'.\n\n if (action !== 'copy' && action !== 'cut') {\n throw new Error('Invalid \"action\" value, use either \"copy\" or \"cut\"');\n } // Sets the `target` property using an element that will be have its content copied.\n\n\n if (target !== undefined) {\n if (target && _typeof(target) === 'object' && target.nodeType === 1) {\n if (action === 'copy' && target.hasAttribute('disabled')) {\n throw new Error('Invalid \"target\" attribute. Please use \"readonly\" instead of \"disabled\" attribute');\n }\n\n if (action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {\n throw new Error('Invalid \"target\" attribute. You can\\'t cut text from elements with \"readonly\" or \"disabled\" attributes');\n }\n } else {\n throw new Error('Invalid \"target\" value, use a valid Element');\n }\n } // Define selection strategy based on `text` property.\n\n\n if (text) {\n return actions_copy(text, {\n container: container\n });\n } // Defines which selection strategy based on `target` property.\n\n\n if (target) {\n return action === 'cut' ? actions_cut(target) : actions_copy(target, {\n container: container\n });\n }\n};\n\n/* harmony default export */ var actions_default = (ClipboardActionDefault);\n;// CONCATENATED MODULE: ./src/clipboard.js\nfunction clipboard_typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { clipboard_typeof = function _typeof(obj) { return typeof obj; }; } else { clipboard_typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return clipboard_typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (clipboard_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\n\n/**\n * Helper function to retrieve attribute value.\n * @param {String} suffix\n * @param {Element} element\n */\n\nfunction getAttributeValue(suffix, element) {\n var attribute = \"data-clipboard-\".concat(suffix);\n\n if (!element.hasAttribute(attribute)) {\n return;\n }\n\n return element.getAttribute(attribute);\n}\n/**\n * Base class which takes one or more elements, adds event listeners to them,\n * and instantiates a new `ClipboardAction` on each click.\n */\n\n\nvar Clipboard = /*#__PURE__*/function (_Emitter) {\n _inherits(Clipboard, _Emitter);\n\n var _super = _createSuper(Clipboard);\n\n /**\n * @param {String|HTMLElement|HTMLCollection|NodeList} trigger\n * @param {Object} options\n */\n function Clipboard(trigger, options) {\n var _this;\n\n _classCallCheck(this, Clipboard);\n\n _this = _super.call(this);\n\n _this.resolveOptions(options);\n\n _this.listenClick(trigger);\n\n return _this;\n }\n /**\n * Defines if attributes would be resolved using internal setter functions\n * or custom functions that were passed in the constructor.\n * @param {Object} options\n */\n\n\n _createClass(Clipboard, [{\n key: \"resolveOptions\",\n value: function resolveOptions() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.action = typeof options.action === 'function' ? options.action : this.defaultAction;\n this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;\n this.text = typeof options.text === 'function' ? options.text : this.defaultText;\n this.container = clipboard_typeof(options.container) === 'object' ? options.container : document.body;\n }\n /**\n * Adds a click event listener to the passed trigger.\n * @param {String|HTMLElement|HTMLCollection|NodeList} trigger\n */\n\n }, {\n key: \"listenClick\",\n value: function listenClick(trigger) {\n var _this2 = this;\n\n this.listener = listen_default()(trigger, 'click', function (e) {\n return _this2.onClick(e);\n });\n }\n /**\n * Defines a new `ClipboardAction` on each click event.\n * @param {Event} e\n */\n\n }, {\n key: \"onClick\",\n value: function onClick(e) {\n var trigger = e.delegateTarget || e.currentTarget;\n var action = this.action(trigger) || 'copy';\n var text = actions_default({\n action: action,\n container: this.container,\n target: this.target(trigger),\n text: this.text(trigger)\n }); // Fires an event based on the copy operation result.\n\n this.emit(text ? 'success' : 'error', {\n action: action,\n text: text,\n trigger: trigger,\n clearSelection: function clearSelection() {\n if (trigger) {\n trigger.focus();\n }\n\n window.getSelection().removeAllRanges();\n }\n });\n }\n /**\n * Default `action` lookup function.\n * @param {Element} trigger\n */\n\n }, {\n key: \"defaultAction\",\n value: function defaultAction(trigger) {\n return getAttributeValue('action', trigger);\n }\n /**\n * Default `target` lookup function.\n * @param {Element} trigger\n */\n\n }, {\n key: \"defaultTarget\",\n value: function defaultTarget(trigger) {\n var selector = getAttributeValue('target', trigger);\n\n if (selector) {\n return document.querySelector(selector);\n }\n }\n /**\n * Allow fire programmatically a copy action\n * @param {String|HTMLElement} target\n * @param {Object} options\n * @returns Text copied.\n */\n\n }, {\n key: \"defaultText\",\n\n /**\n * Default `text` lookup function.\n * @param {Element} trigger\n */\n value: function defaultText(trigger) {\n return getAttributeValue('text', trigger);\n }\n /**\n * Destroy lifecycle.\n */\n\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.listener.destroy();\n }\n }], [{\n key: \"copy\",\n value: function copy(target) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n container: document.body\n };\n return actions_copy(target, options);\n }\n /**\n * Allow fire programmatically a cut action\n * @param {String|HTMLElement} target\n * @returns Text cutted.\n */\n\n }, {\n key: \"cut\",\n value: function cut(target) {\n return actions_cut(target);\n }\n /**\n * Returns the support of the given action, or all actions if no action is\n * given.\n * @param {String} [action]\n */\n\n }, {\n key: \"isSupported\",\n value: function isSupported() {\n var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];\n var actions = typeof action === 'string' ? [action] : action;\n var support = !!document.queryCommandSupported;\n actions.forEach(function (action) {\n support = support && !!document.queryCommandSupported(action);\n });\n return support;\n }\n }]);\n\n return Clipboard;\n}((tiny_emitter_default()));\n\n/* harmony default export */ var clipboard = (Clipboard);\n\n/***/ }),\n\n/***/ 828:\n/***/ (function(module) {\n\nvar DOCUMENT_NODE_TYPE = 9;\n\n/**\n * A polyfill for Element.matches()\n */\nif (typeof Element !== 'undefined' && !Element.prototype.matches) {\n var proto = Element.prototype;\n\n proto.matches = proto.matchesSelector ||\n proto.mozMatchesSelector ||\n proto.msMatchesSelector ||\n proto.oMatchesSelector ||\n proto.webkitMatchesSelector;\n}\n\n/**\n * Finds the closest parent that matches a selector.\n *\n * @param {Element} element\n * @param {String} selector\n * @return {Function}\n */\nfunction closest (element, selector) {\n while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {\n if (typeof element.matches === 'function' &&\n element.matches(selector)) {\n return element;\n }\n element = element.parentNode;\n }\n}\n\nmodule.exports = closest;\n\n\n/***/ }),\n\n/***/ 438:\n/***/ (function(module, __unused_webpack_exports, __webpack_require__) {\n\nvar closest = __webpack_require__(828);\n\n/**\n * Delegates event to a selector.\n *\n * @param {Element} element\n * @param {String} selector\n * @param {String} type\n * @param {Function} callback\n * @param {Boolean} useCapture\n * @return {Object}\n */\nfunction _delegate(element, selector, type, callback, useCapture) {\n var listenerFn = listener.apply(this, arguments);\n\n element.addEventListener(type, listenerFn, useCapture);\n\n return {\n destroy: function() {\n element.removeEventListener(type, listenerFn, useCapture);\n }\n }\n}\n\n/**\n * Delegates event to a selector.\n *\n * @param {Element|String|Array} [elements]\n * @param {String} selector\n * @param {String} type\n * @param {Function} callback\n * @param {Boolean} useCapture\n * @return {Object}\n */\nfunction delegate(elements, selector, type, callback, useCapture) {\n // Handle the regular Element usage\n if (typeof elements.addEventListener === 'function') {\n return _delegate.apply(null, arguments);\n }\n\n // Handle Element-less usage, it defaults to global delegation\n if (typeof type === 'function') {\n // Use `document` as the first parameter, then apply arguments\n // This is a short way to .unshift `arguments` without running into deoptimizations\n return _delegate.bind(null, document).apply(null, arguments);\n }\n\n // Handle Selector-based usage\n if (typeof elements === 'string') {\n elements = document.querySelectorAll(elements);\n }\n\n // Handle Array-like based usage\n return Array.prototype.map.call(elements, function (element) {\n return _delegate(element, selector, type, callback, useCapture);\n });\n}\n\n/**\n * Finds closest match and invokes callback.\n *\n * @param {Element} element\n * @param {String} selector\n * @param {String} type\n * @param {Function} callback\n * @return {Function}\n */\nfunction listener(element, selector, type, callback) {\n return function(e) {\n e.delegateTarget = closest(e.target, selector);\n\n if (e.delegateTarget) {\n callback.call(element, e);\n }\n }\n}\n\nmodule.exports = delegate;\n\n\n/***/ }),\n\n/***/ 879:\n/***/ (function(__unused_webpack_module, exports) {\n\n/**\n * Check if argument is a HTML element.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nexports.node = function(value) {\n return value !== undefined\n && value instanceof HTMLElement\n && value.nodeType === 1;\n};\n\n/**\n * Check if argument is a list of HTML elements.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nexports.nodeList = function(value) {\n var type = Object.prototype.toString.call(value);\n\n return value !== undefined\n && (type === '[object NodeList]' || type === '[object HTMLCollection]')\n && ('length' in value)\n && (value.length === 0 || exports.node(value[0]));\n};\n\n/**\n * Check if argument is a string.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nexports.string = function(value) {\n return typeof value === 'string'\n || value instanceof String;\n};\n\n/**\n * Check if argument is a function.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nexports.fn = function(value) {\n var type = Object.prototype.toString.call(value);\n\n return type === '[object Function]';\n};\n\n\n/***/ }),\n\n/***/ 370:\n/***/ (function(module, __unused_webpack_exports, __webpack_require__) {\n\nvar is = __webpack_require__(879);\nvar delegate = __webpack_require__(438);\n\n/**\n * Validates all params and calls the right\n * listener function based on its target type.\n *\n * @param {String|HTMLElement|HTMLCollection|NodeList} target\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listen(target, type, callback) {\n if (!target && !type && !callback) {\n throw new Error('Missing required arguments');\n }\n\n if (!is.string(type)) {\n throw new TypeError('Second argument must be a String');\n }\n\n if (!is.fn(callback)) {\n throw new TypeError('Third argument must be a Function');\n }\n\n if (is.node(target)) {\n return listenNode(target, type, callback);\n }\n else if (is.nodeList(target)) {\n return listenNodeList(target, type, callback);\n }\n else if (is.string(target)) {\n return listenSelector(target, type, callback);\n }\n else {\n throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');\n }\n}\n\n/**\n * Adds an event listener to a HTML element\n * and returns a remove listener function.\n *\n * @param {HTMLElement} node\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listenNode(node, type, callback) {\n node.addEventListener(type, callback);\n\n return {\n destroy: function() {\n node.removeEventListener(type, callback);\n }\n }\n}\n\n/**\n * Add an event listener to a list of HTML elements\n * and returns a remove listener function.\n *\n * @param {NodeList|HTMLCollection} nodeList\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listenNodeList(nodeList, type, callback) {\n Array.prototype.forEach.call(nodeList, function(node) {\n node.addEventListener(type, callback);\n });\n\n return {\n destroy: function() {\n Array.prototype.forEach.call(nodeList, function(node) {\n node.removeEventListener(type, callback);\n });\n }\n }\n}\n\n/**\n * Add an event listener to a selector\n * and returns a remove listener function.\n *\n * @param {String} selector\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listenSelector(selector, type, callback) {\n return delegate(document.body, selector, type, callback);\n}\n\nmodule.exports = listen;\n\n\n/***/ }),\n\n/***/ 817:\n/***/ (function(module) {\n\nfunction select(element) {\n var selectedText;\n\n if (element.nodeName === 'SELECT') {\n element.focus();\n\n selectedText = element.value;\n }\n else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {\n var isReadOnly = element.hasAttribute('readonly');\n\n if (!isReadOnly) {\n element.setAttribute('readonly', '');\n }\n\n element.select();\n element.setSelectionRange(0, element.value.length);\n\n if (!isReadOnly) {\n element.removeAttribute('readonly');\n }\n\n selectedText = element.value;\n }\n else {\n if (element.hasAttribute('contenteditable')) {\n element.focus();\n }\n\n var selection = window.getSelection();\n var range = document.createRange();\n\n range.selectNodeContents(element);\n selection.removeAllRanges();\n selection.addRange(range);\n\n selectedText = selection.toString();\n }\n\n return selectedText;\n}\n\nmodule.exports = select;\n\n\n/***/ }),\n\n/***/ 279:\n/***/ (function(module) {\n\nfunction E () {\n // Keep this empty so it's easier to inherit from\n // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)\n}\n\nE.prototype = {\n on: function (name, callback, ctx) {\n var e = this.e || (this.e = {});\n\n (e[name] || (e[name] = [])).push({\n fn: callback,\n ctx: ctx\n });\n\n return this;\n },\n\n once: function (name, callback, ctx) {\n var self = this;\n function listener () {\n self.off(name, listener);\n callback.apply(ctx, arguments);\n };\n\n listener._ = callback\n return this.on(name, listener, ctx);\n },\n\n emit: function (name) {\n var data = [].slice.call(arguments, 1);\n var evtArr = ((this.e || (this.e = {}))[name] || []).slice();\n var i = 0;\n var len = evtArr.length;\n\n for (i; i < len; i++) {\n evtArr[i].fn.apply(evtArr[i].ctx, data);\n }\n\n return this;\n },\n\n off: function (name, callback) {\n var e = this.e || (this.e = {});\n var evts = e[name];\n var liveEvents = [];\n\n if (evts && callback) {\n for (var i = 0, len = evts.length; i < len; i++) {\n if (evts[i].fn !== callback && evts[i].fn._ !== callback)\n liveEvents.push(evts[i]);\n }\n }\n\n // Remove event from queue to prevent memory leak\n // Suggested by https://github.com/lazd\n // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910\n\n (liveEvents.length)\n ? e[name] = liveEvents\n : delete e[name];\n\n return this;\n }\n};\n\nmodule.exports = E;\nmodule.exports.TinyEmitter = E;\n\n\n/***/ })\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(__webpack_module_cache__[moduleId]) {\n/******/ \t\t\treturn __webpack_module_cache__[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/compat get default export */\n/******/ \t!function() {\n/******/ \t\t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t\t__webpack_require__.n = function(module) {\n/******/ \t\t\tvar getter = module && module.__esModule ?\n/******/ \t\t\t\tfunction() { return module['default']; } :\n/******/ \t\t\t\tfunction() { return module; };\n/******/ \t\t\t__webpack_require__.d(getter, { a: getter });\n/******/ \t\t\treturn getter;\n/******/ \t\t};\n/******/ \t}();\n/******/ \t\n/******/ \t/* webpack/runtime/define property getters */\n/******/ \t!function() {\n/******/ \t\t// define getter functions for harmony exports\n/******/ \t\t__webpack_require__.d = function(exports, definition) {\n/******/ \t\t\tfor(var key in definition) {\n/******/ \t\t\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n/******/ \t\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n/******/ \t\t\t\t}\n/******/ \t\t\t}\n/******/ \t\t};\n/******/ \t}();\n/******/ \t\n/******/ \t/* webpack/runtime/hasOwnProperty shorthand */\n/******/ \t!function() {\n/******/ \t\t__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }\n/******/ \t}();\n/******/ \t\n/************************************************************************/\n/******/ \t// module exports must be returned from runtime so entry inlining is disabled\n/******/ \t// startup\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(686);\n/******/ })()\n.default;\n});", "/*!\n * escape-html\n * Copyright(c) 2012-2013 TJ Holowaychuk\n * Copyright(c) 2015 Andreas Lubbe\n * Copyright(c) 2015 Tiancheng \"Timothy\" Gu\n * MIT Licensed\n */\n\n'use strict';\n\n/**\n * Module variables.\n * @private\n */\n\nvar matchHtmlRegExp = /[\"'&<>]/;\n\n/**\n * Module exports.\n * @public\n */\n\nmodule.exports = escapeHtml;\n\n/**\n * Escape special characters in the given string of html.\n *\n * @param {string} string The string to escape for inserting into HTML\n * @return {string}\n * @public\n */\n\nfunction escapeHtml(string) {\n var str = '' + string;\n var match = matchHtmlRegExp.exec(str);\n\n if (!match) {\n return str;\n }\n\n var escape;\n var html = '';\n var index = 0;\n var lastIndex = 0;\n\n for (index = match.index; index < str.length; index++) {\n switch (str.charCodeAt(index)) {\n case 34: // \"\n escape = '"';\n break;\n case 38: // &\n escape = '&';\n break;\n case 39: // '\n escape = ''';\n break;\n case 60: // <\n escape = '<';\n break;\n case 62: // >\n escape = '>';\n break;\n default:\n continue;\n }\n\n if (lastIndex !== index) {\n html += str.substring(lastIndex, index);\n }\n\n lastIndex = index + 1;\n html += escape;\n }\n\n return lastIndex !== index\n ? html + str.substring(lastIndex, index)\n : html;\n}\n", "Array.prototype.flat||Object.defineProperty(Array.prototype,\"flat\",{configurable:!0,value:function r(){var t=isNaN(arguments[0])?1:Number(arguments[0]);return t?Array.prototype.reduce.call(this,function(a,e){return Array.isArray(e)?a.push.apply(a,r.call(e,t-1)):a.push(e),a},[]):Array.prototype.slice.call(this)},writable:!0}),Array.prototype.flatMap||Object.defineProperty(Array.prototype,\"flatMap\",{configurable:!0,value:function(r){return Array.prototype.map.apply(this,arguments).flat()},writable:!0})\n", "/*\n * Copyright (c) 2016-2023 Martin Donath \n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n */\n\nimport \"array-flat-polyfill\"\nimport \"focus-visible\"\nimport \"unfetch/polyfill\"\nimport \"url-polyfill\"\n\nimport {\n EMPTY,\n NEVER,\n Observable,\n Subject,\n defer,\n delay,\n filter,\n map,\n merge,\n mergeWith,\n shareReplay,\n switchMap\n} from \"rxjs\"\n\nimport { configuration, feature } from \"./_\"\nimport {\n at,\n getActiveElement,\n getOptionalElement,\n requestJSON,\n setLocation,\n setToggle,\n watchDocument,\n watchKeyboard,\n watchLocation,\n watchLocationTarget,\n watchMedia,\n watchPrint,\n watchScript,\n watchViewport\n} from \"./browser\"\nimport {\n getComponentElement,\n getComponentElements,\n mountAnnounce,\n mountBackToTop,\n mountConsent,\n mountContent,\n mountDialog,\n mountHeader,\n mountHeaderTitle,\n mountPalette,\n mountSearch,\n mountSearchHiglight,\n mountSidebar,\n mountSource,\n mountTableOfContents,\n mountTabs,\n watchHeader,\n watchMain\n} from \"./components\"\nimport {\n SearchIndex,\n setupClipboardJS,\n setupInstantLoading,\n setupVersionSelector\n} from \"./integrations\"\nimport {\n patchIndeterminate,\n patchScrollfix,\n patchScrolllock\n} from \"./patches\"\nimport \"./polyfills\"\n\n/* ----------------------------------------------------------------------------\n * Functions - @todo refactor\n * ------------------------------------------------------------------------- */\n\n/**\n * Fetch search index\n *\n * @returns Search index observable\n */\nfunction fetchSearchIndex(): Observable {\n if (location.protocol === \"file:\") {\n return watchScript(\n `${new URL(\"search/search_index.js\", config.base)}`\n )\n .pipe(\n // @ts-ignore - @todo fix typings\n map(() => __index),\n shareReplay(1)\n )\n } else {\n return requestJSON(\n new URL(\"search/search_index.json\", config.base)\n )\n }\n}\n\n/* ----------------------------------------------------------------------------\n * Application\n * ------------------------------------------------------------------------- */\n\n/* Yay, JavaScript is available */\ndocument.documentElement.classList.remove(\"no-js\")\ndocument.documentElement.classList.add(\"js\")\n\n/* Set up navigation observables and subjects */\nconst document$ = watchDocument()\nconst location$ = watchLocation()\nconst target$ = watchLocationTarget(location$)\nconst keyboard$ = watchKeyboard()\n\n/* Set up media observables */\nconst viewport$ = watchViewport()\nconst tablet$ = watchMedia(\"(min-width: 960px)\")\nconst screen$ = watchMedia(\"(min-width: 1220px)\")\nconst print$ = watchPrint()\n\n/* Retrieve search index, if search is enabled */\nconst config = configuration()\nconst index$ = document.forms.namedItem(\"search\")\n ? fetchSearchIndex()\n : NEVER\n\n/* Set up Clipboard.js integration */\nconst alert$ = new Subject()\nsetupClipboardJS({ alert$ })\n\n/* Set up instant loading, if enabled */\nif (feature(\"navigation.instant\"))\n setupInstantLoading({ location$, viewport$ })\n .subscribe(document$)\n\n/* Set up version selector */\nif (config.version?.provider === \"mike\")\n setupVersionSelector({ document$ })\n\n/* Always close drawer and search on navigation */\nmerge(location$, target$)\n .pipe(\n delay(125)\n )\n .subscribe(() => {\n setToggle(\"drawer\", false)\n setToggle(\"search\", false)\n })\n\n/* Set up global keyboard handlers */\nkeyboard$\n .pipe(\n filter(({ mode }) => mode === \"global\")\n )\n .subscribe(key => {\n switch (key.type) {\n\n /* Go to previous page */\n case \"p\":\n case \",\":\n const prev = getOptionalElement(\"link[rel=prev]\")\n if (typeof prev !== \"undefined\")\n setLocation(prev)\n break\n\n /* Go to next page */\n case \"n\":\n case \".\":\n const next = getOptionalElement(\"link[rel=next]\")\n if (typeof next !== \"undefined\")\n setLocation(next)\n break\n\n /* Expand navigation, see https://bit.ly/3ZjG5io */\n case \"Enter\":\n const active = getActiveElement()\n if (active instanceof HTMLLabelElement)\n active.click()\n }\n })\n\n/* Set up patches */\npatchIndeterminate({ document$, tablet$ })\npatchScrollfix({ document$ })\npatchScrolllock({ viewport$, tablet$ })\n\n/* Set up header and main area observable */\nconst header$ = watchHeader(getComponentElement(\"header\"), { viewport$ })\nconst main$ = document$\n .pipe(\n map(() => getComponentElement(\"main\")),\n switchMap(el => watchMain(el, { viewport$, header$ })),\n shareReplay(1)\n )\n\n/* Set up control component observables */\nconst control$ = merge(\n\n /* Consent */\n ...getComponentElements(\"consent\")\n .map(el => mountConsent(el, { target$ })),\n\n /* Dialog */\n ...getComponentElements(\"dialog\")\n .map(el => mountDialog(el, { alert$ })),\n\n /* Header */\n ...getComponentElements(\"header\")\n .map(el => mountHeader(el, { viewport$, header$, main$ })),\n\n /* Color palette */\n ...getComponentElements(\"palette\")\n .map(el => mountPalette(el)),\n\n /* Search */\n ...getComponentElements(\"search\")\n .map(el => mountSearch(el, { index$, keyboard$ })),\n\n /* Repository information */\n ...getComponentElements(\"source\")\n .map(el => mountSource(el))\n)\n\n/* Set up content component observables */\nconst content$ = defer(() => merge(\n\n /* Announcement bar */\n ...getComponentElements(\"announce\")\n .map(el => mountAnnounce(el)),\n\n /* Content */\n ...getComponentElements(\"content\")\n .map(el => mountContent(el, { viewport$, target$, print$ })),\n\n /* Search highlighting */\n ...getComponentElements(\"content\")\n .map(el => feature(\"search.highlight\")\n ? mountSearchHiglight(el, { index$, location$ })\n : EMPTY\n ),\n\n /* Header title */\n ...getComponentElements(\"header-title\")\n .map(el => mountHeaderTitle(el, { viewport$, header$ })),\n\n /* Sidebar */\n ...getComponentElements(\"sidebar\")\n .map(el => el.getAttribute(\"data-md-type\") === \"navigation\"\n ? at(screen$, () => mountSidebar(el, { viewport$, header$, main$ }))\n : at(tablet$, () => mountSidebar(el, { viewport$, header$, main$ }))\n ),\n\n /* Navigation tabs */\n ...getComponentElements(\"tabs\")\n .map(el => mountTabs(el, { viewport$, header$ })),\n\n /* Table of contents */\n ...getComponentElements(\"toc\")\n .map(el => mountTableOfContents(el, {\n viewport$, header$, main$, target$\n })),\n\n /* Back-to-top button */\n ...getComponentElements(\"top\")\n .map(el => mountBackToTop(el, { viewport$, header$, main$, target$ }))\n))\n\n/* Set up component observables */\nconst component$ = document$\n .pipe(\n switchMap(() => content$),\n mergeWith(control$),\n shareReplay(1)\n )\n\n/* Subscribe to all components */\ncomponent$.subscribe()\n\n/* ----------------------------------------------------------------------------\n * Exports\n * ------------------------------------------------------------------------- */\n\nwindow.document$ = document$ /* Document observable */\nwindow.location$ = location$ /* Location subject */\nwindow.target$ = target$ /* Location target observable */\nwindow.keyboard$ = keyboard$ /* Keyboard observable */\nwindow.viewport$ = viewport$ /* Viewport observable */\nwindow.tablet$ = tablet$ /* Media tablet observable */\nwindow.screen$ = screen$ /* Media screen observable */\nwindow.print$ = print$ /* Media print observable */\nwindow.alert$ = alert$ /* Alert subject */\nwindow.component$ = component$ /* Component observable */\n", "self.fetch||(self.fetch=function(e,n){return n=n||{},new Promise(function(t,r){var s=new XMLHttpRequest,o=[],u={},a=function e(){return{ok:2==(s.status/100|0),statusText:s.statusText,status:s.status,url:s.responseURL,text:function(){return Promise.resolve(s.responseText)},json:function(){return Promise.resolve(s.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([s.response]))},clone:e,headers:{keys:function(){return o},entries:function(){return o.map(function(e){return[e,s.getResponseHeader(e)]})},get:function(e){return s.getResponseHeader(e)},has:function(e){return null!=s.getResponseHeader(e)}}}};for(var i in s.open(n.method||\"get\",e,!0),s.onload=function(){s.getAllResponseHeaders().toLowerCase().replace(/^(.+?):/gm,function(e,n){u[n]||o.push(u[n]=n)}),t(a())},s.onerror=r,s.withCredentials=\"include\"==n.credentials,n.headers)s.setRequestHeader(i,n.headers[i]);s.send(n.body||null)})});\n", "/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n", "/**\n * Returns true if the object is a function.\n * @param value The value to check\n */\nexport function isFunction(value: any): value is (...args: any[]) => any {\n return typeof value === 'function';\n}\n", "/**\n * Used to create Error subclasses until the community moves away from ES5.\n *\n * This is because compiling from TypeScript down to ES5 has issues with subclassing Errors\n * as well as other built-in types: https://github.com/Microsoft/TypeScript/issues/12123\n *\n * @param createImpl A factory function to create the actual constructor implementation. The returned\n * function should be a named function that calls `_super` internally.\n */\nexport function createErrorClass(createImpl: (_super: any) => any): T {\n const _super = (instance: any) => {\n Error.call(instance);\n instance.stack = new Error().stack;\n };\n\n const ctorFunc = createImpl(_super);\n ctorFunc.prototype = Object.create(Error.prototype);\n ctorFunc.prototype.constructor = ctorFunc;\n return ctorFunc;\n}\n", "import { createErrorClass } from './createErrorClass';\n\nexport interface UnsubscriptionError extends Error {\n readonly errors: any[];\n}\n\nexport interface UnsubscriptionErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new (errors: any[]): UnsubscriptionError;\n}\n\n/**\n * An error thrown when one or more errors have occurred during the\n * `unsubscribe` of a {@link Subscription}.\n */\nexport const UnsubscriptionError: UnsubscriptionErrorCtor = createErrorClass(\n (_super) =>\n function UnsubscriptionErrorImpl(this: any, errors: (Error | string)[]) {\n _super(this);\n this.message = errors\n ? `${errors.length} errors occurred during unsubscription:\n${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\\n ')}`\n : '';\n this.name = 'UnsubscriptionError';\n this.errors = errors;\n }\n);\n", "/**\n * Removes an item from an array, mutating it.\n * @param arr The array to remove the item from\n * @param item The item to remove\n */\nexport function arrRemove(arr: T[] | undefined | null, item: T) {\n if (arr) {\n const index = arr.indexOf(item);\n 0 <= index && arr.splice(index, 1);\n }\n}\n", "import { isFunction } from './util/isFunction';\nimport { UnsubscriptionError } from './util/UnsubscriptionError';\nimport { SubscriptionLike, TeardownLogic, Unsubscribable } from './types';\nimport { arrRemove } from './util/arrRemove';\n\n/**\n * Represents a disposable resource, such as the execution of an Observable. A\n * Subscription has one important method, `unsubscribe`, that takes no argument\n * and just disposes the resource held by the subscription.\n *\n * Additionally, subscriptions may be grouped together through the `add()`\n * method, which will attach a child Subscription to the current Subscription.\n * When a Subscription is unsubscribed, all its children (and its grandchildren)\n * will be unsubscribed as well.\n *\n * @class Subscription\n */\nexport class Subscription implements SubscriptionLike {\n /** @nocollapse */\n public static EMPTY = (() => {\n const empty = new Subscription();\n empty.closed = true;\n return empty;\n })();\n\n /**\n * A flag to indicate whether this Subscription has already been unsubscribed.\n */\n public closed = false;\n\n private _parentage: Subscription[] | Subscription | null = null;\n\n /**\n * The list of registered finalizers to execute upon unsubscription. Adding and removing from this\n * list occurs in the {@link #add} and {@link #remove} methods.\n */\n private _finalizers: Exclude[] | null = null;\n\n /**\n * @param initialTeardown A function executed first as part of the finalization\n * process that is kicked off when {@link #unsubscribe} is called.\n */\n constructor(private initialTeardown?: () => void) {}\n\n /**\n * Disposes the resources held by the subscription. May, for instance, cancel\n * an ongoing Observable execution or cancel any other type of work that\n * started when the Subscription was created.\n * @return {void}\n */\n unsubscribe(): void {\n let errors: any[] | undefined;\n\n if (!this.closed) {\n this.closed = true;\n\n // Remove this from it's parents.\n const { _parentage } = this;\n if (_parentage) {\n this._parentage = null;\n if (Array.isArray(_parentage)) {\n for (const parent of _parentage) {\n parent.remove(this);\n }\n } else {\n _parentage.remove(this);\n }\n }\n\n const { initialTeardown: initialFinalizer } = this;\n if (isFunction(initialFinalizer)) {\n try {\n initialFinalizer();\n } catch (e) {\n errors = e instanceof UnsubscriptionError ? e.errors : [e];\n }\n }\n\n const { _finalizers } = this;\n if (_finalizers) {\n this._finalizers = null;\n for (const finalizer of _finalizers) {\n try {\n execFinalizer(finalizer);\n } catch (err) {\n errors = errors ?? [];\n if (err instanceof UnsubscriptionError) {\n errors = [...errors, ...err.errors];\n } else {\n errors.push(err);\n }\n }\n }\n }\n\n if (errors) {\n throw new UnsubscriptionError(errors);\n }\n }\n }\n\n /**\n * Adds a finalizer to this subscription, so that finalization will be unsubscribed/called\n * when this subscription is unsubscribed. If this subscription is already {@link #closed},\n * because it has already been unsubscribed, then whatever finalizer is passed to it\n * will automatically be executed (unless the finalizer itself is also a closed subscription).\n *\n * Closed Subscriptions cannot be added as finalizers to any subscription. Adding a closed\n * subscription to a any subscription will result in no operation. (A noop).\n *\n * Adding a subscription to itself, or adding `null` or `undefined` will not perform any\n * operation at all. (A noop).\n *\n * `Subscription` instances that are added to this instance will automatically remove themselves\n * if they are unsubscribed. Functions and {@link Unsubscribable} objects that you wish to remove\n * will need to be removed manually with {@link #remove}\n *\n * @param teardown The finalization logic to add to this subscription.\n */\n add(teardown: TeardownLogic): void {\n // Only add the finalizer if it's not undefined\n // and don't add a subscription to itself.\n if (teardown && teardown !== this) {\n if (this.closed) {\n // If this subscription is already closed,\n // execute whatever finalizer is handed to it automatically.\n execFinalizer(teardown);\n } else {\n if (teardown instanceof Subscription) {\n // We don't add closed subscriptions, and we don't add the same subscription\n // twice. Subscription unsubscribe is idempotent.\n if (teardown.closed || teardown._hasParent(this)) {\n return;\n }\n teardown._addParent(this);\n }\n (this._finalizers = this._finalizers ?? []).push(teardown);\n }\n }\n }\n\n /**\n * Checks to see if a this subscription already has a particular parent.\n * This will signal that this subscription has already been added to the parent in question.\n * @param parent the parent to check for\n */\n private _hasParent(parent: Subscription) {\n const { _parentage } = this;\n return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));\n }\n\n /**\n * Adds a parent to this subscription so it can be removed from the parent if it\n * unsubscribes on it's own.\n *\n * NOTE: THIS ASSUMES THAT {@link _hasParent} HAS ALREADY BEEN CHECKED.\n * @param parent The parent subscription to add\n */\n private _addParent(parent: Subscription) {\n const { _parentage } = this;\n this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;\n }\n\n /**\n * Called on a child when it is removed via {@link #remove}.\n * @param parent The parent to remove\n */\n private _removeParent(parent: Subscription) {\n const { _parentage } = this;\n if (_parentage === parent) {\n this._parentage = null;\n } else if (Array.isArray(_parentage)) {\n arrRemove(_parentage, parent);\n }\n }\n\n /**\n * Removes a finalizer from this subscription that was previously added with the {@link #add} method.\n *\n * Note that `Subscription` instances, when unsubscribed, will automatically remove themselves\n * from every other `Subscription` they have been added to. This means that using the `remove` method\n * is not a common thing and should be used thoughtfully.\n *\n * If you add the same finalizer instance of a function or an unsubscribable object to a `Subscription` instance\n * more than once, you will need to call `remove` the same number of times to remove all instances.\n *\n * All finalizer instances are removed to free up memory upon unsubscription.\n *\n * @param teardown The finalizer to remove from this subscription\n */\n remove(teardown: Exclude): void {\n const { _finalizers } = this;\n _finalizers && arrRemove(_finalizers, teardown);\n\n if (teardown instanceof Subscription) {\n teardown._removeParent(this);\n }\n }\n}\n\nexport const EMPTY_SUBSCRIPTION = Subscription.EMPTY;\n\nexport function isSubscription(value: any): value is Subscription {\n return (\n value instanceof Subscription ||\n (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe))\n );\n}\n\nfunction execFinalizer(finalizer: Unsubscribable | (() => void)) {\n if (isFunction(finalizer)) {\n finalizer();\n } else {\n finalizer.unsubscribe();\n }\n}\n", "import { Subscriber } from './Subscriber';\nimport { ObservableNotification } from './types';\n\n/**\n * The {@link GlobalConfig} object for RxJS. It is used to configure things\n * like how to react on unhandled errors.\n */\nexport const config: GlobalConfig = {\n onUnhandledError: null,\n onStoppedNotification: null,\n Promise: undefined,\n useDeprecatedSynchronousErrorHandling: false,\n useDeprecatedNextContext: false,\n};\n\n/**\n * The global configuration object for RxJS, used to configure things\n * like how to react on unhandled errors. Accessible via {@link config}\n * object.\n */\nexport interface GlobalConfig {\n /**\n * A registration point for unhandled errors from RxJS. These are errors that\n * cannot were not handled by consuming code in the usual subscription path. For\n * example, if you have this configured, and you subscribe to an observable without\n * providing an error handler, errors from that subscription will end up here. This\n * will _always_ be called asynchronously on another job in the runtime. This is because\n * we do not want errors thrown in this user-configured handler to interfere with the\n * behavior of the library.\n */\n onUnhandledError: ((err: any) => void) | null;\n\n /**\n * A registration point for notifications that cannot be sent to subscribers because they\n * have completed, errored or have been explicitly unsubscribed. By default, next, complete\n * and error notifications sent to stopped subscribers are noops. However, sometimes callers\n * might want a different behavior. For example, with sources that attempt to report errors\n * to stopped subscribers, a caller can configure RxJS to throw an unhandled error instead.\n * This will _always_ be called asynchronously on another job in the runtime. This is because\n * we do not want errors thrown in this user-configured handler to interfere with the\n * behavior of the library.\n */\n onStoppedNotification: ((notification: ObservableNotification, subscriber: Subscriber) => void) | null;\n\n /**\n * The promise constructor used by default for {@link Observable#toPromise toPromise} and {@link Observable#forEach forEach}\n * methods.\n *\n * @deprecated As of version 8, RxJS will no longer support this sort of injection of a\n * Promise constructor. If you need a Promise implementation other than native promises,\n * please polyfill/patch Promise as you see appropriate. Will be removed in v8.\n */\n Promise?: PromiseConstructorLike;\n\n /**\n * If true, turns on synchronous error rethrowing, which is a deprecated behavior\n * in v6 and higher. This behavior enables bad patterns like wrapping a subscribe\n * call in a try/catch block. It also enables producer interference, a nasty bug\n * where a multicast can be broken for all observers by a downstream consumer with\n * an unhandled error. DO NOT USE THIS FLAG UNLESS IT'S NEEDED TO BUY TIME\n * FOR MIGRATION REASONS.\n *\n * @deprecated As of version 8, RxJS will no longer support synchronous throwing\n * of unhandled errors. All errors will be thrown on a separate call stack to prevent bad\n * behaviors described above. Will be removed in v8.\n */\n useDeprecatedSynchronousErrorHandling: boolean;\n\n /**\n * If true, enables an as-of-yet undocumented feature from v5: The ability to access\n * `unsubscribe()` via `this` context in `next` functions created in observers passed\n * to `subscribe`.\n *\n * This is being removed because the performance was severely problematic, and it could also cause\n * issues when types other than POJOs are passed to subscribe as subscribers, as they will likely have\n * their `this` context overwritten.\n *\n * @deprecated As of version 8, RxJS will no longer support altering the\n * context of next functions provided as part of an observer to Subscribe. Instead,\n * you will have access to a subscription or a signal or token that will allow you to do things like\n * unsubscribe and test closed status. Will be removed in v8.\n */\n useDeprecatedNextContext: boolean;\n}\n", "import type { TimerHandle } from './timerHandle';\ntype SetTimeoutFunction = (handler: () => void, timeout?: number, ...args: any[]) => TimerHandle;\ntype ClearTimeoutFunction = (handle: TimerHandle) => void;\n\ninterface TimeoutProvider {\n setTimeout: SetTimeoutFunction;\n clearTimeout: ClearTimeoutFunction;\n delegate:\n | {\n setTimeout: SetTimeoutFunction;\n clearTimeout: ClearTimeoutFunction;\n }\n | undefined;\n}\n\nexport const timeoutProvider: TimeoutProvider = {\n // When accessing the delegate, use the variable rather than `this` so that\n // the functions can be called without being bound to the provider.\n setTimeout(handler: () => void, timeout?: number, ...args) {\n const { delegate } = timeoutProvider;\n if (delegate?.setTimeout) {\n return delegate.setTimeout(handler, timeout, ...args);\n }\n return setTimeout(handler, timeout, ...args);\n },\n clearTimeout(handle) {\n const { delegate } = timeoutProvider;\n return (delegate?.clearTimeout || clearTimeout)(handle as any);\n },\n delegate: undefined,\n};\n", "import { config } from '../config';\nimport { timeoutProvider } from '../scheduler/timeoutProvider';\n\n/**\n * Handles an error on another job either with the user-configured {@link onUnhandledError},\n * or by throwing it on that new job so it can be picked up by `window.onerror`, `process.on('error')`, etc.\n *\n * This should be called whenever there is an error that is out-of-band with the subscription\n * or when an error hits a terminal boundary of the subscription and no error handler was provided.\n *\n * @param err the error to report\n */\nexport function reportUnhandledError(err: any) {\n timeoutProvider.setTimeout(() => {\n const { onUnhandledError } = config;\n if (onUnhandledError) {\n // Execute the user-configured error handler.\n onUnhandledError(err);\n } else {\n // Throw so it is picked up by the runtime's uncaught error mechanism.\n throw err;\n }\n });\n}\n", "/* tslint:disable:no-empty */\nexport function noop() { }\n", "import { CompleteNotification, NextNotification, ErrorNotification } from './types';\n\n/**\n * A completion object optimized for memory use and created to be the\n * same \"shape\" as other notifications in v8.\n * @internal\n */\nexport const COMPLETE_NOTIFICATION = (() => createNotification('C', undefined, undefined) as CompleteNotification)();\n\n/**\n * Internal use only. Creates an optimized error notification that is the same \"shape\"\n * as other notifications.\n * @internal\n */\nexport function errorNotification(error: any): ErrorNotification {\n return createNotification('E', undefined, error) as any;\n}\n\n/**\n * Internal use only. Creates an optimized next notification that is the same \"shape\"\n * as other notifications.\n * @internal\n */\nexport function nextNotification(value: T) {\n return createNotification('N', value, undefined) as NextNotification;\n}\n\n/**\n * Ensures that all notifications created internally have the same \"shape\" in v8.\n *\n * TODO: This is only exported to support a crazy legacy test in `groupBy`.\n * @internal\n */\nexport function createNotification(kind: 'N' | 'E' | 'C', value: any, error: any) {\n return {\n kind,\n value,\n error,\n };\n}\n", "import { config } from '../config';\n\nlet context: { errorThrown: boolean; error: any } | null = null;\n\n/**\n * Handles dealing with errors for super-gross mode. Creates a context, in which\n * any synchronously thrown errors will be passed to {@link captureError}. Which\n * will record the error such that it will be rethrown after the call back is complete.\n * TODO: Remove in v8\n * @param cb An immediately executed function.\n */\nexport function errorContext(cb: () => void) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n const isRoot = !context;\n if (isRoot) {\n context = { errorThrown: false, error: null };\n }\n cb();\n if (isRoot) {\n const { errorThrown, error } = context!;\n context = null;\n if (errorThrown) {\n throw error;\n }\n }\n } else {\n // This is the general non-deprecated path for everyone that\n // isn't crazy enough to use super-gross mode (useDeprecatedSynchronousErrorHandling)\n cb();\n }\n}\n\n/**\n * Captures errors only in super-gross mode.\n * @param err the error to capture\n */\nexport function captureError(err: any) {\n if (config.useDeprecatedSynchronousErrorHandling && context) {\n context.errorThrown = true;\n context.error = err;\n }\n}\n", "import { isFunction } from './util/isFunction';\nimport { Observer, ObservableNotification } from './types';\nimport { isSubscription, Subscription } from './Subscription';\nimport { config } from './config';\nimport { reportUnhandledError } from './util/reportUnhandledError';\nimport { noop } from './util/noop';\nimport { nextNotification, errorNotification, COMPLETE_NOTIFICATION } from './NotificationFactories';\nimport { timeoutProvider } from './scheduler/timeoutProvider';\nimport { captureError } from './util/errorContext';\n\n/**\n * Implements the {@link Observer} interface and extends the\n * {@link Subscription} class. While the {@link Observer} is the public API for\n * consuming the values of an {@link Observable}, all Observers get converted to\n * a Subscriber, in order to provide Subscription-like capabilities such as\n * `unsubscribe`. Subscriber is a common type in RxJS, and crucial for\n * implementing operators, but it is rarely used as a public API.\n *\n * @class Subscriber\n */\nexport class Subscriber extends Subscription implements Observer {\n /**\n * A static factory for a Subscriber, given a (potentially partial) definition\n * of an Observer.\n * @param next The `next` callback of an Observer.\n * @param error The `error` callback of an\n * Observer.\n * @param complete The `complete` callback of an\n * Observer.\n * @return A Subscriber wrapping the (partially defined)\n * Observer represented by the given arguments.\n * @nocollapse\n * @deprecated Do not use. Will be removed in v8. There is no replacement for this\n * method, and there is no reason to be creating instances of `Subscriber` directly.\n * If you have a specific use case, please file an issue.\n */\n static create(next?: (x?: T) => void, error?: (e?: any) => void, complete?: () => void): Subscriber {\n return new SafeSubscriber(next, error, complete);\n }\n\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n protected isStopped: boolean = false;\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n protected destination: Subscriber | Observer; // this `any` is the escape hatch to erase extra type param (e.g. R)\n\n /**\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n * There is no reason to directly create an instance of Subscriber. This type is exported for typings reasons.\n */\n constructor(destination?: Subscriber | Observer) {\n super();\n if (destination) {\n this.destination = destination;\n // Automatically chain subscriptions together here.\n // if destination is a Subscription, then it is a Subscriber.\n if (isSubscription(destination)) {\n destination.add(this);\n }\n } else {\n this.destination = EMPTY_OBSERVER;\n }\n }\n\n /**\n * The {@link Observer} callback to receive notifications of type `next` from\n * the Observable, with a value. The Observable may call this method 0 or more\n * times.\n * @param {T} [value] The `next` value.\n * @return {void}\n */\n next(value?: T): void {\n if (this.isStopped) {\n handleStoppedNotification(nextNotification(value), this);\n } else {\n this._next(value!);\n }\n }\n\n /**\n * The {@link Observer} callback to receive notifications of type `error` from\n * the Observable, with an attached `Error`. Notifies the Observer that\n * the Observable has experienced an error condition.\n * @param {any} [err] The `error` exception.\n * @return {void}\n */\n error(err?: any): void {\n if (this.isStopped) {\n handleStoppedNotification(errorNotification(err), this);\n } else {\n this.isStopped = true;\n this._error(err);\n }\n }\n\n /**\n * The {@link Observer} callback to receive a valueless notification of type\n * `complete` from the Observable. Notifies the Observer that the Observable\n * has finished sending push-based notifications.\n * @return {void}\n */\n complete(): void {\n if (this.isStopped) {\n handleStoppedNotification(COMPLETE_NOTIFICATION, this);\n } else {\n this.isStopped = true;\n this._complete();\n }\n }\n\n unsubscribe(): void {\n if (!this.closed) {\n this.isStopped = true;\n super.unsubscribe();\n this.destination = null!;\n }\n }\n\n protected _next(value: T): void {\n this.destination.next(value);\n }\n\n protected _error(err: any): void {\n try {\n this.destination.error(err);\n } finally {\n this.unsubscribe();\n }\n }\n\n protected _complete(): void {\n try {\n this.destination.complete();\n } finally {\n this.unsubscribe();\n }\n }\n}\n\n/**\n * This bind is captured here because we want to be able to have\n * compatibility with monoid libraries that tend to use a method named\n * `bind`. In particular, a library called Monio requires this.\n */\nconst _bind = Function.prototype.bind;\n\nfunction bind any>(fn: Fn, thisArg: any): Fn {\n return _bind.call(fn, thisArg);\n}\n\n/**\n * Internal optimization only, DO NOT EXPOSE.\n * @internal\n */\nclass ConsumerObserver implements Observer {\n constructor(private partialObserver: Partial>) {}\n\n next(value: T): void {\n const { partialObserver } = this;\n if (partialObserver.next) {\n try {\n partialObserver.next(value);\n } catch (error) {\n handleUnhandledError(error);\n }\n }\n }\n\n error(err: any): void {\n const { partialObserver } = this;\n if (partialObserver.error) {\n try {\n partialObserver.error(err);\n } catch (error) {\n handleUnhandledError(error);\n }\n } else {\n handleUnhandledError(err);\n }\n }\n\n complete(): void {\n const { partialObserver } = this;\n if (partialObserver.complete) {\n try {\n partialObserver.complete();\n } catch (error) {\n handleUnhandledError(error);\n }\n }\n }\n}\n\nexport class SafeSubscriber extends Subscriber {\n constructor(\n observerOrNext?: Partial> | ((value: T) => void) | null,\n error?: ((e?: any) => void) | null,\n complete?: (() => void) | null\n ) {\n super();\n\n let partialObserver: Partial>;\n if (isFunction(observerOrNext) || !observerOrNext) {\n // The first argument is a function, not an observer. The next\n // two arguments *could* be observers, or they could be empty.\n partialObserver = {\n next: (observerOrNext ?? undefined) as (((value: T) => void) | undefined),\n error: error ?? undefined,\n complete: complete ?? undefined,\n };\n } else {\n // The first argument is a partial observer.\n let context: any;\n if (this && config.useDeprecatedNextContext) {\n // This is a deprecated path that made `this.unsubscribe()` available in\n // next handler functions passed to subscribe. This only exists behind a flag\n // now, as it is *very* slow.\n context = Object.create(observerOrNext);\n context.unsubscribe = () => this.unsubscribe();\n partialObserver = {\n next: observerOrNext.next && bind(observerOrNext.next, context),\n error: observerOrNext.error && bind(observerOrNext.error, context),\n complete: observerOrNext.complete && bind(observerOrNext.complete, context),\n };\n } else {\n // The \"normal\" path. Just use the partial observer directly.\n partialObserver = observerOrNext;\n }\n }\n\n // Wrap the partial observer to ensure it's a full observer, and\n // make sure proper error handling is accounted for.\n this.destination = new ConsumerObserver(partialObserver);\n }\n}\n\nfunction handleUnhandledError(error: any) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n captureError(error);\n } else {\n // Ideal path, we report this as an unhandled error,\n // which is thrown on a new call stack.\n reportUnhandledError(error);\n }\n}\n\n/**\n * An error handler used when no error handler was supplied\n * to the SafeSubscriber -- meaning no error handler was supplied\n * do the `subscribe` call on our observable.\n * @param err The error to handle\n */\nfunction defaultErrorHandler(err: any) {\n throw err;\n}\n\n/**\n * A handler for notifications that cannot be sent to a stopped subscriber.\n * @param notification The notification being sent\n * @param subscriber The stopped subscriber\n */\nfunction handleStoppedNotification(notification: ObservableNotification, subscriber: Subscriber) {\n const { onStoppedNotification } = config;\n onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber));\n}\n\n/**\n * The observer used as a stub for subscriptions where the user did not\n * pass any arguments to `subscribe`. Comes with the default error handling\n * behavior.\n */\nexport const EMPTY_OBSERVER: Readonly> & { closed: true } = {\n closed: true,\n next: noop,\n error: defaultErrorHandler,\n complete: noop,\n};\n", "/**\n * Symbol.observable or a string \"@@observable\". Used for interop\n *\n * @deprecated We will no longer be exporting this symbol in upcoming versions of RxJS.\n * Instead polyfill and use Symbol.observable directly *or* use https://www.npmjs.com/package/symbol-observable\n */\nexport const observable: string | symbol = (() => (typeof Symbol === 'function' && Symbol.observable) || '@@observable')();\n", "/**\n * This function takes one parameter and just returns it. Simply put,\n * this is like `(x: T): T => x`.\n *\n * ## Examples\n *\n * This is useful in some cases when using things like `mergeMap`\n *\n * ```ts\n * import { interval, take, map, range, mergeMap, identity } from 'rxjs';\n *\n * const source$ = interval(1000).pipe(take(5));\n *\n * const result$ = source$.pipe(\n * map(i => range(i)),\n * mergeMap(identity) // same as mergeMap(x => x)\n * );\n *\n * result$.subscribe({\n * next: console.log\n * });\n * ```\n *\n * Or when you want to selectively apply an operator\n *\n * ```ts\n * import { interval, take, identity } from 'rxjs';\n *\n * const shouldLimit = () => Math.random() < 0.5;\n *\n * const source$ = interval(1000);\n *\n * const result$ = source$.pipe(shouldLimit() ? take(5) : identity);\n *\n * result$.subscribe({\n * next: console.log\n * });\n * ```\n *\n * @param x Any value that is returned by this function\n * @returns The value passed as the first parameter to this function\n */\nexport function identity(x: T): T {\n return x;\n}\n", "import { identity } from './identity';\nimport { UnaryFunction } from '../types';\n\nexport function pipe(): typeof identity;\nexport function pipe(fn1: UnaryFunction): UnaryFunction;\nexport function pipe(fn1: UnaryFunction, fn2: UnaryFunction): UnaryFunction;\nexport function pipe(fn1: UnaryFunction, fn2: UnaryFunction, fn3: UnaryFunction): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction,\n fn6: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction,\n fn6: UnaryFunction,\n fn7: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction,\n fn6: UnaryFunction,\n fn7: UnaryFunction,\n fn8: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction,\n fn6: UnaryFunction,\n fn7: UnaryFunction,\n fn8: UnaryFunction,\n fn9: UnaryFunction\n): UnaryFunction;\nexport function pipe(\n fn1: UnaryFunction,\n fn2: UnaryFunction,\n fn3: UnaryFunction,\n fn4: UnaryFunction,\n fn5: UnaryFunction,\n fn6: UnaryFunction,\n fn7: UnaryFunction,\n fn8: UnaryFunction,\n fn9: UnaryFunction,\n ...fns: UnaryFunction[]\n): UnaryFunction;\n\n/**\n * pipe() can be called on one or more functions, each of which can take one argument (\"UnaryFunction\")\n * and uses it to return a value.\n * It returns a function that takes one argument, passes it to the first UnaryFunction, and then\n * passes the result to the next one, passes that result to the next one, and so on. \n */\nexport function pipe(...fns: Array>): UnaryFunction {\n return pipeFromArray(fns);\n}\n\n/** @internal */\nexport function pipeFromArray(fns: Array>): UnaryFunction {\n if (fns.length === 0) {\n return identity as UnaryFunction;\n }\n\n if (fns.length === 1) {\n return fns[0];\n }\n\n return function piped(input: T): R {\n return fns.reduce((prev: any, fn: UnaryFunction) => fn(prev), input as any);\n };\n}\n", "import { Operator } from './Operator';\nimport { SafeSubscriber, Subscriber } from './Subscriber';\nimport { isSubscription, Subscription } from './Subscription';\nimport { TeardownLogic, OperatorFunction, Subscribable, Observer } from './types';\nimport { observable as Symbol_observable } from './symbol/observable';\nimport { pipeFromArray } from './util/pipe';\nimport { config } from './config';\nimport { isFunction } from './util/isFunction';\nimport { errorContext } from './util/errorContext';\n\n/**\n * A representation of any set of values over any amount of time. This is the most basic building block\n * of RxJS.\n *\n * @class Observable\n */\nexport class Observable implements Subscribable {\n /**\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n */\n source: Observable | undefined;\n\n /**\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n */\n operator: Operator | undefined;\n\n /**\n * @constructor\n * @param {Function} subscribe the function that is called when the Observable is\n * initially subscribed to. This function is given a Subscriber, to which new values\n * can be `next`ed, or an `error` method can be called to raise an error, or\n * `complete` can be called to notify of a successful completion.\n */\n constructor(subscribe?: (this: Observable, subscriber: Subscriber) => TeardownLogic) {\n if (subscribe) {\n this._subscribe = subscribe;\n }\n }\n\n // HACK: Since TypeScript inherits static properties too, we have to\n // fight against TypeScript here so Subject can have a different static create signature\n /**\n * Creates a new Observable by calling the Observable constructor\n * @owner Observable\n * @method create\n * @param {Function} subscribe? the subscriber function to be passed to the Observable constructor\n * @return {Observable} a new observable\n * @nocollapse\n * @deprecated Use `new Observable()` instead. Will be removed in v8.\n */\n static create: (...args: any[]) => any = (subscribe?: (subscriber: Subscriber) => TeardownLogic) => {\n return new Observable(subscribe);\n };\n\n /**\n * Creates a new Observable, with this Observable instance as the source, and the passed\n * operator defined as the new observable's operator.\n * @method lift\n * @param operator the operator defining the operation to take on the observable\n * @return a new observable with the Operator applied\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n * If you have implemented an operator using `lift`, it is recommended that you create an\n * operator by simply returning `new Observable()` directly. See \"Creating new operators from\n * scratch\" section here: https://rxjs.dev/guide/operators\n */\n lift(operator?: Operator): Observable {\n const observable = new Observable();\n observable.source = this;\n observable.operator = operator;\n return observable;\n }\n\n subscribe(observerOrNext?: Partial> | ((value: T) => void)): Subscription;\n /** @deprecated Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-arguments */\n subscribe(next?: ((value: T) => void) | null, error?: ((error: any) => void) | null, complete?: (() => void) | null): Subscription;\n /**\n * Invokes an execution of an Observable and registers Observer handlers for notifications it will emit.\n *\n * Use it when you have all these Observables, but still nothing is happening.\n *\n * `subscribe` is not a regular operator, but a method that calls Observable's internal `subscribe` function. It\n * might be for example a function that you passed to Observable's constructor, but most of the time it is\n * a library implementation, which defines what will be emitted by an Observable, and when it be will emitted. This means\n * that calling `subscribe` is actually the moment when Observable starts its work, not when it is created, as it is often\n * the thought.\n *\n * Apart from starting the execution of an Observable, this method allows you to listen for values\n * that an Observable emits, as well as for when it completes or errors. You can achieve this in two\n * of the following ways.\n *\n * The first way is creating an object that implements {@link Observer} interface. It should have methods\n * defined by that interface, but note that it should be just a regular JavaScript object, which you can create\n * yourself in any way you want (ES6 class, classic function constructor, object literal etc.). In particular, do\n * not attempt to use any RxJS implementation details to create Observers - you don't need them. Remember also\n * that your object does not have to implement all methods. If you find yourself creating a method that doesn't\n * do anything, you can simply omit it. Note however, if the `error` method is not provided and an error happens,\n * it will be thrown asynchronously. Errors thrown asynchronously cannot be caught using `try`/`catch`. Instead,\n * use the {@link onUnhandledError} configuration option or use a runtime handler (like `window.onerror` or\n * `process.on('error)`) to be notified of unhandled errors. Because of this, it's recommended that you provide\n * an `error` method to avoid missing thrown errors.\n *\n * The second way is to give up on Observer object altogether and simply provide callback functions in place of its methods.\n * This means you can provide three functions as arguments to `subscribe`, where the first function is equivalent\n * of a `next` method, the second of an `error` method and the third of a `complete` method. Just as in case of an Observer,\n * if you do not need to listen for something, you can omit a function by passing `undefined` or `null`,\n * since `subscribe` recognizes these functions by where they were placed in function call. When it comes\n * to the `error` function, as with an Observer, if not provided, errors emitted by an Observable will be thrown asynchronously.\n *\n * You can, however, subscribe with no parameters at all. This may be the case where you're not interested in terminal events\n * and you also handled emissions internally by using operators (e.g. using `tap`).\n *\n * Whichever style of calling `subscribe` you use, in both cases it returns a Subscription object.\n * This object allows you to call `unsubscribe` on it, which in turn will stop the work that an Observable does and will clean\n * up all resources that an Observable used. Note that cancelling a subscription will not call `complete` callback\n * provided to `subscribe` function, which is reserved for a regular completion signal that comes from an Observable.\n *\n * Remember that callbacks provided to `subscribe` are not guaranteed to be called asynchronously.\n * It is an Observable itself that decides when these functions will be called. For example {@link of}\n * by default emits all its values synchronously. Always check documentation for how given Observable\n * will behave when subscribed and if its default behavior can be modified with a `scheduler`.\n *\n * #### Examples\n *\n * Subscribe with an {@link guide/observer Observer}\n *\n * ```ts\n * import { of } from 'rxjs';\n *\n * const sumObserver = {\n * sum: 0,\n * next(value) {\n * console.log('Adding: ' + value);\n * this.sum = this.sum + value;\n * },\n * error() {\n * // We actually could just remove this method,\n * // since we do not really care about errors right now.\n * },\n * complete() {\n * console.log('Sum equals: ' + this.sum);\n * }\n * };\n *\n * of(1, 2, 3) // Synchronously emits 1, 2, 3 and then completes.\n * .subscribe(sumObserver);\n *\n * // Logs:\n * // 'Adding: 1'\n * // 'Adding: 2'\n * // 'Adding: 3'\n * // 'Sum equals: 6'\n * ```\n *\n * Subscribe with functions ({@link deprecations/subscribe-arguments deprecated})\n *\n * ```ts\n * import { of } from 'rxjs'\n *\n * let sum = 0;\n *\n * of(1, 2, 3).subscribe(\n * value => {\n * console.log('Adding: ' + value);\n * sum = sum + value;\n * },\n * undefined,\n * () => console.log('Sum equals: ' + sum)\n * );\n *\n * // Logs:\n * // 'Adding: 1'\n * // 'Adding: 2'\n * // 'Adding: 3'\n * // 'Sum equals: 6'\n * ```\n *\n * Cancel a subscription\n *\n * ```ts\n * import { interval } from 'rxjs';\n *\n * const subscription = interval(1000).subscribe({\n * next(num) {\n * console.log(num)\n * },\n * complete() {\n * // Will not be called, even when cancelling subscription.\n * console.log('completed!');\n * }\n * });\n *\n * setTimeout(() => {\n * subscription.unsubscribe();\n * console.log('unsubscribed!');\n * }, 2500);\n *\n * // Logs:\n * // 0 after 1s\n * // 1 after 2s\n * // 'unsubscribed!' after 2.5s\n * ```\n *\n * @param {Observer|Function} observerOrNext (optional) Either an observer with methods to be called,\n * or the first of three possible handlers, which is the handler for each value emitted from the subscribed\n * Observable.\n * @param {Function} error (optional) A handler for a terminal event resulting from an error. If no error handler is provided,\n * the error will be thrown asynchronously as unhandled.\n * @param {Function} complete (optional) A handler for a terminal event resulting from successful completion.\n * @return {Subscription} a subscription reference to the registered handlers\n * @method subscribe\n */\n subscribe(\n observerOrNext?: Partial> | ((value: T) => void) | null,\n error?: ((error: any) => void) | null,\n complete?: (() => void) | null\n ): Subscription {\n const subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);\n\n errorContext(() => {\n const { operator, source } = this;\n subscriber.add(\n operator\n ? // We're dealing with a subscription in the\n // operator chain to one of our lifted operators.\n operator.call(subscriber, source)\n : source\n ? // If `source` has a value, but `operator` does not, something that\n // had intimate knowledge of our API, like our `Subject`, must have\n // set it. We're going to just call `_subscribe` directly.\n this._subscribe(subscriber)\n : // In all other cases, we're likely wrapping a user-provided initializer\n // function, so we need to catch errors and handle them appropriately.\n this._trySubscribe(subscriber)\n );\n });\n\n return subscriber;\n }\n\n /** @internal */\n protected _trySubscribe(sink: Subscriber): TeardownLogic {\n try {\n return this._subscribe(sink);\n } catch (err) {\n // We don't need to return anything in this case,\n // because it's just going to try to `add()` to a subscription\n // above.\n sink.error(err);\n }\n }\n\n /**\n * Used as a NON-CANCELLABLE means of subscribing to an observable, for use with\n * APIs that expect promises, like `async/await`. You cannot unsubscribe from this.\n *\n * **WARNING**: Only use this with observables you *know* will complete. If the source\n * observable does not complete, you will end up with a promise that is hung up, and\n * potentially all of the state of an async function hanging out in memory. To avoid\n * this situation, look into adding something like {@link timeout}, {@link take},\n * {@link takeWhile}, or {@link takeUntil} amongst others.\n *\n * #### Example\n *\n * ```ts\n * import { interval, take } from 'rxjs';\n *\n * const source$ = interval(1000).pipe(take(4));\n *\n * async function getTotal() {\n * let total = 0;\n *\n * await source$.forEach(value => {\n * total += value;\n * console.log('observable -> ' + value);\n * });\n *\n * return total;\n * }\n *\n * getTotal().then(\n * total => console.log('Total: ' + total)\n * );\n *\n * // Expected:\n * // 'observable -> 0'\n * // 'observable -> 1'\n * // 'observable -> 2'\n * // 'observable -> 3'\n * // 'Total: 6'\n * ```\n *\n * @param next a handler for each value emitted by the observable\n * @return a promise that either resolves on observable completion or\n * rejects with the handled error\n */\n forEach(next: (value: T) => void): Promise;\n\n /**\n * @param next a handler for each value emitted by the observable\n * @param promiseCtor a constructor function used to instantiate the Promise\n * @return a promise that either resolves on observable completion or\n * rejects with the handled error\n * @deprecated Passing a Promise constructor will no longer be available\n * in upcoming versions of RxJS. This is because it adds weight to the library, for very\n * little benefit. If you need this functionality, it is recommended that you either\n * polyfill Promise, or you create an adapter to convert the returned native promise\n * to whatever promise implementation you wanted. Will be removed in v8.\n */\n forEach(next: (value: T) => void, promiseCtor: PromiseConstructorLike): Promise;\n\n forEach(next: (value: T) => void, promiseCtor?: PromiseConstructorLike): Promise {\n promiseCtor = getPromiseCtor(promiseCtor);\n\n return new promiseCtor((resolve, reject) => {\n const subscriber = new SafeSubscriber({\n next: (value) => {\n try {\n next(value);\n } catch (err) {\n reject(err);\n subscriber.unsubscribe();\n }\n },\n error: reject,\n complete: resolve,\n });\n this.subscribe(subscriber);\n }) as Promise;\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber): TeardownLogic {\n return this.source?.subscribe(subscriber);\n }\n\n /**\n * An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable\n * @method Symbol.observable\n * @return {Observable} this instance of the observable\n */\n [Symbol_observable]() {\n return this;\n }\n\n /* tslint:disable:max-line-length */\n pipe(): Observable;\n pipe(op1: OperatorFunction): Observable;\n pipe(op1: OperatorFunction, op2: OperatorFunction): Observable;\n pipe(op1: OperatorFunction, op2: OperatorFunction, op3: OperatorFunction): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction,\n op6: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction,\n op6: OperatorFunction,\n op7: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction,\n op6: OperatorFunction,\n op7: OperatorFunction,\n op8: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction,\n op6: OperatorFunction,\n op7: OperatorFunction,\n op8: OperatorFunction,\n op9: OperatorFunction\n ): Observable;\n pipe(\n op1: OperatorFunction,\n op2: OperatorFunction,\n op3: OperatorFunction,\n op4: OperatorFunction,\n op5: OperatorFunction,\n op6: OperatorFunction,\n op7: OperatorFunction,\n op8: OperatorFunction,\n op9: OperatorFunction,\n ...operations: OperatorFunction[]\n ): Observable;\n /* tslint:enable:max-line-length */\n\n /**\n * Used to stitch together functional operators into a chain.\n * @method pipe\n * @return {Observable} the Observable result of all of the operators having\n * been called in the order they were passed in.\n *\n * ## Example\n *\n * ```ts\n * import { interval, filter, map, scan } from 'rxjs';\n *\n * interval(1000)\n * .pipe(\n * filter(x => x % 2 === 0),\n * map(x => x + x),\n * scan((acc, x) => acc + x)\n * )\n * .subscribe(x => console.log(x));\n * ```\n */\n pipe(...operations: OperatorFunction[]): Observable {\n return pipeFromArray(operations)(this);\n }\n\n /* tslint:disable:max-line-length */\n /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */\n toPromise(): Promise;\n /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */\n toPromise(PromiseCtor: typeof Promise): Promise;\n /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */\n toPromise(PromiseCtor: PromiseConstructorLike): Promise;\n /* tslint:enable:max-line-length */\n\n /**\n * Subscribe to this Observable and get a Promise resolving on\n * `complete` with the last emission (if any).\n *\n * **WARNING**: Only use this with observables you *know* will complete. If the source\n * observable does not complete, you will end up with a promise that is hung up, and\n * potentially all of the state of an async function hanging out in memory. To avoid\n * this situation, look into adding something like {@link timeout}, {@link take},\n * {@link takeWhile}, or {@link takeUntil} amongst others.\n *\n * @method toPromise\n * @param [promiseCtor] a constructor function used to instantiate\n * the Promise\n * @return A Promise that resolves with the last value emit, or\n * rejects on an error. If there were no emissions, Promise\n * resolves with undefined.\n * @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise\n */\n toPromise(promiseCtor?: PromiseConstructorLike): Promise {\n promiseCtor = getPromiseCtor(promiseCtor);\n\n return new promiseCtor((resolve, reject) => {\n let value: T | undefined;\n this.subscribe(\n (x: T) => (value = x),\n (err: any) => reject(err),\n () => resolve(value)\n );\n }) as Promise;\n }\n}\n\n/**\n * Decides between a passed promise constructor from consuming code,\n * A default configured promise constructor, and the native promise\n * constructor and returns it. If nothing can be found, it will throw\n * an error.\n * @param promiseCtor The optional promise constructor to passed by consuming code\n */\nfunction getPromiseCtor(promiseCtor: PromiseConstructorLike | undefined) {\n return promiseCtor ?? config.Promise ?? Promise;\n}\n\nfunction isObserver(value: any): value is Observer {\n return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);\n}\n\nfunction isSubscriber(value: any): value is Subscriber {\n return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));\n}\n", "import { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { OperatorFunction } from '../types';\nimport { isFunction } from './isFunction';\n\n/**\n * Used to determine if an object is an Observable with a lift function.\n */\nexport function hasLift(source: any): source is { lift: InstanceType['lift'] } {\n return isFunction(source?.lift);\n}\n\n/**\n * Creates an `OperatorFunction`. Used to define operators throughout the library in a concise way.\n * @param init The logic to connect the liftedSource to the subscriber at the moment of subscription.\n */\nexport function operate(\n init: (liftedSource: Observable, subscriber: Subscriber) => (() => void) | void\n): OperatorFunction {\n return (source: Observable) => {\n if (hasLift(source)) {\n return source.lift(function (this: Subscriber, liftedSource: Observable) {\n try {\n return init(liftedSource, this);\n } catch (err) {\n this.error(err);\n }\n });\n }\n throw new TypeError('Unable to lift unknown Observable type');\n };\n}\n", "import { Subscriber } from '../Subscriber';\n\n/**\n * Creates an instance of an `OperatorSubscriber`.\n * @param destination The downstream subscriber.\n * @param onNext Handles next values, only called if this subscriber is not stopped or closed. Any\n * error that occurs in this function is caught and sent to the `error` method of this subscriber.\n * @param onError Handles errors from the subscription, any errors that occur in this handler are caught\n * and send to the `destination` error handler.\n * @param onComplete Handles completion notification from the subscription. Any errors that occur in\n * this handler are sent to the `destination` error handler.\n * @param onFinalize Additional teardown logic here. This will only be called on teardown if the\n * subscriber itself is not already closed. This is called after all other teardown logic is executed.\n */\nexport function createOperatorSubscriber(\n destination: Subscriber,\n onNext?: (value: T) => void,\n onComplete?: () => void,\n onError?: (err: any) => void,\n onFinalize?: () => void\n): Subscriber {\n return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);\n}\n\n/**\n * A generic helper for allowing operators to be created with a Subscriber and\n * use closures to capture necessary state from the operator function itself.\n */\nexport class OperatorSubscriber extends Subscriber {\n /**\n * Creates an instance of an `OperatorSubscriber`.\n * @param destination The downstream subscriber.\n * @param onNext Handles next values, only called if this subscriber is not stopped or closed. Any\n * error that occurs in this function is caught and sent to the `error` method of this subscriber.\n * @param onError Handles errors from the subscription, any errors that occur in this handler are caught\n * and send to the `destination` error handler.\n * @param onComplete Handles completion notification from the subscription. Any errors that occur in\n * this handler are sent to the `destination` error handler.\n * @param onFinalize Additional finalization logic here. This will only be called on finalization if the\n * subscriber itself is not already closed. This is called after all other finalization logic is executed.\n * @param shouldUnsubscribe An optional check to see if an unsubscribe call should truly unsubscribe.\n * NOTE: This currently **ONLY** exists to support the strange behavior of {@link groupBy}, where unsubscription\n * to the resulting observable does not actually disconnect from the source if there are active subscriptions\n * to any grouped observable. (DO NOT EXPOSE OR USE EXTERNALLY!!!)\n */\n constructor(\n destination: Subscriber,\n onNext?: (value: T) => void,\n onComplete?: () => void,\n onError?: (err: any) => void,\n private onFinalize?: () => void,\n private shouldUnsubscribe?: () => boolean\n ) {\n // It's important - for performance reasons - that all of this class's\n // members are initialized and that they are always initialized in the same\n // order. This will ensure that all OperatorSubscriber instances have the\n // same hidden class in V8. This, in turn, will help keep the number of\n // hidden classes involved in property accesses within the base class as\n // low as possible. If the number of hidden classes involved exceeds four,\n // the property accesses will become megamorphic and performance penalties\n // will be incurred - i.e. inline caches won't be used.\n //\n // The reasons for ensuring all instances have the same hidden class are\n // further discussed in this blog post from Benedikt Meurer:\n // https://benediktmeurer.de/2018/03/23/impact-of-polymorphism-on-component-based-frameworks-like-react/\n super(destination);\n this._next = onNext\n ? function (this: OperatorSubscriber, value: T) {\n try {\n onNext(value);\n } catch (err) {\n destination.error(err);\n }\n }\n : super._next;\n this._error = onError\n ? function (this: OperatorSubscriber, err: any) {\n try {\n onError(err);\n } catch (err) {\n // Send any errors that occur down stream.\n destination.error(err);\n } finally {\n // Ensure finalization.\n this.unsubscribe();\n }\n }\n : super._error;\n this._complete = onComplete\n ? function (this: OperatorSubscriber) {\n try {\n onComplete();\n } catch (err) {\n // Send any errors that occur down stream.\n destination.error(err);\n } finally {\n // Ensure finalization.\n this.unsubscribe();\n }\n }\n : super._complete;\n }\n\n unsubscribe() {\n if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {\n const { closed } = this;\n super.unsubscribe();\n // Execute additional teardown if we have any and we didn't already do so.\n !closed && this.onFinalize?.();\n }\n }\n}\n", "import { Subscription } from '../Subscription';\n\ninterface AnimationFrameProvider {\n schedule(callback: FrameRequestCallback): Subscription;\n requestAnimationFrame: typeof requestAnimationFrame;\n cancelAnimationFrame: typeof cancelAnimationFrame;\n delegate:\n | {\n requestAnimationFrame: typeof requestAnimationFrame;\n cancelAnimationFrame: typeof cancelAnimationFrame;\n }\n | undefined;\n}\n\nexport const animationFrameProvider: AnimationFrameProvider = {\n // When accessing the delegate, use the variable rather than `this` so that\n // the functions can be called without being bound to the provider.\n schedule(callback) {\n let request = requestAnimationFrame;\n let cancel: typeof cancelAnimationFrame | undefined = cancelAnimationFrame;\n const { delegate } = animationFrameProvider;\n if (delegate) {\n request = delegate.requestAnimationFrame;\n cancel = delegate.cancelAnimationFrame;\n }\n const handle = request((timestamp) => {\n // Clear the cancel function. The request has been fulfilled, so\n // attempting to cancel the request upon unsubscription would be\n // pointless.\n cancel = undefined;\n callback(timestamp);\n });\n return new Subscription(() => cancel?.(handle));\n },\n requestAnimationFrame(...args) {\n const { delegate } = animationFrameProvider;\n return (delegate?.requestAnimationFrame || requestAnimationFrame)(...args);\n },\n cancelAnimationFrame(...args) {\n const { delegate } = animationFrameProvider;\n return (delegate?.cancelAnimationFrame || cancelAnimationFrame)(...args);\n },\n delegate: undefined,\n};\n", "import { createErrorClass } from './createErrorClass';\n\nexport interface ObjectUnsubscribedError extends Error {}\n\nexport interface ObjectUnsubscribedErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new (): ObjectUnsubscribedError;\n}\n\n/**\n * An error thrown when an action is invalid because the object has been\n * unsubscribed.\n *\n * @see {@link Subject}\n * @see {@link BehaviorSubject}\n *\n * @class ObjectUnsubscribedError\n */\nexport const ObjectUnsubscribedError: ObjectUnsubscribedErrorCtor = createErrorClass(\n (_super) =>\n function ObjectUnsubscribedErrorImpl(this: any) {\n _super(this);\n this.name = 'ObjectUnsubscribedError';\n this.message = 'object unsubscribed';\n }\n);\n", "import { Operator } from './Operator';\nimport { Observable } from './Observable';\nimport { Subscriber } from './Subscriber';\nimport { Subscription, EMPTY_SUBSCRIPTION } from './Subscription';\nimport { Observer, SubscriptionLike, TeardownLogic } from './types';\nimport { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError';\nimport { arrRemove } from './util/arrRemove';\nimport { errorContext } from './util/errorContext';\n\n/**\n * A Subject is a special type of Observable that allows values to be\n * multicasted to many Observers. Subjects are like EventEmitters.\n *\n * Every Subject is an Observable and an Observer. You can subscribe to a\n * Subject, and you can call next to feed values as well as error and complete.\n */\nexport class Subject extends Observable implements SubscriptionLike {\n closed = false;\n\n private currentObservers: Observer[] | null = null;\n\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n observers: Observer[] = [];\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n isStopped = false;\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n hasError = false;\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n thrownError: any = null;\n\n /**\n * Creates a \"subject\" by basically gluing an observer to an observable.\n *\n * @nocollapse\n * @deprecated Recommended you do not use. Will be removed at some point in the future. Plans for replacement still under discussion.\n */\n static create: (...args: any[]) => any = (destination: Observer, source: Observable): AnonymousSubject => {\n return new AnonymousSubject(destination, source);\n };\n\n constructor() {\n // NOTE: This must be here to obscure Observable's constructor.\n super();\n }\n\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n lift(operator: Operator): Observable {\n const subject = new AnonymousSubject(this, this);\n subject.operator = operator as any;\n return subject as any;\n }\n\n /** @internal */\n protected _throwIfClosed() {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n }\n\n next(value: T) {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n if (!this.currentObservers) {\n this.currentObservers = Array.from(this.observers);\n }\n for (const observer of this.currentObservers) {\n observer.next(value);\n }\n }\n });\n }\n\n error(err: any) {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n this.hasError = this.isStopped = true;\n this.thrownError = err;\n const { observers } = this;\n while (observers.length) {\n observers.shift()!.error(err);\n }\n }\n });\n }\n\n complete() {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n this.isStopped = true;\n const { observers } = this;\n while (observers.length) {\n observers.shift()!.complete();\n }\n }\n });\n }\n\n unsubscribe() {\n this.isStopped = this.closed = true;\n this.observers = this.currentObservers = null!;\n }\n\n get observed() {\n return this.observers?.length > 0;\n }\n\n /** @internal */\n protected _trySubscribe(subscriber: Subscriber): TeardownLogic {\n this._throwIfClosed();\n return super._trySubscribe(subscriber);\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber): Subscription {\n this._throwIfClosed();\n this._checkFinalizedStatuses(subscriber);\n return this._innerSubscribe(subscriber);\n }\n\n /** @internal */\n protected _innerSubscribe(subscriber: Subscriber) {\n const { hasError, isStopped, observers } = this;\n if (hasError || isStopped) {\n return EMPTY_SUBSCRIPTION;\n }\n this.currentObservers = null;\n observers.push(subscriber);\n return new Subscription(() => {\n this.currentObservers = null;\n arrRemove(observers, subscriber);\n });\n }\n\n /** @internal */\n protected _checkFinalizedStatuses(subscriber: Subscriber) {\n const { hasError, thrownError, isStopped } = this;\n if (hasError) {\n subscriber.error(thrownError);\n } else if (isStopped) {\n subscriber.complete();\n }\n }\n\n /**\n * Creates a new Observable with this Subject as the source. You can do this\n * to create custom Observer-side logic of the Subject and conceal it from\n * code that uses the Observable.\n * @return {Observable} Observable that the Subject casts to\n */\n asObservable(): Observable {\n const observable: any = new Observable();\n observable.source = this;\n return observable;\n }\n}\n\n/**\n * @class AnonymousSubject\n */\nexport class AnonymousSubject extends Subject {\n constructor(\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n public destination?: Observer,\n source?: Observable\n ) {\n super();\n this.source = source;\n }\n\n next(value: T) {\n this.destination?.next?.(value);\n }\n\n error(err: any) {\n this.destination?.error?.(err);\n }\n\n complete() {\n this.destination?.complete?.();\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber): Subscription {\n return this.source?.subscribe(subscriber) ?? EMPTY_SUBSCRIPTION;\n }\n}\n", "import { TimestampProvider } from '../types';\n\ninterface DateTimestampProvider extends TimestampProvider {\n delegate: TimestampProvider | undefined;\n}\n\nexport const dateTimestampProvider: DateTimestampProvider = {\n now() {\n // Use the variable rather than `this` so that the function can be called\n // without being bound to the provider.\n return (dateTimestampProvider.delegate || Date).now();\n },\n delegate: undefined,\n};\n", "import { Subject } from './Subject';\nimport { TimestampProvider } from './types';\nimport { Subscriber } from './Subscriber';\nimport { Subscription } from './Subscription';\nimport { dateTimestampProvider } from './scheduler/dateTimestampProvider';\n\n/**\n * A variant of {@link Subject} that \"replays\" old values to new subscribers by emitting them when they first subscribe.\n *\n * `ReplaySubject` has an internal buffer that will store a specified number of values that it has observed. Like `Subject`,\n * `ReplaySubject` \"observes\" values by having them passed to its `next` method. When it observes a value, it will store that\n * value for a time determined by the configuration of the `ReplaySubject`, as passed to its constructor.\n *\n * When a new subscriber subscribes to the `ReplaySubject` instance, it will synchronously emit all values in its buffer in\n * a First-In-First-Out (FIFO) manner. The `ReplaySubject` will also complete, if it has observed completion; and it will\n * error if it has observed an error.\n *\n * There are two main configuration items to be concerned with:\n *\n * 1. `bufferSize` - This will determine how many items are stored in the buffer, defaults to infinite.\n * 2. `windowTime` - The amount of time to hold a value in the buffer before removing it from the buffer.\n *\n * Both configurations may exist simultaneously. So if you would like to buffer a maximum of 3 values, as long as the values\n * are less than 2 seconds old, you could do so with a `new ReplaySubject(3, 2000)`.\n *\n * ### Differences with BehaviorSubject\n *\n * `BehaviorSubject` is similar to `new ReplaySubject(1)`, with a couple of exceptions:\n *\n * 1. `BehaviorSubject` comes \"primed\" with a single value upon construction.\n * 2. `ReplaySubject` will replay values, even after observing an error, where `BehaviorSubject` will not.\n *\n * @see {@link Subject}\n * @see {@link BehaviorSubject}\n * @see {@link shareReplay}\n */\nexport class ReplaySubject extends Subject {\n private _buffer: (T | number)[] = [];\n private _infiniteTimeWindow = true;\n\n /**\n * @param bufferSize The size of the buffer to replay on subscription\n * @param windowTime The amount of time the buffered items will stay buffered\n * @param timestampProvider An object with a `now()` method that provides the current timestamp. This is used to\n * calculate the amount of time something has been buffered.\n */\n constructor(\n private _bufferSize = Infinity,\n private _windowTime = Infinity,\n private _timestampProvider: TimestampProvider = dateTimestampProvider\n ) {\n super();\n this._infiniteTimeWindow = _windowTime === Infinity;\n this._bufferSize = Math.max(1, _bufferSize);\n this._windowTime = Math.max(1, _windowTime);\n }\n\n next(value: T): void {\n const { isStopped, _buffer, _infiniteTimeWindow, _timestampProvider, _windowTime } = this;\n if (!isStopped) {\n _buffer.push(value);\n !_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime);\n }\n this._trimBuffer();\n super.next(value);\n }\n\n /** @internal */\n protected _subscribe(subscriber: Subscriber): Subscription {\n this._throwIfClosed();\n this._trimBuffer();\n\n const subscription = this._innerSubscribe(subscriber);\n\n const { _infiniteTimeWindow, _buffer } = this;\n // We use a copy here, so reentrant code does not mutate our array while we're\n // emitting it to a new subscriber.\n const copy = _buffer.slice();\n for (let i = 0; i < copy.length && !subscriber.closed; i += _infiniteTimeWindow ? 1 : 2) {\n subscriber.next(copy[i] as T);\n }\n\n this._checkFinalizedStatuses(subscriber);\n\n return subscription;\n }\n\n private _trimBuffer() {\n const { _bufferSize, _timestampProvider, _buffer, _infiniteTimeWindow } = this;\n // If we don't have an infinite buffer size, and we're over the length,\n // use splice to truncate the old buffer values off. Note that we have to\n // double the size for instances where we're not using an infinite time window\n // because we're storing the values and the timestamps in the same array.\n const adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;\n _bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);\n\n // Now, if we're not in an infinite time window, remove all values where the time is\n // older than what is allowed.\n if (!_infiniteTimeWindow) {\n const now = _timestampProvider.now();\n let last = 0;\n // Search the array for the first timestamp that isn't expired and\n // truncate the buffer up to that point.\n for (let i = 1; i < _buffer.length && (_buffer[i] as number) <= now; i += 2) {\n last = i;\n }\n last && _buffer.splice(0, last + 1);\n }\n }\n}\n", "import { Scheduler } from '../Scheduler';\nimport { Subscription } from '../Subscription';\nimport { SchedulerAction } from '../types';\n\n/**\n * A unit of work to be executed in a `scheduler`. An action is typically\n * created from within a {@link SchedulerLike} and an RxJS user does not need to concern\n * themselves about creating and manipulating an Action.\n *\n * ```ts\n * class Action extends Subscription {\n * new (scheduler: Scheduler, work: (state?: T) => void);\n * schedule(state?: T, delay: number = 0): Subscription;\n * }\n * ```\n *\n * @class Action\n */\nexport class Action extends Subscription {\n constructor(scheduler: Scheduler, work: (this: SchedulerAction, state?: T) => void) {\n super();\n }\n /**\n * Schedules this action on its parent {@link SchedulerLike} for execution. May be passed\n * some context object, `state`. May happen at some point in the future,\n * according to the `delay` parameter, if specified.\n * @param {T} [state] Some contextual data that the `work` function uses when\n * called by the Scheduler.\n * @param {number} [delay] Time to wait before executing the work, where the\n * time unit is implicit and defined by the Scheduler.\n * @return {void}\n */\n public schedule(state?: T, delay: number = 0): Subscription {\n return this;\n }\n}\n", "import type { TimerHandle } from './timerHandle';\ntype SetIntervalFunction = (handler: () => void, timeout?: number, ...args: any[]) => TimerHandle;\ntype ClearIntervalFunction = (handle: TimerHandle) => void;\n\ninterface IntervalProvider {\n setInterval: SetIntervalFunction;\n clearInterval: ClearIntervalFunction;\n delegate:\n | {\n setInterval: SetIntervalFunction;\n clearInterval: ClearIntervalFunction;\n }\n | undefined;\n}\n\nexport const intervalProvider: IntervalProvider = {\n // When accessing the delegate, use the variable rather than `this` so that\n // the functions can be called without being bound to the provider.\n setInterval(handler: () => void, timeout?: number, ...args) {\n const { delegate } = intervalProvider;\n if (delegate?.setInterval) {\n return delegate.setInterval(handler, timeout, ...args);\n }\n return setInterval(handler, timeout, ...args);\n },\n clearInterval(handle) {\n const { delegate } = intervalProvider;\n return (delegate?.clearInterval || clearInterval)(handle as any);\n },\n delegate: undefined,\n};\n", "import { Action } from './Action';\nimport { SchedulerAction } from '../types';\nimport { Subscription } from '../Subscription';\nimport { AsyncScheduler } from './AsyncScheduler';\nimport { intervalProvider } from './intervalProvider';\nimport { arrRemove } from '../util/arrRemove';\nimport { TimerHandle } from './timerHandle';\n\nexport class AsyncAction extends Action {\n public id: TimerHandle | undefined;\n public state?: T;\n // @ts-ignore: Property has no initializer and is not definitely assigned\n public delay: number;\n protected pending: boolean = false;\n\n constructor(protected scheduler: AsyncScheduler, protected work: (this: SchedulerAction, state?: T) => void) {\n super(scheduler, work);\n }\n\n public schedule(state?: T, delay: number = 0): Subscription {\n if (this.closed) {\n return this;\n }\n\n // Always replace the current state with the new state.\n this.state = state;\n\n const id = this.id;\n const scheduler = this.scheduler;\n\n //\n // Important implementation note:\n //\n // Actions only execute once by default, unless rescheduled from within the\n // scheduled callback. This allows us to implement single and repeat\n // actions via the same code path, without adding API surface area, as well\n // as mimic traditional recursion but across asynchronous boundaries.\n //\n // However, JS runtimes and timers distinguish between intervals achieved by\n // serial `setTimeout` calls vs. a single `setInterval` call. An interval of\n // serial `setTimeout` calls can be individually delayed, which delays\n // scheduling the next `setTimeout`, and so on. `setInterval` attempts to\n // guarantee the interval callback will be invoked more precisely to the\n // interval period, regardless of load.\n //\n // Therefore, we use `setInterval` to schedule single and repeat actions.\n // If the action reschedules itself with the same delay, the interval is not\n // canceled. If the action doesn't reschedule, or reschedules with a\n // different delay, the interval will be canceled after scheduled callback\n // execution.\n //\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, delay);\n }\n\n // Set the pending flag indicating that this action has been scheduled, or\n // has recursively rescheduled itself.\n this.pending = true;\n\n this.delay = delay;\n // If this action has already an async Id, don't request a new one.\n this.id = this.id ?? this.requestAsyncId(scheduler, this.id, delay);\n\n return this;\n }\n\n protected requestAsyncId(scheduler: AsyncScheduler, _id?: TimerHandle, delay: number = 0): TimerHandle {\n return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);\n }\n\n protected recycleAsyncId(_scheduler: AsyncScheduler, id?: TimerHandle, delay: number | null = 0): TimerHandle | undefined {\n // If this action is rescheduled with the same delay time, don't clear the interval id.\n if (delay != null && this.delay === delay && this.pending === false) {\n return id;\n }\n // Otherwise, if the action's delay time is different from the current delay,\n // or the action has been rescheduled before it's executed, clear the interval id\n if (id != null) {\n intervalProvider.clearInterval(id);\n }\n\n return undefined;\n }\n\n /**\n * Immediately executes this action and the `work` it contains.\n * @return {any}\n */\n public execute(state: T, delay: number): any {\n if (this.closed) {\n return new Error('executing a cancelled action');\n }\n\n this.pending = false;\n const error = this._execute(state, delay);\n if (error) {\n return error;\n } else if (this.pending === false && this.id != null) {\n // Dequeue if the action didn't reschedule itself. Don't call\n // unsubscribe(), because the action could reschedule later.\n // For example:\n // ```\n // scheduler.schedule(function doWork(counter) {\n // /* ... I'm a busy worker bee ... */\n // var originalAction = this;\n // /* wait 100ms before rescheduling the action */\n // setTimeout(function () {\n // originalAction.schedule(counter + 1);\n // }, 100);\n // }, 1000);\n // ```\n this.id = this.recycleAsyncId(this.scheduler, this.id, null);\n }\n }\n\n protected _execute(state: T, _delay: number): any {\n let errored: boolean = false;\n let errorValue: any;\n try {\n this.work(state);\n } catch (e) {\n errored = true;\n // HACK: Since code elsewhere is relying on the \"truthiness\" of the\n // return here, we can't have it return \"\" or 0 or false.\n // TODO: Clean this up when we refactor schedulers mid-version-8 or so.\n errorValue = e ? e : new Error('Scheduled action threw falsy error');\n }\n if (errored) {\n this.unsubscribe();\n return errorValue;\n }\n }\n\n unsubscribe() {\n if (!this.closed) {\n const { id, scheduler } = this;\n const { actions } = scheduler;\n\n this.work = this.state = this.scheduler = null!;\n this.pending = false;\n\n arrRemove(actions, this);\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, null);\n }\n\n this.delay = null!;\n super.unsubscribe();\n }\n }\n}\n", "import { Action } from './scheduler/Action';\nimport { Subscription } from './Subscription';\nimport { SchedulerLike, SchedulerAction } from './types';\nimport { dateTimestampProvider } from './scheduler/dateTimestampProvider';\n\n/**\n * An execution context and a data structure to order tasks and schedule their\n * execution. Provides a notion of (potentially virtual) time, through the\n * `now()` getter method.\n *\n * Each unit of work in a Scheduler is called an `Action`.\n *\n * ```ts\n * class Scheduler {\n * now(): number;\n * schedule(work, delay?, state?): Subscription;\n * }\n * ```\n *\n * @class Scheduler\n * @deprecated Scheduler is an internal implementation detail of RxJS, and\n * should not be used directly. Rather, create your own class and implement\n * {@link SchedulerLike}. Will be made internal in v8.\n */\nexport class Scheduler implements SchedulerLike {\n public static now: () => number = dateTimestampProvider.now;\n\n constructor(private schedulerActionCtor: typeof Action, now: () => number = Scheduler.now) {\n this.now = now;\n }\n\n /**\n * A getter method that returns a number representing the current time\n * (at the time this function was called) according to the scheduler's own\n * internal clock.\n * @return {number} A number that represents the current time. May or may not\n * have a relation to wall-clock time. May or may not refer to a time unit\n * (e.g. milliseconds).\n */\n public now: () => number;\n\n /**\n * Schedules a function, `work`, for execution. May happen at some point in\n * the future, according to the `delay` parameter, if specified. May be passed\n * some context object, `state`, which will be passed to the `work` function.\n *\n * The given arguments will be processed an stored as an Action object in a\n * queue of actions.\n *\n * @param {function(state: ?T): ?Subscription} work A function representing a\n * task, or some unit of work to be executed by the Scheduler.\n * @param {number} [delay] Time to wait before executing the work, where the\n * time unit is implicit and defined by the Scheduler itself.\n * @param {T} [state] Some contextual data that the `work` function uses when\n * called by the Scheduler.\n * @return {Subscription} A subscription in order to be able to unsubscribe\n * the scheduled work.\n */\n public schedule(work: (this: SchedulerAction, state?: T) => void, delay: number = 0, state?: T): Subscription {\n return new this.schedulerActionCtor(this, work).schedule(state, delay);\n }\n}\n", "import { Scheduler } from '../Scheduler';\nimport { Action } from './Action';\nimport { AsyncAction } from './AsyncAction';\nimport { TimerHandle } from './timerHandle';\n\nexport class AsyncScheduler extends Scheduler {\n public actions: Array> = [];\n /**\n * A flag to indicate whether the Scheduler is currently executing a batch of\n * queued actions.\n * @type {boolean}\n * @internal\n */\n public _active: boolean = false;\n /**\n * An internal ID used to track the latest asynchronous task such as those\n * coming from `setTimeout`, `setInterval`, `requestAnimationFrame`, and\n * others.\n * @type {any}\n * @internal\n */\n public _scheduled: TimerHandle | undefined;\n\n constructor(SchedulerAction: typeof Action, now: () => number = Scheduler.now) {\n super(SchedulerAction, now);\n }\n\n public flush(action: AsyncAction): void {\n const { actions } = this;\n\n if (this._active) {\n actions.push(action);\n return;\n }\n\n let error: any;\n this._active = true;\n\n do {\n if ((error = action.execute(action.state, action.delay))) {\n break;\n }\n } while ((action = actions.shift()!)); // exhaust the scheduler queue\n\n this._active = false;\n\n if (error) {\n while ((action = actions.shift()!)) {\n action.unsubscribe();\n }\n throw error;\n }\n }\n}\n", "import { AsyncAction } from './AsyncAction';\nimport { AsyncScheduler } from './AsyncScheduler';\n\n/**\n *\n * Async Scheduler\n *\n * Schedule task as if you used setTimeout(task, duration)\n *\n * `async` scheduler schedules tasks asynchronously, by putting them on the JavaScript\n * event loop queue. It is best used to delay tasks in time or to schedule tasks repeating\n * in intervals.\n *\n * If you just want to \"defer\" task, that is to perform it right after currently\n * executing synchronous code ends (commonly achieved by `setTimeout(deferredTask, 0)`),\n * better choice will be the {@link asapScheduler} scheduler.\n *\n * ## Examples\n * Use async scheduler to delay task\n * ```ts\n * import { asyncScheduler } from 'rxjs';\n *\n * const task = () => console.log('it works!');\n *\n * asyncScheduler.schedule(task, 2000);\n *\n * // After 2 seconds logs:\n * // \"it works!\"\n * ```\n *\n * Use async scheduler to repeat task in intervals\n * ```ts\n * import { asyncScheduler } from 'rxjs';\n *\n * function task(state) {\n * console.log(state);\n * this.schedule(state + 1, 1000); // `this` references currently executing Action,\n * // which we reschedule with new state and delay\n * }\n *\n * asyncScheduler.schedule(task, 3000, 0);\n *\n * // Logs:\n * // 0 after 3s\n * // 1 after 4s\n * // 2 after 5s\n * // 3 after 6s\n * ```\n */\n\nexport const asyncScheduler = new AsyncScheduler(AsyncAction);\n\n/**\n * @deprecated Renamed to {@link asyncScheduler}. Will be removed in v8.\n */\nexport const async = asyncScheduler;\n", "import { AsyncAction } from './AsyncAction';\nimport { AnimationFrameScheduler } from './AnimationFrameScheduler';\nimport { SchedulerAction } from '../types';\nimport { animationFrameProvider } from './animationFrameProvider';\nimport { TimerHandle } from './timerHandle';\n\nexport class AnimationFrameAction extends AsyncAction {\n constructor(protected scheduler: AnimationFrameScheduler, protected work: (this: SchedulerAction, state?: T) => void) {\n super(scheduler, work);\n }\n\n protected requestAsyncId(scheduler: AnimationFrameScheduler, id?: TimerHandle, delay: number = 0): TimerHandle {\n // If delay is greater than 0, request as an async action.\n if (delay !== null && delay > 0) {\n return super.requestAsyncId(scheduler, id, delay);\n }\n // Push the action to the end of the scheduler queue.\n scheduler.actions.push(this);\n // If an animation frame has already been requested, don't request another\n // one. If an animation frame hasn't been requested yet, request one. Return\n // the current animation frame request id.\n return scheduler._scheduled || (scheduler._scheduled = animationFrameProvider.requestAnimationFrame(() => scheduler.flush(undefined)));\n }\n\n protected recycleAsyncId(scheduler: AnimationFrameScheduler, id?: TimerHandle, delay: number = 0): TimerHandle | undefined {\n // If delay exists and is greater than 0, or if the delay is null (the\n // action wasn't rescheduled) but was originally scheduled as an async\n // action, then recycle as an async action.\n if (delay != null ? delay > 0 : this.delay > 0) {\n return super.recycleAsyncId(scheduler, id, delay);\n }\n // If the scheduler queue has no remaining actions with the same async id,\n // cancel the requested animation frame and set the scheduled flag to\n // undefined so the next AnimationFrameAction will request its own.\n const { actions } = scheduler;\n if (id != null && actions[actions.length - 1]?.id !== id) {\n animationFrameProvider.cancelAnimationFrame(id as number);\n scheduler._scheduled = undefined;\n }\n // Return undefined so the action knows to request a new async id if it's rescheduled.\n return undefined;\n }\n}\n", "import { AsyncAction } from './AsyncAction';\nimport { AsyncScheduler } from './AsyncScheduler';\n\nexport class AnimationFrameScheduler extends AsyncScheduler {\n public flush(action?: AsyncAction): void {\n this._active = true;\n // The async id that effects a call to flush is stored in _scheduled.\n // Before executing an action, it's necessary to check the action's async\n // id to determine whether it's supposed to be executed in the current\n // flush.\n // Previous implementations of this method used a count to determine this,\n // but that was unsound, as actions that are unsubscribed - i.e. cancelled -\n // are removed from the actions array and that can shift actions that are\n // scheduled to be executed in a subsequent flush into positions at which\n // they are executed within the current flush.\n const flushId = this._scheduled;\n this._scheduled = undefined;\n\n const { actions } = this;\n let error: any;\n action = action || actions.shift()!;\n\n do {\n if ((error = action.execute(action.state, action.delay))) {\n break;\n }\n } while ((action = actions[0]) && action.id === flushId && actions.shift());\n\n this._active = false;\n\n if (error) {\n while ((action = actions[0]) && action.id === flushId && actions.shift()) {\n action.unsubscribe();\n }\n throw error;\n }\n }\n}\n", "import { AnimationFrameAction } from './AnimationFrameAction';\nimport { AnimationFrameScheduler } from './AnimationFrameScheduler';\n\n/**\n *\n * Animation Frame Scheduler\n *\n * Perform task when `window.requestAnimationFrame` would fire\n *\n * When `animationFrame` scheduler is used with delay, it will fall back to {@link asyncScheduler} scheduler\n * behaviour.\n *\n * Without delay, `animationFrame` scheduler can be used to create smooth browser animations.\n * It makes sure scheduled task will happen just before next browser content repaint,\n * thus performing animations as efficiently as possible.\n *\n * ## Example\n * Schedule div height animation\n * ```ts\n * // html:
    \n * import { animationFrameScheduler } from 'rxjs';\n *\n * const div = document.querySelector('div');\n *\n * animationFrameScheduler.schedule(function(height) {\n * div.style.height = height + \"px\";\n *\n * this.schedule(height + 1); // `this` references currently executing Action,\n * // which we reschedule with new state\n * }, 0, 0);\n *\n * // You will see a div element growing in height\n * ```\n */\n\nexport const animationFrameScheduler = new AnimationFrameScheduler(AnimationFrameAction);\n\n/**\n * @deprecated Renamed to {@link animationFrameScheduler}. Will be removed in v8.\n */\nexport const animationFrame = animationFrameScheduler;\n", "import { Observable } from '../Observable';\nimport { SchedulerLike } from '../types';\n\n/**\n * A simple Observable that emits no items to the Observer and immediately\n * emits a complete notification.\n *\n * Just emits 'complete', and nothing else.\n *\n * ![](empty.png)\n *\n * A simple Observable that only emits the complete notification. It can be used\n * for composing with other Observables, such as in a {@link mergeMap}.\n *\n * ## Examples\n *\n * Log complete notification\n *\n * ```ts\n * import { EMPTY } from 'rxjs';\n *\n * EMPTY.subscribe({\n * next: () => console.log('Next'),\n * complete: () => console.log('Complete!')\n * });\n *\n * // Outputs\n * // Complete!\n * ```\n *\n * Emit the number 7, then complete\n *\n * ```ts\n * import { EMPTY, startWith } from 'rxjs';\n *\n * const result = EMPTY.pipe(startWith(7));\n * result.subscribe(x => console.log(x));\n *\n * // Outputs\n * // 7\n * ```\n *\n * Map and flatten only odd numbers to the sequence `'a'`, `'b'`, `'c'`\n *\n * ```ts\n * import { interval, mergeMap, of, EMPTY } from 'rxjs';\n *\n * const interval$ = interval(1000);\n * const result = interval$.pipe(\n * mergeMap(x => x % 2 === 1 ? of('a', 'b', 'c') : EMPTY),\n * );\n * result.subscribe(x => console.log(x));\n *\n * // Results in the following to the console:\n * // x is equal to the count on the interval, e.g. (0, 1, 2, 3, ...)\n * // x will occur every 1000ms\n * // if x % 2 is equal to 1, print a, b, c (each on its own)\n * // if x % 2 is not equal to 1, nothing will be output\n * ```\n *\n * @see {@link Observable}\n * @see {@link NEVER}\n * @see {@link of}\n * @see {@link throwError}\n */\nexport const EMPTY = new Observable((subscriber) => subscriber.complete());\n\n/**\n * @param scheduler A {@link SchedulerLike} to use for scheduling\n * the emission of the complete notification.\n * @deprecated Replaced with the {@link EMPTY} constant or {@link scheduled} (e.g. `scheduled([], scheduler)`). Will be removed in v8.\n */\nexport function empty(scheduler?: SchedulerLike) {\n return scheduler ? emptyScheduled(scheduler) : EMPTY;\n}\n\nfunction emptyScheduled(scheduler: SchedulerLike) {\n return new Observable((subscriber) => scheduler.schedule(() => subscriber.complete()));\n}\n", "import { SchedulerLike } from '../types';\nimport { isFunction } from './isFunction';\n\nexport function isScheduler(value: any): value is SchedulerLike {\n return value && isFunction(value.schedule);\n}\n", "import { SchedulerLike } from '../types';\nimport { isFunction } from './isFunction';\nimport { isScheduler } from './isScheduler';\n\nfunction last(arr: T[]): T | undefined {\n return arr[arr.length - 1];\n}\n\nexport function popResultSelector(args: any[]): ((...args: unknown[]) => unknown) | undefined {\n return isFunction(last(args)) ? args.pop() : undefined;\n}\n\nexport function popScheduler(args: any[]): SchedulerLike | undefined {\n return isScheduler(last(args)) ? args.pop() : undefined;\n}\n\nexport function popNumber(args: any[], defaultValue: number): number {\n return typeof last(args) === 'number' ? args.pop()! : defaultValue;\n}\n", "export const isArrayLike = ((x: any): x is ArrayLike => x && typeof x.length === 'number' && typeof x !== 'function');", "import { isFunction } from \"./isFunction\";\n\n/**\n * Tests to see if the object is \"thennable\".\n * @param value the object to test\n */\nexport function isPromise(value: any): value is PromiseLike {\n return isFunction(value?.then);\n}\n", "import { InteropObservable } from '../types';\nimport { observable as Symbol_observable } from '../symbol/observable';\nimport { isFunction } from './isFunction';\n\n/** Identifies an input as being Observable (but not necessary an Rx Observable) */\nexport function isInteropObservable(input: any): input is InteropObservable {\n return isFunction(input[Symbol_observable]);\n}\n", "import { isFunction } from './isFunction';\n\nexport function isAsyncIterable(obj: any): obj is AsyncIterable {\n return Symbol.asyncIterator && isFunction(obj?.[Symbol.asyncIterator]);\n}\n", "/**\n * Creates the TypeError to throw if an invalid object is passed to `from` or `scheduled`.\n * @param input The object that was passed.\n */\nexport function createInvalidObservableTypeError(input: any) {\n // TODO: We should create error codes that can be looked up, so this can be less verbose.\n return new TypeError(\n `You provided ${\n input !== null && typeof input === 'object' ? 'an invalid object' : `'${input}'`\n } where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`\n );\n}\n", "export function getSymbolIterator(): symbol {\n if (typeof Symbol !== 'function' || !Symbol.iterator) {\n return '@@iterator' as any;\n }\n\n return Symbol.iterator;\n}\n\nexport const iterator = getSymbolIterator();\n", "import { iterator as Symbol_iterator } from '../symbol/iterator';\nimport { isFunction } from './isFunction';\n\n/** Identifies an input as being an Iterable */\nexport function isIterable(input: any): input is Iterable {\n return isFunction(input?.[Symbol_iterator]);\n}\n", "import { ReadableStreamLike } from '../types';\nimport { isFunction } from './isFunction';\n\nexport async function* readableStreamLikeToAsyncGenerator(readableStream: ReadableStreamLike): AsyncGenerator {\n const reader = readableStream.getReader();\n try {\n while (true) {\n const { value, done } = await reader.read();\n if (done) {\n return;\n }\n yield value!;\n }\n } finally {\n reader.releaseLock();\n }\n}\n\nexport function isReadableStreamLike(obj: any): obj is ReadableStreamLike {\n // We don't want to use instanceof checks because they would return\n // false for instances from another Realm, like an