# Error in Autotrain Training

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-in-autotrain-training%2F154069%3E%5C
**Category:** Beginners\
**Created:** [May 8, 2025, 7:41am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-in-autotrain-training%2F154069 "2025-05-08T07:41:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![LuuWee](https://avatars.discourse-cdn.com/v4/letter/l/4af34b/32.png) [@LuuWee](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FLuuWee)%5C
**Post date:** [May 8, 2025, 7:41am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-in-autotrain-training%2F154069%2F1 "2025-05-08T07:41:32Z")

</div>

Hello everyone I am very new and im experimenting with the Huggingface Autotrain UI but im having a little trouble getting the training started. I am trying to train a meta-llama/Llama-3.1-8b-Instruct Model with an example dataset that i found  
alpaca1k.csv  
which i uploaded as a local file.  
I have not made any changes to any other parameters. When i then click start training i get an error.

ERROR | 2025-05-08 07:39:20 | autotrain.trainers.common:wrapper:215 - train has failed due to an exception: Traceback (most recent call last):  
File “/app/env/lib/python3.10/site-packages/autotrain/trainers/common.py”, line 212, in wrapper  
return func(\*args, \*\*kwargs)  
File “/app/env/lib/python3.10/site-packages/autotrain/trainers/clm/ **main**.py”, line 28, in train  
train\_sft(config)  
File “/app/env/lib/python3.10/site-packages/autotrain/trainers/clm/train\_clm\_sft.py”, line 27, in train  
model = utils.get\_model(config, tokenizer)  
File “/app/env/lib/python3.10/site-packages/autotrain/trainers/clm/utils.py”, line 943, in get\_model  
model = AutoModelForCausalLM.from\_pretrained(  
File “/app/env/lib/python3.10/site-packages/transformers/models/auto/auto\_factory.py”, line 564, in from\_pretrained  
return model\_class.from\_pretrained(  
File “/app/env/lib/python3.10/site-packages/transformers/modeling\_utils.py”, line 3620, in from\_pretrained  
hf\_quantizer.validate\_environment(  
File “/app/env/lib/python3.10/site-packages/transformers/quantizers/quantizer\_bnb\_4bit.py”, line 83, in validate\_environment  
validate\_bnb\_backend\_availability(raise\_exception=True)  
File “/app/env/lib/python3.10/site-packages/transformers/integrations/bitsandbytes.py”, line 559, in validate\_bnb\_backend\_availability  
return \_validate\_bnb\_cuda\_backend\_availability(raise\_exception)  
File “/app/env/lib/python3.10/site-packages/transformers/integrations/bitsandbytes.py”, line 537, in \_validate\_bnb\_cuda\_backend\_availability  
raise RuntimeError(log\_msg)  
RuntimeError: CUDA is required but not available for bitsandbytes. Please consider installing the multi-platform enabled version of bitsandbytes, which is currently a work in progress. Please check currently supported platforms and installation instructions at [Installation Guide](https://huggingface.co/docs/bitsandbytes/main/en/installation#multi-backend)

ERROR | 2025-05-08 07:39:20 | autotrain.trainers.common:wrapper:216 - CUDA is required but not available for bitsandbytes. Please consider installing the multi-platform enabled version of bitsandbytes, which is currently a work in progress. Please check currently supported platforms and installation instructions at [Installation Guide](https://huggingface.co/docs/bitsandbytes/main/en/installation#multi-backend)  
INFO | 2025-05-08 07:39:20 | autotrain.trainers.common:pause\_space:156 - Pausing space…

I not sure how i can fix this. Any help is appreciated

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [May 8, 2025, 8:06am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-in-autotrain-training%2F154069%2F2 "2025-05-08T08:06:56Z")

</div>

In some cases, the problem can be resolved by installing bitsandbytes as indicated in the error message. However, in other cases, reinstalling PyTorch and the CUDA Toolkit may be necessary.

> <https://github.com/bitsandbytes-foundation/bitsandbytes/issues/1384>
>
> \### System Info
> 
> please I have tried many ways but I couldn't address the issues…, could anyone please give me a hint or help me to solve this bug because I couldn't figure it where the problem coming from 
> 
> note: I have installed Cuda in my env, but I am still getting an error 
> 
> here is the error : 
> 
> An error occurred: CUDA is required but not available for bitsandbytes. Please consider installing the multi-platform enabled version of bitsandbytes, which is currently a work in progress. Please check currently supported platforms and installation instructions at https://huggingface.co/docs/bitsandbytes/main/en/installation#multi-backend
> 
> thank you so much
> 
>  
> 
> \### Reproduction
> 
> import torch
> from transformers import AutoModelForVision2Seq, AutoProcessor, BitsAndBytesConfig
>  
> \# Hugging Face model id
> try:
> model\_id = "Qwen/Qwen2-VL-7B-Instruct" 
>      
> # BitsAndBytesConfig int-4 config
> bnb\_config = BitsAndBytesConfig(
> load\_in\_4bit=True, bnb\_4bit\_use\_double\_quant=True, bnb\_4bit\_quant\_type="nf4", bnb\_4bit\_compute\_dtype=torch.bfloat16
> )
>      
> # Load model and tokenizer
> model = AutoModelForVision2Seq.from\_pretrained(
> model\_id,
> device\_map="auto",
> torch\_dtype=torch.bfloat16,
> quantization\_config=bnb\_config
> )
> except Exception as e:
> print(f"An error occurred: {e}")
> 
> \### Expected behavior
> 
> please I have tried many ways but I couldn't address the issues, could anyone please give me a hint or help me to solve this bug because I couldn't figure it where the problem coming from 
> 
> note: I have installed Cuda in my env, but I am still getting an error 
> 
> here is the error : 
> 
> An error occurred: CUDA is required but not available for bitsandbytes. Please consider installing the multi-platform enabled version of bitsandbytes, which is currently a work in progress. Please check currently supported platforms and installation instructions at https://huggingface.co/docs/bitsandbytes/main/en/installation#multi-backend
> 
> thank you so much

> <https://github.com/bitsandbytes-foundation/bitsandbytes/issues/1093>
>
> \### System Info
> 
> \`\`\`
> The \`load\_in\_4bit\` and \`load\_in\_8bit\` arguments are depr…ecated and will be removed in the future versions. Please, pass a \`BitsAndBytesConfig\` object in \`quantization\_config\` argument instead.
> Traceback (most recent call last):
> File "c:\\SQl coder\\app.py", line 22, in \<module\>
> model = AutoModelForCausalLM.from\_pretrained(
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "C:\\SQl coder\\sqlenv\\Lib\\site-packages\\transformers\\models\\auto\\auto\_factory.py", line 563, in from\_pretrained
> return model\_class.from\_pretrained(
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "C:\\SQl coder\\sqlenv\\Lib\\site-packages\\transformers\\modeling\_utils.py", line 3026, in from\_pretrained
> hf\_quantizer.validate\_environment(
> File "C:\\SQl coder\\sqlenv\\Lib\\site-packages\\transformers\\quantizers\\quantizer\_bnb\_8bit.py", line 62, in validate\_environment
> raise ImportError(
> ImportError: Using \`bitsandbytes\` 8-bit quantization requires Accelerate: \`pip install accelerate\` and the latest version of bitsandbytes: \`pip install -i https://pypi.org/simple/ bitsandbytes\`
> (sqlenv) PS C:\\SQl coder\> pip install -i https://pypi.org/simple/ bitsandbytes
> Looking in indexes: https://pypi.org/simple/, https://pypi.ngc.nvidia.com
> Collecting bitsandbytes
> Downloading bitsandbytes-0.42.0-py3-none-any.whl.metadata (9.9 kB)
> Requirement already satisfied: scipy in c:\\sql coder\\sqlenv\\lib\\site-packages (from bitsandbytes) (1.12.0)
> Requirement already satisfied: numpy\<1.29.0,\>=1.22.4 in c:\\sql coder\\sqlenv\\lib\\site-packages (from scipy-\>bitsandbytes) (1.26.4)
> Downloading bitsandbytes-0.42.0-py3-none-any.whl (105.0 MB)
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 105.0/105.0 MB 6.2 MB/s eta 0:00:00
> Installing collected packages: bitsandbytes
> Successfully installed bitsandbytes-0.42.0
> (sqlenv) PS C:\\SQl coder\> & "c:/SQl coder/sqlenv/Scripts/python.exe" "c:/SQl coder/app.py"
> The \`load\_in\_4bit\` and \`load\_in\_8bit\` arguments are deprecated and will be removed in the future versions. Please, pass a \`BitsAndBytesConfig\` object in \`quantization\_config\` argument instead.
> False
> 
> ===================================BUG REPORT===================================
> C:\\SQl coder\\sqlenv\\Lib\\site-packages\\bitsandbytes\\cuda\_setup\\main.py:167: UserWarning: Welcome to bitsandbytes. For bug reports, please run
> 
> python -m bitsandbytes
> 
> 
> warn(msg)
> ================================================================================
> CUDA\_SETUP: WARNING! libcudart.so not found in any environmental path. Searching in backup paths...
> The following directories listed in your path were found to be non-existent: {WindowsPath('/usr/local/cuda/lib64')}
> DEBUG: Possible options found for libcudart.so: set()
> CUDA SETUP: PyTorch settings found: CUDA\_VERSION=118, Highest Compute Capability: 8.6.
> CUDA SETUP: To manually override the PyTorch CUDA version please see:https://github.com/TimDettmers/bitsandbytes/blob/main/how\_to\_use\_nonpytorch\_cuda.md
> CUDA SETUP: Loading binary C:\\SQl coder\\sqlenv\\Lib\\site-packages\\bitsandbytes\\libbitsandbytes\_cuda118.so...
> argument of type 'WindowsPath' is not iterable
> CUDA SETUP: Problem: The main issue seems to be that the main CUDA runtime library was not detected.
> CUDA SETUP: Solution 1: To solve the issue the libcudart.so location needs to be added to the LD\_LIBRARY\_PATH variable        
> CUDA SETUP: Solution 1a): Find the cuda runtime library via: find / -name libcudart.so 2\>/dev/null
> CUDA SETUP: Solution 1b): Once the library is found add it to the LD\_LIBRARY\_PATH: export LD\_LIBRARY\_PATH=$LD\_LIBRARY\_PATH:FOUND\_PATH\_FROM\_1a
> CUDA SETUP: Solution 1c): For a permanent solution add the export from 1b into your .bashrc file, located at ~/.bashrc        
> CUDA SETUP: Solution 2: If no library was found in step 1a) you need to install CUDA.
> CUDA SETUP: Solution 2a): Download CUDA install script: wget https://raw.githubusercontent.com/TimDettmers/bitsandbytes/main/cuda\_install.sh
> CUDA SETUP: Solution 2b): Install desired CUDA version to desired location. The syntax is bash cuda\_install.sh CUDA\_VERSION PATH\_TO\_INSTALL\_INTO.
> CUDA SETUP: Solution 2b): For example, "bash cuda\_install.sh 113 ~/local/" will download CUDA 11.3 and install into the folder ~/local
> Traceback (most recent call last):
> File "C:\\SQl coder\\sqlenv\\Lib\\site-packages\\transformers\\utils\\import\_utils.py", line 1383, in \_get\_module
> return importlib.import\_module("." + module\_name, self.\_\_name\_\_)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "C:\\Users\\sumai\\anaconda\\Lib\\importlib\\\_\_init\_\_.py", line 126, in import\_module
> return \_bootstrap.\_gcd\_import(name\[level:\], package, level)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "\<frozen importlib.\_bootstrap\>", line 1204, in \_gcd\_import
> File "\<frozen importlib.\_bootstrap\>", line 1176, in \_find\_and\_load
> File "\<frozen importlib.\_bootstrap\>", line 1147, in \_find\_and\_load\_unlocked
> File "\<frozen importlib.\_bootstrap\>", line 690, in \_load\_unlocked
> File "\<frozen importlib.\_bootstrap\_external\>", line 940, in exec\_module
> File "\<frozen importlib.\_bootstrap\>", line 241, in \_call\_with\_frames\_removed
> File "C:\\SQl coder\\sqlenv\\Lib\\site-packages\\transformers\\integrations\\bitsandbytes.py", line 11, in \<module\>
> import bitsandbytes as bnb
> File "C:\\SQl coder\\sqlenv\\Lib\\site-packages\\bitsandbytes\\\_\_init\_\_.py", line 6, in \<module\>
> from . import cuda\_setup, utils, research
> File "C:\\SQl coder\\sqlenv\\Lib\\site-packages\\bitsandbytes\\research\\\_\_init\_\_.py", line 1, in \<module\>
> from . import nn
> File "C:\\SQl coder\\sqlenv\\Lib\\site-packages\\bitsandbytes\\research\\nn\\\_\_init\_\_.py", line 1, in \<module\>
> from .modules import LinearFP8Mixed, LinearFP8Global
> File "C:\\SQl coder\\sqlenv\\Lib\\site-packages\\bitsandbytes\\research\\nn\\modules.py", line 8, in \<module\>
> from bitsandbytes.optim import GlobalOptimManager
> File "C:\\SQl coder\\sqlenv\\Lib\\site-packages\\bitsandbytes\\optim\\\_\_init\_\_.py", line 6, in \<module\>
> from bitsandbytes.cextension import COMPILED\_WITH\_CUDA
> File "C:\\SQl coder\\sqlenv\\Lib\\site-packages\\bitsandbytes\\cextension.py", line 20, in \<module\>
> raise RuntimeError('''
> RuntimeError:
> CUDA Setup failed despite GPU being available. Please run the following command to get more information:
> 
> python -m bitsandbytes
> 
> Inspect the output of the command and see if you can locate CUDA libraries. You might need to add them
> to your LD\_LIBRARY\_PATH. If you suspect a bug, please take the information from python -m bitsandbytes
> and open an issue at: https://github.com/TimDettmers/bitsandbytes/issues
> 
> The above exception was the direct cause of the following exception:
> 
> Traceback (most recent call last):
> File "c:\\SQl coder\\app.py", line 22, in \<module\>
> model = AutoModelForCausalLM.from\_pretrained(
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "C:\\SQl coder\\sqlenv\\Lib\\site-packages\\transformers\\models\\auto\\auto\_factory.py", line 563, in from\_pretrained
> return model\_class.from\_pretrained(
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "C:\\SQl coder\\sqlenv\\Lib\\site-packages\\transformers\\modeling\_utils.py", line 3391, in from\_pretrained
> hf\_quantizer.preprocess\_model(
> File "C:\\SQl coder\\sqlenv\\Lib\\site-packages\\transformers\\quantizers\\base.py", line 166, in preprocess\_model
> return self.\_process\_model\_before\_weight\_loading(model, \*\*kwargs)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "C:\\SQl coder\\sqlenv\\Lib\\site-packages\\transformers\\quantizers\\quantizer\_bnb\_8bit.py", line 219, in \_process\_model\_before\_weight\_loading
> from ..integrations import get\_keys\_to\_not\_convert, replace\_with\_bnb\_linear
> File "\<frozen importlib.\_bootstrap\>", line 1229, in \_handle\_fromlist
> File "C:\\SQl coder\\sqlenv\\Lib\\site-packages\\transformers\\utils\\import\_utils.py", line 1373, in \_\_getattr\_\_
> module = self.\_get\_module(self.\_class\_to\_module\[name\])
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "C:\\SQl coder\\sqlenv\\Lib\\site-packages\\transformers\\utils\\import\_utils.py", line 1385, in \_get\_module
> raise RuntimeError(
> RuntimeError: Failed to import transformers.integrations.bitsandbytes because of the following error (look up to see its traceback):
> 
> CUDA Setup failed despite GPU being available. Please run the following command to get more information:
> 
> python -m bitsandbytes
> 
> Inspect the output of the command and see if you can locate CUDA libraries. You might need to add them
> to your LD\_LIBRARY\_PATH. If you suspect a bug, please take the information from python -m bitsandbytes
> and open an issue at: https://github.com/TimDettmers/bitsandbytes/issues
> \`\`\`
> 
> \### Reproduction
> 
> https://github.com/defog-ai/sqlcoder/blob/main/defog\_sqlcoder\_colab.ipynb
> 
> \### Expected behavior
> 
> i want to run defog.ai SQLCoder-7b-2\`import streamlit as st
> import torch
> from transformers import AutoTokenizer, AutoModelForCausalLM
> import sqlparse
> import sqlite3
> 
> \# Model loading and configuration
> model\_name = "defog/sqlcoder-7b-2"
> tokenizer = AutoTokenizer.from\_pretrained(model\_name)
> 
> if torch.cuda.is\_available():
> available\_memory = torch.cuda.memory\_allocated()
> if available\_memory \> 15e9:
> model = AutoModelForCausalLM.from\_pretrained(
> model\_name,
> trust\_remote\_code=True,
> torch\_dtype=torch.float16,
> device\_map="auto",
> use\_cache=True,
> )
> else:
> model = AutoModelForCausalLM.from\_pretrained(
> model\_name,
> trust\_remote\_code=True,
> load\_in\_8bit=True,
> device\_map="auto",
> torch\_dtype=torch.float16,
> use\_cache=True,
> )
> else:
> model = AutoModelForCausalLM.from\_pretrained(
> model\_name, trust\_remote\_code=True, use\_cache=True
> )
> 
> prompt = """### Task
> Generate a SQL query to answer \[QUESTION\]{question}\[/QUESTION\]
> 
> \###Instructions
> \- if the question cannot be answered given the database schema, return "I do not know"
> \- Every helpdesk ticket is associated to a space or an equipment mandatorily.
> \- Every equipment or space is related to a Block in a site
> 
> 
> 
> \### Database Schema
> CREATE TABLE website\_support\_ticket(id INTEGER PRIMARY KEY,
> sla\_active BOOLEAN, --SLA is active if it is true else it is inactive
> asset\_id INTEGER, --Space for which the ticket is created
> equipment\_id INTEGER, --Equipment for which the ticket is created
> equipment\_location\_id INTEGER, --Space where the Equipment is located
> maintenance\_team\_id INTEGER, --Maintenance Team that is responsible for the ticket actions
> at\_start\_mro BOOLEAN, --Photo is required to start a work order
> at\_done\_mro BOOLEAN, --Photo is required to close a work order
> at\_review\_mro BOOLEAN, --Photo is required to review a work order
> mro\_order\_id INTEGER, --Order related to the ticket
> employee\_id INTEGER, --Employee related to the ticket
> pause\_reason\_id INTEGER, --Reason for Pause
> equip\_block\_id INTEGER, --Block of an equipment for which the ticket is created
> space\_block\_id INTEGER, --Block of an space for which the ticket is created
> requestee\_id INTEGER, --Requestor of the ticket
> region\_id INTEGER, --Region of the ticket
> is\_reopen BOOLEAN, --Ticket was reopned if this is set to True
> reopen\_count INTEGER, --Number of times this ticket was reopened
> on\_hold\_date TIMESTAMP WITHOUT TIME ZONE, --Date on which the ticket was moved to On-Hold
> doc\_count INTEGER, --Count of Attachments
> sla\_end\_date TIMESTAMP WITHOUT TIME ZONE, --Planned End date for SLA
> priority\_id INTEGER, --Priority of the Ticket
> category\_id INTEGER, --Category of the Problem
> sub\_category\_id INTEGER, --Sub Category of the Problem
> state\_id INTEGER, --Status of the ticket (Open, InProgress, Closed, Paused)
> company\_id INTEGER, --Company of the ticket
> close\_time TIMESTAMP WITHOUT TIME ZONE, --Ticket Closed Date time
> closed\_by\_id INTEGER, --Technician who closed the ticet
> ticket\_type CHARACTER VARYING, --Proactive or Reactive
> sla\_status CHARACTER VARYING, --To show within SLA or SLA elapsed
> state\_category\_id CHARACTER VARYING, --Category to which the Status belongs to
> subject CHARACTER VARYING, --Subject line of the Problem
> issue\_type CHARACTER VARYING, --Issue Type of the Ticket
> close\_comment CHARACTER VARYING, --Comments that was enetered while closing the ticket
> current\_escalation\_level CHARACTER VARYING, --To show the current escalationlevel
> type\_category CHARACTER VARYING, --Type category of the ticket
> state\_name CHARACTER VARYING, --State to which the site belongs to
> city\_name CHARACTER VARYING, --City to which the site belongs to
> last\_commented\_by CHARACTER VARYING, --Comment
> region CHARACTER VARYING, --Region of the ticket
> mro\_state CHARACTER VARYING, --Status of the Work order
> 
> );
> 
> CREATE TABLE res\_company (
> id INTEGER PRIMARY KEY,
> name VARCHAR(20)
> );
> 
> CREATE TABLE mro\_maintenance\_team(
> id INTEGER INTEGER PRIMARY KEY,
> name VARCHAR VARCHAR(20)
> );
> 
> CREATE TABLE mro\_equipment\_location(
> id INTEGER PRIMARY KEY,
> name VARCHAR(50)
> );
> 
> CREATE TABLE mro\_equipment(
> id INTEGER PRIMARY KEY,
> name VARCHAR(50)
> );
> 
> CREATE TABLE website\_support\_ticket\_state(
> id INTEGER PRIMARY KEY,
> name VARCHAR(50));
> 
> CREATE TABLE mro\_order(
> id INTEGER PRIMARY KEY,
> name VARCHAR(50));
> 
> CREATE TABLE website\_support\_ticket\_category(
> id INTEGER PRIMARY KEY,
> name VARCHAR(50))
> ;
> 
> CREATE TABLE website\_support\_ticket\_subcategory(
> id INTEGER PRIMARY KEY,
> name VARCHAR(50));
> 
> CREATE TABLE website\_support\_ticket\_priority(
> id INTEGER PRIMARY KEY,
> name VARCHAR(50));
> 
> 
> 
> \-website\_support\_ticket.company\_id can be joined with res\_company.id
> \-website\_support\_ticket.maintenance\_team\_id can be joined with mro\_maintenance\_team.id
> \-website\_support\_ticket.asset\_id can be joined with mro\_equipment\_location.id
> \-website\_support\_ticket.equipment\_id can be joined with mro\_equipment.id
> \-website\_support\_ticket.state\_id can be joined with website\_support\_ticket\_state.id
> \-website\_support\_ticket.mro\_order\_id can be joined with mro\_order.id
> \-website\_support\_ticket.category\_id can be joined with website\_support\_ticket\_category.id
> \-website\_support\_ticket.sub\_category\_id can be joined with website\_support\_ticket\_subcategory.id
> \-website\_support\_ticket.priority\_id can be joined with website\_support\_ticket\_priority.id
> 
> 
> 
> 
> \### Answer
> Given the database schema, here is the SQL query that answers \[QUESTION\]{question}\[/QUESTION\]
> \[SQL\]
> """
> def generate\_query(question):
> updated\_prompt = prompt.format(question=question)
> inputs = tokenizer(updated\_prompt, return\_tensors="pt").to("cuda")
> generated\_ids = model.generate(
> \*\*inputs,
> num\_return\_sequences=1,
> eos\_token\_id=tokenizer.eos\_token\_id,
> pad\_token\_id=tokenizer.eos\_token\_id,
> max\_new\_tokens=400,
> do\_sample=False,
> num\_beams=1,
> )
> outputs = tokenizer.batch\_decode(generated\_ids, skip\_special\_tokens=True)
> 
> torch.cuda.empty\_cache()
> torch.cuda.synchronize()
> return sqlparse.format(outputs\[0\].split("\[SQL\]")\[-1\], reindent=True)
> 
> 
> def execute\_sql(question, db\_file):
> query = generate\_query(question)
> 
> conn = sqlite3.connect(db\_file)
> cursor = conn.cursor()
> 
> try:
> cursor.execute(query)
> 
> # Fetch column names
> columns = \[col\[0\] for col in cursor.description\]
> 
> # Fetch results into a pandas DataFrame
> df = pd.DataFrame(cursor.fetchall(), columns=columns)
> 
> # Print the result as a table
> return df.to\_markdown(index=False)
> except sqlite3.OperationalError as e:
> if "ILIKE" in str(e):
> query = query.replace("ILIKE", "LIKE")
> return execute\_query(query, db\_file)
> except sqlite3.Error as e:
> print("Error executing query:", e)
> return None
> 
> finally:
> cursor.close()
> conn.close()
> 
> 
> \# Streamlit app
> st.title("SQL Code Generator")
> 
> \# Input field for the question
> user\_question = st.text\_input("Enter your question about the database:")
> 
> \# Button to generate the SQL query
> if st.button("Generate SQL"):
> if user\_question:
> # Generate SQL query and display it
> generated\_sql = generate\_query(user\_question)
> st.write("Generated SQL Query:")
> st.code(generated\_sql)
> 
> # Connect to the database (replace with your database file path)
> db\_file = "your\_database.db"
> if db\_file:
> # Execute the query and display the results
> result = execute\_sql(user\_question, db\_file)
> if result:
> st.write("Results:")
> st.markdown(result)
> else:
> st.write("No results found.")
> else:
> st.warning("Please enter a question.")
> 
> \`
> 
> this is the code i am trying to run

---

<div class="post-metadata">

**Author:** ![LuuWee](https://avatars.discourse-cdn.com/v4/letter/l/4af34b/32.png) [@LuuWee](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FLuuWee)%5C
**Post date:** [May 8, 2025, 8:17am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-in-autotrain-training%2F154069%2F3 "2025-05-08T08:17:02Z")

</div>

I found a solution by myself. Im using the free plan to there is only cpu to use and no gpu. I had to change some of the parameters. This is what i did for anyone who is wondering  
Distributed Backend from ddp to deepspeed  
Mixed precision from fp16 to none  
PEFT/LoRA from true to false

Im not exactly sure what did the trick but its training now

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png) [@system](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsystem)%5C
**Post date:** [May 8, 2025, 8:17pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ferror-in-autotrain-training%2F154069%2F4 "2025-05-08T20:17:56Z")

</div>

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
