#[non_exhaustive]
pub enum TrainingInputMode {
Fastfile,
File,
Pipe,
Unknown(UnknownVariantValue),
}
Expand description
When writing a match expression against TrainingInputMode
, it is important to ensure
your code is forward-compatible. That is, if a match arm handles a case for a
feature that is supported by the service but has not been represented as an enum
variant in a current version of SDK, your code should continue to work when you
upgrade SDK to a future version in which the enum does include a variant for that
feature.
Here is an example of how you can make a match expression forward-compatible:
# let traininginputmode = unimplemented!();
match traininginputmode {
TrainingInputMode::Fastfile => { /* ... */ },
TrainingInputMode::File => { /* ... */ },
TrainingInputMode::Pipe => { /* ... */ },
other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
_ => { /* ... */ },
}
The above code demonstrates that when traininginputmode
represents
NewFeature
, the execution path will lead to the second last match arm,
even though the enum does not contain a variant TrainingInputMode::NewFeature
in the current version of SDK. The reason is that the variable other
,
created by the @
operator, is bound to
TrainingInputMode::Unknown(UnknownVariantValue("NewFeature".to_owned()))
and calling as_str
on it yields "NewFeature"
.
This match expression is forward-compatible when executed with a newer
version of SDK where the variant TrainingInputMode::NewFeature
is defined.
Specifically, when traininginputmode
represents NewFeature
,
the execution path will hit the second last match arm as before by virtue of
calling as_str
on TrainingInputMode::NewFeature
also yielding "NewFeature"
.
Explicitly matching on the Unknown
variant should
be avoided for two reasons:
- The inner data
UnknownVariantValue
is opaque, and no further information can be extracted. - It might inadvertently shadow other intended match arms.
The training input mode that the algorithm supports. For more information about input modes, see Algorithms.
Pipe mode
If an algorithm supports Pipe
mode, Amazon SageMaker streams data directly from
Amazon S3 to the container.
File mode
If an algorithm supports File
mode, SageMaker downloads the training data from
S3 to the provisioned ML storage volume, and mounts the directory to the Docker volume
for the training container.
You must provision the ML storage volume with sufficient capacity to accommodate the data downloaded from S3. In addition to the training data, the ML storage volume also stores the output model. The algorithm container uses the ML storage volume to also store intermediate information, if any.
For distributed algorithms, training data is distributed uniformly. Your training duration is predictable if the input data objects sizes are approximately the same. SageMaker does not split the files any further for model training. If the object sizes are skewed, training won't be optimal as the data distribution is also skewed when one host in a training cluster is overloaded, thus becoming a bottleneck in training.
FastFile mode
If an algorithm supports FastFile
mode, SageMaker streams data directly from
S3 to the container with no code changes, and provides file system access to the data.
Users can author their training script to interact with these files as if they were
stored on disk.
FastFile
mode works best when the data is read sequentially. Augmented
manifest files aren't supported. The startup time is lower when there are fewer files in
the S3 bucket provided.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Fastfile
File
Pipe
Unknown(UnknownVariantValue)
Unknown
contains new variants that have been added since this code was generated.
Implementations§
Trait Implementations§
source§impl AsRef<str> for TrainingInputMode
impl AsRef<str> for TrainingInputMode
source§impl Clone for TrainingInputMode
impl Clone for TrainingInputMode
source§fn clone(&self) -> TrainingInputMode
fn clone(&self) -> TrainingInputMode
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TrainingInputMode
impl Debug for TrainingInputMode
source§impl From<&str> for TrainingInputMode
impl From<&str> for TrainingInputMode
source§impl FromStr for TrainingInputMode
impl FromStr for TrainingInputMode
source§impl Hash for TrainingInputMode
impl Hash for TrainingInputMode
source§impl Ord for TrainingInputMode
impl Ord for TrainingInputMode
source§fn cmp(&self, other: &TrainingInputMode) -> Ordering
fn cmp(&self, other: &TrainingInputMode) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<TrainingInputMode> for TrainingInputMode
impl PartialEq<TrainingInputMode> for TrainingInputMode
source§fn eq(&self, other: &TrainingInputMode) -> bool
fn eq(&self, other: &TrainingInputMode) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<TrainingInputMode> for TrainingInputMode
impl PartialOrd<TrainingInputMode> for TrainingInputMode
source§fn partial_cmp(&self, other: &TrainingInputMode) -> Option<Ordering>
fn partial_cmp(&self, other: &TrainingInputMode) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Eq for TrainingInputMode
impl StructuralEq for TrainingInputMode
impl StructuralPartialEq for TrainingInputMode
Auto Trait Implementations§
impl RefUnwindSafe for TrainingInputMode
impl Send for TrainingInputMode
impl Sync for TrainingInputMode
impl Unpin for TrainingInputMode
impl UnwindSafe for TrainingInputMode
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.