- Data scientist, NLP/LLM Engineer
- Applied mathematics and informatics, HSE NN (bachelor's)
- Intellectual Data Analysis, HSE NN (master degree)
- Hackathons
Contact info:
Generative adversarial approach to most popular NLP tasks
License: MIT License
You did an amazing job with your research and implementing the code.
Hi..I have been trying to test and use the repository, but I am encountering an error while training the model.
KeyError Traceback (most recent call last)
Cell In[22], line 3
1 for epoch_i in range(config["num_train_epochs"]):
2 print(f"======== Epoch {epoch_i + 1} / {config['num_train_epochs']} ========")
----> 3 train_info = gan_trainer.train_epoch(log_env=None)
4 result = gan_trainer.validation(log_env=None)
File ~/Desktop/pii Detection/GAN/gan-plus-nlp/base/base_trainer.py:15, in BaseTrainer.train_epoch(self, log_env)
13 self.train_mode_on()
14 for step, batch in enumerate(self.train_dataloader):
---> 15 epoch_info = self.training_step(batch, log_env)
16 self.on_epoch_end(train_info=train_info, epoch_info=epoch_info)
18 self.on_train_end(train_info)
File ~/Desktop/pii Detection/GAN/gan-plus-nlp/trainer/gan_trainer.py:155, in GANTrainerSequenceClassification.training_step(self, batch, log_env)
148 batch_size = batch["input_ids"].shape[0]
149 seq_len = batch["input_ids"].shape[1]
151 output = self.model(
152 input_ids=batch["input_ids"],
153 input_mask=batch["attention_mask"],
154 token_type_ids=batch.get("token_type_ids", None),
--> 155 labels=batch["labels"],
156 labeled_mask=batch["labeled_mask"],
157 )
158 noise = get_noise(
159 (batch_size, self.config["noise_size"]),
160 dist=self.config.get("noise_type", "uniform"),
161 range=self.config.get("noise_range", (-2, 2)),
162 device=self.device,
163 )
164 gen_states = self.generator(noise)
File ~/anaconda3/lib/python3.10/site-packages/transformers/tokenization_utils_base.py:237, in BatchEncoding.getitem(self, item)
230 """
231 If the key is a string, returns the value of the dict associated to key
('input_ids', 'attention_mask',
232 etc.).
233
234 If the key is an integer, get the tokenizers.Encoding
for batch item with index key
.
235 """
236 if isinstance(item, str):
--> 237 return self.data[item]
238 elif self._encodings is not None:
239 return self._encodings[item]
KeyError: 'labels'
The model has been tweaked, but I have not been able to succeed.
Can please give some guidance or workable code? thanks a lot!
Look forward to hearing from you soon!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.