Hub Python Library
  • 🌍GET STARTED
    • Home
    • Quickstart
    • Installation
  • 🌍HOW-TO GUIDES
    • Overview
    • Download files
    • Upload files
    • BAFileSystem
    • Repository
    • Search
    • Inference
    • Community Tab
    • Collections
    • Cache
    • Model Cards
    • Manage your Space
    • Integrate a library
    • Webhooks server
  • 🌍CONCEPTUAL GUIDES
    • Git vs HTTP paradigm
  • 🌍REFERENCE
    • Overview
    • Login and logout
    • Environment variables
    • Managing local and online repositories
    • BOINC AI Hub API
    • Downloading files
    • Mixins & serialization methods
    • Inference Client
    • BaFileSystem
    • Utilities
    • Discussions and Pull Requests
    • Cache-system reference
    • Repo Cards and Repo Card Data
    • Space runtime
    • Collections
    • TensorBoard logger
    • Webhooks server
Powered by GitBook
On this page
  • Installation
  • Install with pip
  • Install with conda
  • Check installation
  • Windows limitations
  • Next steps
  1. GET STARTED

Installation

PreviousQuickstartNextHOW-TO GUIDES

Last updated 1 year ago

Installation

Before you start, you will need to setup your environment by installing the appropriate packages.

boincai_hub is tested on Python 3.8+.

Install with pip

It is highly recommended to install boincai_hub in a . If you are unfamiliar with Python virtual environments, take a look at this . A virtual environment makes it easier to manage different projects, and avoid compatibility issues between dependencies.

Start by creating a virtual environment in your project directory:

Copied

python -m venv .env

Activate the virtual environment. On Linux and macOS:

Copied

source .env/bin/activate

Activate virtual environment on Windows:

Copied

.env/Scripts/activate

Now you’re ready to install boincai_hub :

Copied

pip install --upgrade boincai_hub

Install optional dependencies

You can install optional dependencies via pip:

Copied

# Install dependencies for tensorflow-specific features
# /!\ Warning: this is not equivalent to `pip install tensorflow`
pip install 'boincai_hub[tensorflow]'

# Install dependencies for both torch-specific and CLI-specific features.
pip install 'boincai_hub[cli,torch]'

Here is the list of optional dependencies in boincai_hub:

  • cli: provide a more convenient CLI interface for boincai_hub.

  • fastai, torch, tensorflow: dependencies to run framework-specific features.

  • dev: dependencies to contribute to the lib. Includes testing (to run tests), typing (to run type checker) and quality (to run linters).

Install from source

In some cases, it is interesting to install boincai_hub directly from source. This allows you to use the bleeding edge main version rather than the latest stable version. The main version is useful for staying up-to-date with the latest developments, for instance if a bug has been fixed since the last official release but a new release hasn’t been rolled out yet.

However, this means the main version may not always be stable. We strive to keep the main version operational, and most issues are usually resolved within a few hours or a day. If you run into a problem, please open an Issue so we can fix it even sooner!

Copied

pip install git+https://github.com/boincai/boincai_hub

When installing from source, you can also specify a specific branch. This is useful if you want to test a new feature or a new bug-fix that has not been merged yet:

Copied

pip install git+https://github.com/boincai/boincai_hub@my-feature-branch

Editable install

Copied

# First, clone repo locally
git clone https://github.com/boincai/boincai_hub.git

# Then, install with -e flag
cd boincai_hub
pip install -e .

These commands will link the folder you cloned the repository to and your Python library paths. Python will now look inside the folder you cloned to in addition to the normal library paths. For example, if your Python packages are typically installed in ./.venv/lib/python3.11/site-packages/, Python will also search the folder you cloned ./boincai_hub/.

Install with conda

Copied

conda install -c conda-forge boincai_hub

Check installation

Once installed, check that boincai_hub works properly by running the following command:

Copied

python -c "from boincai_hub import model_info; print(model_info('gpt2'))"

Copied

Model Name: gpt2
Tags: ['pytorch', 'tf', 'jax', 'tflite', 'rust', 'safetensors', 'gpt2', 'text-generation', 'en', 'doi:10.57967/hf/0039', 'transformers', 'exbert', 'license:mit', 'has_space']
Task: text-generation

Windows limitations

Next steps

Once done, is working correctly.

Some dependencies of boincai_hub are because they are not required to run the core features of boincai_hub. However, some features of the boincai_hub may not be available if the optional dependencies aren’t installed.

Once done, is working correctly.

Installing from source allows you to setup an . This is a more advanced installation if you plan to contribute to boincai_hub and need to test changes in the code. You need to clone a local copy of boincai_hub on your machine.

If you are more familiar with it, you can install boincai_hub using the :

Once done, is working correctly.

This command will fetch information from the Hub about the model. Output should look like this:

With our goal of democratizing good ML everywhere, we built boincai_hub to be a cross-platform library and in particular to work correctly on both Unix-based and Windows systems. However, there are a few cases where boincai_hub has some limitations when run on Windows. Here is an exhaustive list of known issues. Please let us know if you encounter any undocumented problem by opening .

boincai_hub’s cache system relies on symlinks to efficiently cache files downloaded from the Hub. On Windows, you must activate developer mode or run your script as admin to enable symlinks. If they are not activated, the cache-system still works but in an non-optimized manner. Please read section for more details.

Filepaths on the Hub can have special characters (e.g. "path/to?/my/file"). Windows is more restrictive on which makes it impossible to download those files on Windows. Hopefully this is a rare case. Please reach out to the repo owner if you think this is a mistake or to us to figure out a solution.

Once boincai_hub is properly installed on your machine, you might want or to get started.

🌍
virtual environment
guide
from the PyPi registry
check installation
optional
check installation
editable install
conda-forge channel
check installation
gpt2
an issue on Github
the cache limitations
special characters
configure environment variables
check one of our guides