steffel
Trying the BERT fine tunning on GPU
I have successfully fine-tuned the BERT model using my CPU. I would like to try fine-tuning using my GPU an RTX4090 with 24GB RAM. I am getting an out-of-memory error. I am a little surprised but I would like to make sure the memory is truly the issue and it’s not a misconfiguration.
The out-of-memory error raised on loading the model
{:ok, model} = Bumblebee.load_model({:hf, "bert-base-cased"}, spec: spec)
Thanks
Trending in Questions
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Using Phoenix.LiveView.TagEngine as an EEx.Engine is deprecated!
To compile HEEx, use Phoenix.LiveView.TagEngine.compile/2 instead.
Sta...
New
Hello !
We want new/edit form pages to POST/PUT to their own URL rather than the resources REST defaults (post /things, put /things/:id)...
New
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app?
Looking for hints regarding:
Addi...
New
Hi all, I wanted to ask how the community is dealing with post-release steps.
Today we have Ecto migrations, which make sure that the db...
New
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #elixirconf-us
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex










First 10 of 19 Posts!
outlog
have you configured it to run on GPU and not CPU?
eg the appropriate
XLA_TARGET?maybe post more code..
steffel
The code is the one from the example here with the difference I have updated the libraries in order to be able to use cuda 12.
XLA_TARGETis set to cuda120 with my version of cuda being cuda 12.2. Should I downgrade to cuda 12.0? From my understanding cuda120 is CUDA 12.0+ so 12.0 and above.Running
nvidia-smiI can see the GPU memory is filled up.steffel
I have managed to get it to run using
XLA_TARGET=cudaso it will compile it’s own version.To get it to work, the batch size needs to be decreased, on my GPU it’s a batch size of 4.
jonatanklosko
@steffel this is very interesting, the model is like 0.5gb, so loading it should be far from running out of memory. Note that XLA preallocates memory upfront, so your GPU memory usage will bump to a high value, but an OOM is definitely unexpected.
What is the CUDA and cuDNN version you built with locally to make it work?
jonatanklosko
@steffel can you please run with
XLA_ARCHIVE_URL=https://static.jonatanklosko.com/builds/xla_extension-x86_64-linux-gnu-cuda120.tar.gzand see if it makes a difference?steffel
Regarding the versions:
Cuda compilation tools, release 12.2, V12.2.140
Build cuda_12.2.r12.2/compiler.33191640_0
cudnn: v8
steffel
The model loads without any memory issues.
Now when it comes to training the model I am using
mrm8488/codebert-base-finetuned-detect-insecure-codethat is based onroberta-basewhen compiling myself I am not able to push the sequence_length up to 1024 (batch_size=1) with your version it works. I would like to know what is different.jonatanklosko
Oh, so just to make sure we are on the same page, the original OOM was during loading or training?
The archive I sent is precompiled using CUDA 12.1, rather than 12.0. According to Jax README it should still be compatible with CUDA 12.0, in which case we would be fine precompiling with 12.1. I will need to do some further tests.
steffel
First I had an OOM during loading.
I managed to solve it using my own built version of xla extension.
I was able to train using a batch_size=1 and sequence_length=64 or 128.
With sequence_length above 128, I am getting an OOM error during training.
Something like that:
steffel
The OOM while training seems to be back, I am a little confused.
Here is my livemd if that can help.
Last Post!
jonatanklosko
@steffel I published
xlav0.5.1 with the updated archive, feel free to update (orMix.install([...], force: true)) to give it a try.