Hugging Face: The Surprisingly Tough Setup for an 'Easy' AI Library

Hugging Face: The Surprisingly Tough Setup for an 'Easy' AI Library

One morning, my friend Shujaat Ali and I found ourselves knee deep in an AI project. Shujaat was excited to explore the power of Hugging Face , but as we began setting it up on my Mac, the process quickly turned from a promising adventure into a frustrating challenge. Despite the library’s reputation as an easy-to-use tool, we were hitting roadblocks left and right.

After a couple of hours of troubleshooting and poring over official documentation, we started to lose hope. We were hungry, tired, and questioning our abilities. “Is this AI library really that tough to set up, or are we just too old for new technology?” Shujaat asked with a nervous laugh. The question raised, a mix of humor and genuine frustration.

But we were not ready to give up just yet. Boosted with fresh determination and a quick breakfast to fuel our efforts, we revisited every step of the process. Finally, the pieces started falling into place. By the end of the day, we had the Hugging Face setup running smoothly. It felt like a small victory in the face of a daunting task.

The Journey to Resolution

As I reflected on the experience, I realized that our struggles stemmed not from the library itself but from the assumptions baked into its documentation. It presumes users have familiarity with key prerequisites, something not always true for those new to the tool or AI development in general.

Here is what I learned along the way:

1. TensorFlow vs. PyTorch: Choose One

  • Hugging Face supports both TensorFlow and PyTorch. However, installing both simultaneously can lead to conflicts. Initially, I had both installed, which caused dependency issues and runtime errors.
  • Solution: This article on Geeksforgeeks saved the day for me. Decide which framework you will primarily use with Hugging Face and install only that. I chose TensorFlow, and once I removed PyTorch, many issues disappeared.

2. Keras Compatibility

  • Hugging Face models rely on Keras. Installing Keras without ensuring backward compatibility caused unexpected errors.
  • Solution: Install Keras with a version compatible with your chosen framework. For TensorFlow, I ensured Keras was updated but backward-compatible with the dependencies.

If Keras already installed, first uninstall it and then install it with backward compatibility.

pip uninstall keras
pip install tf-keras        

3. Understanding Prerequisites

  • Documentation often skips over prerequisites, assuming users have them set up. This led to missteps in my installation process.
  • Solution: Before diving in, ensure your environment meets all prerequisites. Look for community tutorials that break down prerequisites in detail.

The Outcome: A Smooth Setup

Once I resolved these issues, the Hugging Face basic setup worked seamlessly on my Mac. It was a rewarding experience, not just because I got it to work, but also because of the learning curve I overcame. The frustration transformed into a deeper understanding of dependencies and their management.

Sharing My Learnings

To help others, I have compiled a list of common issues and solutions:

  • Install either TensorFlow or PyTorch, not both.
  • Ensure Keras compatibility with your framework.
  • Check for conflicting dependencies before proceeding.
  • Use forums, ChatGPT or other AI Bots, GitHub Issues, and community discussions for specific error messages.

What’s Next?

I am planning to explore Hugging Face models and integrate them into my projects. But more importantly, I want to contribute to making such setups easier for others. If you have faced similar challenges, feel free to share your tips and tricks.

Closing Thoughts

Setting up Hugging Face was not just about installing software, it was a lesson in resilience, curiosity, and learning from errors. For those just starting out, remember:

every roadblock is an opportunity to learn something new. And when in doubt, the community is always there to help.



Image Credit: https://www.cloudgeometry.com/blog/hugging-face


Shujaat Ali

Senior Software Engineer & Engineering Lead at EdAid | C# | .NET | Microservices | SQL Server | Azure | Fintech | Payments

2 个月

Thank you so much Muhammad K., for walking through the entire setup process and helping me get everything running locally. I’m sure this article will be a huge help to others. Incredible!

Abu Affan khan

Implementation and Test Engineer II epay |ex-HPS | ex-BPC | ex-TPS

2 个月

Insightful

要查看或添加评论,请登录

Muhammad K.的更多文章

  • Diversification of Media Spend - An Engineer's Perspective

    Diversification of Media Spend - An Engineer's Perspective

    After spending a good chunk of time in the advertising world, it's clear that there's a bit of a gap between how sales…

    2 条评论
  • One year as Angular Developer

    One year as Angular Developer

    Through out my career I never felt easy with writing front ends and I always considered my self as a back end…

    15 条评论
  • My first AWS Micro Services Architecture App

    My first AWS Micro Services Architecture App

    Just recently I worked on a project which constitutes of 5 micro-services, all of them were built as AWS serverless…

    8 条评论
  • C# Data Structure: When to use Linked List

    C# Data Structure: When to use Linked List

    In my last article I explained the differences between Array, ArrayList and List. I also cleared the miss understanding…

  • C# Data Structure - Array, ArrayList and List

    C# Data Structure - Array, ArrayList and List

    Some times it is good to look at the basics you have taken for granted. This post is one such post where I am…

    9 条评论
  • Microsoft OpenHack Machine Learning, Dubai, 2018

    Microsoft OpenHack Machine Learning, Dubai, 2018

    Microsoft concluded it's first OpenHack in Dubai. I had a chance to participate in the event along with my team at OSN.

社区洞察

其他会员也浏览了