Category : huggingface-transformers

I am looking to build a pipeline that applies the hugging-face BART model step-by-step. Once I have built the pipeline, I will be looking to substitute the encoder attention heads with a pre-trained / pre-defined encoder attention head. The pipeline I will be looking to implement is as follows: Tokenize input Run the tokenized input ..

Read more

This is my code from transformers import Trainer trainer = Trainer( model=model, data_collator=data_collator, args=training_args, compute_metrics=compute_metrics, train_dataset=dataset_prepared["train"], eval_dataset=dataset_prepared["test"], tokenizer=processor.feature_extractor, ) trainer.train() And the error that I am getting is as follows: ————————————————————————— RuntimeError Traceback (most recent call last) <ipython-input-29-3435b262f1ae> in <module>() —-> 1 trainer.train() 5 frames /usr/local/lib/python3.7/dist-packages/transformers/trainer.py in train(self, resume_from_checkpoint, trial, **kwargs) 1051 tr_loss += self.training_step(model, ..

Read more

I was looking at the documentation at https://huggingface.co/pierreguillou/bert-base-cased-squad-v1.1-portuguese import transformers from transformers import AutoTokenizer, AutoModelForQuestionAnswering tokenizer = AutoTokenizer.from_pretrained("pierreguillou/bert-base-cased-squad-v1.1-portuguese") model = AutoModelForQuestionAnswering.from_pretrained("pierreguillou/bert-base-cased-squad-v1.1-portuguese") but it raises an exception: OSError: Can’t load config for ‘pierreguillou/bert-base-cased-squad-v1.1-portuguese’. Make sure that: – ‘pierreguillou/bert-base-cased-squad-v1.1-portuguese’ is a correct model identifier listed on ‘https://huggingface.co/models’ – or ‘pierreguillou/bert-base-cased-squad-v1.1-portuguese’ is the correct path to a directory ..

Read more

Following this stackoverflow question: Outputting attention for bert-base-uncased with huggingface/transformers (torch) I am leveraging Hugging-face’s Bart model for summarising text. In particular, I am going to follow their suggestion of using ‘Bart for conditional generation’ I am trying to identify, analyse and tweak the encoder attention layer for articles depending on different topics. The code ..

Read more

I am trying to fine tune Wav2Vec2 model for medical vocabulary. When I try to run the following code on my VS Code Jupyter notebook, I am getting an error, but when I run the same thing on Google Colab, it works fine. from transformers import Wav2Vec2ForCTC model = Wav2Vec2ForCTC.from_pretrained( "facebook/wav2vec2-base", gradient_checkpointing=True, ctc_loss_reduction="mean", pad_token_id=processor.tokenizer.pad_token_id, ) ..

Read more

I am doing sentiment analysis, and I was wondering how to show the other sentiment scores from classifying my sentence: "Tesla’s stock just increased by 20%." I have three sentiments: positive, negative and neutral. This is my code, which contains the sentence I want to classify: pip install happytransformer from happytransformer import HappyTextClassification happy_tc = ..

Read more