Comments (5)
You can create another tokenizer and embedding matrix for your own datasets.
from attentionxml.
Thank you for your answer. However, when i create another tokenizer and embedding matrix i have the error below:
RuntimeError: Error(s) in loading state_dict for AttentionRNN:
size mismatch for emb.emb.weight: copying a param with shape torch.Size([697040, 300]) from checkpoint, the shape in current model is torch.Size([81651, 300]).
from attentionxml.
this is the whole error:
RuntimeError Traceback (most recent call last)
in
3 model1 = FastAttentionXML(labels_num, data_cnf, model_cnf, '')
4 start_time = time.time()
----> 5 scores, labels_pred = model1.predict(x)
6 finish_time = time.time()
7 print('Predicting finished')
/home/hmouzoun/patent_classification/AttentionXML/deepxml/tree.py in predict(self, test_x)
209
210 def predict(self, test_x):
--> 211 return self.predict_level(self.level - 1, test_x, self.model_cnf['predict'].get('k', 100), self.labels_num)
/home/hmouzoun/patent_classification/AttentionXML/deepxml/tree.py in predict_level(self, level, test_x, k, labels_num)
181 else:
182 groups = self.get_inter_groups(labels_num)
--> 183 group_scores, group_labels = self.predict_level(level - 1, test_x, self.top, len(groups))
184 torch.cuda.empty_cache()
185 logger.info(F'Predicting Level-{level}, Top: {k}')
/home/hmouzoun/patent_classification/AttentionXML/deepxml/tree.py in predict_level(self, level, test_x, k, labels_num)
181 else:
182 groups = self.get_inter_groups(labels_num)
--> 183 group_scores, group_labels = self.predict_level(level - 1, test_x, self.top, len(groups))
184 torch.cuda.empty_cache()
185 logger.info(F'Predicting Level-{level}, Top: {k}')
/home/hmouzoun/patent_classification/AttentionXML/deepxml/tree.py in predict_level(self, level, test_x, k, labels_num)
181 else:
182 groups = self.get_inter_groups(labels_num)
--> 183 group_scores, group_labels = self.predict_level(level - 1, test_x, self.top, len(groups))
184 torch.cuda.empty_cache()
185 logger.info(F'Predicting Level-{level}, Top: {k}')
/home/hmouzoun/patent_classification/AttentionXML/deepxml/tree.py in predict_level(self, level, test_x, k, labels_num)
175 test_loader = DataLoader(MultiLabelDataset(test_x), model_cnf['predict']['batch_size'],
176 num_workers=4)
--> 177 return model.predict(test_loader, k=k)
178 else:
179 if level == self.level - 1:
/home/hmouzoun/patent_classification/AttentionXML/deepxml/models.py in predict(self, data_loader, k, desc, **kwargs)
88
89 def predict(self, data_loader: DataLoader, k=100, desc='Predict', **kwargs):
---> 90 self.load_model()
91 scores_list, labels_list = zip(*(self.predict_step(data_x, k)
92 for data_x in tqdm(data_loader, desc=desc, leave=False)))
/home/hmouzoun/patent_classification/AttentionXML/deepxml/models.py in load_model(self)
97
98 def load_model(self):
---> 99 self.model.module.load_state_dict(torch.load(self.model_path))
100
101 def clip_gradient(self):
/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py in load_state_dict(self, state_dict, strict)
1049
1050 if len(error_msgs) > 0:
-> 1051 raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
1052 self.class.name, "\n\t".join(error_msgs)))
1053 return _IncompatibleKeys(missing_keys, unexpected_keys)
RuntimeError: Error(s) in loading state_dict for AttentionRNN:
size mismatch for emb.emb.weight: copying a param with shape torch.Size([697040, 300]) from checkpoint, the shape in current model is torch.Size([81651, 300]).
from attentionxml.
I think maybe I misunderstanded your question. The tokenizer and embedding matrix should be consistent for training and prediction. You need to retrain the model with your own tokenizer and embedding matrix.
from attentionxml.
Ok i got it Thank you so much
from attentionxml.
Related Issues (20)
- where is PLT compression performed? HOT 3
- Regarding max_leaf hyperparameter for Amazon-670K dataset HOT 3
- Transformers as encoder HOT 1
- .npy file HOT 3
- CUDA ERROR HOT 6
- 无法 加载'glove.840B.300d.gensim' model HOT 1
- License for code HOT 1
- 如何在自己的数据集上做cluster HOT 1
- Cuda Error : RuntimeError: CUDNN_STATUS_EXECUTION_FAILED HOT 4
- Where can I get the label name from the data link. HOT 1
- 执行命令过程的报错问题 HOT 2
- Preprocess not working HOT 5
- 关于论文中PSP@K的评价指标
- RuntimeError: cuDNN error: CUDNN_STATUS_EXECUTION_FAILED HOT 4
- How to generate `train_v1.txt` for datasets such as Amazon-670k? HOT 5
- AttentionXML on the Amazon-670k HOT 1
- Training Error on Amazon-670k HOT 4
- Time Complexity HOT 1
- Error when MultiLabelBinarizer get CSR matrix HOT 1
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 attentionxml.