modelId
stringlengths
4
112
lastModified
stringlengths
24
24
tags
list
pipeline_tag
stringclasses
21 values
files
list
publishedBy
stringlengths
2
37
downloads_last_month
int32
0
9.44M
library
stringclasses
15 values
modelCard
large_stringlengths
0
100k
patrickvonplaten/reformer-tiny-random
2021-05-20T02:18:13.000Z
[ "pytorch", "bert", "lm-head", "masked-lm", "transformers", "fill-mask" ]
fill-mask
[ ".gitattributes", "config.json", "pytorch_model.bin" ]
patrickvonplaten
41
transformers
patrickvonplaten/roberta2roberta-cnn_dailymail-fp16
2020-12-11T21:59:23.000Z
[ "pytorch", "encoder_decoder", "seq2seq", "transformers", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin" ]
patrickvonplaten
27
transformers
# Roberta2Roberta Summarization with 🤗 EncoderDecoder Framework This model is a Roberta2Roberta model fine-tuned on summarization. Roberta2Roberta is a `EncoderDecoderModel`, meaning that both the encoder and the decoder are `roberta-base` RoBERTa models. Leveraging the [EncoderDecoderFramework](https://huggingface.co/transformers/model_doc/encoderdecoder.html#encoder-decoder-models), the two pretrained models can simply be loaded into the framework via: ```python roberta2roberta = EncoderDecoderModel.from_encoder_decoder_pretrained("roberta-base", "roberta-base") ``` The decoder of an `EncoderDecoder` model needs cross-attention layers and usually makes use of causal masking for auto-regressiv generation. Thus, ``roberta2roberta`` is consequently fined-tuned on the `CNN/Daily Mail`dataset and the resulting model `roberta2roberta-cnn_dailymail-fp16` is uploaded here. ## Example The model is by no means a state-of-the-art model, but nevertheless produces reasonable summarization results. It was mainly fine-tuned as a proof-of-concept for the 🤗 EncoderDecoder Framework. The model can be used as follows: ```python from transformers import BertTokenizer, EncoderDecoderModel model = EncoderDecoderModel.from_pretrained("patrickvonplaten/roberta2roberta-cnn_dailymail-fp16") tokenizer = RobertaTokenizer.from_pretrained("roberta-base") article = """(CNN)Sigma Alpha Epsilon is under fire for a video showing party-bound fraternity members singing a racist chant. SAE's national chapter suspended the students, but University of Oklahoma President David B oren took it a step further, saying the university's affiliation with the fraternity is permanently done. The news is shocking, but it's not the first time SAE has faced controversy. SAE was founded March 9, 185 6, at the University of Alabama, five years before the American Civil War, according to the fraternity website. When the war began, the group had fewer than 400 members, of which "369 went to war for the Confede rate States and seven for the Union Army," the website says. The fraternity now boasts more than 200,000 living alumni, along with about 15,000 undergraduates populating 219 chapters and 20 "colonies" seeking fu ll membership at universities. SAE has had to work hard to change recently after a string of member deaths, many blamed on the hazing of new recruits, SAE national President Bradley Cohen wrote in a message on t he fraternity's website. The fraternity's website lists more than 130 chapters cited or suspended for "health and safety incidents" since 2010. At least 30 of the incidents involved hazing, and dozens more invol ved alcohol. However, the list is missing numerous incidents from recent months. Among them, according to various media outlets: Yale University banned the SAEs from campus activities last month after members al legedly tried to interfere with a sexual misconduct investigation connected to an initiation rite. Stanford University in December suspended SAE housing privileges after finding sorority members attending a frat ernity function were subjected to graphic sexual content. And Johns Hopkins University in November suspended the fraternity for underage drinking. "The media has labeled us as the 'nation's deadliest fraternity, ' " Cohen said. In 2011, for example, a student died while being coerced into excessive alcohol consumption, according to a lawsuit. SAE's previous insurer dumped the fraternity. "As a result, we are paying Lloy d's of London the highest insurance rates in the Greek-letter world," Cohen said. Universities have turned down SAE's attempts to open new chapters, and the fraternity had to close 12 in 18 months over hazing in cidents.""" input_ids = tokenizer(article, return_tensors="pt").input_ids output_ids = model.generate(input_ids) print(tokenizer.decode(output_ids[0], skip_special_tokens=True)) # should produce # Sigma Alpha Epsilon is under fire for a video showing party-bound fraternity members singing racist chants. The fraternity's national chapter has had to close 12 in 18 months over hazing. # Sigma has had more than 130 chapters in 18 states. University of Oklahoma president says fraternity has been "deteriorated". ``` ## Training script: **IMPORTANT**: In order for this code to work, make sure you checkout to the branch [more_general_trainer_metric](https://github.com/huggingface/transformers/tree/more_general_trainer_metric), which slightly adapts the `Trainer` for `EncoderDecoderModels` according to this PR: https://github.com/huggingface/transformers/pull/5840. The following code shows the complete training script that was used to fine-tune `roberta2roberta-cnn_dailymail-fp16 ` for reproducability. The training last ~9h on a standard GPU. ```python #!/usr/bin/env python3 import nlp import logging from transformers import RobertaTokenizer, EncoderDecoderModel, Trainer, TrainingArguments logging.basicConfig(level=logging.INFO) model = EncoderDecoderModel.from_encoder_decoder_pretrained("roberta-base", "roberta-base") tokenizer = RobertaTokenizer.from_pretrained("roberta-base") # load train and validation data train_dataset = nlp.load_dataset("cnn_dailymail", "3.0.0", split="train") val_dataset = nlp.load_dataset("cnn_dailymail", "3.0.0", split="validation[:5%]") # load rouge for validation rouge = nlp.load_metric("rouge", experiment_id=0) # set decoding params model.config.decoder_start_token_id = tokenizer.bos_token_id model.config.eos_token_id = tokenizer.eos_token_id model.config.max_length = 142 model.config.min_length = 56 model.config.no_repeat_ngram_size = 3 model.early_stopping = True model.length_penalty = 2.0 model.num_beams = 4 encoder_length = 512 decoder_length = 128 batch_size = 16 # map data correctly def map_to_encoder_decoder_inputs(batch): # Tokenizer will automatically set [BOS] <text> [EOS] # cut off at Longformer at 2048 inputs = tokenizer(batch["article"], padding="max_length", truncation=True, max_length=encoder_length) # force summarization <= 256 outputs = tokenizer(batch["highlights"], padding="max_length", truncation=True, max_length=decoder_length) batch["input_ids"] = inputs.input_ids batch["attention_mask"] = inputs.attention_mask batch["decoder_input_ids"] = outputs.input_ids batch["labels"] = outputs.input_ids.copy() # mask loss for padding batch["labels"] = [ [-100 if token == tokenizer.pad_token_id else token for token in labels] for labels in batch["labels"] ] batch["decoder_attention_mask"] = outputs.attention_mask assert all([len(x) == encoder_length for x in inputs.input_ids]) assert all([len(x) == decoder_length for x in outputs.input_ids]) return batch def compute_metrics(pred): labels_ids = pred.label_ids pred_ids = pred.predictions # all unnecessary tokens are removed pred_str = tokenizer.batch_decode(pred_ids, skip_special_tokens=True) labels_ids[labels_ids == -100] = tokenizer.eos_token_id label_str = tokenizer.batch_decode(labels_ids, skip_special_tokens=True) rouge_output = rouge.compute(predictions=pred_str, references=label_str, rouge_types=["rouge2"])["rouge2"].mid return { "rouge2_precision": round(rouge_output.precision, 4), "rouge2_recall": round(rouge_output.recall, 4), "rouge2_fmeasure": round(rouge_output.fmeasure, 4), } # make train dataset ready train_dataset = train_dataset.map( map_to_encoder_decoder_inputs, batched=True, batch_size=batch_size, remove_columns=["article", "highlights"], ) train_dataset.set_format( type="torch", columns=["input_ids", "attention_mask", "decoder_attention_mask", "decoder_input_ids", "labels"], ) # same for validation dataset val_dataset = val_dataset.map( map_to_encoder_decoder_inputs, batched=True, batch_size=batch_size, remove_columns=["article", "highlights"], ) val_dataset.set_format( type="torch", columns=["input_ids", "decoder_attention_mask", "attention_mask", "decoder_input_ids", "labels"], ) # set training arguments - these params are not really tuned, feel free to change training_args = TrainingArguments( output_dir="./", per_device_train_batch_size=batch_size, per_device_eval_batch_size=batch_size, predict_from_generate=True, evaluate_during_training=True, do_train=True, do_eval=True, logging_steps=1000, save_steps=1000, eval_steps=1000, overwrite_output_dir=True, warmup_steps=2000, save_total_limit=3, fp16=True, ) # instantiate trainer trainer = Trainer( model=model, args=training_args, compute_metrics=compute_metrics, train_dataset=train_dataset, eval_dataset=val_dataset, ) # start training trainer.train() ``` ## Evaluation The following script evaluates the model on the test set of CNN/Daily Mail. ```python #!/usr/bin/env python3 import nlp from transformers import RobertaTokenizer, EncoderDecoderModel tokenizer = RobertaTokenizer.from_pretrained("roberta-base") model = EncoderDecoderModel.from_pretrained("patrickvonplaten/roberta2roberta-cnn_dailymail-fp16") model.to("cuda") test_dataset = nlp.load_dataset("cnn_dailymail", "3.0.0", split="test") batch_size = 128 # map data correctly def generate_summary(batch): # Tokenizer will automatically set [BOS] <text> [EOS] # cut off at BERT max length 512 inputs = tokenizer(batch["article"], padding="max_length", truncation=True, max_length=512, return_tensors="pt") input_ids = inputs.input_ids.to("cuda") attention_mask = inputs.attention_mask.to("cuda") outputs = model.generate(input_ids, attention_mask=attention_mask) # all special tokens including will be removed output_str = tokenizer.batch_decode(outputs, skip_special_tokens=True) batch["pred"] = output_str return batch results = test_dataset.map(generate_summary, batched=True, batch_size=batch_size, remove_columns=["article"]) # load rouge for validation rouge = nlp.load_metric("rouge") pred_str = results["pred"] label_str = results["highlights"] rouge_output = rouge.compute(predictions=pred_str, references=label_str, rouge_types=["rouge2"])["rouge2"].mid print(rouge_output) ``` The obtained results should be: | - | Rouge2 - mid -precision | Rouge2 - mid - recall | Rouge2 - mid - fmeasure | |----------|:-------------:|:------:|:------:| | **CNN/Daily Mail** | 15.79 | 19.05 | **16.79** |
patrickvonplaten/roberta2roberta-share-cnn_dailymail-fp16
2020-12-11T21:59:26.000Z
[ "pytorch", "encoder_decoder", "seq2seq", "transformers", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin" ]
patrickvonplaten
20
transformers
# Shared Roberta2Roberta Summarization with 🤗 EncoderDecoder Framework This model is a shared Roberta2Roberta model, meaning that the encoder and decoder weights are tied, fine-tuned on summarization. Roberta2Roberta is a `EncoderDecoderModel`, meaning that both the encoder and the decoder are `roberta-base` RoBERTa models. In this setup the encoder and decoder weights are tied. Leveraging the [EncoderDecoderFramework](https://huggingface.co/transformers/model_doc/encoderdecoder.html#encoder-decoder-models), the two pretrained models can simply be loaded into the framework via: ```python roberta2roberta = EncoderDecoderModel.from_encoder_decoder_pretrained("roberta-base", "roberta-base", tie_encoder_decoder=True) ``` The decoder of an `EncoderDecoder` model needs cross-attention layers and usually makes use of causal masking for auto-regressiv generation. Thus, ``roberta2roberta`` is consequently fined-tuned on the `CNN/Daily Mail`dataset and the resulting model `roberta2roberta-share-cnn_dailymail-fp16` is uploaded here. ## Example The model is by no means a state-of-the-art model, but nevertheless produces reasonable summarization results. It was mainly fine-tuned as a proof-of-concept for the 🤗 EncoderDecoder Framework. The model can be used as follows: ```python from transformers import RobertaTokenizer, EncoderDecoderModel model = EncoderDecoderModel.from_pretrained("patrickvonplaten/roberta2roberta-share-cnn_dailymail-fp16") tokenizer = RobertaTokenizer.from_pretrained("roberta-base") article = """(CNN)Sigma Alpha Epsilon is under fire for a video showing party-bound fraternity members singing a racist chant. SAE's national chapter suspended the students, but University of Oklahoma President David B oren took it a step further, saying the university's affiliation with the fraternity is permanently done. The news is shocking, but it's not the first time SAE has faced controversy. SAE was founded March 9, 185 6, at the University of Alabama, five years before the American Civil War, according to the fraternity website. When the war began, the group had fewer than 400 members, of which "369 went to war for the Confede rate States and seven for the Union Army," the website says. The fraternity now boasts more than 200,000 living alumni, along with about 15,000 undergraduates populating 219 chapters and 20 "colonies" seeking fu ll membership at universities. SAE has had to work hard to change recently after a string of member deaths, many blamed on the hazing of new recruits, SAE national President Bradley Cohen wrote in a message on t he fraternity's website. The fraternity's website lists more than 130 chapters cited or suspended for "health and safety incidents" since 2010. At least 30 of the incidents involved hazing, and dozens more invol ved alcohol. However, the list is missing numerous incidents from recent months. Among them, according to various media outlets: Yale University banned the SAEs from campus activities last month after members al legedly tried to interfere with a sexual misconduct investigation connected to an initiation rite. Stanford University in December suspended SAE housing privileges after finding sorority members attending a frat ernity function were subjected to graphic sexual content. And Johns Hopkins University in November suspended the fraternity for underage drinking. "The media has labeled us as the 'nation's deadliest fraternity, ' " Cohen said. In 2011, for example, a student died while being coerced into excessive alcohol consumption, according to a lawsuit. SAE's previous insurer dumped the fraternity. "As a result, we are paying Lloy d's of London the highest insurance rates in the Greek-letter world," Cohen said. Universities have turned down SAE's attempts to open new chapters, and the fraternity had to close 12 in 18 months over hazing in cidents.""" input_ids = tokenizer(article, return_tensors="pt").input_ids output_ids = model.generate(input_ids) print(tokenizer.decode(output_ids[0], skip_special_tokens=True)) # should produce # SAE's national chapter suspended after video shows party-bound fraternity members singing racist chant. University of Oklahoma president says university's affiliation with fraternity is permanently done. # SAE has had to close 12 chapters since 2010 after members were killed in hazing. The fraternity has had more than 130 chapters in 18 months. ``` ## Training script: **IMPORTANT**: In order for this code to work, make sure you checkout to the branch [more_general_trainer_metric](https://github.com/huggingface/transformers/tree/more_general_trainer_metric), which slightly adapts the `Trainer` for `EncoderDecoderModels` according to this PR: https://github.com/huggingface/transformers/pull/5840. The following code shows the complete training script that was used to fine-tune `roberta2roberta-cnn_dailymail-fp16 ` for reproducability. The training last ~9h on a standard GPU. ```python #!/usr/bin/env python3 import nlp import logging from transformers import RobertaTokenizer, EncoderDecoderModel, Trainer, TrainingArguments logging.basicConfig(level=logging.INFO) model = EncoderDecoderModel.from_encoder_decoder_pretrained("roberta-base", "roberta-base", tie_encoder_decoder=True) tokenizer = RobertaTokenizer.from_pretrained("roberta-base") # load train and validation data train_dataset = nlp.load_dataset("cnn_dailymail", "3.0.0", split="train") val_dataset = nlp.load_dataset("cnn_dailymail", "3.0.0", split="validation[:5%]") # load rouge for validation rouge = nlp.load_metric("rouge", experiment_id=0) # set decoding params model.config.decoder_start_token_id = tokenizer.bos_token_id model.config.eos_token_id = tokenizer.eos_token_id model.config.max_length = 142 model.config.min_length = 56 model.config.no_repeat_ngram_size = 3 model.early_stopping = True model.length_penalty = 2.0 model.num_beams = 4 encoder_length = 512 decoder_length = 128 batch_size = 16 # map data correctly def map_to_encoder_decoder_inputs(batch): # Tokenizer will automatically set [BOS] <text> [EOS] # cut off at Longformer at 2048 inputs = tokenizer(batch["article"], padding="max_length", truncation=True, max_length=encoder_length) # force summarization <= 256 outputs = tokenizer(batch["highlights"], padding="max_length", truncation=True, max_length=decoder_length) batch["input_ids"] = inputs.input_ids batch["attention_mask"] = inputs.attention_mask batch["decoder_input_ids"] = outputs.input_ids batch["labels"] = outputs.input_ids.copy() # mask loss for padding batch["labels"] = [ [-100 if token == tokenizer.pad_token_id else token for token in labels] for labels in batch["labels"] ] batch["decoder_attention_mask"] = outputs.attention_mask assert all([len(x) == encoder_length for x in inputs.input_ids]) assert all([len(x) == decoder_length for x in outputs.input_ids]) return batch def compute_metrics(pred): labels_ids = pred.label_ids pred_ids = pred.predictions # all unnecessary tokens are removed pred_str = tokenizer.batch_decode(pred_ids, skip_special_tokens=True) labels_ids[labels_ids == -100] = tokenizer.eos_token_id label_str = tokenizer.batch_decode(labels_ids, skip_special_tokens=True) rouge_output = rouge.compute(predictions=pred_str, references=label_str, rouge_types=["rouge2"])["rouge2"].mid return { "rouge2_precision": round(rouge_output.precision, 4), "rouge2_recall": round(rouge_output.recall, 4), "rouge2_fmeasure": round(rouge_output.fmeasure, 4), } # make train dataset ready train_dataset = train_dataset.map( map_to_encoder_decoder_inputs, batched=True, batch_size=batch_size, remove_columns=["article", "highlights"], ) train_dataset.set_format( type="torch", columns=["input_ids", "attention_mask", "decoder_attention_mask", "decoder_input_ids", "labels"], ) # same for validation dataset val_dataset = val_dataset.map( map_to_encoder_decoder_inputs, batched=True, batch_size=batch_size, remove_columns=["article", "highlights"], ) val_dataset.set_format( type="torch", columns=["input_ids", "decoder_attention_mask", "attention_mask", "decoder_input_ids", "labels"], ) # set training arguments - these params are not really tuned, feel free to change training_args = TrainingArguments( output_dir="./", per_device_train_batch_size=batch_size, per_device_eval_batch_size=batch_size, predict_from_generate=True, evaluate_during_training=True, do_train=True, do_eval=True, logging_steps=1000, save_steps=1000, eval_steps=1000, overwrite_output_dir=True, warmup_steps=2000, save_total_limit=3, fp16=True, ) # instantiate trainer trainer = Trainer( model=model, args=training_args, compute_metrics=compute_metrics, train_dataset=train_dataset, eval_dataset=val_dataset, ) # start training trainer.train() ``` ## Evaluation The following script evaluates the model on the test set of CNN/Daily Mail. ```python #!/usr/bin/env python3 import nlp from transformers import RobertaTokenizer, EncoderDecoderModel tokenizer = RobertaTokenizer.from_pretrained("roberta-base") model = EncoderDecoderModel.from_pretrained("patrickvonplaten/roberta2roberta-share-cnn_dailymail-fp16") model.to("cuda") test_dataset = nlp.load_dataset("cnn_dailymail", "3.0.0", split="test") batch_size = 128 # map data correctly def generate_summary(batch): # Tokenizer will automatically set [BOS] <text> [EOS] # cut off at BERT max length 512 inputs = tokenizer(batch["article"], padding="max_length", truncation=True, max_length=512, return_tensors="pt") input_ids = inputs.input_ids.to("cuda") attention_mask = inputs.attention_mask.to("cuda") outputs = model.generate(input_ids, attention_mask=attention_mask) # all special tokens including will be removed output_str = tokenizer.batch_decode(outputs, skip_special_tokens=True) batch["pred"] = output_str return batch results = test_dataset.map(generate_summary, batched=True, batch_size=batch_size, remove_columns=["article"]) # load rouge for validation rouge = nlp.load_metric("rouge") pred_str = results["pred"] label_str = results["highlights"] rouge_output = rouge.compute(predictions=pred_str, references=label_str, rouge_types=["rouge2"])["rouge2"].mid print(rouge_output) ``` The obtained results should be: | - | Rouge2 - mid -precision | Rouge2 - mid - recall | Rouge2 - mid - fmeasure | |----------|:-------------:|:------:|:------:| | **CNN/Daily Mail** | 15.6 | 18.79 | **16.59** |
patrickvonplaten/roberta_shared_bbc_xsum
2020-12-11T21:59:29.000Z
[ "pytorch", "encoder-decoder", "seq2seq", "en", "dataset:xsum", "transformers", "license:apache-2.0", "summarization", "text2text-generation" ]
summarization
[ ".gitattributes", "README.md", "config.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
patrickvonplaten
55
transformers
--- language: en license: apache-2.0 datasets: - xsum tags: - summarization --- Shared RoBERTa2RoBERTa Summarization with 🤗EncoderDecoder Framework This model is a warm-started *RoBERTaShared* model fine-tuned on the *BBC XSum* summarization dataset. The model achieves a **16.89** ROUGE-2 score on *BBC XSUM*'s test dataset. For more details on how the model was fine-tuned, please refer to [this](https://colab.research.google.com/drive/1Ekd5pUeCX7VOrMx94_czTkwNtLN32Uyu?usp=sharing) notebook.
patrickvonplaten/t5-tiny-random
2020-11-20T16:04:22.000Z
[ "pytorch", "tf", "t5", "seq2seq", "transformers", "text2text-generation", "pipeline_tag:text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tf_model.h5", "tokenizer.json", "tokenizer_config.json" ]
patrickvonplaten
129,989
transformers
--- pipeline_tag: text2text-generation ---
patrickvonplaten/test
2021-05-20T12:23:50.000Z
[ "jax", "bert", "text-classification", "transformers" ]
text-classification
[ ".gitattributes", "config.json", "flax_model.msgpack" ]
patrickvonplaten
12
transformers
patrickvonplaten/tf_tts_fast_speech_2
2021-04-30T10:20:18.000Z
[]
[ ".gitattributes", "README.md", "config.yml", "model.h5", "processor.json" ]
patrickvonplaten
0
This is an example repo for a possible integration with TensorSpeech, see [here](https://github.com/TensorSpeech/TensorFlowTTS/pull/555).
patrickvonplaten/tryout
2021-01-06T08:21:06.000Z
[]
[ ".gitattributes" ]
patrickvonplaten
0
patrickvonplaten/wav2vec2-base-100h-13K-steps
2021-03-03T13:11:07.000Z
[ "pytorch", "wav2vec2", "transformers" ]
[ ".gitattributes", "README.md", "config.json", "preprocessor_config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
patrickvonplaten
7
transformers
Fine-tuning of `wav2vec2-base` on 100h of Librispeech training data. Results on "clean" data are very similar to the ones of the [official model](https://huggingface.co/facebook/wav2vec2-base-100h). However, the result on "other" is significantly worse - the model seems to have overfitting to the "clean" data. Model was trained on *librispeech-clean-train.100* with following hyper-parameters: - 2 GPUs Titan RTX - Total update steps 13000 - Batch size per GPU: 32 corresponding to a *total batch size* of ca. ~1500 seconds - Adam with linear decaying learning rate with 3000 warmup steps - dynamic grouping for batch - fp16 - attention_mask was **not** used during training Check: https://wandb.ai/patrickvonplaten/huggingface/reports/Project-Dashboard--Vmlldzo1MDI2MTU?accessToken=69z0mrkoxs1msgh71p4nntr9shi6mll8rhtbo6c56yynygw0scp11d8z9o1xd0uk *Result (WER)* on Librispeech test: | "clean" | "other" | |---|---| | 6.5 | 18.7 |
patrickvonplaten/wav2vec2-base-100h-2nd-try
2021-02-25T14:58:07.000Z
[ "pytorch", "wav2vec2", "transformers" ]
[ ".gitattributes", "README.md", "config.json", "preprocessor_config.json", "pytorch_model.bin" ]
patrickvonplaten
7
transformers
Second fine-tuning try of `wav2vec2-base`. Results are similar to the ones reported in https://huggingface.co/facebook/wav2vec2-base-100h. Model was trained on *librispeech-clean-train.100* with following hyper-parameters: - 2 GPUs Titan RTX - Total update steps 11000 - Batch size per GPU: 32 corresponding to a *total batch size* of ca. ~750 seconds - Adam with linear decaying learning rate with 3000 warmup steps - dynamic padding for batch - fp16 - attention_mask was **not** used during training Check: https://wandb.ai/patrickvonplaten/huggingface/runs/1yrpescx?workspace=user-patrickvonplaten *Result (WER)* on Librispeech: | "clean" (% rel difference to results in paper) | "other" (% rel difference to results in paper) | |---|---| | 6.2 (-1.6%) | 15.2 (-11.2%)|
patrickvonplaten/wav2vec2-base-libri-100h
2021-06-09T15:51:22.000Z
[ "wav2vec2", "transformers" ]
[ ".gitattributes", "config.json", "preprocessor_config.json" ]
patrickvonplaten
52
transformers
patrickvonplaten/wav2vec2-base-timit-demo
2021-03-12T15:12:49.000Z
[ "pytorch", "wav2vec2", "transformers" ]
[ ".gitattributes", "README.md", "config.json", "preprocessor_config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
patrickvonplaten
340
transformers
## Wav2Vec2 Fine-Tuned on English dataset Timit The model was fine-tuned in a google colab for demonstration purposes. Please refer to [this blog](https://huggingface.co/blog/fine-tune-wav2vec2-english) for more information about the model.
patrickvonplaten/wav2vec2-base
2021-06-08T17:00:26.000Z
[ "pytorch", "wav2vec2", "pretraining", "en", "dataset:librispeech_asr", "arxiv:2006.11477", "transformers", "speech", "license:apache-2.0" ]
[ ".gitattributes", "README.md", "config.json", "preprocessor_config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
patrickvonplaten
139
transformers
--- language: en datasets: - librispeech_asr tags: - speech license: apache-2.0 --- # Wav2Vec2-Base [Facebook's Wav2Vec2](https://ai.facebook.com/blog/wav2vec-20-learning-the-structure-of-speech-from-raw-audio/) The base model pretrained on 16kHz sampled speech audio. When using the model make sure that your speech input is also sampled at 16Khz. Note that this model should be fine-tuned on a downstream task, like Automatic Speech Recognition. Check out [this blog](https://huggingface.co/blog/fine-tune-wav2vec2-english) for more information. [Paper](https://arxiv.org/abs/2006.11477) Authors: Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael Auli **Abstract** We show for the first time that learning powerful representations from speech audio alone followed by fine-tuning on transcribed speech can outperform the best semi-supervised methods while being conceptually simpler. wav2vec 2.0 masks the speech input in the latent space and solves a contrastive task defined over a quantization of the latent representations which are jointly learned. Experiments using all labeled data of Librispeech achieve 1.8/3.3 WER on the clean/other test sets. When lowering the amount of labeled data to one hour, wav2vec 2.0 outperforms the previous state of the art on the 100 hour subset while using 100 times less labeled data. Using just ten minutes of labeled data and pre-training on 53k hours of unlabeled data still achieves 4.8/8.2 WER. This demonstrates the feasibility of speech recognition with limited amounts of labeled data. The original model can be found under https://github.com/pytorch/fairseq/tree/master/examples/wav2vec#wav2vec-20. # Usage See [this notebook](https://colab.research.google.com/drive/1FjTsqbYKphl9kL-eILgUc-bl4zVThL8F?usp=sharing) for more information on how to fine-tune the model.
patrickvonplaten/wav2vec2-large-lv60h-100h-2nd-try
2021-03-03T13:02:06.000Z
[ "pytorch", "wav2vec2", "arxiv:2006.11477", "transformers" ]
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin" ]
patrickvonplaten
16
transformers
Fine-tuning of `wav2vec2-large-lv60` on 100h of Librispeech training data. Results are a bit worse than those reported in the Appendix in Table 3 of the original [paper](https://arxiv.org/pdf/2006.11477.pdf). Model was trained on *librispeech-clean-train.100* with following hyper-parameters: - 2 GPUs Titan RTX - Total update steps 17500 - Batch size per GPU: 16 corresponding to a *total batch size* of ca. ~750 seconds - Adam with linear decaying learning rate with 3000 warmup steps - dynamic padding for batch - fp16 - attention_mask was used during training Check: https://wandb.ai/patrickvonplaten/huggingface/reports/Project-Dashboard--Vmlldzo0OTI0OTc?accessToken=8azw8iyxnbiqd4ytxcgm4hbnfh3x1b2c9l2eyfqfzdqw7l0icreljc9qpx0rkl6f *Result (WER)* on Librispeech test: | "clean" | "other" | |---|---| | 4.0 | 10.3 |
patrickvonplaten/wav2vec2-large-xlsr-turkish-demo
2021-03-21T09:42:54.000Z
[ "pytorch", "wav2vec2", "tr", "dataset:common_voice", "transformers", "audio", "automatic-speech-recognition", "speech", "xlsr-fine-tuning-week", "license:apache-2.0" ]
automatic-speech-recognition
[ ".gitattributes", "README.md", "config.json", "preprocessor_config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
patrickvonplaten
279
transformers
--- language: tr datasets: - common_voice tags: - audio - automatic-speech-recognition - speech - xlsr-fine-tuning-week license: apache-2.0 model-index: - name: XLSR Wav2Vec2 Turkish by Patrick von Platen results: - task: name: Speech Recognition type: automatic-speech-recognition dataset: name: Common Voice tr type: common_voice args: {lang_id} metrics: - name: Test WER type: wer value: 37.1 --- # Wav2Vec2-Large-XLSR-53-Turkish Fine-tuned [facebook/wav2vec2-large-xlsr-53](https://huggingface.co/facebook/wav2vec2-large-xlsr-53) in Turkish using the [Common Voice](https://huggingface.co/datasets/common_voice) When using this model, make sure that your speech input is sampled at 16kHz. ## Usage The model can be used directly (without a language model) as follows: ```python import torch import torchaudio from datasets import load_dataset from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor test_dataset = load_dataset("common_voice", "tr", split="test[:2%]"). processor = Wav2Vec2Processor.from_pretrained("patrickvonplaten/wav2vec2-large-xlsr-turkish-demo") model = Wav2Vec2ForCTC.from_pretrained("patrickvonplaten/wav2vec2-large-xlsr-turkish-demo") resampler = torchaudio.transforms.Resample(48_000, 16_000) # Preprocessing the datasets. # We need to read the aduio files as arrays def speech_file_to_array_fn(batch): speech_array, sampling_rate = torchaudio.load(batch["path"]) batch["speech"] = resampler(speech_array).squeeze().numpy() return batch test_dataset = test_dataset.map(speech_file_to_array_fn) inputs = processor(test_dataset["speech"][:2], sampling_rate=16_000, return_tensors="pt", padding=True) with torch.no_grad(): logits = model(inputs.input_values, attention_mask=inputs.attention_mask).logits predicted_ids = torch.argmax(logits, dim=-1) print("Prediction:", processor.batch_decode(predicted_ids)) print("Reference:", test_dataset["sentence"][:2]) ``` ## Evaluation The model can be evaluated as follows on the {language} test data of Common Voice. ```python import torch import torchaudio from datasets import load_dataset, load_metric from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor import re test_dataset = load_dataset("common_voice", "tr", split="test") wer = load_metric("wer") processor = Wav2Vec2Processor.from_pretrained("patrickvonplaten/wav2vec2-large-xlsr-turkish-demo") model = Wav2Vec2ForCTC.from_pretrained("patrickvonplaten/wav2vec2-large-xlsr-turkish-demo") model.to("cuda") chars_to_ignore_regex = '[\,\?\.\!\-\;\:\"\“]' resampler = torchaudio.transforms.Resample(48_000, 16_000) # Preprocessing the datasets. # We need to read the aduio files as arrays def speech_file_to_array_fn(batch): batch["sentence"] = re.sub(chars_to_ignore_regex, '', batch["sentence"]).lower() speech_array, sampling_rate = torchaudio.load(batch["path"]) batch["speech"] = resampler(speech_array).squeeze().numpy() return batch test_dataset = test_dataset.map(speech_file_to_array_fn) # Preprocessing the datasets. # We need to read the aduio files as arrays def evaluate(batch): inputs = processor(batch["speech"], sampling_rate=16_000, return_tensors="pt", padding=True) with torch.no_grad(): logits = model(inputs.input_values.to("cuda"), attention_mask=inputs.attention_mask.to("cuda")).logits pred_ids = torch.argmax(logits, dim=-1) batch["pred_strings"] = processor.batch_decode(pred_ids) return batch result = test_dataset.map(evaluate, batched=True, batch_size=8) print("WER: {:2f}".format(100 * wer.compute(predictions=result["pred_strings"], references=result["sentence"]))) ``` **Test Result**: 37.10 % ## Training The Common Voice `train`, `validation` datasets were used for training. The script used for training can be found [here](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/Fine_Tune_XLSR_Wav2Vec2_on_Turkish_ASR_with_%F0%9F%A4%97_Transformers.ipynb)
patrickvonplaten/wav2vec2_tiny_random
2021-05-04T17:48:43.000Z
[ "pytorch", "wav2vec2", "transformers" ]
[ ".gitattributes", "README.md", "config.json", "create_model_files.py", "preprocessor_config.json", "pytorch_model.bin", "run.sh", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
patrickvonplaten
48
transformers
## Test model To test this model run the following code: ```python from datasets import load_dataset from transformers import Wav2Vec2ForCTC import torchaudio import torch ds = load_dataset("patrickvonplaten/librispeech_asr_dummy", "clean", split="validation") model = Wav2Vec2ForCTC.from_pretrained("patrickvonplaten/wav2vec2_tiny_random") def load_audio(batch): batch["samples"], _ = torchaudio.load(batch["file"]) return batch ds = ds.map(load_audio) input_values = torch.nn.utils.rnn.pad_sequence([torch.tensor(x[0]) for x in ds["samples"][:10]], batch_first=True) # forward logits = model(input_values).logits pred_ids = torch.argmax(logits, dim=-1) # dummy loss dummy_labels = pred_ids.clone() dummy_labels[dummy_labels == model.config.pad_token_id] = 1 # can't have CTC blank token in label dummy_labels = dummy_labels[:, -(dummy_labels.shape[1] // 4):] # make sure labels are shorter to avoid "inf" loss (can still happen though...) loss = model(input_values, labels=dummy_labels).loss ```
patrickvonplaten/wav2vec2_tiny_random_robust
2021-05-04T17:48:58.000Z
[ "pytorch", "wav2vec2", "transformers" ]
[ ".gitattributes", "README.md", "config.json", "preprocessor_config.json", "pytorch_model.bin", "run.sh", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
patrickvonplaten
218
transformers
## Test model To test this model run the following code: ```python from datasets import load_dataset from transformers import Wav2Vec2ForCTC import torchaudio import torch ds = load_dataset("patrickvonplaten/librispeech_asr_dummy", "clean", split="validation") model = Wav2Vec2ForCTC.from_pretrained("patrickvonplaten/wav2vec2_tiny_random_robust") def load_audio(batch): batch["samples"], _ = torchaudio.load(batch["file"]) return batch ds = ds.map(load_audio) input_values = torch.nn.utils.rnn.pad_sequence([torch.tensor(x[0]) for x in ds["samples"][:10]], batch_first=True) # forward logits = model(input_values).logits pred_ids = torch.argmax(logits, dim=-1) # dummy loss dummy_labels = pred_ids.clone() dummy_labels[dummy_labels == model.config.pad_token_id] = 1 # can't have CTC blank token in label dummy_labels = dummy_labels[:, -(dummy_labels.shape[1] // 4):] # make sure labels are shorter to avoid "inf" loss (can still happen though...) loss = model(input_values, labels=dummy_labels).loss ```
patrickvonplaten/xprophetnet-decoder-clm-large-uncased
2020-10-21T10:25:04.000Z
[ "pytorch", "xlm-prophetnet", "causal-lm", "transformers", "text-generation" ]
text-generation
[ ".gitattributes", "config.json", "pytorch_model.bin" ]
patrickvonplaten
16
transformers
patrickvonplaten/xprophetnet-large-uncased-standalone
2020-10-21T10:16:36.000Z
[ "pytorch", "xlm-prophetnet", "transformers" ]
[ ".gitattributes", "config.json", "pytorch_model.bin" ]
patrickvonplaten
13
transformers
patrickvonplaten/xprophetnet-large-wiki100-cased-xglue-ntg_old
2020-10-16T13:09:59.000Z
[ "pytorch", "xlm-prophetnet", "seq2seq", "transformers", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "config.json", "prophetnet.tokenizer", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json" ]
patrickvonplaten
10
transformers
patrickvonplaten/xprophetnet-large-wiki100-cased-xglue-qg_old
2020-10-16T13:18:43.000Z
[ "pytorch", "xlm-prophetnet", "seq2seq", "transformers", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "config.json", "prophetnet.tokenizer", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json" ]
patrickvonplaten
22
transformers
patrickvonplaten/xprophetnet-large-wiki100-cased_old
2020-10-16T13:05:43.000Z
[ "pytorch", "xlm-prophetnet", "seq2seq", "transformers", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "config.json", "prophetnet.tokenizer", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json" ]
patrickvonplaten
11
transformers
paulowoicho/t5-podcast-summarisation
2020-11-11T10:15:57.000Z
[ "pytorch", "t5", "seq2seq", "[en]", "dataset:Spotify Podcasts Dataset", "arxiv:2004.04270", "arxiv:1910.10683", "transformers", "summarisation", "lm-head", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
paulowoicho
104
transformers
--- language: "[en]" datasets: - Spotify Podcasts Dataset tags: - t5 - summarisation - pytorch - lm-head metrics: - ROUGE pipeline: - summarisation --- # T5 for Automatic Podcast Summarisation This model is the result of fine-tuning [t5-base](https://huggingface.co/t5-base) on the [Spotify Podcast Dataset](https://arxiv.org/abs/2004.04270). It is based on [Google's T5](https://ai.googleblog.com/2020/02/exploring-transfer-learning-with-t5.html) which was pretrained on the [C4 dataset](https://huggingface.co/datasets/c4). Paper: [Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer](https://arxiv.org/pdf/1910.10683.pdf) Authors: Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, Peter J. Liu ## Intended uses & limitations This model is intended to be used for automatic podcast summarisation. As creator provided descriptions were used for training, the model also learned to generate promotional material (links, hashtags, etc) in its summaries, as such some post processing may be required on the model's outputs. If using on Colab, the instance will crash if the number of tokens in the transcript exceeds 7000. I discovered that the model generated reasonable summaries even when the podcast transcript was truncated to reduce the number of tokens. #### How to use The model can be used with the summarisation as follows: ```python from transformers import pipeline summarizer = pipeline("summarization", model="paulowoicho/t5-podcast-summarisation", tokenizer="paulowoicho/t5-podcast-summarisation") summary = summarizer(podcast_transcript, min_length=5, max_length=20) print(summary[0]['summary_text']) ``` ## Training data This model is the result of fine-tuning [t5-base](https://huggingface.co/t5-base) on the [Spotify Podcast Dataset](https://arxiv.org/abs/2004.04270). [Pre-processing](https://github.com/paulowoicho/msc_project/blob/master/reformat.py) was done on the original data before fine-tuning. ## Training procedure Training was largely based on [Fine-tune T5 for Summarization](https://github.com/abhimishra91/transformers-tutorials/blob/master/transformers_summarization_wandb.ipynb) by [Abhishek Kumar Mishra](https://github.com/abhimishra91)
pavanchhatpar/electra-base-sentence-splitter
2020-07-06T22:01:57.000Z
[ "tf", "electra", "pretraining", "transformers" ]
[ ".gitattributes", "config.json", "special_tokens_map.json", "tf_model.h5", "tokenizer_config.json", "vocab.txt" ]
pavanchhatpar
14
transformers
pbmstrk/t5-large-arxiv-abstract-title
2020-11-23T15:57:50.000Z
[ "pytorch", "tf", "t5", "seq2seq", "transformers", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tf_model.h5", "tokenizer_config.json" ]
pbmstrk
66
transformers
pbmstrk/t5-large-arxiv-title-abstract
2020-11-28T12:42:05.000Z
[ "pytorch", "tf", "t5", "seq2seq", "transformers", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tf_model.h5", "tokenizer_config.json" ]
pbmstrk
37
transformers
pchanda/pretrained-smiles-pubchem10m
2021-05-20T13:01:15.000Z
[ "pytorch", "roberta", "masked-lm", "transformers", "fill-mask" ]
fill-mask
[ ".gitattributes", "README.md", "config.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "trainer_state.json", "training_args.bin", "vocab.json" ]
pchanda
27
transformers
model pretrained on 10m smiles from pubchem.
pcuenq/wav2vec2-large-xlsr-53-es
2021-03-28T19:06:18.000Z
[ "pytorch", "wav2vec2", "es", "dataset:common_voice", "transformers", "audio", "automatic-speech-recognition", "speech", "xlsr-fine-tuning-week", "license:apache-2.0" ]
automatic-speech-recognition
[ ".gitattributes", "README.md", "config.json", "preprocessor_config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
pcuenq
277
transformers
--- language: es datasets: - common_voice metrics: - wer tags: - audio - automatic-speech-recognition - speech - xlsr-fine-tuning-week license: apache-2.0 model-index: - name: XLSR Wav2Vec2 Large 53 Spanish by pcuenq results: - task: name: Speech Recognition type: automatic-speech-recognition dataset: name: Common Voice es type: common_voice args: es metrics: - name: Test WER type: wer value: 10.50 --- # Wav2Vec2-Large-XLSR-53-Spanish Fine-tuned [facebook/wav2vec2-large-xlsr-53](https://huggingface.co/facebook/wav2vec2-large-xlsr-53) on Spanish using the [Common Voice](https://huggingface.co/datasets/common_voice) dataset{s}. When using this model, make sure that your speech input is sampled at 16kHz. ## Usage The model can be used directly (without a language model) as follows: ```python import torch import torchaudio from datasets import load_dataset from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor test_dataset = load_dataset("common_voice", "es", split="test[:2%]") processor = Wav2Vec2Processor.from_pretrained("pcuenq/wav2vec2-large-xlsr-53-es") model = Wav2Vec2ForCTC.from_pretrained("pcuenq/wav2vec2-large-xlsr-53-es") resampler = torchaudio.transforms.Resample(48_000, 16_000) # Preprocessing the datasets. # We need to read the audio files as arrays def speech_file_to_array_fn(batch): speech_array, sampling_rate = torchaudio.load(batch["path"]) batch["speech"] = resampler(speech_array).squeeze().numpy() return batch test_dataset = test_dataset.map(speech_file_to_array_fn) inputs = processor(test_dataset["speech"][:2], sampling_rate=16_000, return_tensors="pt", padding=True) with torch.no_grad(): logits = model(inputs.input_values, attention_mask=inputs.attention_mask).logits predicted_ids = torch.argmax(logits, dim=-1) print("Prediction:", processor.batch_decode(predicted_ids)) print("Reference:", test_dataset["sentence"][:2]) ``` ## Evaluation The model can be evaluated as follows on the Spanish test data of Common Voice. ```python import torch import torchaudio from datasets import load_dataset, load_metric from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor import re test_dataset = load_dataset("common_voice", "es", split="test") wer = load_metric("wer") processor = Wav2Vec2Processor.from_pretrained("pcuenq/wav2vec2-large-xlsr-53-es") model = Wav2Vec2ForCTC.from_pretrained("pcuenq/wav2vec2-large-xlsr-53-es") model.to("cuda") ## Text pre-processing chars_to_ignore_regex = '[\,\¿\?\.\¡\!\-\;\:\"\“\%\‘\”\\…\’\ː\'\‹\›\`\´\®\—\→]' chars_to_ignore_pattern = re.compile(chars_to_ignore_regex) def remove_special_characters(batch): batch["sentence"] = chars_to_ignore_pattern.sub('', batch["sentence"]).lower() + " " return batch def replace_diacritics(batch): sentence = batch["sentence"] sentence = re.sub('ì', 'í', sentence) sentence = re.sub('ù', 'ú', sentence) sentence = re.sub('ò', 'ó', sentence) sentence = re.sub('à', 'á', sentence) batch["sentence"] = sentence return batch def replace_additional(batch): sentence = batch["sentence"] sentence = re.sub('ã', 'a', sentence) # Portuguese, as in São Paulo sentence = re.sub('ō', 'o', sentence) # Japanese sentence = re.sub('ê', 'e', sentence) # Português batch["sentence"] = sentence return batch ## Audio pre-processing # I tried to perform the resampling using a `torchaudio` `Resampler` transform, # but found that the process deadlocked when using multiple processes. # Perhaps my torchaudio is using the wrong sox library under the hood, I'm not sure. # Fortunately, `librosa` seems to work fine, so that's what I'll use for now. import librosa def speech_file_to_array_fn(batch): speech_array, sample_rate = torchaudio.load(batch["path"]) batch["speech"] = librosa.resample(speech_array.squeeze().numpy(), sample_rate, 16_000) return batch # One-pass mapping function # Text transformation and audio resampling def cv_prepare(batch): batch = remove_special_characters(batch) batch = replace_diacritics(batch) batch = replace_additional(batch) batch = speech_file_to_array_fn(batch) return batch # Number of CPUs or None num_proc = 16 test_dataset = test_dataset.map(cv_prepare, remove_columns=['path'], num_proc=num_proc) def evaluate(batch): inputs = processor(batch["speech"], sampling_rate=16_000, return_tensors="pt", padding=True) with torch.no_grad(): logits = model(inputs.input_values.to("cuda"), attention_mask=inputs.attention_mask.to("cuda")).logits pred_ids = torch.argmax(logits, dim=-1) batch["pred_strings"] = processor.batch_decode(pred_ids) return batch result = test_dataset.map(evaluate, batched=True, batch_size=8) # WER Metric computation # `wer.compute` crashes in my computer with more than ~10000 samples. # Until I confirm in a different one, I created a "chunked" version of the computation. # It gives the same results as `wer.compute` for smaller datasets. import jiwer def chunked_wer(targets, predictions, chunk_size=None): if chunk_size is None: return jiwer.wer(targets, predictions) start = 0 end = chunk_size H, S, D, I = 0, 0, 0, 0 while start < len(targets): chunk_metrics = jiwer.compute_measures(targets[start:end], predictions[start:end]) H = H + chunk_metrics["hits"] S = S + chunk_metrics["substitutions"] D = D + chunk_metrics["deletions"] I = I + chunk_metrics["insertions"] start += chunk_size end += chunk_size return float(S + D + I) / float(H + S + D) print("WER: {:2f}".format(100 * chunked_wer(result["sentence"], result["pred_strings"], chunk_size=4000))) #print("WER: {:2f}".format(100 * wer.compute(predictions=result["pred_strings"], references=result["sentence"]))) ``` **Test Result**: 10.50 % ## Text processing The Common Voice `es` dataset has a lot of characters that don't belong to the Spanish language, even after discarding separators and punctuators. I made some translations and discarded most of the extraneous characters. I decided to keep all the Spanish language diacritics. This is a difficult decision. Some times the diacritics are added just because of ortography rules, but they don't alter the meaning of the word. In other cases, however, the diacritics carry meaning, as they disambiguate among different senses. A better WER score would surely have been achieved using just the non-accented characters, and the resulting text would be understood by Spanish speakers. Nevertheless, I think keeping them is "more correct". All the rules I applied are shown in the evaluation script. ## Training The Common Voice `train` and `validation` datasets were used for training. For dataset handling reasons, I initially split `train`+`validation` in 10% splits so I could see progress earlier and react if needed. * I trained for 30 epochs on the first split only, using similar values as the ones proposed by Patrick in his demo notebook. I used a batch_size of 24 with 2 gradient accumulation steps. This gave a WER of about 16.3%on the full test set. * I then trained the resulting model on the 9 remaining splits, for 3 epochs each, but with a faster warmup of 75 steps. * Next, I trained 3 epochs on each of the 10 splits using a smaller learning rate of `1e-4`. A warmup of 75 steps was used in this case too. The final model had a WER of about 11.7%. * By this time we had already figured out the reason for the initial delay in training time, and I decided to use the full dataset for training. However, in my tests I had seen that varying the learning rate seemed to work well, so I wanted to replicate that. I selected a cosine schedule with hard restarts, a reference learning rate of `3e-5` and 10 epochs. I configured the cosine schedule to have 10 cycles too, and used no warmup. This produced a WER of ~10.5%. ## Other things I tried * Starting from the same fine-tuned model, I compared a constant lr of 1e-4 against a linear schedule with warmup. The linear schedule worked better (11.85 vs 12.72 WER%). * I tried to use a Spanish model to improve a Basque one. I transformed the text to make ortography more similar to the target language, but the Basque model did not improve. * Label smoothing did not work. ## Issues and other technical challenges I had previously used the `transformers` library as an end user, just to try Bert on some tasks, but this is the first time I have needed to look into the code. * The `Datasets` abstraction is great because, being based on memory-mapped files, it allows arbitrarily-sized datasets to be processed. However, it is important to understand its limitations and trade-offs. I found caching convenient, but disk usage explodes fast. I keep the datasets for my current projects in a 1 TB, fast SSD disk, and a couple of times I ran out of space. I had to understand how cache files are stored and learn when it's best to disable caching and manually save when you need to. I found that data exploration is better suited for smaller datasets or sampled ones, but actual processing is most efficient when you have identified the transformations you need and apply them in a single `map` operation. * There was a noticeable delay before training started. Fortunately, we found the reason why, discussed it in Slack and the forums and created a workaround. * The WER metric crashed on large datasets. I evaluated on a small sample (also, it's faster) and wrote an accumulative version of wer that runs on fixed memory. I'd like to verify whether this change makes sense to be used inside the training loop. * `torchaudio` deadlocks when using multiple processes. `librosa` works fine. To be investigated. * When using `num_proc` inside a notebook, I could not see progress bars. This is surely some permissions issue in my computer. I still need to find it out.
pcuenq/wav2vec2-large-xlsr-53-eu
2021-03-28T19:35:49.000Z
[ "pytorch", "wav2vec2", "eu", "dataset:common_voice", "transformers", "audio", "automatic-speech-recognition", "speech", "xlsr-fine-tuning-week", "license:apache-2.0" ]
automatic-speech-recognition
[ ".gitattributes", "README.md", "config.json", "preprocessor_config.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
pcuenq
14
transformers
--- language: eu datasets: - common_voice metrics: - wer tags: - audio - automatic-speech-recognition - speech - xlsr-fine-tuning-week license: apache-2.0 model-index: - name: XLSR Wav2Vec2 Large 53 Basque by pcuenq results: - task: name: Speech Recognition type: automatic-speech-recognition dataset: name: Common Voice eu type: common_voice args: eu metrics: - name: Test WER type: wer value: 15.34 --- # Wav2Vec2-Large-XLSR-53-EU Fine-tuned [facebook/wav2vec2-large-xlsr-53](https://huggingface.co/facebook/wav2vec2-large-xlsr-53) on Basque using the [Common Voice](https://huggingface.co/datasets/common_voice) dataset. When using this model, make sure that your speech input is sampled at 16kHz. ## Usage The model can be used directly (without a language model) as follows: ```python import torch import torchaudio from datasets import load_dataset from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor test_dataset = load_dataset("common_voice", "eu", split="test[:2%]") processor = Wav2Vec2Processor.from_pretrained("pcuenq/wav2vec2-large-xlsr-53-eu") model = Wav2Vec2ForCTC.from_pretrained("pcuenq/wav2vec2-large-xlsr-53-eu") resampler = torchaudio.transforms.Resample(48_000, 16_000) # Preprocessing the datasets. # We need to read the audio files as arrays def speech_file_to_array_fn(batch): speech_array, sampling_rate = torchaudio.load(batch["path"]) batch["speech"] = resampler(speech_array).squeeze().numpy() return batch test_dataset = test_dataset.map(speech_file_to_array_fn) inputs = processor(test_dataset["speech"][:2], sampling_rate=16_000, return_tensors="pt", padding=True) with torch.no_grad(): logits = model(inputs.input_values, attention_mask=inputs.attention_mask).logits predicted_ids = torch.argmax(logits, dim=-1) print("Prediction:", processor.batch_decode(predicted_ids)) print("Reference:", test_dataset["sentence"][:2]) ``` ## Evaluation The model can be evaluated as follows on the Basque test data of Common Voice. ```python import torch import torchaudio from datasets import load_dataset, load_metric from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor import re test_dataset = load_dataset("common_voice", "eu", split="test") wer = load_metric("wer") model_name = "pcuenq/wav2vec2-large-xlsr-53-eu" processor = Wav2Vec2Processor.from_pretrained(model_name) model = Wav2Vec2ForCTC.from_pretrained(model_name) model.to("cuda") ## Text pre-processing chars_to_ignore_regex = '[\,\¿\?\.\¡\!\-\;\:\"\“\%\‘\”\\…\’\ː\'\‹\›\`\´\®\—\→]' chars_to_ignore_pattern = re.compile(chars_to_ignore_regex) def remove_special_characters(batch): batch["sentence"] = chars_to_ignore_pattern.sub('', batch["sentence"]).lower() + " " return batch ## Audio pre-processing import librosa def speech_file_to_array_fn(batch): speech_array, sample_rate = torchaudio.load(batch["path"]) batch["speech"] = librosa.resample(speech_array.squeeze().numpy(), sample_rate, 16_000) return batch # Text transformation and audio resampling def cv_prepare(batch): batch = remove_special_characters(batch) batch = speech_file_to_array_fn(batch) return batch # Number of CPUs or None num_proc = 16 test_dataset = test_dataset.map(cv_prepare, remove_columns=['path'], num_proc=num_proc) def evaluate(batch): inputs = processor(batch["speech"], sampling_rate=16_000, return_tensors="pt", padding=True) with torch.no_grad(): logits = model(inputs.input_values.to("cuda"), attention_mask=inputs.attention_mask.to("cuda")).logits pred_ids = torch.argmax(logits, dim=-1) batch["pred_strings"] = processor.batch_decode(pred_ids) return batch result = test_dataset.map(evaluate, batched=True, batch_size=8) # WER Metric computation print("WER: {:2f}".format(100 * wer.compute(predictions=result["pred_strings"], references=result["sentence"]))) ``` **Test Result**: 15.34 % ## Training The Common Voice `train` and `validation` datasets were used for training. Training was performed for 22 + 20 epochs with the following parameters: - Batch size 16, 2 gradient accumulation steps. - Learning rate: 2.5e-4 - Activation dropout: 0.05 - Attention dropout: 0.1 - Hidden dropout: 0.05 - Feature proj. dropout: 0.05 - Mask time probability: 0.08 - Layer dropout: 0.05
pdelobelle/robBERT-base
2021-05-20T19:16:19.000Z
[ "pytorch", "jax", "roberta", "masked-lm", "transformers", "fill-mask" ]
fill-mask
[ ".gitattributes", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "vocab.json" ]
pdelobelle
171
transformers
pdelobelle/robBERT-dutch-books
2021-05-20T19:17:17.000Z
[ "pytorch", "jax", "roberta", "masked-lm", "transformers", "fill-mask" ]
fill-mask
[ ".gitattributes", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "vocab.json" ]
pdelobelle
35
transformers
pdelobelle/robbert-v2-dutch-base
2021-05-20T19:20:49.000Z
[ "pytorch", "tf", "jax", "roberta", "masked-lm", "nl", "dataset:oscar", "dataset:oscar (NL)", "dataset:dbrd", "dataset:lassy-ud", "dataset:europarl-mono", "dataset:conll2002", "arxiv:2001.06286", "arxiv:2004.02814", "arxiv:2010.13652", "arxiv:2101.05716", "arxiv:1907.11692", "arxiv:2001.02943", "arxiv:1909.11942", "transformers", "Dutch", "Flemish", "RoBERTa", "RobBERT", "license:mit", "fill-mask" ]
fill-mask
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tf_model.h5", "tokenizer.json", "tokenizer_config.json", "vocab.json" ]
pdelobelle
40,665
transformers
--- language: "nl" thumbnail: "https://github.com/iPieter/RobBERT/raw/master/res/robbert_logo.png" tags: - Dutch - Flemish - RoBERTa - RobBERT license: mit datasets: - oscar - oscar (NL) - dbrd - lassy-ud - europarl-mono - conll2002 widget: - text: "Hallo, ik ben RobBERT, een <mask> taalmodel van de KU Leuven." --- <p align="center"> <img src="https://github.com/iPieter/RobBERT/raw/master/res/robbert_logo_with_name.png" alt="RobBERT: A Dutch RoBERTa-based Language Model" width="75%"> </p> # RobBERT: Dutch RoBERTa-based Language Model. [RobBERT](https://github.com/iPieter/RobBERT) is the state-of-the-art Dutch BERT model. It is a large pre-trained general Dutch language model that can be fine-tuned on a given dataset to perform any text classification, regression or token-tagging task. As such, it has been successfully used by many [researchers](https://scholar.google.com/scholar?oi=bibs&hl=en&cites=7180110604335112086) and [practitioners](https://huggingface.co/models?search=robbert) for achieving state-of-the-art performance for a wide range of Dutch natural language processing tasks, including: - [Emotion detection](https://www.aclweb.org/anthology/2021.wassa-1.27/) - Sentiment analysis ([book reviews](https://arxiv.org/pdf/2001.06286.pdf), [news articles](https://biblio.ugent.be/publication/8704637/file/8704638.pdf)*) - [Coreference resolution](https://arxiv.org/pdf/2001.06286.pdf) - Named entity recognition ([CoNLL](https://arxiv.org/pdf/2001.06286.pdf), [job titles](https://arxiv.org/pdf/2004.02814.pdf)*, [SoNaR](https://github.com/proycon/deepfrog)) - Part-of-speech tagging ([Small UD Lassy](https://arxiv.org/pdf/2001.06286.pdf), [CGN](https://github.com/proycon/deepfrog)) - [Zero-shot word prediction](https://arxiv.org/pdf/2001.06286.pdf) - [Humor detection](https://arxiv.org/pdf/2010.13652.pdf) - [Cyberbulling detection](https://www.cambridge.org/core/journals/natural-language-engineering/article/abs/automatic-classification-of-participant-roles-in-cyberbullying-can-we-detect-victims-bullies-and-bystanders-in-social-media-text/A2079C2C738C29428E666810B8903342) - [Correcting dt-spelling mistakes](https://gitlab.com/spelfouten/dutch-simpletransformers/)* and also achieved outstanding, near-sota results for: - [Natural language inference](https://arxiv.org/pdf/2101.05716.pdf)* - [Review classification](https://medium.com/broadhorizon-cmotions/nlp-with-r-part-5-state-of-the-art-in-nlp-transformers-bert-3449e3cd7494)* \\* *Note that several evaluations use RobBERT-v1, and that the second and improved RobBERT-v2 outperforms this first model on everything we tested* *(Also note that this list is not exhaustive. If you used RobBERT for your application, we are happy to know about it! Send us a mail, or add it yourself to this list by sending a pull request with the edit!)* More in-depth information about RobBERT can be found in our [blog post](https://people.cs.kuleuven.be/~pieter.delobelle/robbert/), [our paper](https://arxiv.org/abs/2001.06286) and [the RobBERT Github repository](https://github.com/iPieter/RobBERT) ## How to use RobBERT uses the [RoBERTa](https://arxiv.org/abs/1907.11692) architecture and pre-training but with a Dutch tokenizer and training data. RoBERTa is the robustly optimized English BERT model, making it even more powerful than the original BERT model. Given this same architecture, RobBERT can easily be finetuned and inferenced using [code to finetune RoBERTa](https://huggingface.co/transformers/model_doc/roberta.html) models and most code used for BERT models, e.g. as provided by [HuggingFace Transformers](https://huggingface.co/transformers/) library. By default, RobBERT has the masked language model head used in training. This can be used as a zero-shot way to fill masks in sentences. It can be tested out for free on [RobBERT's Hosted infererence API of Huggingface](https://huggingface.co/pdelobelle/robbert-v2-dutch-base?text=De+hoofdstad+van+Belgi%C3%AB+is+%3Cmask%3E.). You can also create a new prediction head for your own task by using any of HuggingFace's [RoBERTa-runners](https://huggingface.co/transformers/v2.7.0/examples.html#language-model-training), [their fine-tuning notebooks](https://huggingface.co/transformers/v4.1.1/notebooks.html) by changing the model name to `pdelobelle/robbert-v2-dutch-base`, or use the original fairseq [RoBERTa](https://github.com/pytorch/fairseq/tree/master/examples/roberta) training regimes. Use the following code to download the base model and finetune it yourself, or use one of our finetuned models (documented on [our project site](https://people.cs.kuleuven.be/~pieter.delobelle/robbert/)). ```python from transformers import RobertaTokenizer, RobertaForSequenceClassification tokenizer = RobertaTokenizer.from_pretrained("pdelobelle/robbert-v2-dutch-base") model = RobertaForSequenceClassification.from_pretrained("pdelobelle/robbert-v2-dutch-base") ``` Starting with `transformers v2.4.0` (or installing from source), you can use AutoTokenizer and AutoModel. You can then use most of [HuggingFace's BERT-based notebooks](https://huggingface.co/transformers/v4.1.1/notebooks.html) for finetuning RobBERT on your type of Dutch language dataset. ## Technical Details From The Paper ### Our Performance Evaluation Results All experiments are described in more detail in our [paper](https://arxiv.org/abs/2001.06286), with the code in [our GitHub repository](https://github.com/iPieter/RobBERT). ### Sentiment analysis Predicting whether a review is positive or negative using the [Dutch Book Reviews Dataset](https://github.com/benjaminvdb/110kDBRD). | Model | Accuracy [%] | |-------------------|--------------------------| | ULMFiT | 93.8 | | BERTje | 93.0 | | RobBERT v2 | **95.1** | ### Die/Dat (coreference resolution) We measured how well the models are able to do coreference resolution by predicting whether "die" or "dat" should be filled into a sentence. For this, we used the [EuroParl corpus](https://www.statmt.org/europarl/). #### Finetuning on whole dataset | Model | Accuracy [%] | F1 [%] | |-------------------|--------------------------|--------------| | [Baseline](https://arxiv.org/abs/2001.02943) (LSTM) | | 75.03 | | mBERT | 98.285 | 98.033 | | BERTje | 98.268 | 98.014 | | RobBERT v2 | **99.232** | **99.121** | #### Finetuning on 10K examples We also measured the performance using only 10K training examples. This experiment clearly illustrates that RobBERT outperforms other models when there is little data available. | Model | Accuracy [%] | F1 [%] | |-------------------|--------------------------|--------------| | mBERT | 92.157 | 90.898 | | BERTje | 93.096 | 91.279 | | RobBERT v2 | **97.816** | **97.514** | #### Using zero-shot word masking task Since BERT models are pre-trained using the word masking task, we can use this to predict whether "die" or "dat" is more likely. This experiment shows that RobBERT has internalised more information about Dutch than other models. | Model | Accuracy [%] | |-------------------|--------------------------| | ZeroR | 66.70 | | mBERT | 90.21 | | BERTje | 94.94 | | RobBERT v2 | **98.75** | ### Part-of-Speech Tagging. Using the [Lassy UD dataset](https://universaldependencies.org/treebanks/nl_lassysmall/index.html). | Model | Accuracy [%] | |-------------------|--------------------------| | Frog | 91.7 | | mBERT | **96.5** | | BERTje | 96.3 | | RobBERT v2 | 96.4 | Interestingly, we found that when dealing with **small data sets**, RobBERT v2 **significantly outperforms** other models. <p align="center"> <img src="https://github.com/iPieter/RobBERT/raw/master/res/robbert_pos_accuracy.png" alt="RobBERT's performance on smaller datasets"> </p> ### Named Entity Recognition Using the [CoNLL 2002 evaluation script](https://www.clips.uantwerpen.be/conll2002/ner/). | Model | Accuracy [%] | |-------------------|--------------------------| | Frog | 57.31 | | mBERT | **90.94** | | BERT-NL | 89.7 | | BERTje | 88.3 | | RobBERT v2 | 89.08 | ## Pre-Training Procedure Details We pre-trained RobBERT using the RoBERTa training regime. We pre-trained our model on the Dutch section of the [OSCAR corpus](https://oscar-corpus.com/), a large multilingual corpus which was obtained by language classification in the Common Crawl corpus. This Dutch corpus is 39GB large, with 6.6 billion words spread over 126 million lines of text, where each line could contain multiple sentences, thus using more data than concurrently developed Dutch BERT models. RobBERT shares its architecture with [RoBERTa's base model](https://github.com/pytorch/fairseq/tree/master/examples/roberta), which itself is a replication and improvement over BERT. Like BERT, it's architecture consists of 12 self-attention layers with 12 heads with 117M trainable parameters. One difference with the original BERT model is due to the different pre-training task specified by RoBERTa, using only the MLM task and not the NSP task. During pre-training, it thus only predicts which words are masked in certain positions of given sentences. The training process uses the Adam optimizer with polynomial decay of the learning rate l_r=10^-6 and a ramp-up period of 1000 iterations, with hyperparameters beta_1=0.9 and RoBERTa's default beta_2=0.98. Additionally, a weight decay of 0.1 and a small dropout of 0.1 helps prevent the model from overfitting. RobBERT was trained on a computing cluster with 4 Nvidia P100 GPUs per node, where the number of nodes was dynamically adjusted while keeping a fixed batch size of 8192 sentences. At most 20 nodes were used (i.e. 80 GPUs), and the median was 5 nodes. By using gradient accumulation, the batch size could be set independently of the number of GPUs available, in order to maximally utilize the cluster. Using the [Fairseq library](https://github.com/pytorch/fairseq/tree/master/examples/roberta), the model trained for two epochs, which equals over 16k batches in total, which took about three days on the computing cluster. In between training jobs on the computing cluster, 2 Nvidia 1080 Ti's also covered some parameter updates for RobBERT v2. ## Investigating Limitations and Bias In the [RobBERT paper](https://arxiv.org/abs/2001.06286), we also investigated potential sources of bias in RobBERT. We found that the zeroshot model estimates the probability of *hij* (he) to be higher than *zij* (she) for most occupations in bleached template sentences, regardless of their actual job gender ratio in reality. <p align="center"> <img src="https://github.com/iPieter/RobBERT/raw/master/res/gender_diff.png" alt="RobBERT's performance on smaller datasets"> </p> By augmenting the DBRB Dutch Book sentiment analysis dataset with the stated gender of the author of the review, we found that highly positive reviews written by women were generally more accurately detected by RobBERT as being positive than those written by men. <p align="center"> <img src="https://github.com/iPieter/RobBERT/raw/master/res/dbrd.png" alt="RobBERT's performance on smaller datasets"> </p> ## How to Replicate Our Paper Experiments Replicating our paper experiments is [described in detail on teh RobBERT repository README](https://github.com/iPieter/RobBERT#how-to-replicate-our-paper-experiments). ## Name Origin of RobBERT Most BERT-like models have the word *BERT* in their name (e.g. [RoBERTa](https://huggingface.co/transformers/model_doc/roberta.html), [ALBERT](https://arxiv.org/abs/1909.11942), [CamemBERT](https://camembert-model.fr/), and [many, many others](https://huggingface.co/models?search=bert)). As such, we queried our newly trained model using its masked language model to name itself *\\<mask\\>bert* using [all](https://huggingface.co/pdelobelle/robbert-v2-dutch-base?text=Mijn+naam+is+%3Cmask%3Ebert.) [kinds](https://huggingface.co/pdelobelle/robbert-v2-dutch-base?text=Hallo%2C+ik+ben+%3Cmask%3Ebert.) [of](https://huggingface.co/pdelobelle/robbert-v2-dutch-base?text=Leuk+je+te+ontmoeten%2C+ik+heet+%3Cmask%3Ebert.) [prompts](https://huggingface.co/pdelobelle/robbert-v2-dutch-base?text=Niemand+weet%2C+niemand+weet%2C+dat+ik+%3Cmask%3Ebert+heet.), and it consistently called itself RobBERT. We thought it was really quite fitting, given that RobBERT is a [*very* Dutch name](https://en.wikipedia.org/wiki/Robbert) *(and thus clearly a Dutch language model)*, and additionally has a high similarity to its root architecture, namely [RoBERTa](https://huggingface.co/transformers/model_doc/roberta.html). Since *"rob"* is a Dutch words to denote a seal, we decided to draw a seal and dress it up like [Bert from Sesame Street](https://muppet.fandom.com/wiki/Bert) for the [RobBERT logo](https://github.com/iPieter/RobBERT/blob/master/res/robbert_logo.png). ## Credits and citation This project is created by [Pieter Delobelle](https://people.cs.kuleuven.be/~pieter.delobelle), [Thomas Winters](https://thomaswinters.be) and [Bettina Berendt](https://people.cs.kuleuven.be/~bettina.berendt/). If you would like to cite our paper or model, you can use the following BibTeX: ``` @inproceedings{delobelle2020robbert, title = "{R}ob{BERT}: a {D}utch {R}o{BERT}a-based {L}anguage {M}odel", author = "Delobelle, Pieter and Winters, Thomas and Berendt, Bettina", booktitle = "Findings of the Association for Computational Linguistics: EMNLP 2020", month = nov, year = "2020", address = "Online", publisher = "Association for Computational Linguistics", url = "https://www.aclweb.org/anthology/2020.findings-emnlp.292", doi = "10.18653/v1/2020.findings-emnlp.292", pages = "3255--3265" } ```
pdelobelle/robbert-v2-dutch-ner
2021-05-20T19:22:04.000Z
[ "pytorch", "jax", "roberta", "token-classification", "transformers" ]
token-classification
[ ".gitattributes", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
pdelobelle
203
transformers
pearsonkyle/gpt2-exomachina
2021-05-23T10:57:32.000Z
[ "pytorch", "jax", "gpt2", "lm-head", "causal-lm", "transformers", "text-generation" ]
text-generation
[ ".gitattributes", "README.md", "config.json", "exoplanet_keywords.png", "flax_model.msgpack", "merges.txt", "optimizer.pt", "pytorch_model.bin", "scheduler.pt", "special_tokens_map.json", "tokenizer_config.json", "trainer_state.json", "training_args.bin", "vocab.json" ]
pearsonkyle
31
transformers
# Exo-Machina A deep language model, GPT-2, is trained on scientific manuscripts from NASA's Astrophysical Data System pertaining to extrasolar planets and the references therein. This pilot study uses the abstracts of each article as training data in order to explore correlations in scientific literature from a language perspective. A language model is a mathematical representation for an algorithm used to generate sequences in the same way a human would to form sentances. Each word or letter in a sentance is encoded to a numerical value (e.g. using word2vec) and is appended to a list forming sequences that represent up to a paragraph worth of text. The sequences are fed into the [GPT-2](https://openai.com/blog/better-language-models/) 117M model and trained for 500,000 steps with fine tuning. After training, the language model is used to generate new text from scratch and from user input. - ### [Browse samples](https://pearsonkyle.github.io/Exo-Machina/) - ### [Train a model on Google Colab](https://colab.research.google.com/drive/1Pur0rFi5YVdn7axYRacXWFMic4NxRexV?usp=sharing) ### Get started fast: ```python from transformers import pipeline exo = pipeline('text-generation',model='pearsonkyle/gpt2-exomachina', tokenizer='gpt2', config={'max_length':1600}) machina = lambda text: exo(text)[0]['generated_text'] print(machina("Transiting exoplanets are")) ``` ## Training Samples ~40,000 Abstracts from NASA's Astrophysical data system (ADS) and ArXiv. ![](https://huggingface.co/pearsonkyle/gpt2-exomachina/raw/main/exoplanet_keywords.png) A few generated samples are below: - *We can remotely sense an atmosphere by observing its reflected, transmitted, or emitted light in varying geometries. This light will contain information on the planetary conditions including* `temperature, pressure, composition, and cloud optical thickness. One such property that is important is...` - *The reflectance of Earth's vegetation suggests* `that large, deciduous forest fires are composed of mostly dry, unprocessed material that is distributed in a nearly patchy fashion. The distributions of these fires are correlated with temperature, and also with vegetation...` - *Directly imaged exoplanets probe* `key aspects of planet formation and evolution theory, as well as atmospheric and interior physics. These insights have led to numerous direct imaging instruments for exoplanets, many using polarimetry. However, current instruments take` Letting the scrape run for ~2 hours found articles from these publications: ``` 5364 - The Astrophysical Journal 3365 - Astronomy and Astrophysics 2704 - Monthly Notices of the Royal Astronomical Society 1355 - The Astronomical Journal 617 - arXiv e-prints 498 - Icarus 388 - Publications of the Astronomical Society of the Pacific 324 - The Astrophysical Journal Supplement Series 245 - Nature 187 - Journal of Geophysical Research 167 - Science 145 - Astronomische Nachrichten 129 - Planetary and Space Science 114 - Space Science Reviews 109 - Geophysical Research Letters ```
pedropei/live-demo-question-intimacy
2021-05-20T19:23:45.000Z
[ "pytorch", "jax", "roberta", "text-classification", "transformers" ]
text-classification
[ ".gitattributes", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
pedropei
17
transformers
pedropei/question-intimacy
2021-05-20T19:25:02.000Z
[ "pytorch", "jax", "roberta", "text-classification", "en", "transformers" ]
text-classification
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
pedropei
37
transformers
--- language: - en inference: false ---
pelican/COMP0087_GPT2
2021-05-30T16:43:54.000Z
[ "pytorch", "gpt2", "lm-head", "causal-lm", "transformers", "text-generation" ]
text-generation
[ ".gitattributes", "added_tokens.json", "config.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
pelican
47
transformers
pelican/COMP0087_GPT2_tokenizer
2021-05-30T16:32:27.000Z
[ "pytorch", "gpt2", "lm-head", "causal-lm", "transformers", "text-generation" ]
text-generation
[ ".gitattributes", "config.json", "pytorch_model.bin" ]
pelican
16
transformers
peril10/Pypinion
2021-05-20T19:26:01.000Z
[ "pytorch", "jax", "roberta", "text-classification", "transformers" ]
text-classification
[ ".gitattributes", "config.json", "eval_results.txt", "flax_model.msgpack", "merges.txt", "model_args.json", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.json" ]
peril10
30
transformers
peril10/play_time
2021-05-23T10:58:48.000Z
[ "pytorch", "tf", "jax", "gpt2", "lm-head", "causal-lm", "transformers", "text-generation" ]
text-generation
[ ".gitattributes", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "tf_model.h5", "tokenizer_config.json", "vocab.json" ]
peril10
37
transformers
persiannlp/mbert-base-parsinlu-entailment
2021-05-20T02:19:08.000Z
[ "pytorch", "jax", "bert", "text-classification", "fa", "multilingual", "dataset:parsinlu", "transformers", "entailment", "parsbert", "persian", "farsi", "license:cc by-nc-sa 4.0" ]
text-classification
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.txt" ]
persiannlp
39
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - entailment - parsbert - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu metrics: - accuracy --- # Textual Entailment (مدل برای پاسخ به استلزام منطقی) This is a model for textual entailment problems. Here is an example of how you can run this model: ```python import torch from transformers import AutoModelForSequenceClassification, AutoTokenizer import numpy as np labels = ["entails", "contradicts", "neutral"] model_name_or_path = "persiannlp/mbert-base-parsinlu-entailment" model = AutoModelForSequenceClassification.from_pretrained(model_name_or_path) tokenizer = AutoTokenizer.from_pretrained(model_name_or_path,) def model_predict(text_a, text_b): features = tokenizer( [(text_a, text_b)], padding="max_length", truncation=True, return_tensors='pt') output = model(**features) logits = output[0] probs = torch.nn.functional.softmax(logits, dim=1).tolist() idx = np.argmax(np.array(probs)) print(labels[idx], probs) model_predict( "این مسابقات بین آوریل و دسامبر در هیپودروم ولیفندی در نزدیکی باکرکی ، ۱۵ کیلومتری (۹ مایل) غرب استانبول برگزار می شود.", "در ولیفندی هیپودروم، مسابقاتی از آوریل تا دسامبر وجود دارد." ) model_predict( "آیا کودکانی وجود دارند که نیاز به سرگرمی دارند؟", "هیچ کودکی هرگز نمی خواهد سرگرم شود.", ) model_predict( "ما به سفرهایی رفته ایم که در نهرهایی شنا کرده ایم", "علاوه بر استحمام در نهرها ، ما به اسپا ها و سونا ها نیز رفته ایم." ) ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mbert-base-parsinlu-multiple-choice
2021-05-20T02:22:43.000Z
[ "pytorch", "jax", "bert", "multiple-choice", "fa", "multilingual", "dataset:parsinlu", "transformers", "mbert", "persian", "farsi", "license:cc by-nc-sa 4.0", "text-classification", "pipeline_tag:text-classification" ]
text-classification
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.txt" ]
persiannlp
92
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - multiple-choice - mbert - persian - farsi pipeline_tag: text-classification license: "CC BY-NC-SA 4.0" datasets: - parsinlu metrics: - accuracy --- # Multiple-Choice Question Answering (مدل برای پاسخ به سوالات چهار جوابی) This is a mbert-based model for multiple-choice question answering. Here is an example of how you can run this model: ```python from typing import List import torch from transformers import AutoConfig, AutoModelForMultipleChoice, AutoTokenizer model_name = "persiannlp/mbert-base-parsinlu-multiple-choice" tokenizer = AutoTokenizer.from_pretrained(model_name) config = AutoConfig.from_pretrained(model_name) model = AutoModelForMultipleChoice.from_pretrained(model_name, config=config) def run_model(question: str, candicates: List[str]): assert len(candicates) == 4, "you need four candidates" choices_inputs = [] for c in candicates: text_a = "" # empty context text_b = question + " " + c inputs = tokenizer( text_a, text_b, add_special_tokens=True, max_length=128, padding="max_length", truncation=True, return_overflowing_tokens=True, ) choices_inputs.append(inputs) input_ids = torch.LongTensor([x["input_ids"] for x in choices_inputs]) output = model(input_ids=input_ids) print(output) return output run_model(question="وسیع ترین کشور جهان کدام است؟", candicates=["آمریکا", "کانادا", "روسیه", "چین"]) run_model(question="طامع یعنی ؟", candicates=["آزمند", "خوش شانس", "محتاج", "مطمئن"]) run_model( question="زمینی به ۳۱ قطعه متساوی مفروض شده است و هر روز مساحت آماده شده برای احداث، دو برابر مساحت روز قبل است.اگر پس از (۵ روز) تمام زمین آماده شده باشد، در چه روزی یک قطعه زمین آماده شده ", candicates=["روز اول", "روز دوم", "روز سوم", "هیچکدام"]) ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-base-parsinlu-arc-comqa-obqa-multiple-choice
2021-03-08T02:40:12.000Z
[ "pytorch", "t5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "dataset:commonsenseqa", "dataset:arc", "dataset:openbookqa", "transformers", "multiple-choice", "mt5", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
34
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - multiple-choice - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu - commonsenseqa - arc - openbookqa metrics: - accuracy --- # Multiple-Choice Question Answering (مدل برای پاسخ به سوالات چهار جوابی) This is a mT5-based model for multiple-choice question answering. Here is an example of how you can run this model: ```python from transformers import MT5ForConditionalGeneration, MT5Tokenizer model_size = "base" model_name = f"persiannlp/mt5-{model_size}-parsinlu-arc-comqa-obqa-multiple-choice" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(input_string, **generator_args): input_ids = tokenizer.encode(input_string, return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model("وسیع ترین کشور جهان کدام است؟ <sep> آمریکا <sep> کانادا <sep> روسیه <sep> چین") run_model("طامع یعنی ؟ <sep> آزمند <sep> خوش شانس <sep> محتاج <sep> مطمئن") run_model( "زمینی به ۳۱ قطعه متساوی مفروض شده است و هر روز مساحت آماده شده برای احداث، دو برابر مساحت روز قبل است.اگر پس از (۵ روز) تمام زمین آماده شده باشد، در چه روزی یک قطعه زمین آماده شده <sep> روز اول <sep> روز دوم <sep> روز سوم <sep> هیچکدام") ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-base-parsinlu-multiple-choice
2021-02-25T18:39:25.000Z
[ "pytorch", "t5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "transformers", "multiple-choice", "mt5", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
8
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - multiple-choice - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu metrics: - accuracy --- # Multiple-Choice Question Answering (مدل برای پاسخ به سوالات چهار جوابی) This is a mT5-based model for multiple-choice question answering. Here is an example of how you can run this model: ```python from transformers import MT5ForConditionalGeneration, MT5Tokenizer model_size = "base" model_name = f"persiannlp/mt5-{model_size}-parsinlu-multiple-choice" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(input_string, **generator_args): input_ids = tokenizer.encode(input_string, return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model("وسیع ترین کشور جهان کدام است؟ <sep> آمریکا <sep> کانادا <sep> روسیه <sep> چین") run_model("طامع یعنی ؟ <sep> آزمند <sep> خوش شانس <sep> محتاج <sep> مطمئن") run_model( "زمینی به ۳۱ قطعه متساوی مفروض شده است و هر روز مساحت آماده شده برای احداث، دو برابر مساحت روز قبل است.اگر پس از (۵ روز) تمام زمین آماده شده باشد، در چه روزی یک قطعه زمین آماده شده <sep> روز اول <sep> روز دوم <sep> روز سوم <sep> هیچکدام") ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-base-parsinlu-opus-translation_fa_en
2021-03-31T04:08:12.000Z
[ "pytorch", "mt5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "transformers", "machine-translation", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
34
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - machine-translation - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu metrics: - sacrebleu --- # Machine Translation (ترجمه‌ی ماشینی) This is an mT5-based model for machine translation (Persian -> English). Here is an example of how you can run this model: ```python from transformers import MT5ForConditionalGeneration, MT5Tokenizer model_size = "base" model_name = f"persiannlp/mt5-{model_size}-parsinlu-opus-translation_fa_en" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(input_string, **generator_args): input_ids = tokenizer.encode(input_string, return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model("ستایش خدای را که پروردگار جهانیان است.") run_model("در هاید پارک کرنر بر گلدانی ایستاده موعظه می‌کند؛") run_model("وی از تمامی بلاگرها، سازمان‌ها و افرادی که از وی پشتیبانی کرده‌اند، تشکر کرد.") run_model("مشابه سال ۲۰۰۱، تولید آمونیاک بی آب در ایالات متحده در سال ۲۰۰۰ تقریباً ۱۷،۴۰۰،۰۰۰ تن (معادل بدون آب) با مصرف ظاهری ۲۲،۰۰۰،۰۰۰ تن و حدود ۴۶۰۰۰۰۰ با واردات خالص مواجه شد. ") run_model("می خواهم دکترای علوم کامپیوتر راجع به شبکه های اجتماعی را دنبال کنم، چالش حل نشده در شبکه های اجتماعی چیست؟") ``` which should give the following: ``` ['the admiration of God, which is the Lord of the world.'] ['At the Ford Park, the Crawford Park stands on a vase;'] ['He thanked all the bloggers, the organizations, and the people who supported him'] ['similar to the year 2001, the economy of ammonia in the United States in the'] ['I want to follow the computer experts on social networks, what is the unsolved problem in'] ``` which should give the following: ``` ['Adoration of God, the Lord of the world.'] ['At the High End of the Park, Conrad stands on a vase preaching;'] ['She thanked all the bloggers, organizations, and men who had supported her.'] ['In 2000, the lack of water ammonia in the United States was almost'] ['I want to follow the computer science doctorate on social networks. What is the unsolved challenge'] ``` Which should produce the following: ``` ['the praise of God, the Lord of the world.'] ['At the Hyde Park Corner, Carpenter is preaching on a vase;'] ['He thanked all the bloggers, organizations, and people who had supported him.'] ['Similarly in 2001, the production of waterless ammonia in the United States was'] ['I want to pursue my degree in Computer Science on social networks, what is the'] ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-base-parsinlu-qqp-query-paraphrasing
2021-03-08T03:27:23.000Z
[ "pytorch", "t5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "dataset:qqp", "transformers", "query-paraphrasing", "mt5", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
37
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - query-paraphrasing - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu - qqp metrics: - accuracy --- # Detection of Paraphrased Queries (تشخصیص سوالات هم‌معنی) This is a model for detection of paraphrased queries. Here is an example of how you can run this model: ```python from transformers import MT5Config, MT5ForConditionalGeneration, MT5Tokenizer model_name = "persiannlp/mt5-base-parsinlu-qqp-query-paraphrasing" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(q1, q2, **generator_args): input_ids = tokenizer.encode(f"{q1}<sep>{q2}", return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model("چه چیزی باعث پوکی استخوان می شود؟", "چه چیزی باعث مقاومت استخوان در برابر ضربه می شود؟") run_model("من دارم به این فکر میکنم چرا ساعت هفت نمیشه؟", "چرا من ساده فکر میکردم به عشقت پابندی؟") run_model("دعای کمیل در چه روزهایی خوانده می شود؟", "دعای جوشن کبیر در چه شبی خوانده می شود؟") run_model("دعای کمیل در چه روزهایی خوانده می شود؟", "دعای جوشن کبیر در چه شبی خوانده می شود؟") run_model("شناسنامه در چه سالی وارد ایران شد؟", "سیب زمینی در چه سالی وارد ایران شد؟") run_model("سیب زمینی چه زمانی وارد ایران شد؟", "سیب زمینی در چه سالی وارد ایران شد؟") ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-base-parsinlu-sentiment-analysis
2021-03-11T00:10:55.000Z
[ "pytorch", "mt5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "transformers", "sentiment", "sentiment-analysis", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
48
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - sentiment - sentiment-analysis - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu metrics: - accuracy --- # Sentiment Analysis (آنالیز احساسات) This is a mT5 model for sentiment analysis. Here is an example of how you can run this model: ```python import torch from transformers import MT5ForConditionalGeneration, MT5Tokenizer import numpy as np model_name_or_path = "persiannlp/mt5-base-parsinlu-sentiment-analysis" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def model_predict(text_a, text_b): features = tokenizer( [(text_a, text_b)], padding="max_length", truncation=True, return_tensors='pt') output = model(**features) logits = output[0] probs = torch.nn.functional.softmax(logits, dim=1).tolist() idx = np.argmax(np.array(probs)) print(labels[idx], probs) def run_model(context, query, **generator_args): input_ids = tokenizer.encode(context + "<sep>" + query, return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model( "یک فیلم ضعیف بی محتوا بدون فیلمنامه . شوخی های سخیف .", "نظر شما در مورد داستان، فیلمنامه، دیالوگ ها و موضوع فیلم لونه زنبور چیست؟" ) run_model( "فیلم تا وسط فیلم یعنی دقیقا تا جایی که معلوم میشه بچه های املشی دنبال رضان خیلی خوب و جذاب پیش میره ولی دقیقا از همونجاش سکته میزنه و خلاص...", "نظر شما به صورت کلی در مورد فیلم ژن خوک چیست؟" ) run_model( "اصلا به هیچ عنوان علاقه نداشتم اجرای می سی سی پی نشسته میمیرد روی پرده سینما ببینم دیالوگ های تکراری هلیکوپتر ماشین آلندلون لئون پاپیون آخه چرااااااااااااااا همون حسی که توی تالار وحدت بعد از نیم ساعت به سرم اومد امشب توی سالن سینما تجربه کردم ،حس گریز از سالن.......⁦ ⁦(ノಠ益ಠ)ノ⁩ ", " نظر شما در مورد صداگذاری و جلوه های صوتی فیلم مسخره‌باز چیست؟" ) run_model( " گول نخورید این رنگارنگ مینو نیست برای شرکت گرجیه و متاسفانه این محصولش اصلا مزه رنگارنگی که انتظار دارید رو نمیده ", " نظر شما در مورد عطر، بو، و طعم این بیسکویت و ویفر چیست؟" ) run_model( "در مقایسه با سایر برندهای موجود در بازار با توجه به حراجی که داشت ارزانتر ب", " شما در مورد قیمت و ارزش خرید این حبوبات و سویا چیست؟" ) run_model( "من پسرم عاشق ایناس ولی دیگه به خاطر حفظ محیط زیست فقط زمانهایی که مجبور باشم شیر دونه ای میخرم و سعی میکنم دیگه کمتر شیر با بسته بندی تتراپک استفاده کنم ", "نظر شما به صورت کلی در مورد این شیر چیست؟" ) ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-base-parsinlu-snli-entailment
2021-03-08T03:00:41.000Z
[ "pytorch", "t5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "dataset:snli", "transformers", "entailment", "mt5", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
179
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - entailment - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu - snli metrics: - accuracy --- # Textual Entailment (مدل برای پاسخ به استلزام منطقی) This is a model for textual entailment problems. Here is an example of how you can run this model: ```python from transformers import MT5ForConditionalGeneration, MT5Tokenizer model_size="base" model_name = f"persiannlp/mt5-{model_size}-parsinlu-snli-entailment" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(premise, hypothesis, **generator_args): input_ids = tokenizer.encode(f"{premise}<sep>{hypothesis}", return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model( "این مسابقات بین آوریل و دسامبر در هیپودروم ولیفندی در نزدیکی باکرکی ، ۱۵ کیلومتری (۹ مایل) غرب استانبول برگزار می شود.", "در ولیفندی هیپودروم، مسابقاتی از آوریل تا دسامبر وجود دارد." ) run_model( "آیا کودکانی وجود دارند که نیاز به سرگرمی دارند؟", "هیچ کودکی هرگز نمی خواهد سرگرم شود.", ) run_model( "ما به سفرهایی رفته ایم که در نهرهایی شنا کرده ایم", "علاوه بر استحمام در نهرها ، ما به اسپا ها و سونا ها نیز رفته ایم." ) ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-base-parsinlu-squad-reading-comprehension
2021-03-10T18:02:23.000Z
[ "pytorch", "mt5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "dataset:squad", "transformers", "reading-comprehension", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
43
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - reading-comprehension - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu - squad metrics: - f1 --- # Reading Comprehension (مدل برای پاسخ به درک مطلب) This is a mT5-based model for reading comprehension. Here is an example of how you can run this model: ```python from transformers import MT5ForConditionalGeneration, MT5Tokenizer model_size = "base" model_name = f"persiannlp/mt5-{model_size}-parsinlu-squad-reading-comprehension" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(paragraph, question, **generator_args): input_ids = tokenizer.encode(question + "\n" + paragraph, return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model( "یک شی را دارای تقارن می‌نامیم زمانی که ان شی را بتوان به دو یا چند قسمت تقسیم کرد که آن‌ها قسمتی از یک طرح سازمان یافته باشند یعنی بر روی شکل تنها جابجایی و چرخش و بازتاب و تجانس انجام شود و در اصل شکل تغییری به وجود نیایید آنگاه ان را تقارن می‌نامیم مرکز تقارن:اگر در یک شکل نقطه‌ای مانندA وجود داشته باشد که هر نقطهٔ روی شکل (محیط) نسبت به نقطه یAمتقارن یک نقطهٔ دیگر شکل (محیط) باشد، نقطهٔ Aمرکز تقارن است. یعنی هر نقطه روی شکل باید متقارنی داشته باشد شکل‌های که منتظم هستند و زوج ضلع دارند دارای مرکز تقارند ولی شکل‌های فرد ضلعی منتظم مرکز تقارن ندارند. متوازی‌الأضلاع و دایره یک مرکز تقارن دارند ممکن است یک شکل خط تقارن نداشته باشد ولی مرکز تقارن داشته باشد. (منبع:س. گ)", "اشکالی که یک مرکز تقارن دارند" ) run_model( "شُتُر یا اُشتر را که در زبان پهلوی (ushtar)[نیازمند منبع] می‌گفتند حیوانی است نیرومند و تنومند با توش و توان بالا از خانواده شتران؛ شبه نشخوارکننده و با دست و گردنی دراز. بر پشت خود یک یا دو کوهان دارد که ساختارش از پیه و چربی است. در دین اسلام گوشت او حلال است. اما ذبح آن با دیگر جانوران حلال گوشت متفاوت است و آن را نحر (بریدن گلو) می‌کنند و اگر سر آن را مانند گوسفند پیش از نحر ببرند گوشت آن حلال نیست. شیرش نیز نوشیده می‌شود ولی بیشتر کاربرد بارکشی دارد. پشم و پوستش نیز برای ریسندگی و پارچه‌بافی و کفش‌دوزی کاربرد دارد. گونه‌های دیگری از شتران نیز در آمریکای جنوبی زندگی می‌کنند، به نام‌های لاما، آلپاکا، گواناکو که دارای کوهان نیستند. شتر ویژگی‌های خاصّی دارد که مهم‌ترین آن‌ها تحمّل شرایط سخت صحرا و دماهای گوناگون و به‌ویژه گرمای شدید تابستان و کمبود آب و علوفه است. ترکیب جسمانی شتر با دیگر جانوران اختلاف زیادی دارد، و این اختلاف انگیزه شده که شتر در درازا روزهای سال در بیابان زندگی کند و از بوته‌ها و درختچه‌های گوناگون صحرایی و کویری و حتی از بوته‌های شور و خاردار تغذیه کند. عرب‌ها از زمان‌های بسیار دور از شتر استفاده کرده و می‌کنند. آن‌ها به این حیوان اهلی لقب کشتی صحرا (به عربی: سفینةالصحراء) داده‌اند.", "غذای شترچیست؟" ) run_model( """حسین میرزایی می‌گوید مرحله اول پرداخت وام حمایتی کرونا به همگی خانوارهای یارانه‌بگیر متقاضی تکمیل شده است و حال چهار میلیون خانوار که به عنوان "اقشار خاص" و "آسیب‌پذیر" شناسایی شدند، می‌توانند برای یک میلیون تومان وام دیگر درخواست بدهند. آقای میرزایی گفته خانوارهای "آسیب‌پذیر" که شرایط گرفتن وام یک میلیونی اضافی را دارند با پیامک از این امکان مطلع شده‌اند. بنا به گزارش‌های رسمی با شیوع کرونا در ایران یک میلیون نفر بیکار شده‌اند و درآمد کارکنان مشاغل غیررسمی نیز ضربه قابل توجهی خورده است. ارزش ریال هم در هفته‌های اخیر در برابر ارزهای خارجی سقوط کرده است. اقتصاد ایران پیش از شیوع کرونا نیز با مشکلات مزمن رکود، تورم، تحریم و فساد روبرو بود.""", "وام یارانه به چه کسانی میدهند؟" ) run_model( "در ۲۲ ژوئن ۱۹۴۱ نیروهای محور در عملیات بارباروسا حمله سنگینی به اتحاد شوروی کرده و یکی از بزرگترین نبردهای زمینی تاریخ بشر را رقم زدند. همچنین جبهه شرقی باعث به دام افتادن نیروهای محور شد و بیش از همه ارتش آلمان نازی را درگیر جنگ فرسایشی کرد. در دسامبر ۱۹۴۱ ژاپن یک در عملیاتی ناگهانی با نام نبرد پرل هاربر به پایگاه دریایی ایالات متحده آمریکا حمله کرد. به دنبال این اتفاق آمریکا نیز بلافاصله علیه ژاپن اعلان جنگ کرد که با حمایت بریتانیا همراه شد. پس از آن متحدین (نیروهای محور در اروپا) نیز با اتحاد ژاپن علیه آمریکا اعلام جنگ کردند. دست‌آوردهای ژاپن در یورش به آمریکا باعث ایجاد این احساس در آسیا شد که آسیا از تسلط غرب خارج شده‌است از این رو بسیاری از ارتش‌های شکست خورده با آنها همراهی کردند.", "چرا امریکا وارد جنگ جهانی دوم شد؟" ) ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-base-parsinlu-translation_en_fa
2021-03-31T04:28:22.000Z
[ "pytorch", "mt5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "transformers", "machine-translation", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
35
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - machine-translation - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu metrics: - sacrebleu --- # Machine Translation (ترجمه‌ی ماشینی) This is an mT5-based model for machine translation (English -> Persian). Here is an example of how you can run this model: ```python from transformers import MT5ForConditionalGeneration, MT5Tokenizer model_size = "base" model_name = f"persiannlp/mt5-{model_size}-parsinlu-translation_en_fa" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(input_string, **generator_args): input_ids = tokenizer.encode(input_string, return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model("Praise be to Allah, the Cherisher and Sustainer of the worlds;") run_model("shrouds herself in white and walks penitentially disguised as brotherly love through factories and parliaments; offers help, but desires power;") run_model("He thanked all fellow bloggers and organizations that showed support.") run_model("Races are held between April and December at the Veliefendi Hippodrome near Bakerky, 15 km (9 miles) west of Istanbul.") run_model("I want to pursue PhD in Computer Science about social network,what is the open problem in social networks?") ``` which should output: ``` ['خدا را شکر که عامل خطرناک و محافظ دنیاست.'] ['خود را سفید می کند و به شکل برادرانه ای در کارخانه ها و'] ['او از تمامی همکاران و سازمان هایی که از او حمایت می کردند تشکر'] ['برگزاری مسابقات بین آوریل تا دسامبر در هیپوگریم والی'] ['من می خواهم تحصیل دکترای علوم کامپیوتری را در مورد شب'] ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-large-parsinlu-arc-comqa-obqa-multiple-choice
2021-03-08T02:39:59.000Z
[ "pytorch", "t5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "dataset:commonsenseqa", "dataset:arc", "dataset:openbookqa", "transformers", "multiple-choice", "mt5", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
7
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - multiple-choice - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu - commonsenseqa - arc - openbookqa metrics: - accuracy --- # Multiple-Choice Question Answering (مدل برای پاسخ به سوالات چهار جوابی) This is a mT5-based model for multiple-choice question answering. Here is an example of how you can run this model: ```python from transformers import MT5ForConditionalGeneration, MT5Tokenizer model_size = "large" model_name = f"persiannlp/mt5-{model_size}-parsinlu-arc-comqa-obqa-multiple-choice" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(input_string, **generator_args): input_ids = tokenizer.encode(input_string, return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model("وسیع ترین کشور جهان کدام است؟ <sep> آمریکا <sep> کانادا <sep> روسیه <sep> چین") run_model("طامع یعنی ؟ <sep> آزمند <sep> خوش شانس <sep> محتاج <sep> مطمئن") run_model( "زمینی به ۳۱ قطعه متساوی مفروض شده است و هر روز مساحت آماده شده برای احداث، دو برابر مساحت روز قبل است.اگر پس از (۵ روز) تمام زمین آماده شده باشد، در چه روزی یک قطعه زمین آماده شده <sep> روز اول <sep> روز دوم <sep> روز سوم <sep> هیچکدام") ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-large-parsinlu-multiple-choice
2021-02-25T18:40:18.000Z
[ "pytorch", "t5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "transformers", "multiple-choice", "mt5", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
7
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - multiple-choice - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu metrics: - accuracy --- # Multiple-Choice Question Answering (مدل برای پاسخ به سوالات چهار جوابی) This is a mT5-based model for multiple-choice question answering. Here is an example of how you can run this model: ```python from transformers import MT5ForConditionalGeneration, MT5Tokenizer model_size = "large" model_name = f"persiannlp/mt5-{model_size}-parsinlu-multiple-choice" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(input_string, **generator_args): input_ids = tokenizer.encode(input_string, return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model("وسیع ترین کشور جهان کدام است؟ <sep> آمریکا <sep> کانادا <sep> روسیه <sep> چین") run_model("طامع یعنی ؟ <sep> آزمند <sep> خوش شانس <sep> محتاج <sep> مطمئن") run_model( "زمینی به ۳۱ قطعه متساوی مفروض شده است و هر روز مساحت آماده شده برای احداث، دو برابر مساحت روز قبل است.اگر پس از (۵ روز) تمام زمین آماده شده باشد، در چه روزی یک قطعه زمین آماده شده <sep> روز اول <sep> روز دوم <sep> روز سوم <sep> هیچکدام") ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-large-parsinlu-opus-translation_fa_en
2021-03-31T04:08:46.000Z
[ "pytorch", "mt5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "transformers", "machine-translation", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
25
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - machine-translation - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu metrics: - sacrebleu --- # Machine Translation (ترجمه‌ی ماشینی) This is an mT5-based model for machine translation (Persian -> English). Here is an example of how you can run this model: ```python from transformers import MT5ForConditionalGeneration, MT5Tokenizer model_size = "large" model_name = f"persiannlp/mt5-{model_size}-parsinlu-opus-translation_fa_en" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(input_string, **generator_args): input_ids = tokenizer.encode(input_string, return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model("ستایش خدای را که پروردگار جهانیان است.") run_model("در هاید پارک کرنر بر گلدانی ایستاده موعظه می‌کند؛") run_model("وی از تمامی بلاگرها، سازمان‌ها و افرادی که از وی پشتیبانی کرده‌اند، تشکر کرد.") run_model("مشابه سال ۲۰۰۱، تولید آمونیاک بی آب در ایالات متحده در سال ۲۰۰۰ تقریباً ۱۷،۴۰۰،۰۰۰ تن (معادل بدون آب) با مصرف ظاهری ۲۲،۰۰۰،۰۰۰ تن و حدود ۴۶۰۰۰۰۰ با واردات خالص مواجه شد. ") run_model("می خواهم دکترای علوم کامپیوتر راجع به شبکه های اجتماعی را دنبال کنم، چالش حل نشده در شبکه های اجتماعی چیست؟") ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-large-parsinlu-qqp-query-paraphrasing
2021-03-08T03:27:12.000Z
[ "pytorch", "t5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "dataset:qqp", "transformers", "query-paraphrasing", "mt5", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
31
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - query-paraphrasing - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu - qqp metrics: - accuracy --- # Detection of Paraphrased Queries (تشخصیص سوالات هم‌معنی) This is a model for detection of paraphrased queries. Here is an example of how you can run this model: ```python from transformers import MT5Config, MT5ForConditionalGeneration, MT5Tokenizer model_name = "persiannlp/mt5-large-parsinlu-qqp-query-paraphrasing" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(q1, q2, **generator_args): input_ids = tokenizer.encode(f"{q1}<sep>{q2}", return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model("چه چیزی باعث پوکی استخوان می شود؟", "چه چیزی باعث مقاومت استخوان در برابر ضربه می شود؟") run_model("من دارم به این فکر میکنم چرا ساعت هفت نمیشه؟", "چرا من ساده فکر میکردم به عشقت پابندی؟") run_model("دعای کمیل در چه روزهایی خوانده می شود؟", "دعای جوشن کبیر در چه شبی خوانده می شود؟") run_model("دعای کمیل در چه روزهایی خوانده می شود؟", "دعای جوشن کبیر در چه شبی خوانده می شود؟") run_model("شناسنامه در چه سالی وارد ایران شد؟", "سیب زمینی در چه سالی وارد ایران شد؟") run_model("سیب زمینی چه زمانی وارد ایران شد؟", "سیب زمینی در چه سالی وارد ایران شد؟") ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-large-parsinlu-sentiment-analysis
2021-03-11T04:42:11.000Z
[ "pytorch", "mt5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "transformers", "sentiment", "sentiment-analysis", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
6
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - sentiment - sentiment-analysis - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu metrics: - accuracy --- # Sentiment Analysis (آنالیز احساسات) This is a mT5 model for sentiment analysis. Here is an example of how you can run this model: ```python import torch from transformers import MT5ForConditionalGeneration, MT5Tokenizer import numpy as np model_name_or_path = "persiannlp/mt5-large-parsinlu-sentiment-analysis" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def model_predict(text_a, text_b): features = tokenizer( [(text_a, text_b)], padding="max_length", truncation=True, return_tensors='pt') output = model(**features) logits = output[0] probs = torch.nn.functional.softmax(logits, dim=1).tolist() idx = np.argmax(np.array(probs)) print(labels[idx], probs) def run_model(context, query, **generator_args): input_ids = tokenizer.encode(context + "<sep>" + query, return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model( "یک فیلم ضعیف بی محتوا بدون فیلمنامه . شوخی های سخیف .", "نظر شما در مورد داستان، فیلمنامه، دیالوگ ها و موضوع فیلم لونه زنبور چیست؟" ) run_model( "فیلم تا وسط فیلم یعنی دقیقا تا جایی که معلوم میشه بچه های املشی دنبال رضان خیلی خوب و جذاب پیش میره ولی دقیقا از همونجاش سکته میزنه و خلاص...", "نظر شما به صورت کلی در مورد فیلم ژن خوک چیست؟" ) run_model( "اصلا به هیچ عنوان علاقه نداشتم اجرای می سی سی پی نشسته میمیرد روی پرده سینما ببینم دیالوگ های تکراری هلیکوپتر ماشین آلندلون لئون پاپیون آخه چرااااااااااااااا همون حسی که توی تالار وحدت بعد از نیم ساعت به سرم اومد امشب توی سالن سینما تجربه کردم ،حس گریز از سالن.......⁦ ⁦(ノಠ益ಠ)ノ⁩ ", " نظر شما در مورد صداگذاری و جلوه های صوتی فیلم مسخره‌باز چیست؟" ) run_model( " گول نخورید این رنگارنگ مینو نیست برای شرکت گرجیه و متاسفانه این محصولش اصلا مزه رنگارنگی که انتظار دارید رو نمیده ", " نظر شما در مورد عطر، بو، و طعم این بیسکویت و ویفر چیست؟" ) run_model( "در مقایسه با سایر برندهای موجود در بازار با توجه به حراجی که داشت ارزانتر ب", " شما در مورد قیمت و ارزش خرید این حبوبات و سویا چیست؟" ) run_model( "من پسرم عاشق ایناس ولی دیگه به خاطر حفظ محیط زیست فقط زمانهایی که مجبور باشم شیر دونه ای میخرم و سعی میکنم دیگه کمتر شیر با بسته بندی تتراپک استفاده کنم ", "نظر شما به صورت کلی در مورد این شیر چیست؟" ) ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-large-parsinlu-snli-entailment
2021-03-09T22:16:22.000Z
[ "pytorch", "t5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "dataset:snli", "transformers", "entailment", "mt5", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
10
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - entailment - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu - snli metrics: - accuracy --- # Textual Entailment (مدل برای پاسخ به استلزام منطقی) This is a model for textual entailment problems. Here is an example of how you can run this model: ```python from transformers import MT5ForConditionalGeneration, MT5Tokenizer model_size="large" model_name = f"persiannlp/mt5-{model_size}-parsinlu-snli-entailment" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(premise, hypothesis, **generator_args): input_ids = tokenizer.encode(f"{premise}<sep>{hypothesis}", return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model( "این مسابقات بین آوریل و دسامبر در هیپودروم ولیفندی در نزدیکی باکرکی ، ۱۵ کیلومتری (۹ مایل) غرب استانبول برگزار می شود.", "در ولیفندی هیپودروم، مسابقاتی از آوریل تا دسامبر وجود دارد." ) run_model( "آیا کودکانی وجود دارند که نیاز به سرگرمی دارند؟", "هیچ کودکی هرگز نمی خواهد سرگرم شود.", ) run_model( "ما به سفرهایی رفته ایم که در نهرهایی شنا کرده ایم", "علاوه بر استحمام در نهرها ، ما به اسپا ها و سونا ها نیز رفته ایم." ) ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-large-parsinlu-squad-reading-comprehension
2021-03-10T18:02:39.000Z
[ "pytorch", "mt5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "dataset:squad", "transformers", "reading-comprehension", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
16
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - reading-comprehension - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu - squad metrics: - f1 --- # Reading Comprehension (مدل برای پاسخ به درک مطلب) This is a mT5-based model for reading comprehension. Here is an example of how you can run this model: ```python from transformers import MT5ForConditionalGeneration, MT5Tokenizer model_size = "large" model_name = f"persiannlp/mt5-{model_size}-parsinlu-squad-reading-comprehension" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(paragraph, question, **generator_args): input_ids = tokenizer.encode(question + "\n" + paragraph, return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model( "یک شی را دارای تقارن می‌نامیم زمانی که ان شی را بتوان به دو یا چند قسمت تقسیم کرد که آن‌ها قسمتی از یک طرح سازمان یافته باشند یعنی بر روی شکل تنها جابجایی و چرخش و بازتاب و تجانس انجام شود و در اصل شکل تغییری به وجود نیایید آنگاه ان را تقارن می‌نامیم مرکز تقارن:اگر در یک شکل نقطه‌ای مانندA وجود داشته باشد که هر نقطهٔ روی شکل (محیط) نسبت به نقطه یAمتقارن یک نقطهٔ دیگر شکل (محیط) باشد، نقطهٔ Aمرکز تقارن است. یعنی هر نقطه روی شکل باید متقارنی داشته باشد شکل‌های که منتظم هستند و زوج ضلع دارند دارای مرکز تقارند ولی شکل‌های فرد ضلعی منتظم مرکز تقارن ندارند. متوازی‌الأضلاع و دایره یک مرکز تقارن دارند ممکن است یک شکل خط تقارن نداشته باشد ولی مرکز تقارن داشته باشد. (منبع:س. گ)", "اشکالی که یک مرکز تقارن دارند" ) run_model( "شُتُر یا اُشتر را که در زبان پهلوی (ushtar)[نیازمند منبع] می‌گفتند حیوانی است نیرومند و تنومند با توش و توان بالا از خانواده شتران؛ شبه نشخوارکننده و با دست و گردنی دراز. بر پشت خود یک یا دو کوهان دارد که ساختارش از پیه و چربی است. در دین اسلام گوشت او حلال است. اما ذبح آن با دیگر جانوران حلال گوشت متفاوت است و آن را نحر (بریدن گلو) می‌کنند و اگر سر آن را مانند گوسفند پیش از نحر ببرند گوشت آن حلال نیست. شیرش نیز نوشیده می‌شود ولی بیشتر کاربرد بارکشی دارد. پشم و پوستش نیز برای ریسندگی و پارچه‌بافی و کفش‌دوزی کاربرد دارد. گونه‌های دیگری از شتران نیز در آمریکای جنوبی زندگی می‌کنند، به نام‌های لاما، آلپاکا، گواناکو که دارای کوهان نیستند. شتر ویژگی‌های خاصّی دارد که مهم‌ترین آن‌ها تحمّل شرایط سخت صحرا و دماهای گوناگون و به‌ویژه گرمای شدید تابستان و کمبود آب و علوفه است. ترکیب جسمانی شتر با دیگر جانوران اختلاف زیادی دارد، و این اختلاف انگیزه شده که شتر در درازا روزهای سال در بیابان زندگی کند و از بوته‌ها و درختچه‌های گوناگون صحرایی و کویری و حتی از بوته‌های شور و خاردار تغذیه کند. عرب‌ها از زمان‌های بسیار دور از شتر استفاده کرده و می‌کنند. آن‌ها به این حیوان اهلی لقب کشتی صحرا (به عربی: سفینةالصحراء) داده‌اند.", "غذای شترچیست؟" ) run_model( """حسین میرزایی می‌گوید مرحله اول پرداخت وام حمایتی کرونا به همگی خانوارهای یارانه‌بگیر متقاضی تکمیل شده است و حال چهار میلیون خانوار که به عنوان "اقشار خاص" و "آسیب‌پذیر" شناسایی شدند، می‌توانند برای یک میلیون تومان وام دیگر درخواست بدهند. آقای میرزایی گفته خانوارهای "آسیب‌پذیر" که شرایط گرفتن وام یک میلیونی اضافی را دارند با پیامک از این امکان مطلع شده‌اند. بنا به گزارش‌های رسمی با شیوع کرونا در ایران یک میلیون نفر بیکار شده‌اند و درآمد کارکنان مشاغل غیررسمی نیز ضربه قابل توجهی خورده است. ارزش ریال هم در هفته‌های اخیر در برابر ارزهای خارجی سقوط کرده است. اقتصاد ایران پیش از شیوع کرونا نیز با مشکلات مزمن رکود، تورم، تحریم و فساد روبرو بود.""", "وام یارانه به چه کسانی میدهند؟" ) run_model( "در ۲۲ ژوئن ۱۹۴۱ نیروهای محور در عملیات بارباروسا حمله سنگینی به اتحاد شوروی کرده و یکی از بزرگترین نبردهای زمینی تاریخ بشر را رقم زدند. همچنین جبهه شرقی باعث به دام افتادن نیروهای محور شد و بیش از همه ارتش آلمان نازی را درگیر جنگ فرسایشی کرد. در دسامبر ۱۹۴۱ ژاپن یک در عملیاتی ناگهانی با نام نبرد پرل هاربر به پایگاه دریایی ایالات متحده آمریکا حمله کرد. به دنبال این اتفاق آمریکا نیز بلافاصله علیه ژاپن اعلان جنگ کرد که با حمایت بریتانیا همراه شد. پس از آن متحدین (نیروهای محور در اروپا) نیز با اتحاد ژاپن علیه آمریکا اعلام جنگ کردند. دست‌آوردهای ژاپن در یورش به آمریکا باعث ایجاد این احساس در آسیا شد که آسیا از تسلط غرب خارج شده‌است از این رو بسیاری از ارتش‌های شکست خورده با آنها همراهی کردند.", "چرا امریکا وارد جنگ جهانی دوم شد؟" ) ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-large-parsinlu-translation_en_fa
2021-03-31T04:31:00.000Z
[ "pytorch", "mt5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "transformers", "machine-translation", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
44
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - machine-translation - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu metrics: - sacrebleu --- # Machine Translation (ترجمه‌ی ماشینی) This is an mT5-based model for machine translation (English -> Persian). Here is an example of how you can run this model: ```python from transformers import MT5ForConditionalGeneration, MT5Tokenizer model_size = "large" model_name = f"persiannlp/mt5-{model_size}-parsinlu-translation_en_fa" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(input_string, **generator_args): input_ids = tokenizer.encode(input_string, return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model("Praise be to Allah, the Cherisher and Sustainer of the worlds;") run_model("shrouds herself in white and walks penitentially disguised as brotherly love through factories and parliaments; offers help, but desires power;") run_model("He thanked all fellow bloggers and organizations that showed support.") run_model("Races are held between April and December at the Veliefendi Hippodrome near Bakerky, 15 km (9 miles) west of Istanbul.") run_model("I want to pursue PhD in Computer Science about social network,what is the open problem in social networks?") ``` which should output: ``` ['خدا را شکر که آفریننده و نگهدار جهان است.'] ['خود را با کفن سفید می پوشد و به شکل برادرانه ای در'] ['او از همه ی وبلاگ نویسان و سازمان هایی که از او حمایت کردند'] ['مسابقات بین آوریل و دسامبر در فرودگاه والی عبدین نزدیک بی'] ['من می خواهم پایان نامه دکتری را در رشته علوم کامپیوتر در'] ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-small-parsinlu-arc-comqa-obqa-multiple-choice
2021-03-08T02:39:37.000Z
[ "pytorch", "t5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "dataset:commonsenseqa", "dataset:arc", "dataset:openbookqa", "transformers", "multiple-choice", "mt5", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
8
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - multiple-choice - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu - commonsenseqa - arc - openbookqa metrics: - accuracy --- # Multiple-Choice Question Answering (مدل برای پاسخ به سوالات چهار جوابی) This is a mT5-based model for multiple-choice question answering. Here is an example of how you can run this model: ```python from transformers import MT5ForConditionalGeneration, MT5Tokenizer model_size = "small" model_name = f"persiannlp/mt5-{model_size}-parsinlu-arc-comqa-obqa-multiple-choice" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(input_string, **generator_args): input_ids = tokenizer.encode(input_string, return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model("وسیع ترین کشور جهان کدام است؟ <sep> آمریکا <sep> کانادا <sep> روسیه <sep> چین") run_model("طامع یعنی ؟ <sep> آزمند <sep> خوش شانس <sep> محتاج <sep> مطمئن") run_model( "زمینی به ۳۱ قطعه متساوی مفروض شده است و هر روز مساحت آماده شده برای احداث، دو برابر مساحت روز قبل است.اگر پس از (۵ روز) تمام زمین آماده شده باشد، در چه روزی یک قطعه زمین آماده شده <sep> روز اول <sep> روز دوم <sep> روز سوم <sep> هیچکدام") ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-small-parsinlu-multiple-choice
2021-02-25T06:41:01.000Z
[ "pytorch", "t5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "transformers", "multiple-choice", "mt5", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
6
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - multiple-choice - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu metrics: - accuracy --- # Multiple-Choice Question Answering (مدل برای پاسخ به سوالات چهار جوابی) This is a mT5-based model for multiple-choice question answering. Here is an example of how you can run this model: ```python from transformers import MT5ForConditionalGeneration, MT5Tokenizer model_size = "small" model_name = f"persiannlp/mt5-{model_size}-parsinlu-multiple-choice" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(input_string, **generator_args): input_ids = tokenizer.encode(input_string, return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model("وسیع ترین کشور جهان کدام است؟ <sep> آمریکا <sep> کانادا <sep> روسیه <sep> چین") run_model("طامع یعنی ؟ <sep> آزمند <sep> خوش شانس <sep> محتاج <sep> مطمئن") run_model( "زمینی به ۳۱ قطعه متساوی مفروض شده است و هر روز مساحت آماده شده برای احداث، دو برابر مساحت روز قبل است.اگر پس از (۵ روز) تمام زمین آماده شده باشد، در چه روزی یک قطعه زمین آماده شده <sep> روز اول <sep> روز دوم <sep> روز سوم <sep> هیچکدام") ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-small-parsinlu-opus-translation_fa_en
2021-03-31T04:07:53.000Z
[ "pytorch", "mt5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "transformers", "machine-translation", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
11
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - machine-translation - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu metrics: - sacrebleu --- # Machine Translation (ترجمه‌ی ماشینی) This is an mT5-based model for machine translation (Persian -> English). Here is an example of how you can run this model: ```python from transformers import MT5ForConditionalGeneration, MT5Tokenizer model_size = "small" model_name = f"persiannlp/mt5-{model_size}-parsinlu-opus-translation_fa_en" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(input_string, **generator_args): input_ids = tokenizer.encode(input_string, return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model("ستایش خدای را که پروردگار جهانیان است.") run_model("در هاید پارک کرنر بر گلدانی ایستاده موعظه می‌کند؛") run_model("وی از تمامی بلاگرها، سازمان‌ها و افرادی که از وی پشتیبانی کرده‌اند، تشکر کرد.") run_model("مشابه سال ۲۰۰۱، تولید آمونیاک بی آب در ایالات متحده در سال ۲۰۰۰ تقریباً ۱۷،۴۰۰،۰۰۰ تن (معادل بدون آب) با مصرف ظاهری ۲۲،۰۰۰،۰۰۰ تن و حدود ۴۶۰۰۰۰۰ با واردات خالص مواجه شد. ") run_model("می خواهم دکترای علوم کامپیوتر راجع به شبکه های اجتماعی را دنبال کنم، چالش حل نشده در شبکه های اجتماعی چیست؟") ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-small-parsinlu-qqp-query-paraphrasing
2021-03-08T03:26:49.000Z
[ "pytorch", "t5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "dataset:qqp", "transformers", "query-paraphrasing", "mt5", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
24
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - query-paraphrasing - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu - qqp metrics: - accuracy --- # Detection of Paraphrased Queries (تشخصیص سوالات هم‌معنی) This is a model for detection of paraphrased queries. Here is an example of how you can run this model: ```python from transformers import MT5Config, MT5ForConditionalGeneration, MT5Tokenizer model_name = "persiannlp/mt5-small-parsinlu-qqp-query-paraphrasing" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(q1, q2, **generator_args): input_ids = tokenizer.encode(f"{q1}<sep>{q2}", return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model("چه چیزی باعث پوکی استخوان می شود؟", "چه چیزی باعث مقاومت استخوان در برابر ضربه می شود؟") run_model("من دارم به این فکر میکنم چرا ساعت هفت نمیشه؟", "چرا من ساده فکر میکردم به عشقت پابندی؟") run_model("دعای کمیل در چه روزهایی خوانده می شود؟", "دعای جوشن کبیر در چه شبی خوانده می شود؟") run_model("دعای کمیل در چه روزهایی خوانده می شود؟", "دعای جوشن کبیر در چه شبی خوانده می شود؟") run_model("شناسنامه در چه سالی وارد ایران شد؟", "سیب زمینی در چه سالی وارد ایران شد؟") run_model("سیب زمینی چه زمانی وارد ایران شد؟", "سیب زمینی در چه سالی وارد ایران شد؟") ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-small-parsinlu-sentiment-analysis
2021-03-10T23:03:19.000Z
[ "pytorch", "mt5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "transformers", "sentiment", "sentiment-analysis", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
3,846
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - sentiment - sentiment-analysis - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu metrics: - accuracy --- # Sentiment Analysis (آنالیز احساسات) This is a mT5 model for sentiment analysis. Here is an example of how you can run this model: ```python import torch from transformers import MT5ForConditionalGeneration, MT5Tokenizer import numpy as np model_name_or_path = "persiannlp/mt5-small-parsinlu-sentiment-analysis" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def model_predict(text_a, text_b): features = tokenizer( [(text_a, text_b)], padding="max_length", truncation=True, return_tensors='pt') output = model(**features) logits = output[0] probs = torch.nn.functional.softmax(logits, dim=1).tolist() idx = np.argmax(np.array(probs)) print(labels[idx], probs) def run_model(context, query, **generator_args): input_ids = tokenizer.encode(context + "<sep>" + query, return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model( "یک فیلم ضعیف بی محتوا بدون فیلمنامه . شوخی های سخیف .", "نظر شما در مورد داستان، فیلمنامه، دیالوگ ها و موضوع فیلم لونه زنبور چیست؟" ) run_model( "فیلم تا وسط فیلم یعنی دقیقا تا جایی که معلوم میشه بچه های املشی دنبال رضان خیلی خوب و جذاب پیش میره ولی دقیقا از همونجاش سکته میزنه و خلاص...", "نظر شما به صورت کلی در مورد فیلم ژن خوک چیست؟" ) run_model( "اصلا به هیچ عنوان علاقه نداشتم اجرای می سی سی پی نشسته میمیرد روی پرده سینما ببینم دیالوگ های تکراری هلیکوپتر ماشین آلندلون لئون پاپیون آخه چرااااااااااااااا همون حسی که توی تالار وحدت بعد از نیم ساعت به سرم اومد امشب توی سالن سینما تجربه کردم ،حس گریز از سالن.......⁦ ⁦(ノಠ益ಠ)ノ⁩ ", " نظر شما در مورد صداگذاری و جلوه های صوتی فیلم مسخره‌باز چیست؟" ) run_model( " گول نخورید این رنگارنگ مینو نیست برای شرکت گرجیه و متاسفانه این محصولش اصلا مزه رنگارنگی که انتظار دارید رو نمیده ", " نظر شما در مورد عطر، بو، و طعم این بیسکویت و ویفر چیست؟" ) run_model( "در مقایسه با سایر برندهای موجود در بازار با توجه به حراجی که داشت ارزانتر ب", " شما در مورد قیمت و ارزش خرید این حبوبات و سویا چیست؟" ) run_model( "من پسرم عاشق ایناس ولی دیگه به خاطر حفظ محیط زیست فقط زمانهایی که مجبور باشم شیر دونه ای میخرم و سعی میکنم دیگه کمتر شیر با بسته بندی تتراپک استفاده کنم ", "نظر شما به صورت کلی در مورد این شیر چیست؟" ) ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-small-parsinlu-snli-entailment
2021-03-08T03:01:02.000Z
[ "pytorch", "t5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "dataset:snli", "transformers", "entailment", "mt5", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
13
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - entailment - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu - snli metrics: - accuracy --- # Textual Entailment (مدل برای پاسخ به استلزام منطقی) This is a model for textual entailment problems. Here is an example of how you can run this model: ```python from transformers import MT5ForConditionalGeneration, MT5Tokenizer model_size="small" model_name = f"persiannlp/mt5-{model_size}-parsinlu-snli-entailment" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(premise, hypothesis, **generator_args): input_ids = tokenizer.encode(f"{premise}<sep>{hypothesis}", return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model( "این مسابقات بین آوریل و دسامبر در هیپودروم ولیفندی در نزدیکی باکرکی ، ۱۵ کیلومتری (۹ مایل) غرب استانبول برگزار می شود.", "در ولیفندی هیپودروم، مسابقاتی از آوریل تا دسامبر وجود دارد." ) run_model( "آیا کودکانی وجود دارند که نیاز به سرگرمی دارند؟", "هیچ کودکی هرگز نمی خواهد سرگرم شود.", ) run_model( "ما به سفرهایی رفته ایم که در نهرهایی شنا کرده ایم", "علاوه بر استحمام در نهرها ، ما به اسپا ها و سونا ها نیز رفته ایم." ) ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-small-parsinlu-squad-reading-comprehension
2021-03-10T18:02:00.000Z
[ "pytorch", "mt5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "dataset:squad", "transformers", "reading-comprehension", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
19
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - reading-comprehension - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu - squad metrics: - f1 --- # Reading Comprehension (مدل برای پاسخ به درک مطلب) This is a mT5-based model for reading comprehension. Here is an example of how you can run this model: ```python from transformers import MT5ForConditionalGeneration, MT5Tokenizer model_size = "small" model_name = f"persiannlp/mt5-{model_size}-parsinlu-squad-reading-comprehension" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(paragraph, question, **generator_args): input_ids = tokenizer.encode(question + "\n" + paragraph, return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model( "یک شی را دارای تقارن می‌نامیم زمانی که ان شی را بتوان به دو یا چند قسمت تقسیم کرد که آن‌ها قسمتی از یک طرح سازمان یافته باشند یعنی بر روی شکل تنها جابجایی و چرخش و بازتاب و تجانس انجام شود و در اصل شکل تغییری به وجود نیایید آنگاه ان را تقارن می‌نامیم مرکز تقارن:اگر در یک شکل نقطه‌ای مانندA وجود داشته باشد که هر نقطهٔ روی شکل (محیط) نسبت به نقطه یAمتقارن یک نقطهٔ دیگر شکل (محیط) باشد، نقطهٔ Aمرکز تقارن است. یعنی هر نقطه روی شکل باید متقارنی داشته باشد شکل‌های که منتظم هستند و زوج ضلع دارند دارای مرکز تقارند ولی شکل‌های فرد ضلعی منتظم مرکز تقارن ندارند. متوازی‌الأضلاع و دایره یک مرکز تقارن دارند ممکن است یک شکل خط تقارن نداشته باشد ولی مرکز تقارن داشته باشد. (منبع:س. گ)", "اشکالی که یک مرکز تقارن دارند" ) run_model( "شُتُر یا اُشتر را که در زبان پهلوی (ushtar)[نیازمند منبع] می‌گفتند حیوانی است نیرومند و تنومند با توش و توان بالا از خانواده شتران؛ شبه نشخوارکننده و با دست و گردنی دراز. بر پشت خود یک یا دو کوهان دارد که ساختارش از پیه و چربی است. در دین اسلام گوشت او حلال است. اما ذبح آن با دیگر جانوران حلال گوشت متفاوت است و آن را نحر (بریدن گلو) می‌کنند و اگر سر آن را مانند گوسفند پیش از نحر ببرند گوشت آن حلال نیست. شیرش نیز نوشیده می‌شود ولی بیشتر کاربرد بارکشی دارد. پشم و پوستش نیز برای ریسندگی و پارچه‌بافی و کفش‌دوزی کاربرد دارد. گونه‌های دیگری از شتران نیز در آمریکای جنوبی زندگی می‌کنند، به نام‌های لاما، آلپاکا، گواناکو که دارای کوهان نیستند. شتر ویژگی‌های خاصّی دارد که مهم‌ترین آن‌ها تحمّل شرایط سخت صحرا و دماهای گوناگون و به‌ویژه گرمای شدید تابستان و کمبود آب و علوفه است. ترکیب جسمانی شتر با دیگر جانوران اختلاف زیادی دارد، و این اختلاف انگیزه شده که شتر در درازا روزهای سال در بیابان زندگی کند و از بوته‌ها و درختچه‌های گوناگون صحرایی و کویری و حتی از بوته‌های شور و خاردار تغذیه کند. عرب‌ها از زمان‌های بسیار دور از شتر استفاده کرده و می‌کنند. آن‌ها به این حیوان اهلی لقب کشتی صحرا (به عربی: سفینةالصحراء) داده‌اند.", "غذای شترچیست؟" ) run_model( """حسین میرزایی می‌گوید مرحله اول پرداخت وام حمایتی کرونا به همگی خانوارهای یارانه‌بگیر متقاضی تکمیل شده است و حال چهار میلیون خانوار که به عنوان "اقشار خاص" و "آسیب‌پذیر" شناسایی شدند، می‌توانند برای یک میلیون تومان وام دیگر درخواست بدهند. آقای میرزایی گفته خانوارهای "آسیب‌پذیر" که شرایط گرفتن وام یک میلیونی اضافی را دارند با پیامک از این امکان مطلع شده‌اند. بنا به گزارش‌های رسمی با شیوع کرونا در ایران یک میلیون نفر بیکار شده‌اند و درآمد کارکنان مشاغل غیررسمی نیز ضربه قابل توجهی خورده است. ارزش ریال هم در هفته‌های اخیر در برابر ارزهای خارجی سقوط کرده است. اقتصاد ایران پیش از شیوع کرونا نیز با مشکلات مزمن رکود، تورم، تحریم و فساد روبرو بود.""", "وام یارانه به چه کسانی میدهند؟" ) run_model( "در ۲۲ ژوئن ۱۹۴۱ نیروهای محور در عملیات بارباروسا حمله سنگینی به اتحاد شوروی کرده و یکی از بزرگترین نبردهای زمینی تاریخ بشر را رقم زدند. همچنین جبهه شرقی باعث به دام افتادن نیروهای محور شد و بیش از همه ارتش آلمان نازی را درگیر جنگ فرسایشی کرد. در دسامبر ۱۹۴۱ ژاپن یک در عملیاتی ناگهانی با نام نبرد پرل هاربر به پایگاه دریایی ایالات متحده آمریکا حمله کرد. به دنبال این اتفاق آمریکا نیز بلافاصله علیه ژاپن اعلان جنگ کرد که با حمایت بریتانیا همراه شد. پس از آن متحدین (نیروهای محور در اروپا) نیز با اتحاد ژاپن علیه آمریکا اعلام جنگ کردند. دست‌آوردهای ژاپن در یورش به آمریکا باعث ایجاد این احساس در آسیا شد که آسیا از تسلط غرب خارج شده‌است از این رو بسیاری از ارتش‌های شکست خورده با آنها همراهی کردند.", "چرا امریکا وارد جنگ جهانی دوم شد؟" ) ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/mt5-small-parsinlu-translation_en_fa
2021-03-31T04:31:06.000Z
[ "pytorch", "mt5", "seq2seq", "fa", "multilingual", "dataset:parsinlu", "transformers", "machine-translation", "persian", "farsi", "license:cc by-nc-sa 4.0", "text2text-generation" ]
text2text-generation
[ ".gitattributes", "README.md", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
persiannlp
38
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - machine-translation - mt5 - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu metrics: - sacrebleu --- # Machine Translation (ترجمه‌ی ماشینی) This is an mT5-based model for machine translation (English -> Persian). Here is an example of how you can run this model: ```python from transformers import MT5ForConditionalGeneration, MT5Tokenizer model_size = "small" model_name = f"persiannlp/mt5-{model_size}-parsinlu-translation_en_fa" tokenizer = MT5Tokenizer.from_pretrained(model_name) model = MT5ForConditionalGeneration.from_pretrained(model_name) def run_model(input_string, **generator_args): input_ids = tokenizer.encode(input_string, return_tensors="pt") res = model.generate(input_ids, **generator_args) output = tokenizer.batch_decode(res, skip_special_tokens=True) print(output) return output run_model("Praise be to Allah, the Cherisher and Sustainer of the worlds;") run_model("shrouds herself in white and walks penitentially disguised as brotherly love through factories and parliaments; offers help, but desires power;") run_model("He thanked all fellow bloggers and organizations that showed support.") run_model("Races are held between April and December at the Veliefendi Hippodrome near Bakerky, 15 km (9 miles) west of Istanbul.") run_model("I want to pursue PhD in Computer Science about social network,what is the open problem in social networks?") ``` which should output: ``` ['برای الله، یعنی چرنده و سوزان دنیا، تحسین کنید'] ['خودش را در سفید پوسته می کند و به صورت عشق برادرانه'] ['او از تمام بلاگرها و سازمان هایی که حمایتشان را نشان می داد'] ['در طول ماه آوریل و دسامبر در والی فیودورونا نزدیک بیکر'] ['من می خواهم در مورد شبکه اجتماعی تحقیقات علوم کامپیوتری را دن'] ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/parsbert-base-parsinlu-entailment
2021-05-20T02:23:55.000Z
[ "pytorch", "jax", "bert", "text-classification", "fa", "multilingual", "dataset:parsinlu", "transformers", "entailment", "parsbert", "persian", "farsi", "license:cc by-nc-sa 4.0" ]
text-classification
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.txt" ]
persiannlp
28
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - entailment - parsbert - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu metrics: - accuracy --- # Textual Entailment (مدل برای پاسخ به استلزام منطقی) This is a model for textual entailment problems. Here is an example of how you can run this model: ```python import torch from transformers import AutoModelForSequenceClassification, AutoTokenizer import numpy as np labels = ["entails", "contradicts", "neutral"] model_name_or_path = "persiannlp/parsbert-base-parsinlu-entailment" model = AutoModelForSequenceClassification.from_pretrained(model_name_or_path) tokenizer = AutoTokenizer.from_pretrained(model_name_or_path,) def model_predict(text_a, text_b): features = tokenizer( [(text_a, text_b)], padding="max_length", truncation=True, return_tensors='pt') output = model(**features) logits = output[0] probs = torch.nn.functional.softmax(logits, dim=1).tolist() idx = np.argmax(np.array(probs)) print(labels[idx], probs) model_predict( "این مسابقات بین آوریل و دسامبر در هیپودروم ولیفندی در نزدیکی باکرکی ، ۱۵ کیلومتری (۹ مایل) غرب استانبول برگزار می شود.", "در ولیفندی هیپودروم، مسابقاتی از آوریل تا دسامبر وجود دارد." ) model_predict( "آیا کودکانی وجود دارند که نیاز به سرگرمی دارند؟", "هیچ کودکی هرگز نمی خواهد سرگرم شود.", ) model_predict( "ما به سفرهایی رفته ایم که در نهرهایی شنا کرده ایم", "علاوه بر استحمام در نهرها ، ما به اسپا ها و سونا ها نیز رفته ایم." ) ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/parsbert-base-parsinlu-multiple-choice
2021-05-20T02:25:38.000Z
[ "pytorch", "jax", "bert", "multiple-choice", "fa", "multilingual", "dataset:parsinlu", "transformers", "parsbert", "persian", "farsi", "license:cc by-nc-sa 4.0", "text-classification", "pipeline_tag:text-classification" ]
text-classification
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.txt" ]
persiannlp
42
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - multiple-choice - parsbert - persian - farsi pipeline_tag: text-classification license: "CC BY-NC-SA 4.0" datasets: - parsinlu metrics: - accuracy --- # Multiple-Choice Question Answering (مدل برای پاسخ به سوالات چهار جوابی) This is a parsbert-based model for multiple-choice question answering. Here is an example of how you can run this model: ```python from typing import List import torch from transformers import AutoConfig, AutoModelForMultipleChoice, AutoTokenizer model_name = "persiannlp/parsbert-base-parsinlu-multiple-choice" tokenizer = AutoTokenizer.from_pretrained(model_name) config = AutoConfig.from_pretrained(model_name) model = AutoModelForMultipleChoice.from_pretrained(model_name, config=config) def run_model(question: str, candicates: List[str]): assert len(candicates) == 4, "you need four candidates" choices_inputs = [] for c in candicates: text_a = "" # empty context text_b = question + " " + c inputs = tokenizer( text_a, text_b, add_special_tokens=True, max_length=128, padding="max_length", truncation=True, return_overflowing_tokens=True, ) choices_inputs.append(inputs) input_ids = torch.LongTensor([x["input_ids"] for x in choices_inputs]) output = model(input_ids=input_ids) print(output) return output run_model(question="وسیع ترین کشور جهان کدام است؟", candicates=["آمریکا", "کانادا", "روسیه", "چین"]) run_model(question="طامع یعنی ؟", candicates=["آزمند", "خوش شانس", "محتاج", "مطمئن"]) run_model( question="زمینی به ۳۱ قطعه متساوی مفروض شده است و هر روز مساحت آماده شده برای احداث، دو برابر مساحت روز قبل است.اگر پس از (۵ روز) تمام زمین آماده شده باشد، در چه روزی یک قطعه زمین آماده شده ", candicates=["روز اول", "روز دوم", "روز سوم", "هیچکدام"]) ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/wikibert-base-parsinlu-entailment
2021-05-20T02:26:51.000Z
[ "pytorch", "jax", "bert", "text-classification", "fa", "multilingual", "dataset:parsinlu", "transformers", "entailment", "wikibert", "persian", "farsi", "license:cc by-nc-sa 4.0" ]
text-classification
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.txt" ]
persiannlp
111
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - entailment - wikibert - persian - farsi license: "CC BY-NC-SA 4.0" datasets: - parsinlu metrics: - accuracy --- # Textual Entailment (مدل برای پاسخ به استلزام منطقی) This is a model for textual entailment problems. Here is an example of how you can run this model: ```python import torch from transformers import AutoModelForSequenceClassification, AutoTokenizer import numpy as np labels = ["entails", "contradicts", "neutral"] model_name_or_path = "persiannlp/wikibert-base-parsinlu-entailment" model = AutoModelForSequenceClassification.from_pretrained(model_name_or_path) tokenizer = AutoTokenizer.from_pretrained(model_name_or_path,) def model_predict(text_a, text_b): features = tokenizer( [(text_a, text_b)], padding="max_length", truncation=True, return_tensors='pt') output = model(**features) logits = output[0] probs = torch.nn.functional.softmax(logits, dim=1).tolist() idx = np.argmax(np.array(probs)) print(labels[idx], probs) model_predict( "این مسابقات بین آوریل و دسامبر در هیپودروم ولیفندی در نزدیکی باکرکی ، ۱۵ کیلومتری (۹ مایل) غرب استانبول برگزار می شود.", "در ولیفندی هیپودروم، مسابقاتی از آوریل تا دسامبر وجود دارد." ) model_predict( "آیا کودکانی وجود دارند که نیاز به سرگرمی دارند؟", "هیچ کودکی هرگز نمی خواهد سرگرم شود.", ) model_predict( "ما به سفرهایی رفته ایم که در نهرهایی شنا کرده ایم", "علاوه بر استحمام در نهرها ، ما به اسپا ها و سونا ها نیز رفته ایم." ) ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
persiannlp/wikibert-base-parsinlu-multiple-choice
2021-05-20T02:28:01.000Z
[ "pytorch", "jax", "bert", "multiple-choice", "fa", "multilingual", "dataset:parsinlu", "transformers", "wikibert", "persian", "farsi", "license:cc by-nc-sa 4.0", "text-classification", "pipeline_tag:text-classification" ]
text-classification
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.txt" ]
persiannlp
75
transformers
--- language: - fa - multilingual thumbnail: "https://upload.wikimedia.org/wikipedia/commons/a/a2/Farsi.svg" tags: - multiple-choice - wikibert - persian - farsi pipeline_tag: text-classification license: "CC BY-NC-SA 4.0" datasets: - parsinlu metrics: - accuracy --- # Multiple-Choice Question Answering (مدل برای پاسخ به سوالات چهار جوابی) This is a wikibert-based model for multiple-choice question answering. Here is an example of how you can run this model: ```python from typing import List import torch from transformers import AutoConfig, AutoModelForMultipleChoice, AutoTokenizer model_name = "persiannlp/wikibert-base-parsinlu-multiple-choice" tokenizer = AutoTokenizer.from_pretrained(model_name) config = AutoConfig.from_pretrained(model_name) model = AutoModelForMultipleChoice.from_pretrained(model_name, config=config) def run_model(question: str, candicates: List[str]): assert len(candicates) == 4, "you need four candidates" choices_inputs = [] for c in candicates: text_a = "" # empty context text_b = question + " " + c inputs = tokenizer( text_a, text_b, add_special_tokens=True, max_length=128, padding="max_length", truncation=True, return_overflowing_tokens=True, ) choices_inputs.append(inputs) input_ids = torch.LongTensor([x["input_ids"] for x in choices_inputs]) output = model(input_ids=input_ids) print(output) return output run_model(question="وسیع ترین کشور جهان کدام است؟", candicates=["آمریکا", "کانادا", "روسیه", "چین"]) run_model(question="طامع یعنی ؟", candicates=["آزمند", "خوش شانس", "محتاج", "مطمئن"]) run_model( question="زمینی به ۳۱ قطعه متساوی مفروض شده است و هر روز مساحت آماده شده برای احداث، دو برابر مساحت روز قبل است.اگر پس از (۵ روز) تمام زمین آماده شده باشد، در چه روزی یک قطعه زمین آماده شده ", candicates=["روز اول", "روز دوم", "روز سوم", "هیچکدام"]) ``` For more details, visit this page: https://github.com/persiannlp/parsinlu/
pertschuk/0_RoBERTa
2020-04-15T23:33:48.000Z
[ "pytorch", "transformers" ]
[ ".gitattributes", "added_tokens.json", "config.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
pertschuk
12
transformers
pertschuk/albert-base-quora-classifier
2020-04-24T16:04:59.000Z
[ "pytorch", "albert", "text-classification", "transformers" ]
text-classification
[ ".gitattributes", "config.json", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
pertschuk
19
transformers
pertschuk/albert-base-squad-classifier-ms
2020-04-24T16:05:01.000Z
[ "pytorch", "albert", "text-classification", "transformers" ]
text-classification
[ ".gitattributes", "config.json", "pytorch_model.bin" ]
pertschuk
10
transformers
pertschuk/albert-base-squad-classifier
2020-04-24T16:05:03.000Z
[ "pytorch", "albert", "text-classification", "transformers" ]
text-classification
[ ".gitattributes", "config.json", "pytorch_model.bin" ]
pertschuk
11
transformers
pertschuk/albert-intent-model-v3
2020-04-24T16:05:05.000Z
[ "pytorch", "albert", "text-classification", "transformers" ]
text-classification
[ ".gitattributes", "config.json", "labels.txt", "pytorch_model.bin" ]
pertschuk
317
transformers
pertschuk/albert-large-intent-v2
2020-04-24T16:05:07.000Z
[ "pytorch", "albert", "text-classification", "transformers" ]
text-classification
[ ".gitattributes", "config.json", "labels.txt", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
pertschuk
61
transformers
pertschuk/albert-large-intent-v3
2020-04-24T16:05:09.000Z
[ "pytorch", "albert", "text-classification", "transformers" ]
text-classification
[ ".gitattributes", "config.json", "labels.txt", "pytorch_model.bin", "special_tokens_map.json", "spiece.model", "tokenizer_config.json" ]
pertschuk
122
transformers
pertschuk/bert-large-uncased-msmarco
2021-05-20T02:30:02.000Z
[ "pytorch", "jax", "bert", "transformers" ]
[ ".gitattributes", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.txt" ]
pertschuk
15
transformers
pervonrosen/gpt2-swedish
2020-11-30T12:01:19.000Z
[]
[ ".gitattributes" ]
pervonrosen
0
peterb/test_model_3
2021-03-24T21:35:31.000Z
[]
[ ".gitattributes" ]
peterb
0
peterchou/ernie-gram
2021-05-21T15:26:54.000Z
[ "pytorch", "bert", "transformers" ]
[ ".gitattributes", "config.json", "pytorch_model.bin", "vocab.txt" ]
peterchou
140
transformers
peterchou/nezha-chinese-base
2021-05-20T02:32:33.000Z
[ "pytorch", "jax", "bert", "masked-lm", "transformers", "fill-mask" ]
fill-mask
[ ".gitattributes", "config.json", "flax_model.msgpack", "pytorch_model.bin", "vocab.txt" ]
peterchou
138
transformers
peterchou/simbert-chinese-base
2021-06-07T05:21:51.000Z
[ "pytorch", "bert", "transformers" ]
[ ".gitattributes", "config.json", "pytorch_model.bin", "vocab.txt" ]
peterchou
27
transformers
peterchou/unilm-chinese-base
2021-05-20T02:33:23.000Z
[ "pytorch", "jax", "bert", "transformers" ]
[ ".gitattributes", "config.json", "flax_model.msgpack", "pytorch_model.bin", "vocab.txt" ]
peterchou
42
transformers
petrovlaurent/hfasdfg
2021-06-10T07:37:45.000Z
[]
[ ".gitattributes", "README.md" ]
petrovlaurent
0
pewriebontal/DialoGPT-medium-Pewpewbon
2021-06-13T11:46:24.000Z
[ "pytorch", "gpt2", "lm-head", "causal-lm", "transformers", "conversational", "text-generation" ]
conversational
[ ".gitattributes", "README.md", "config.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer.json", "tokenizer_config.json", "vocab.json" ]
pewriebontal
108
transformers
--- tags: - conversational --- # My Awesome Model
philschmid/bart-base-samsum
2021-03-31T11:49:58.000Z
[ "pytorch", "bart", "seq2seq", "en", "dataset:samsum", "transformers", "sagemaker", "summarization", "license:apache-2.0", "text2text-generation" ]
summarization
[ ".gitattributes", "README.md", "all_results.json", "config.json", "eval_results.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "train_results.json", "trainer_state.json", "training_args.bin", "vocab.json" ]
philschmid
1,114
transformers
--- language: en tags: - sagemaker - bart - summarization license: apache-2.0 datasets: - samsum widget: - text: | Jeff: Can I train a 🤗 Transformers model on Amazon SageMaker? Philipp: Sure you can use the new Hugging Face Deep Learning Container. Jeff: ok. Jeff: and how can I get started? Jeff: where can I find documentation? Philipp: ok, ok you can find everything here. https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face --- ## `bart-base-samsum` This model was trained using Amazon SageMaker and the new Hugging Face Deep Learning container. You can find the notebook [here]() and the referring blog post [here](). For more information look at: - [🤗 Transformers Documentation: Amazon SageMaker](https://huggingface.co/transformers/sagemaker.html) - [Example Notebooks](https://github.com/huggingface/notebooks/tree/master/sagemaker) - [Amazon SageMaker documentation for Hugging Face](https://docs.aws.amazon.com/sagemaker/latest/dg/hugging-face.html) - [Python SDK SageMaker documentation for Hugging Face](https://sagemaker.readthedocs.io/en/stable/frameworks/huggingface/index.html) - [Deep Learning Container](https://github.com/aws/deep-learning-containers/blob/master/available_images.md#huggingface-training-containers) ## Hyperparameters ```json { "dataset_name": "samsum", "do_eval": true, "do_train": true, "fp16": true, "learning_rate": 5e-05, "model_name_or_path": "facebook/bart-base", "num_train_epochs": 3, "output_dir": "/opt/ml/model", "per_device_eval_batch_size": 8, "per_device_train_batch_size": 8, "seed": 7 } ``` ## Train results | key | value | | --- | ----- | | epoch | 3 | | init_mem_cpu_alloc_delta | 180190 | | init_mem_cpu_peaked_delta | 18282 | | init_mem_gpu_alloc_delta | 558658048 | | init_mem_gpu_peaked_delta | 0 | | train_mem_cpu_alloc_delta | 6658519 | | train_mem_cpu_peaked_delta | 642937 | | train_mem_gpu_alloc_delta | 2267624448 | | train_mem_gpu_peaked_delta | 10355728896 | | train_runtime | 98.4931 | | train_samples | 14732 | | train_samples_per_second | 3.533 | ## Eval results | key | value | | --- | ----- | | epoch | 3 | | eval_loss | 1.5356481075286865 | | eval_mem_cpu_alloc_delta | 659047 | | eval_mem_cpu_peaked_delta | 18254 | | eval_mem_gpu_alloc_delta | 0 | | eval_mem_gpu_peaked_delta | 300285440 | | eval_runtime | 0.3116 | | eval_samples | 818 | | eval_samples_per_second | 2625.337 | ## Usage ```python from transformers import pipeline summarizer = pipeline("summarization", model="philschmid/bart-base-samsum") conversation = '''Jeff: Can I train a 🤗 Transformers model on Amazon SageMaker? Philipp: Sure you can use the new Hugging Face Deep Learning Container. Jeff: ok. Jeff: and how can I get started? Jeff: where can I find documentation? Philipp: ok, ok you can find everything here. https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face ''' nlp(conversation) ```
philschmid/bart-large-cnn-samsum
2021-04-01T14:19:26.000Z
[ "pytorch", "bart", "seq2seq", "en", "dataset:samsum", "transformers", "sagemaker", "summarization", "license:apache-2.0", "text2text-generation" ]
summarization
[ ".gitattributes", "README.md", "all_results.json", "config.json", "eval_results.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "test_generations.txt", "test_results.json", "tokenizer_config.json", "train_results.json", "trainer_state.json", "training_args.bin", "vocab.json", "checkpoint-500/config.json", "checkpoint-500/merges.txt", "checkpoint-500/optimizer.pt", "checkpoint-500/pytorch_model.bin", "checkpoint-500/scheduler.pt", "checkpoint-500/special_tokens_map.json", "checkpoint-500/tokenizer_config.json", "checkpoint-500/trainer_state.json", "checkpoint-500/training_args.bin", "checkpoint-500/vocab.json" ]
philschmid
2,246
transformers
--- language: en tags: - sagemaker - bart - summarization license: apache-2.0 datasets: - samsum widget: - text: | Jeff: Can I train a 🤗 Transformers model on Amazon SageMaker? Philipp: Sure you can use the new Hugging Face Deep Learning Container. Jeff: ok. Jeff: and how can I get started? Jeff: where can I find documentation? Philipp: ok, ok you can find everything here. https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face model-index: - name: bart-large-cnn-samsum results: - task: name: Abstractive Text Summarization type: abstractive-text-summarization dataset: name: "SAMSum Corpus: A Human-annotated Dialogue Dataset for Abstractive Summarization" type: samsum metrics: - name: Validation ROGUE-1 type: rogue-1 value: 42.621 - name: Validation ROGUE-2 type: rogue-2 value: 21.9825 - name: Validation ROGUE-L type: rogue-l value: 33.034 - name: Test ROGUE-1 type: rogue-1 value: 41.3174 - name: Test ROGUE-2 type: rogue-2 value: 20.8716 - name: Test ROGUE-L type: rogue-l value: 32.1337 --- ## `bart-large-cnn-samsum` This model was trained using Amazon SageMaker and the new Hugging Face Deep Learning container. For more information look at: - [🤗 Transformers Documentation: Amazon SageMaker](https://huggingface.co/transformers/sagemaker.html) - [Example Notebooks](https://github.com/huggingface/notebooks/tree/master/sagemaker) - [Amazon SageMaker documentation for Hugging Face](https://docs.aws.amazon.com/sagemaker/latest/dg/hugging-face.html) - [Python SDK SageMaker documentation for Hugging Face](https://sagemaker.readthedocs.io/en/stable/frameworks/huggingface/index.html) - [Deep Learning Container](https://github.com/aws/deep-learning-containers/blob/master/available_images.md#huggingface-training-containers) ## Hyperparameters ```json { "dataset_name": "samsum", "do_eval": true, "do_predict": true, "do_train": true, "fp16": true, "learning_rate": 5e-05, "model_name_or_path": "facebook/bart-large-cnn", "num_train_epochs": 3, "output_dir": "/opt/ml/model", "per_device_eval_batch_size": 4, "per_device_train_batch_size": 4, "predict_with_generate": true, "seed": 7 } ``` ## Usage ```python from transformers import pipeline summarizer = pipeline("summarization", model="philschmid/bart-large-cnn-samsum") conversation = '''Jeff: Can I train a 🤗 Transformers model on Amazon SageMaker? Philipp: Sure you can use the new Hugging Face Deep Learning Container. Jeff: ok. Jeff: and how can I get started? Jeff: where can I find documentation? Philipp: ok, ok you can find everything here. https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face ''' nlp(conversation) ``` ## Results | key | value | | --- | ----- | | eval_rouge1 | 42.621 | | eval_rouge2 | 21.9825 | | eval_rougeL | 33.034 | | eval_rougeLsum | 39.6783 | | test_rouge1 | 41.3174 | | test_rouge2 | 20.8716 | | test_rougeL | 32.1337 | | test_rougeLsum | 38.4149 |
philschmid/distilbart-cnn-12-6-samsum
2021-03-31T11:50:38.000Z
[ "pytorch", "bart", "seq2seq", "en", "dataset:samsum", "transformers", "sagemaker", "summarization", "license:apache-2.0", "text2text-generation" ]
summarization
[ ".gitattributes", "README.md", "all_results.json", "config.json", "eval_results.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "train_results.json", "trainer_state.json", "training_args.bin", "vocab.json" ]
philschmid
359
transformers
--- language: en tags: - sagemaker - bart - summarization license: apache-2.0 datasets: - samsum widget: - text: | Jeff: Can I train a 🤗 Transformers model on Amazon SageMaker? Philipp: Sure you can use the new Hugging Face Deep Learning Container. Jeff: ok. Jeff: and how can I get started? Jeff: where can I find documentation? Philipp: ok, ok you can find everything here. https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face --- ## `distilbart-cnn-12-6-samsum` This model was trained using Amazon SageMaker and the new Hugging Face Deep Learning container. For more information look at: - [🤗 Transformers Documentation: Amazon SageMaker](https://huggingface.co/transformers/sagemaker.html) - [Example Notebooks](https://github.com/huggingface/notebooks/tree/master/sagemaker) - [Amazon SageMaker documentation for Hugging Face](https://docs.aws.amazon.com/sagemaker/latest/dg/hugging-face.html) - [Python SDK SageMaker documentation for Hugging Face](https://sagemaker.readthedocs.io/en/stable/frameworks/huggingface/index.html) - [Deep Learning Container](https://github.com/aws/deep-learning-containers/blob/master/available_images.md#huggingface-training-containers) ## Hyperparameters ```json { "dataset_name": "samsum", "do_eval": true, "do_train": true, "fp16": true, "learning_rate": 5e-05, "model_name_or_path": "sshleifer/distilbart-cnn-12-6", "num_train_epochs": 3, "output_dir": "/opt/ml/model", "per_device_eval_batch_size": 8, "per_device_train_batch_size": 8, "seed": 7 } ``` ## Train results | key | value | | --- | ----- | | epoch | 3.0 | | init_mem_cpu_alloc_delta | 180338 | | init_mem_cpu_peaked_delta | 18282 | | init_mem_gpu_alloc_delta | 1222242816 | | init_mem_gpu_peaked_delta | 0 | | train_mem_cpu_alloc_delta | 6971403 | | train_mem_cpu_peaked_delta | 640733 | | train_mem_gpu_alloc_delta | 4910897664 | | train_mem_gpu_peaked_delta | 23331969536 | | train_runtime | 155.2034 | | train_samples | 14732 | | train_samples_per_second | 2.242 | ## Eval results | key | value | | --- | ----- | | epoch | 3.0 | | eval_loss | 1.4209576845169067 | | eval_mem_cpu_alloc_delta | 868003 | | eval_mem_cpu_peaked_delta | 18250 | | eval_mem_gpu_alloc_delta | 0 | | eval_mem_gpu_peaked_delta | 328244736 | | eval_runtime | 0.6088 | | eval_samples | 818 | | eval_samples_per_second | 1343.647 | ## Usage ```python from transformers import pipeline summarizer = pipeline("summarization", model="philschmid/distilbart-cnn-12-6-samsum") conversation = '''Jeff: Can I train a 🤗 Transformers model on Amazon SageMaker? Philipp: Sure you can use the new Hugging Face Deep Learning Container. Jeff: ok. Jeff: and how can I get started? Jeff: where can I find documentation? Philipp: ok, ok you can find everything here. https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face ''' nlp(conversation) ```
philschmid/distilroberta-base-ner-conll2003
2021-05-22T18:17:12.000Z
[ "pytorch", "roberta", "token-classification", "dataset:conll2003", "transformers", "license:apache-2.0" ]
token-classification
[ ".gitattributes", "README.md", "config.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer.json", "tokenizer_config.json", "vocab.json" ]
philschmid
147
transformers
--- license: apache-2.0 tags: - token-classification datasets: - conll2003 metrics: - precision - recall - f1 - accuracy model-index: - name: distilroberta-base-ner-conll2003 results: - task: name: Token Classification type: token-classification dataset: name: conll2003 type: conll2003 metrics: - name: Precision type: precision value: 0.9492923423001218 - name: Recall type: recall value: 0.9565545901020023 - name: F1 type: f1 value: 0.9529096297690173 - name: Accuracy type: accuracy value: 0.9883096560400111 --- <!-- This model card has been generated automatically according to the information the Trainer had access to. You should probably proofread and complete it, then remove this comment. --> # distilroberta-base-ner-conll2003 This model is a fine-tuned version of [distilroberta-base](https://huggingface.co/distilroberta-base) on the conll2003 dataset. eval F1-Score: **95,29** (CoNLL-03) test F1-Score: **90,74** (CoNLL-03) eval F1-Score: **95,29** (CoNLL++ / CoNLL-03 corrected) test F1-Score: **92,23** (CoNLL++ / CoNLL-03 corrected) ## Model Usage ```python from transformers import AutoTokenizer, AutoModelForTokenClassification from transformers import pipeline tokenizer = AutoTokenizer.from_pretrained("philschmid/distilroberta-base-ner-conll2003") model = AutoModelForTokenClassification.from_pretrained("philschmid/distilroberta-base-ner-conll2003") nlp = pipeline("ner", model=model, tokenizer=tokenizer, grouped_entities=True) example = "My name is Philipp and live in Germany" nlp(example) ``` ## Training procedure ### Training hyperparameters The following hyperparameters were used during training: - learning_rate: 4.9902376275441704e-05 - train_batch_size: 32 - eval_batch_size: 16 - seed: 42 - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 - lr_scheduler_type: linear - num_epochs: 6.0 - mixed_precision_training: Native AMP ### Training results #### CoNNL2003 It achieves the following results on the evaluation set: - Loss: 0.0583 - Precision: 0.9493 - Recall: 0.9566 - F1: 0.9529 - Accuracy: 0.9883 It achieves the following results on the test set: - Loss: 0.2025 - Precision: 0.8999 - Recall: 0.915 - F1: 0.9074 - Accuracy: 0.9741 #### CoNNL++ / CoNLL2003 corrected It achieves the following results on the evaluation set: - Loss: 0.0567 - Precision: 0.9493 - Recall: 0.9566 - F1: 0.9529 - Accuracy: 0.9883 It achieves the following results on the test set: - Loss: 0.1359 - Precision: 0.92 - Recall: 0.9245 - F1: 0.9223 - Accuracy: 0.9785 ### Framework versions - Transformers 4.6.1 - Pytorch 1.8.1+cu101 - Datasets 1.6.2 - Tokenizers 0.10.2
philschmid/distilroberta-base-ner-wikiann-conll2003-3-class
2021-05-26T14:13:00.000Z
[ "pytorch", "roberta", "token-classification", "dataset:wikiann-conll2003", "transformers", "license:apache-2.0" ]
token-classification
[ ".gitattributes", "README.md", "config.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer.json", "tokenizer_config.json", "vocab.json" ]
philschmid
25
transformers
--- license: apache-2.0 tags: - token-classification datasets: - wikiann-conll2003 metrics: - precision - recall - f1 - accuracy model-index: - name: distilroberta-base-ner-wikiann-conll2003-3-class results: - task: name: Token Classification type: token-classification dataset: name: wikiann-conll2003 type: wikiann-conll2003 metrics: - name: Precision type: precision value: 0.9624757386241104 - name: Recall type: recall value: 0.9667497021553124 - name: F1 type: f1 value: 0.964607986167396 - name: Accuracy type: accuracy value: 0.9913626461292995 --- <!-- This model card has been generated automatically according to the information the Trainer had access to. You should probably proofread and complete it, then remove this comment. --> # distilroberta-base-ner-wikiann-conll2003-3-class This model is a fine-tuned version of [distilroberta-base](https://huggingface.co/distilroberta-base) on the wikiann and conll2003 dataset. It consists out of the classes of wikiann. O (0), B-PER (1), I-PER (2), B-ORG (3), I-ORG (4) B-LOC (5), I-LOC (6). eval F1-Score: **96,25** (merged dataset) test F1-Score: **92,41** (merged dataset) ## Model Usage ```python from transformers import AutoTokenizer, AutoModelForTokenClassification from transformers import pipeline tokenizer = AutoTokenizer.from_pretrained("philschmid/distilroberta-base-ner-wikiann-conll2003-3-class") model = AutoModelForTokenClassification.from_pretrained("philschmid/distilroberta-base-ner-wikiann-conll2003-3-class") nlp = pipeline("ner", model=model, tokenizer=tokenizer, grouped_entities=True) example = "My name is Philipp and live in Germany" nlp(example) ``` ## Training procedure ### Training hyperparameters The following hyperparameters were used during training: - learning_rate: 4.9086903597787154e-05 - train_batch_size: 32 - eval_batch_size: 16 - seed: 42 - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 - lr_scheduler_type: linear - num_epochs: 5.0 - mixed_precision_training: Native AMP ### Training results It achieves the following results on the evaluation set: - Loss: 0.0520 - Precision: 0.9625 - Recall: 0.9667 - F1: 0.9646 - Accuracy: 0.9914 It achieves the following results on the test set: - Loss: 0.141 - Precision: 0.917 - Recall: 0.9313 - F1: 0.9241 - Accuracy: 0.9807 ### Framework versions - Transformers 4.6.1 - Pytorch 1.8.1+cu101 - Datasets 1.6.2 - Tokenizers 0.10.3
philschmid/distilroberta-base-ner-wikiann-conll2003-4-class
2021-05-24T18:53:58.000Z
[ "pytorch", "roberta", "token-classification", "dataset:wikiann-conll2003", "transformers", "license:apache-2.0" ]
token-classification
[ ".gitattributes", "README.md", "config.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer.json", "tokenizer_config.json", "vocab.json" ]
philschmid
19
transformers
--- license: apache-2.0 tags: - token-classification datasets: - wikiann-conll2003 metrics: - precision - recall - f1 - accuracy model-index: - name: distilroberta-base-ner-wikiann-conll2003-4-class results: - task: name: Token Classification type: token-classification dataset: name: wikiann-conll2003 type: wikiann-conll2003 metrics: - name: Precision type: precision value: 0.9492143658810326 - name: Recall type: recall value: 0.9585379675103891 - name: F1 type: f1 value: 0.9538533834586467 - name: Accuracy type: accuracy value: 0.9882022644288301 --- <!-- This model card has been generated automatically according to the information the Trainer had access to. You should probably proofread and complete it, then remove this comment. --> # distilroberta-base-ner-wikiann-conll2003-4-class This model is a fine-tuned version of [distilroberta-base](https://huggingface.co/distilroberta-base) on the wikiann and conll2003 dataset. It consists out of the classes of conll2003. O (0), B-PER (1), I-PER (2), B-ORG (3), I-ORG (4) B-LOC (5), I-LOC (6) B-MISC (7), I-MISC (8). eval F1-Score: **95,39** (merged dataset) test F1-Score: **90,75** (merged dataset) ## Model Usage ```python from transformers import AutoTokenizer, AutoModelForTokenClassification from transformers import pipeline tokenizer = AutoTokenizer.from_pretrained("philschmid/distilroberta-base-ner-wikiann-conll2003-4-class") model = AutoModelForTokenClassification.from_pretrained("philschmid/distilroberta-base-ner-wikiann-conll2003-4-class") nlp = pipeline("ner", model=model, tokenizer=tokenizer, grouped_entities=True) example = "My name is Philipp and live in Germany" nlp(example) ``` ## Training procedure ### Training hyperparameters The following hyperparameters were used during training: - learning_rate: 4.9086903597787154e-05 - train_batch_size: 32 - eval_batch_size: 16 - seed: 42 - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 - lr_scheduler_type: linear - num_epochs: 5.0 - mixed_precision_training: Native AMP ### Training results It achieves the following results on the evaluation set: - Loss: 0.0705 - Precision: 0.9492 - Recall: 0.9585 - F1: 0.9539 - Accuracy: 0.9882 It achieves the following results on the test set: - Loss: 0.239 - Precision: 0.8984 - Recall: 0.9168 - F1: 0.9075 - Accuracy: 0.9741 ### Framework versions - Transformers 4.6.1 - Pytorch 1.8.1+cu101 - Datasets 1.6.2 - Tokenizers 0.10.2
philschmid/distilroberta-base-ner-wikiann
2021-05-24T18:50:56.000Z
[ "pytorch", "roberta", "token-classification", "dataset:wikiann", "transformers", "license:apache-2.0" ]
token-classification
[ ".gitattributes", "README.md", "config.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer.json", "tokenizer_config.json", "vocab.json" ]
philschmid
102
transformers
--- license: apache-2.0 tags: - token-classification datasets: - wikiann metrics: - precision - recall - f1 - accuracy model-index: - name: distilroberta-base-ner-wikiann results: - task: name: Token Classification type: token-classification dataset: name: wikiann type: wikiann metrics: - name: Precision type: precision value: 0.8331921416757433 - name: Recall type: recall value: 0.84243586083126 - name: F1 type: f1 value: 0.8377885044416501 - name: Accuracy type: accuracy value: 0.91930707459758 --- <!-- This model card has been generated automatically according to the information the Trainer had access to. You should probably proofread and complete it, then remove this comment. --> # distilroberta-base-ner-wikiann This model is a fine-tuned version of [distilroberta-base](https://huggingface.co/distilroberta-base) on the wikiann dataset. eval F1-Score: **83,78** test F1-Score: **83,76** ## Model Usage ```python from transformers import AutoTokenizer, AutoModelForTokenClassification from transformers import pipeline tokenizer = AutoTokenizer.from_pretrained("philschmid/distilroberta-base-ner-wikiann") model = AutoModelForTokenClassification.from_pretrained("philschmid/distilroberta-base-ner-wikiann") nlp = pipeline("ner", model=model, tokenizer=tokenizer, grouped_entities=True) example = "My name is Philipp and live in Germany" nlp(example) ``` ## Training procedure ### Training hyperparameters The following hyperparameters were used during training: - learning_rate: 4.9086903597787154e-05 - train_batch_size: 32 - eval_batch_size: 16 - seed: 42 - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 - lr_scheduler_type: linear - num_epochs: 5.0 - mixed_precision_training: Native AMP ### Training results It achieves the following results on the evaluation set: - Loss: 0.3156 - Precision: 0.8332 - Recall: 0.8424 - F1: 0.8378 - Accuracy: 0.9193 It achieves the following results on the test set: - Loss: 0.3023 - Precision: 0.8301 - Recall: 0.8452 - F1: 0.8376 - Accuracy: 0.92 ### Framework versions - Transformers 4.6.1 - Pytorch 1.8.1+cu101 - Datasets 1.6.2 - Tokenizers 0.10.2
philschmid/vit-base-patch16-224-in21k-image-classification-sagemaker
2021-06-09T08:07:35.000Z
[ "pytorch", "vit", "transformers", "image-classification" ]
image-classification
[ ".gitattributes", "README.md", "config.json", "preprocessor_config.json", "pytorch_model.bin" ]
philschmid
48
transformers
--- tags: - image-classification metrics: - accuracy model-index: - name: vit-base-patch16-224-in21k-image-classification-sagemaker --- <!-- This model card has been generated automatically according to the information the Trainer had access to. You should probably proofread and complete it, then remove this comment. --> # vit-base-patch16-224-in21k-image-classification-sagemaker This model is a fine-tuned version of [vit-base-patch16-224-in21k](https://huggingface.co/vit-base-patch16-224-in21k) on the cifar10 dataset. It achieves the following results on the evaluation set: - Loss: 0.3033 - Accuracy: 0.972 ## Model description More information needed ## Intended uses & limitations More information needed ## Training and evaluation data More information needed ## Training procedure ### Training hyperparameters The following hyperparameters were used during training: - learning_rate: 2e-05 - train_batch_size: 16 - eval_batch_size: 64 - seed: 42 - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08 - lr_scheduler_type: linear - lr_scheduler_warmup_steps: 500 - num_epochs: 3 ### Training results | Training Loss | Epoch | Step | Validation Loss | Accuracy | |:-------------:|:-----:|:----:|:---------------:|:--------:| | No log | 1.0 | 313 | 1.4603 | 0.936 | | 1.6548 | 2.0 | 626 | 0.4451 | 0.966 | | 1.6548 | 3.0 | 939 | 0.3033 | 0.972 | ### Framework versions - Transformers 4.6.1 - Pytorch 1.7.1 - Datasets 1.6.2 - Tokenizers 0.10.3
phiyodr/bart-large-finetuned-squad2
2020-10-08T06:12:19.000Z
[ "pytorch", "bart", "question-answering", "en", "dataset:squad2", "arxiv:1910.13461", "arxiv:1806.03822", "transformers" ]
question-answering
[ ".gitattributes", "README.md", "config.json", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.json" ]
phiyodr
657
transformers
--- language: en tags: - pytorch - question-answering datasets: - squad2 metrics: - exact - f1 widget: - text: "What discipline did Winkelmann create?" context: "Johann Joachim Winckelmann was a German art historian and archaeologist. He was a pioneering Hellenist who first articulated the difference between Greek, Greco-Roman and Roman art. The prophet and founding hero of modern archaeology, Winckelmann was one of the founders of scientific archaeology and first applied the categories of style on a large, systematic basis to the history of art." --- # roberta-large-finetuned-squad2 ## Model description This model is based on [facebook/bart-large](https://huggingface.co/facebook/bart-large) and was finetuned on [SQuAD2.0](https://rajpurkar.github.io/SQuAD-explorer/). The corresponding papers you can found [here (model)](https://arxiv.org/pdf/1910.13461.pdf) and [here (data)](https://arxiv.org/abs/1806.03822). ## How to use ```python from transformers.pipelines import pipeline model_name = "phiyodr/bart-large-finetuned-squad2" nlp = pipeline('question-answering', model=model_name, tokenizer=model_name) inputs = { 'question': 'What discipline did Winkelmann create?', 'context': 'Johann Joachim Winckelmann was a German art historian and archaeologist. He was a pioneering Hellenist who first articulated the difference between Greek, Greco-Roman and Roman art. "The prophet and founding hero of modern archaeology", Winckelmann was one of the founders of scientific archaeology and first applied the categories of style on a large, systematic basis to the history of art. ' } nlp(inputs) ``` ## Training procedure ``` { "base_model": "facebook/bart-large", "do_lower_case": True, "learning_rate": 3e-5, "num_train_epochs": 4, "max_seq_length": 384, "doc_stride": 128, "max_query_length": 64, "batch_size": 96 } ``` ## Eval results - Data: [dev-v2.0.json](https://rajpurkar.github.io/SQuAD-explorer/dataset/dev-v2.0.json) - Script: [evaluate-v2.0.py](https://worksheets.codalab.org/rest/bundles/0x6b567e1cf2e041ec80d7098f031c5c9e/contents/blob/) (original script from [here](https://github.com/huggingface/transformers/blob/master/examples/question-answering/README.md)) ``` { "exact": 81.96748926134929, "f1": 85.93825235371045, "total": 11873, "HasAns_exact": 78.71120107962213, "HasAns_f1": 86.6641144054667, "HasAns_total": 5928, "NoAns_exact": 85.21446593776282, "NoAns_f1": 85.21446593776282, "NoAns_total": 5945 } ```
phiyodr/bert-base-finetuned-squad2
2021-05-20T02:34:19.000Z
[ "pytorch", "jax", "bert", "question-answering", "en", "dataset:squad2", "arxiv:1810.04805", "arxiv:1806.03822", "transformers" ]
question-answering
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.txt" ]
phiyodr
78
transformers
--- language: en tags: - pytorch - question-answering datasets: - squad2 metrics: - exact - f1 widget: - text: "What discipline did Winkelmann create?" context: "Johann Joachim Winckelmann was a German art historian and archaeologist. He was a pioneering Hellenist who first articulated the difference between Greek, Greco-Roman and Roman art. The prophet and founding hero of modern archaeology, Winckelmann was one of the founders of scientific archaeology and first applied the categories of style on a large, systematic basis to the history of art." --- # bert-base-finetuned-squad2 ## Model description This model is based on **[bert-base-uncased](https://huggingface.co/bert-base-uncased)** and was finetuned on **[SQuAD2.0](https://rajpurkar.github.io/SQuAD-explorer/)**. The corresponding papers you can found [here (model)](https://arxiv.org/abs/1810.04805) and [here (data)](https://arxiv.org/abs/1806.03822). ## How to use ```python from transformers.pipelines import pipeline model_name = "phiyodr/bert-base-finetuned-squad2" nlp = pipeline('question-answering', model=model_name, tokenizer=model_name) inputs = { 'question': 'What discipline did Winkelmann create?', 'context': 'Johann Joachim Winckelmann was a German art historian and archaeologist. He was a pioneering Hellenist who first articulated the difference between Greek, Greco-Roman and Roman art. "The prophet and founding hero of modern archaeology", Winckelmann was one of the founders of scientific archaeology and first applied the categories of style on a large, systematic basis to the history of art. ' } nlp(inputs) ``` ## Training procedure ``` { "base_model": "bert-base-uncased", "do_lower_case": True, "learning_rate": 3e-5, "num_train_epochs": 4, "max_seq_length": 384, "doc_stride": 128, "max_query_length": 64, "batch_size": 96 } ``` ## Eval results - Data: [dev-v2.0.json](https://rajpurkar.github.io/SQuAD-explorer/dataset/dev-v2.0.json) - Script: [evaluate-v2.0.py](https://worksheets.codalab.org/rest/bundles/0x6b567e1cf2e041ec80d7098f031c5c9e/contents/blob/) (original script from [here](https://github.com/huggingface/transformers/blob/master/examples/question-answering/README.md)) ``` { "exact": 70.3950138970774, "f1": 73.90527661873521, "total": 11873, "HasAns_exact": 71.4574898785425, "HasAns_f1": 78.48808186475087, "HasAns_total": 5928, "NoAns_exact": 69.33557611438184, "NoAns_f1": 69.33557611438184, "NoAns_total": 5945 } ```
phiyodr/bert-large-finetuned-squad2
2021-05-20T02:36:12.000Z
[ "pytorch", "jax", "bert", "question-answering", "en", "dataset:squad2", "arxiv:1810.04805", "arxiv:1806.03822", "transformers" ]
question-answering
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "training_args.bin", "vocab.txt" ]
phiyodr
51
transformers
--- language: en tags: - pytorch - question-answering datasets: - squad2 metrics: - exact - f1 widget: - text: "What discipline did Winkelmann create?" context: "Johann Joachim Winckelmann was a German art historian and archaeologist. He was a pioneering Hellenist who first articulated the difference between Greek, Greco-Roman and Roman art. The prophet and founding hero of modern archaeology, Winckelmann was one of the founders of scientific archaeology and first applied the categories of style on a large, systematic basis to the history of art." --- # bert-large-finetuned-squad2 ## Model description This model is based on **[bert-large-uncased](https://huggingface.co/bert-large-uncased)** and was finetuned on **[SQuAD2.0](https://rajpurkar.github.io/SQuAD-explorer/)**. The corresponding papers you can found [here (model)](https://arxiv.org/abs/1810.04805) and [here (data)](https://arxiv.org/abs/1806.03822). ## How to use ```python from transformers.pipelines import pipeline model_name = "phiyodr/bert-large-finetuned-squad2" nlp = pipeline('question-answering', model=model_name, tokenizer=model_name) inputs = { 'question': 'What discipline did Winkelmann create?', 'context': 'Johann Joachim Winckelmann was a German art historian and archaeologist. He was a pioneering Hellenist who first articulated the difference between Greek, Greco-Roman and Roman art. "The prophet and founding hero of modern archaeology", Winckelmann was one of the founders of scientific archaeology and first applied the categories of style on a large, systematic basis to the history of art. ' } nlp(inputs) ``` ## Training procedure ``` { "base_model": "bert-large-uncased", "do_lower_case": True, "learning_rate": 3e-5, "num_train_epochs": 4, "max_seq_length": 384, "doc_stride": 128, "max_query_length": 64, "batch_size": 96 } ``` ## Eval results - Data: [dev-v2.0.json](https://rajpurkar.github.io/SQuAD-explorer/dataset/dev-v2.0.json) - Script: [evaluate-v2.0.py](https://worksheets.codalab.org/rest/bundles/0x6b567e1cf2e041ec80d7098f031c5c9e/contents/blob/) (original script from [here](https://github.com/huggingface/transformers/blob/master/examples/question-answering/README.md)) ``` { "exact": 76.22336393497852, "f1": 79.72527570261339, "total": 11873, "HasAns_exact": 76.19770580296895, "HasAns_f1": 83.21157193271408, "HasAns_total": 5928, "NoAns_exact": 76.24894869638352, "NoAns_f1": 76.24894869638352, "NoAns_total": 5945 } ```
phiyodr/roberta-large-finetuned-squad2
2021-05-20T19:27:52.000Z
[ "pytorch", "jax", "roberta", "question-answering", "en", "dataset:squad2", "arxiv:1907.11692", "arxiv:1806.03822", "transformers" ]
question-answering
[ ".gitattributes", "README.md", "config.json", "flax_model.msgpack", "merges.txt", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.json" ]
phiyodr
136
transformers
--- language: en tags: - pytorch - question-answering datasets: - squad2 metrics: - exact - f1 widget: - text: "What discipline did Winkelmann create?" context: "Johann Joachim Winckelmann was a German art historian and archaeologist. He was a pioneering Hellenist who first articulated the difference between Greek, Greco-Roman and Roman art. The prophet and founding hero of modern archaeology, Winckelmann was one of the founders of scientific archaeology and first applied the categories of style on a large, systematic basis to the history of art." --- # roberta-large-finetuned-squad2 ## Model description This model is based on [roberta-large](https://huggingface.co/roberta-large) and was finetuned on [SQuAD2.0](https://rajpurkar.github.io/SQuAD-explorer/). The corresponding papers you can found [here (model)](https://arxiv.org/abs/1907.11692) and [here (data)](https://arxiv.org/abs/1806.03822). ## How to use ```python from transformers.pipelines import pipeline model_name = "phiyodr/roberta-large-finetuned-squad2" nlp = pipeline('question-answering', model=model_name, tokenizer=model_name) inputs = { 'question': 'What discipline did Winkelmann create?', 'context': 'Johann Joachim Winckelmann was a German art historian and archaeologist. He was a pioneering Hellenist who first articulated the difference between Greek, Greco-Roman and Roman art. "The prophet and founding hero of modern archaeology", Winckelmann was one of the founders of scientific archaeology and first applied the categories of style on a large, systematic basis to the history of art. ' } nlp(inputs) ``` ## Training procedure ``` { "base_model": "roberta-large", "do_lower_case": True, "learning_rate": 3e-5, "num_train_epochs": 4, "max_seq_length": 384, "doc_stride": 128, "max_query_length": 64, "batch_size": 96 } ``` ## Eval results - Data: [dev-v2.0.json](https://rajpurkar.github.io/SQuAD-explorer/dataset/dev-v2.0.json) - Script: [evaluate-v2.0.py](https://worksheets.codalab.org/rest/bundles/0x6b567e1cf2e041ec80d7098f031c5c9e/contents/blob/) (original script from [here](https://github.com/huggingface/transformers/blob/master/examples/question-answering/README.md)) ``` { "exact": 84.38473848227069, "f1": 87.89711571225455, "total": 11873, "HasAns_exact": 80.9885290148448, "HasAns_f1": 88.02335608157898, "HasAns_total": 5928, "NoAns_exact": 87.77123633305298, "NoAns_f1": 87.77123633305298, "NoAns_total": 5945 } ```
pi3ni0/pubmedqa-scibert-classical
2021-05-20T02:37:34.000Z
[ "pytorch", "jax", "bert", "pretraining", "transformers" ]
[ ".gitattributes", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.txt" ]
pi3ni0
20
transformers
pi3ni0/pubmedqa-scibert-special
2021-05-20T02:38:41.000Z
[ "pytorch", "jax", "bert", "pretraining", "transformers" ]
[ ".gitattributes", "config.json", "flax_model.msgpack", "pytorch_model.bin", "special_tokens_map.json", "tokenizer_config.json", "vocab.txt" ]
pi3ni0
28
transformers