Skip to content

Commit

Permalink
Updated local paths to avoid conflict with previous version (guillaum…
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-be authored Sep 12, 2020
1 parent 34e061c commit 0f22985
Show file tree
Hide file tree
Showing 11 changed files with 133 additions and 140 deletions.
6 changes: 3 additions & 3 deletions src/albert/albert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ pub struct AlbertVocabResources;
impl AlbertModelResources {
/// Shared under Apache 2.0 license by the Google team at https://github.com/google-research/ALBERT. Modified with conversion to C-array format.
pub const ALBERT_BASE_V2: (&'static str, &'static str) = (
"albert-base-v2/model.ot",
"albert-base-v2/model",
"https://cdn.huggingface.co/albert-base-v2/rust_model.ot",
);
}

impl AlbertConfigResources {
/// Shared under Apache 2.0 license by the Google team at https://github.com/google-research/ALBERT. Modified with conversion to C-array format.
pub const ALBERT_BASE_V2: (&'static str, &'static str) = (
"albert-base-v2/config.json",
"albert-base-v2/config",
"https://cdn.huggingface.co/albert-base-v2-config.json",
);
}

impl AlbertVocabResources {
/// Shared under Apache 2.0 license by the Google team at https://github.com/google-research/ALBERT. Modified with conversion to C-array format.
pub const ALBERT_BASE_V2: (&'static str, &'static str) = (
"albert-base-v2/spiece.model",
"albert-base-v2/spiece",
"https://cdn.huggingface.co/albert-base-v2-spiece.model",
);
}
Expand Down
32 changes: 16 additions & 16 deletions src/bart/bart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,91 +39,91 @@ pub struct BartMergesResources;
impl BartModelResources {
/// Shared under MIT license by the Facebook AI Research Fairseq team at https://github.com/pytorch/fairseq. Modified with conversion to C-array format.
pub const BART: (&'static str, &'static str) = (
"bart/model.ot",
"bart/model",
"https://cdn.huggingface.co/facebook/bart-large/rust_model.ot",
);
/// Shared under MIT license by the Facebook AI Research Fairseq team at https://github.com/pytorch/fairseq. Modified with conversion to C-array format.
pub const BART_CNN: (&'static str, &'static str) = (
"bart-cnn/model.ot",
"bart-cnn/model",
"https://cdn.huggingface.co/facebook/bart-large-cnn/rust_model.ot",
);
/// Shared under MIT license by the Facebook AI Research Fairseq team at https://github.com/pytorch/fairseq. Modified with conversion to C-array format.
pub const BART_XSUM: (&'static str, &'static str) = (
"bart-xsum/model.ot",
"bart-xsum/model",
"https://cdn.huggingface.co/facebook/bart-large-xsum/rust_model.ot",
);
/// Shared under MIT license by the Facebook AI Research Fairseq team at https://github.com/pytorch/fairseq. Modified with conversion to C-array format.
pub const BART_MNLI: (&'static str, &'static str) = (
"bart-large-mnli/model.ot",
"bart-large-mnli/model",
"https://cdn.huggingface.co/facebook/bart-large-mnli/rust_model.ot",
);
}

impl BartConfigResources {
/// Shared under MIT license by the Facebook AI Research Fairseq team at https://github.com/pytorch/fairseq. Modified with conversion to C-array format.
pub const BART: (&'static str, &'static str) = (
"bart/config.json",
"bart/config",
"https://cdn.huggingface.co/facebook/bart-large/config.json",
);
/// Shared under MIT license by the Facebook AI Research Fairseq team at https://github.com/pytorch/fairseq. Modified with conversion to C-array format.
pub const BART_CNN: (&'static str, &'static str) = (
"bart-cnn/config.json",
"bart-cnn/config",
"https://cdn.huggingface.co/facebook/bart-large-cnn/config.json",
);
/// Shared under MIT license by the Facebook AI Research Fairseq team at https://github.com/pytorch/fairseq. Modified with conversion to C-array format.
pub const BART_XSUM: (&'static str, &'static str) = (
"bart-xsum/config.json",
"bart-xsum/config",
"https://cdn.huggingface.co/facebook/bart-large-xsum/config.json",
);
/// Shared under MIT license by the Facebook AI Research Fairseq team at https://github.com/pytorch/fairseq. Modified with conversion to C-array format.
pub const BART_MNLI: (&'static str, &'static str) = (
"bart-large-mnli/config.json",
"bart-large-mnli/config",
"https://cdn.huggingface.co/facebook/bart-large-mnli/config.json",
);
}

impl BartVocabResources {
/// Shared under MIT license by the Facebook AI Research Fairseq team at https://github.com/pytorch/fairseq. Modified with conversion to C-array format.
pub const BART: (&'static str, &'static str) = (
"bart/vocab.txt",
"bart/vocab",
"https://cdn.huggingface.co/roberta-large-vocab.json",
);
/// Shared under MIT license by the Facebook AI Research Fairseq team at https://github.com/pytorch/fairseq. Modified with conversion to C-array format.
pub const BART_CNN: (&'static str, &'static str) = (
"bart-cnn/vocab.txt",
"bart-cnn/vocab",
"https://cdn.huggingface.co/roberta-large-vocab.json",
);
/// Shared under MIT license by the Facebook AI Research Fairseq team at https://github.com/pytorch/fairseq. Modified with conversion to C-array format.
pub const BART_XSUM: (&'static str, &'static str) = (
"bart-xsum/vocab.txt",
"bart-xsum/vocab",
"https://cdn.huggingface.co/roberta-large-vocab.json",
);
/// Shared under MIT license by the Facebook AI Research Fairseq team at https://github.com/pytorch/fairseq. Modified with conversion to C-array format.
pub const BART_MNLI: (&'static str, &'static str) = (
"bart-large-mnli/vocab.txt",
"bart-large-mnli/vocab",
"https://cdn.huggingface.co/roberta-large-vocab.json",
);
}

impl BartMergesResources {
/// Shared under MIT license by the Facebook AI Research Fairseq team at https://github.com/pytorch/fairseq. Modified with conversion to C-array format.
pub const BART: (&'static str, &'static str) = (
"bart/merges.txt",
"bart/merges",
"https://cdn.huggingface.co/roberta-large-merges.txt",
);
/// Shared under MIT license by the Facebook AI Research Fairseq team at https://github.com/pytorch/fairseq. Modified with conversion to C-array format.
pub const BART_CNN: (&'static str, &'static str) = (
"bart-cnn/merges.txt",
"bart-cnn/merges",
"https://cdn.huggingface.co/roberta-large-merges.txt",
);
/// Shared under MIT license by the Facebook AI Research Fairseq team at https://github.com/pytorch/fairseq. Modified with conversion to C-array format.
pub const BART_XSUM: (&'static str, &'static str) = (
"bart-xsum/merges.txt",
"bart-xsum/merges",
"https://cdn.huggingface.co/roberta-large-merges.txt",
);
/// Shared under MIT license by the Facebook AI Research Fairseq team at https://github.com/pytorch/fairseq. Modified with conversion to C-array format.
pub const BART_MNLI: (&'static str, &'static str) = (
"bart-large-mnli/merges.txt",
"bart-large-mnli/merges",
"https://cdn.huggingface.co/roberta-large-merges.txt",
);
}
Expand Down
18 changes: 9 additions & 9 deletions src/bert/bert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,53 +36,53 @@ pub struct BertVocabResources;
impl BertModelResources {
/// Shared under Apache 2.0 license by the Google team at https://github.com/google-research/bert. Modified with conversion to C-array format.
pub const BERT: (&'static str, &'static str) = (
"bert/model.ot",
"bert/model",
"https://cdn.huggingface.co/bert-base-uncased-rust_model.ot",
);
/// Shared under MIT license by the MDZ Digital Library team at the Bavarian State Library at https://github.com/dbmdz/berts. Modified with conversion to C-array format.
pub const BERT_NER: (&'static str, &'static str) = (
"bert-ner/model.ot",
"bert-ner/model",
"https://cdn.huggingface.co/dbmdz/bert-large-cased-finetuned-conll03-english/rust_model.ot",
);
/// Shared under Apache 2.0 license by Hugging Face Inc at https://github.com/huggingface/transformers/tree/master/examples/question-answering. Modified with conversion to C-array format.
pub const BERT_QA: (&'static str, &'static str) = (
"bert-qa/model.ot",
"bert-qa/model",
"https://cdn.huggingface.co/bert-large-cased-whole-word-masking-finetuned-squad-rust_model.ot",
);
}

impl BertConfigResources {
/// Shared under Apache 2.0 license by the Google team at https://github.com/google-research/bert. Modified with conversion to C-array format.
pub const BERT: (&'static str, &'static str) = (
"bert/config.json",
"bert/config",
"https://cdn.huggingface.co/bert-base-uncased-config.json",
);
/// Shared under MIT license by the MDZ Digital Library team at the Bavarian State Library at https://github.com/dbmdz/berts. Modified with conversion to C-array format.
pub const BERT_NER: (&'static str, &'static str) = (
"bert-ner/config.json",
"bert-ner/config",
"https://cdn.huggingface.co/dbmdz/bert-large-cased-finetuned-conll03-english/config.json",
);
/// Shared under Apache 2.0 license by Hugging Face Inc at https://github.com/huggingface/transformers/tree/master/examples/question-answering. Modified with conversion to C-array format.
pub const BERT_QA: (&'static str, &'static str) = (
"bert-qa/config.json",
"bert-qa/config",
"https://s3.amazonaws.com/models.huggingface.co/bert/bert-large-cased-whole-word-masking-finetuned-squad-config.json",
);
}

impl BertVocabResources {
/// Shared under Apache 2.0 license by the Google team at https://github.com/google-research/bert. Modified with conversion to C-array format.
pub const BERT: (&'static str, &'static str) = (
"bert/vocab.txt",
"bert/vocab",
"https://cdn.huggingface.co/bert-base-uncased-vocab.txt",
);
/// Shared under MIT license by the MDZ Digital Library team at the Bavarian State Library at https://github.com/dbmdz/berts. Modified with conversion to C-array format.
pub const BERT_NER: (&'static str, &'static str) = (
"bert-ner/vocab.txt",
"bert-ner/vocab",
"https://cdn.huggingface.co/dbmdz/bert-large-cased-finetuned-conll03-english/vocab.txt",
);
/// Shared under Apache 2.0 license by Hugging Face Inc at https://github.com/huggingface/transformers/tree/master/examples/question-answering. Modified with conversion to C-array format.
pub const BERT_QA: (&'static str, &'static str) = (
"bert-qa/vocab.txt",
"bert-qa/vocab",
"https://cdn.huggingface.co/bert-large-cased-whole-word-masking-finetuned-squad-vocab.txt",
);
}
Expand Down
3 changes: 1 addition & 2 deletions src/common/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use std::path::PathBuf;

extern crate dirs;

/// # Resource Enum expected by the `download_resource` function
/// # Resource Enum pointing to model, configuration or vocabulary resources
/// Can be of type:
/// - LocalResource
/// - RemoteResource
Expand Down Expand Up @@ -61,7 +61,6 @@ impl Resource {
Resource::Remote(resource) => {
let cached_path =
CACHE.cached_path_in_subdir(&resource.url, Some(&resource.cache_subdir))?;
println!("Downloaded {} to {:?}", resource.url, cached_path);
Ok(cached_path)
}
}
Expand Down
18 changes: 9 additions & 9 deletions src/distilbert/distilbert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,53 +32,53 @@ pub struct DistilBertVocabResources;
impl DistilBertModelResources {
/// Shared under Apache 2.0 license by the HuggingFace Inc. team at https://huggingface.co/models. Modified with conversion to C-array format.
pub const DISTIL_BERT_SST2: (&'static str, &'static str) = (
"distilbert-sst2/model.ot",
"distilbert-sst2/model",
"https://cdn.huggingface.co/distilbert-base-uncased-finetuned-sst-2-english-rust_model.ot",
);
/// Shared under Apache 2.0 license by the HuggingFace Inc. team at https://huggingface.co/models. Modified with conversion to C-array format.
pub const DISTIL_BERT: (&'static str, &'static str) = (
"distilbert/model.ot",
"distilbert/model",
"https://cdn.huggingface.co/distilbert-base-uncased-rust_model.ot",
);
/// Shared under Apache 2.0 license by the HuggingFace Inc. team at https://huggingface.co/models. Modified with conversion to C-array format.
pub const DISTIL_BERT_SQUAD: (&'static str, &'static str) = (
"distilbert-qa/model.ot",
"distilbert-qa/model",
"https://cdn.huggingface.co/distilbert-base-cased-distilled-squad-rust_model.ot",
);
}

impl DistilBertConfigResources {
/// Shared under Apache 2.0 license by the HuggingFace Inc. team at https://huggingface.co/models. Modified with conversion to C-array format.
pub const DISTIL_BERT_SST2: (&'static str, &'static str) = (
"distilbert-sst2/config.json",
"distilbert-sst2/config",
"https://cdn.huggingface.co/distilbert-base-uncased-finetuned-sst-2-english-config.json",
);
/// Shared under Apache 2.0 license by the HuggingFace Inc. team at https://huggingface.co/models. Modified with conversion to C-array format.
pub const DISTIL_BERT: (&'static str, &'static str) = (
"distilbert/config.json",
"distilbert/config",
"https://cdn.huggingface.co/distilbert-base-uncased-config.json",
);
/// Shared under Apache 2.0 license by the HuggingFace Inc. team at https://huggingface.co/models. Modified with conversion to C-array format.
pub const DISTIL_BERT_SQUAD: (&'static str, &'static str) = (
"distilbert-qa/config.json",
"distilbert-qa/config",
"https://cdn.huggingface.co/distilbert-base-cased-distilled-squad-config.json",
);
}

impl DistilBertVocabResources {
/// Shared under Apache 2.0 license by the HuggingFace Inc. team at https://huggingface.co/models. Modified with conversion to C-array format.
pub const DISTIL_BERT_SST2: (&'static str, &'static str) = (
"distilbert-sst2/vocab.txt",
"distilbert-sst2/vocab",
"https://cdn.huggingface.co/distilbert-base-uncased-finetuned-sst-2-english-vocab.txt",
);
/// Shared under Apache 2.0 license by the HuggingFace Inc. team at https://huggingface.co/models. Modified with conversion to C-array format.
pub const DISTIL_BERT: (&'static str, &'static str) = (
"distilbert/vocab.txt",
"distilbert/vocab",
"https://cdn.huggingface.co/bert-base-uncased-vocab.txt",
);
/// Shared under Apache 2.0 license by the HuggingFace Inc. team at https://huggingface.co/models. Modified with conversion to C-array format.
pub const DISTIL_BERT_SQUAD: (&'static str, &'static str) = (
"distilbert-qa/vocab.txt",
"distilbert-qa/vocab",
"https://cdn.huggingface.co/bert-large-cased-vocab.txt",
);
}
Expand Down
12 changes: 6 additions & 6 deletions src/electra/electra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,38 +34,38 @@ pub struct ElectraVocabResources;
impl ElectraModelResources {
/// Shared under Apache 2.0 license by the Google team at https://github.com/google-research/electra. Modified with conversion to C-array format.
pub const BASE_GENERATOR: (&'static str, &'static str) = (
"electra-base-generator/model.ot",
"electra-base-generator/model",
"https://cdn.huggingface.co/google/electra-base-generator/rust_model.ot",
);
/// Shared under Apache 2.0 license by the Google team at https://github.com/google-research/electra. Modified with conversion to C-array format.
pub const BASE_DISCRIMINATOR: (&'static str, &'static str) = (
"electra-base-discriminator/model.ot",
"electra-base-discriminator/model",
"https://cdn.huggingface.co/google/electra-base-discriminator/rust_model.ot",
);
}

impl ElectraConfigResources {
/// Shared under Apache 2.0 license by the Google team at https://github.com/google-research/electra. Modified with conversion to C-array format.
pub const BASE_GENERATOR: (&'static str, &'static str) = (
"electra-base-generator/config.json",
"electra-base-generator/config",
"https://cdn.huggingface.co/google/electra-base-generator/config.json",
);
/// Shared under Apache 2.0 license by the Google team at https://github.com/google-research/electra. Modified with conversion to C-array format.
pub const BASE_DISCRIMINATOR: (&'static str, &'static str) = (
"electra-base-discriminator/config.json",
"electra-base-discriminator/config",
"https://cdn.huggingface.co/google/electra-base-discriminator/config.json",
);
}

impl ElectraVocabResources {
/// Shared under Apache 2.0 license by the Google team at https://github.com/google-research/electra. Modified with conversion to C-array format.
pub const BASE_GENERATOR: (&'static str, &'static str) = (
"electra-base-generator/vocab.txt",
"electra-base-generator/vocab",
"https://cdn.huggingface.co/google/electra-base-generator/vocab.txt",
);
/// Shared under Apache 2.0 license by the Google team at https://github.com/google-research/electra. Modified with conversion to C-array format.
pub const BASE_DISCRIMINATOR: (&'static str, &'static str) = (
"electra-base-discriminator/vocab.txt",
"electra-base-discriminator/vocab",
"https://cdn.huggingface.co/google/electra-base-discriminator/vocab.txt",
);
}
Expand Down
Loading

0 comments on commit 0f22985

Please sign in to comment.