<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: HuggingFace bert-large-uncased gives NameError in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/huggingface-bert-large-uncased-gives-nameerror/m-p/127231#M47895</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/154483"&gt;@Carl_B&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error indicates that PyTorch is not installed in your environment. Just try below this.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Install PyTorch&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Option 1: Using pip&lt;/STRONG&gt;&lt;BR /&gt;pip install torch torchvision torchaudio&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Option 2: Using conda (if you're using Anaconda/Miniconda)&lt;/STRONG&gt;&lt;BR /&gt;conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Option 3: CPU-only version (if no GPU)&lt;/STRONG&gt;&lt;BR /&gt;pip install torch torchvision torchaudio --index-url &lt;A href="https://download.pytorch.org/whl/cpu" target="_blank"&gt;https://download.pytorch.org/whl/cpu&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;After installation, test it:&lt;/STRONG&gt;&lt;BR /&gt;import torch&lt;BR /&gt;print(torch.__version__)&lt;BR /&gt;print(torch.cuda.is_available()) # Check if CUDA is available&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Complete Setup for BERT&lt;/STRONG&gt;&lt;BR /&gt;Once PyTorch is installed, you'll also need:&lt;BR /&gt;# Install transformers properly via pip instead of GitHub&lt;BR /&gt;pip install transformers&lt;/P&gt;&lt;P&gt;# Additional dependencies you might need&lt;BR /&gt;pip install datasets tokenizers accelerate&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Test BERT Model Loading&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;from transformers import AutoTokenizer, AutoModel&lt;BR /&gt;import torch&lt;/P&gt;&lt;P&gt;# Load BERT model and tokenizer&lt;BR /&gt;model_name = "bert-large-uncased"&lt;BR /&gt;tokenizer = AutoTokenizer.from_pretrained(model_name)&lt;BR /&gt;model = AutoModel.from_pretrained(model_name)&lt;/P&gt;&lt;P&gt;print("BERT model loaded successfully!")&lt;BR /&gt;print(f"Model device: {next(model.parameters()).device}")&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If You're Using Databricks&lt;/STRONG&gt;&lt;BR /&gt;If you're running this on Databricks, install via notebook cell:&lt;BR /&gt;%pip install torch torchvision torchaudio transformers&lt;/P&gt;&lt;P&gt;Then restart the Python kernel:&lt;BR /&gt;dbutils.library.restartPython()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 02 Aug 2025 21:17:48 GMT</pubDate>
    <dc:creator>lingareddy_Alva</dc:creator>
    <dc:date>2025-08-02T21:17:48Z</dc:date>
    <item>
      <title>HuggingFace bert-large-uncased gives NameError</title>
      <link>https://community.databricks.com/t5/data-engineering/huggingface-bert-large-uncased-gives-nameerror/m-p/127202#M47890</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to run the LLM&amp;nbsp;bert-large-uncased from&amp;nbsp;HuggingFace.&lt;/P&gt;&lt;P&gt;I have downloaded the transformers from github. I have installed the various packages. I am now getting an error message:&amp;nbsp;&lt;U&gt;&lt;SPAN class=""&gt;NameError: &lt;/SPAN&gt;name 'torch' is not defined&lt;/U&gt;.&lt;/P&gt;&lt;P&gt;Not sure what the problem is. Is pytorch not installed? Any help would be appreciated.&lt;/P&gt;&lt;P&gt;C&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Aug 2025 18:22:45 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/huggingface-bert-large-uncased-gives-nameerror/m-p/127202#M47890</guid>
      <dc:creator>Carl_B</dc:creator>
      <dc:date>2025-08-01T18:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: HuggingFace bert-large-uncased gives NameError</title>
      <link>https://community.databricks.com/t5/data-engineering/huggingface-bert-large-uncased-gives-nameerror/m-p/127231#M47895</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/154483"&gt;@Carl_B&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error indicates that PyTorch is not installed in your environment. Just try below this.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Install PyTorch&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;Option 1: Using pip&lt;/STRONG&gt;&lt;BR /&gt;pip install torch torchvision torchaudio&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Option 2: Using conda (if you're using Anaconda/Miniconda)&lt;/STRONG&gt;&lt;BR /&gt;conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Option 3: CPU-only version (if no GPU)&lt;/STRONG&gt;&lt;BR /&gt;pip install torch torchvision torchaudio --index-url &lt;A href="https://download.pytorch.org/whl/cpu" target="_blank"&gt;https://download.pytorch.org/whl/cpu&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;After installation, test it:&lt;/STRONG&gt;&lt;BR /&gt;import torch&lt;BR /&gt;print(torch.__version__)&lt;BR /&gt;print(torch.cuda.is_available()) # Check if CUDA is available&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Complete Setup for BERT&lt;/STRONG&gt;&lt;BR /&gt;Once PyTorch is installed, you'll also need:&lt;BR /&gt;# Install transformers properly via pip instead of GitHub&lt;BR /&gt;pip install transformers&lt;/P&gt;&lt;P&gt;# Additional dependencies you might need&lt;BR /&gt;pip install datasets tokenizers accelerate&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Test BERT Model Loading&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;from transformers import AutoTokenizer, AutoModel&lt;BR /&gt;import torch&lt;/P&gt;&lt;P&gt;# Load BERT model and tokenizer&lt;BR /&gt;model_name = "bert-large-uncased"&lt;BR /&gt;tokenizer = AutoTokenizer.from_pretrained(model_name)&lt;BR /&gt;model = AutoModel.from_pretrained(model_name)&lt;/P&gt;&lt;P&gt;print("BERT model loaded successfully!")&lt;BR /&gt;print(f"Model device: {next(model.parameters()).device}")&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If You're Using Databricks&lt;/STRONG&gt;&lt;BR /&gt;If you're running this on Databricks, install via notebook cell:&lt;BR /&gt;%pip install torch torchvision torchaudio transformers&lt;/P&gt;&lt;P&gt;Then restart the Python kernel:&lt;BR /&gt;dbutils.library.restartPython()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Aug 2025 21:17:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/huggingface-bert-large-uncased-gives-nameerror/m-p/127231#M47895</guid>
      <dc:creator>lingareddy_Alva</dc:creator>
      <dc:date>2025-08-02T21:17:48Z</dc:date>
    </item>
  </channel>
</rss>

