Comments (7)
Well, the error is telling you what the issue is. Simple Transformers will try to use CUDA by default. If it's not available, you have to specify use_cuda=False when creating the model.
model = ClassificationModel('bert', 'bert-base-cased', use_cuda=False)
from simpletransformers.
Thanks for your reply. Now I got the error while training the model:
ValueError: too many dimensions 'str'
from simpletransformers.
Please give more details about the issue.
Describe the bug
A clear and concise description of what the bug is. Please specify the class causing the issue.
from simpletransformers.
ValueError Traceback (most recent call last)
in
8 model = MultiLabelClassificationModel('roberta', 'roberta-base', num_labels=6, args={'train_batch_size':2, 'gradient_accumulation_steps':16, 'learning_rate': 3e-5, 'num_train_epochs': 3, 'max_seq_length': 512}, use_cuda=False)
9
---> 10 model.train_model(train_df)
~\Anaconda3\envs\simpletransformers\lib\site-packages\simpletransformers\classification\multi_label_classification_model.py in train_model(self, train_df, multi_label, output_dir, show_running_loss, args)
97
98 def train_model(self, train_df, multi_label=True, output_dir=None, show_running_loss=True, args=None):
---> 99 return super().train_model(train_df, multi_label=multi_label, output_dir=output_dir, show_running_loss=show_running_loss, args=args)
100
101 def eval_model(self, eval_df, multi_label=True, output_dir=None, verbose=False, **kwargs):
~\Anaconda3\envs\simpletransformers\lib\site-packages\simpletransformers\classification\classification_model.py in train_model(self, train_df, multi_label, output_dir, show_running_loss, args, eval_df)
157
158
--> 159 train_dataset = self.load_and_cache_examples(train_examples)
160 global_step, tr_loss = self.train(train_dataset, output_dir, show_running_loss=show_running_loss, eval_df=eval_df)
161
~\Anaconda3\envs\simpletransformers\lib\site-packages\simpletransformers\classification\multi_label_classification_model.py in load_and_cache_examples(self, examples, evaluate, no_cache, multi_label)
106
107 def load_and_cache_examples(self, examples, evaluate=False, no_cache=False, multi_label=True):
--> 108 return super().load_and_cache_examples(examples, evaluate=evaluate, no_cache=no_cache, multi_label=multi_label)
109
110 def compute_metrics(self, preds, labels, eval_examples, multi_label=True, **kwargs):
~\Anaconda3\envs\simpletransformers\lib\site-packages\simpletransformers\classification\classification_model.py in load_and_cache_examples(self, examples, evaluate, no_cache, multi_label)
440
441 if output_mode == "classification":
--> 442 all_label_ids = torch.tensor([f.label_id for f in features], dtype=torch.long)
443 elif output_mode == "regression":
444 all_label_ids = torch.tensor([f.label_id for f in features], dtype=torch.float)
ValueError: too many dimensions 'str'
from simpletransformers.
Hi
I am getting the error when I am trying to execute the code:
model.train_model(train_df)
from simpletransformers.
What is the data in train_df? Is it the minimal example code?
from simpletransformers.
This should be fixed now. There was a typo in the readme.
from simpletransformers.
Related Issues (20)
- ValueError: multiclass-multioutput is not supported HOT 6
- save_steps not working , checkpoint getting generated on every epoch morethan once HOT 2
- MMBT no longer supported by huggingface transformers. HOT 1
- Memory Leak Issue HOT 1
- `calculate_results` appears to only use the first correct answer, not all correct answers
- `ValueError` occurred with `representation_model`
- Update of macos to Sonoma 14.0 breaks train_model when using 'mps' device HOT 1
- Convert generate model into .tflite for token classification
- RuntimeError: "nll_loss_forward_reduce_cuda_kernel_2d_index" not implemented for 'Int'
- argmax sliding_window tiebreaker bug
- Error with prediction using multilabel classification
- RoBERTa model Prediction taking Infinite time with no error but Multiprocessing disabled warning
- saving pytorch_model.bin instead of safetensors HOT 1
- Unable to do hyperparamters search on sentence-pair classification(regression) task
- change threshold value in predict for multi-label classification? HOT 1
- Binary classification .predict raises a ValueError: could not broadcast input array from shape (2,2) into shape (1,2) HOT 3
- Problem with the absence of attention_mask when using sliding_window
- Target is multiclass but average='binary'. Please choose another average setting, one of [None, 'micro', 'macro', 'weighted']. HOT 4
- Default learning rate on pretrained layers?
- Loading a fine tuned Seq2Seq MarianMT model gives wrong predictions HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simpletransformers.