[][src]Struct rust_bert::resources::RemoteResource

pub struct RemoteResource {
    pub url: String,
    pub local_path: PathBuf,
}

Fields

url: String

Remote path/url for the resource

local_path: PathBuf

Local path for the resource

Methods

impl RemoteResource[src]

pub fn new(url: &str, target: PathBuf) -> RemoteResource[src]

Creates a new RemoteResource from an URL and a custom local path. Note that this does not download the resource (only declares the remote and local locations)

Arguments

  • url - &str Location of the remote resource
  • target - PathBuf Local path to save teh resource to

Returns

  • RemoteResource RemoteResource object

Example

use rust_bert::resources::{Resource, RemoteResource};
use std::path::PathBuf;
let config_resource = Resource::Remote(RemoteResource::new("http://config_json_location", PathBuf::from("path/to/config.json")));

pub fn from_pretrained(name_url_tuple: (&str, &str)) -> RemoteResource[src]

Creates a new RemoteResource from an URL and local name. Will define a local path pointing to ~/.cache/.rusbert/model_name. Note that this does not download the resource (only declares the remote and local locations)

Arguments

  • name_url_tuple - (&str, &str) Location of the name of model and remote resource

Returns

  • RemoteResource RemoteResource object

Example

use rust_bert::resources::{Resource, RemoteResource};
let model_resource = Resource::Remote(RemoteResource::from_pretrained(
    ("distilbert-sst2/model.ot",
    "https://cdn.huggingface.co/distilbert-base-uncased-finetuned-sst-2-english-rust_model.ot"
    )
));

Trait Implementations

impl Clone for RemoteResource[src]

impl PartialEq<RemoteResource> for RemoteResource[src]

impl StructuralPartialEq for RemoteResource[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.