Giter Club home page Giter Club logo

Comments (9)

richarddwang avatar richarddwang commented on May 22, 2024 1

There's no direct way to do this.
As a workaround, take generator for example.
You can refer to the source code and write a ElectraForMaskedLMWithAnyModel that takes a pretrained AutoModel instance as an argument.

from electra_pytorch.

lucaguarro avatar lucaguarro commented on May 22, 2024

Thank you for responding to my question. I got it working but am perhaps getting strange results from the training process. It always reports a training loss of 0.000000. Is this just because the model has already been well-trained enough?

Also is it normal for each training epoch to take only 1-2 seconds? Or is this a sign that my dataset that I set up was poorly configured?

Here is a screenshot of the output of the training process
electrapretraindebug

from electra_pytorch.

richarddwang avatar richarddwang commented on May 22, 2024

There should be an error caught.

Because fastai didn't support specifying training steps, I wrote an callback myself to do that.
The side effect is it will catch any error we encountered.

So you can comment out this callback, run it again, and you will see the error.
After you resolve the error, you can add it back and do the normal training.

RunSteps(c.steps, [0.0625, 0.125, 0.25, 0.5, 1.0], c.run_name+"_{percent}"),

from electra_pytorch.

lucaguarro avatar lucaguarro commented on May 22, 2024

Oh perfect thank you. I was getting an error because I added a special token to the tokenizer and needed to notify the generator and discriminator of the new size of the token embeddings.

I am however getting a memory error now. Usually I resolve this by just lowering the batch size but I am not so sure where this is set in your code?

I am using a Nvidia Tesla P100 and this is the error message:

RuntimeError: CUDA out of memory. Tried to allocate 376.00 MiB (GPU 0; 15.90 GiB total capacity; 14.22 GiB already allocated; 291.75 MiB free; 14.73 GiB reserved in total by PyTorch)

Sorry to ask so many questions.

from electra_pytorch.

richarddwang avatar richarddwang commented on May 22, 2024

No worries !

Here is where batch size set.

c.bs = [128, 256, 2048][i]

You can change it by c.bs = whatever after it.

from electra_pytorch.

lucaguarro avatar lucaguarro commented on May 22, 2024

Awesome, I got it working! I did have to lower my batch size all the way down to 32 w/ Google Colab pro though (quite a bit lower than your presets)

On another note, I took notice of your "multi_task.py" file and it interested me for my own research as well but I'll open a new issue so as to not bog this one down

from electra_pytorch.

congchan avatar congchan commented on May 22, 2024

Side question, How can we pretrain ELECTRA starting from weights from other pretrained models, such as roberta?

from electra_pytorch.

JiazhaoLi avatar JiazhaoLi commented on May 22, 2024

Hi, Thank you for the wonderful code.
I try to continue training based on google ELECTRA checkpoints. I followed the step in this post. I also comment out

RunSteps(c.steps, [0.0625, 0.125, 0.25, 0.5, 1.0], c.run_name+"_{percent}"),

However, I still got the following error, which encountered in fastai learner file. Do you have any hints on this, I appreciate it.

`Traceback (most recent call last):
File "pretrain.py", line 405, in
cbs=[mlm_cb],
.....

File "/home/anaconda3/envs/electra/lib/python3.7/site-packages/fastai/learner.py", line 137, in _call_one
[cb(event_name) for cb in sort_by_run(self.cbs)]
NameError: name 'sort_by_run' is not defined`

I am not sure whether it is due to the package version.

from electra_pytorch.

stvhuang avatar stvhuang commented on May 22, 2024

Hi @JiazhaoLi.

Do you solve the problem (sort_by_run not found)? I also met the same error recently.

Update:
This error can be solved by downgrading fastcore version to fastcore<=1.3.13.

from electra_pytorch.

Related Issues (20)

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.