Code Monkey home page Code Monkey logo

gan-plus-nlp's Introduction

Hi, there ๐Ÿ‘‹!

views


About

  • Data scientist, NLP/LLM Engineer
  • Applied mathematics and informatics, HSE NN (bachelor's)
  • Intellectual Data Analysis, HSE NN (master degree)
  • Hackathons

Contact info:

Telegram

gan-plus-nlp's People

Contributors

virtualroyalty avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

hodge-ge

gan-plus-nlp's Issues

KeyError: 'labels'

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.

======== Epoch 1 / 3 ========

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.