### Install Dependencies Source: https://github.com/huggingface/blog/blob/main/sentiment-analysis-python.md Installs the necessary libraries for the tutorial: datasets, transformers, and huggingface_hub. ```bash !pip install datasets transformers huggingface_hub ``` -------------------------------- ### Installing GUI Dependencies and Starting Server Source: https://github.com/huggingface/blog/blob/main/cost-efficient-rag-applications-with-intel.md Commands to install frontend dependencies and start the GUI server. ```bash npm install nohup npm run dev & ``` -------------------------------- ### Install ScreenEnv and Try Examples Source: https://github.com/huggingface/blog/blob/main/screenenv.md Command-line instructions to install ScreenEnv and run its examples. ```bash # Install ScreenEnv pip install screenenv # Try the examples git clone git@github.com:huggingface/screenenv.git cd screenenv python -m examples.desktop_agent # use 'sudo -E python -m examples.desktop_agent` if you're not in 'docker' group ``` -------------------------------- ### Set up PopTorch for the IPU Source: https://github.com/huggingface/blog/blob/main/graphcore-getting-started.md Commands to create and activate a PopTorch environment and install the PopTorch wheel. ```bash $ virtualenv -p python3 ~/workspace/poptorch_env $ source ~/workspace/poptorch_env/bin/activate $ pip3 install -U pip $ pip3 install /opt/gc/poplar_sdk-ubuntu_18_04-2.3.0+774-b47c577c2a/poptorch-.whl ``` -------------------------------- ### Wall-X Installation and Training Example Source: https://github.com/huggingface/blog/blob/main/lerobot-release-v050.md Commands to install the Wall-X extra and train a Wall-X policy. ```bash pip install lerobot[wall_x] lerobot-train \ --policy.type=wall_x \ --dataset.repo_id=lerobot/aloha_sim_insertion_human ``` -------------------------------- ### X-VLA Installation and Training Example Source: https://github.com/huggingface/blog/blob/main/lerobot-release-v050.md Commands to install the X-VLA extra and train an X-VLA policy. ```bash pip install lerobot[xvla] lerobot-train \ --policy.type=xvla \ --dataset.repo_id=lerobot/bimanual-so100-handover-cube ``` -------------------------------- ### Install Text Classification Example Requirements Source: https://github.com/huggingface/blog/blob/main/getting-started-habana.md Navigates to the text classification example directory and installs its dependencies. ```bash cd examples/text-classification pip install -r requirements.txt ``` -------------------------------- ### Install necessary libraries Source: https://github.com/huggingface/blog/blob/main/notebooks/85_sentiment_analysis_twitter.ipynb Installs the tweepy, matplotlib, and wordcloud libraries, with '-q' for quiet installation. ```python !pip install -q tweepy matplotlib wordcloud ``` -------------------------------- ### Installing Frontend GUI Components Source: https://github.com/huggingface/blog/blob/main/cost-efficient-rag-applications-with-intel.md Commands to install Node.js and npm for the frontend GUI. ```bash sudo apt-get install npm && \ npm install -g n && \ n stable && \ hash -r && \ npm install -g npm@latest ``` -------------------------------- ### Example Texts for Embedding Source: https://github.com/huggingface/blog/blob/main/getting-started-with-embeddings.md A list of example questions to be embedded using the configured model and API. ```python texts = ["How do I get a replacement Medicare card?", "What is the monthly premium for Medicare Part B?", "How do I terminate my Medicare Part B (medical insurance)?", "How do I sign up for Medicare?", "Can I sign up for Medicare Part B if I am working and have health insurance through an employer?", "How do I sign up for Medicare Part B if I already have Part A?", "What are Medicare late enrollment penalties?", "What is Medicare and who can get it?", "How can I get help with my Medicare Part A and Part B premiums?", "What are the different parts of Medicare?", "Will my Medicare premiums be higher because of my income?", "What is TRICARE ?", "Should I sign up for Medicare Part B if I have Veterans' Benefits?"] output = query(texts) ``` -------------------------------- ### Server Setup Steps Source: https://github.com/huggingface/blog/blob/main/intel-sapphire-rapids-inference.md These commands set up the necessary software environment on the test servers, including PyTorch, Intel Extension for PyTorch, and Transformers. It also includes optional performance enhancements like libtcmalloc. ```bash sudo apt-get update # Add libtcmalloc for extra performance sudo apt install libgoogle-perftools-dev -y export LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libtcmalloc.so" sudo apt-get install python3-pip -y pip install pip --upgrade export PATH=/home/ubuntu/.local/bin:$PATH pip install virtualenv virtualenv inference_env source inference_env/bin/activate pip3 install torch==1.13.0 -f https://download.pytorch.org/whl/cpu pip3 install intel_extension_for_pytorch==1.13.0 -f https://developer.intel.com/ipex-whl-stable-cpu pip3 install transformers # Only needed on the r7iz instance pip3 install optimum[intel] ``` -------------------------------- ### Install Dependencies Source: https://github.com/huggingface/blog/blob/main/sentiment-analysis-twitter.md Installs the necessary Python libraries: transformers, tweepy, matplotlib, and wordcloud. ```python !pip install -q transformers tweepy matplotlib wordcloud ``` -------------------------------- ### Installation commands Source: https://github.com/huggingface/blog/blob/main/hf-bitsandbytes-integration.md Commands to install the necessary libraries for bitsandbytes integration with Hugging Face Transformers. ```bash pip install accelerate pip install bitsandbytes pip install git+https://github.com/huggingface/transformers.git ``` -------------------------------- ### Install transformers Source: https://github.com/huggingface/blog/blob/main/notebooks/trainer/01_text_classification.ipynb Installs the transformers library from master and clones the repository to get utility files. ```shell !pip transformers==3.5.1 ``` -------------------------------- ### Environment Setup and Local Training Check Source: https://github.com/huggingface/blog/blob/main/intel-sapphire-rapids.md Sets up the environment and installs dependencies, then runs a local training job as a sanity check. ```bash source ~/cluster_env/bin/activate cd ~/transformers/examples/pytorch/question-answering pip3 install -r requirements.txt ``` ```bash export LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libtcmalloc.so" python run_qa.py --model_name_or_path distilbert-base-uncased \ --dataset_name squad --do_train --do_eval --per_device_train_batch_size 32 \ --num_train_epochs 1 --output_dir /tmp/debug_squad/ \ --use_ipex --bf16 --no_cuda ``` -------------------------------- ### Install the library Source: https://github.com/huggingface/blog/blob/main/hello-hf-kernels.md Installs the kernels library and its dependencies. ```bash pip install kernels torch numpy ``` -------------------------------- ### Install huggingface-hub Source: https://github.com/huggingface/blog/blob/main/notebooks/80_getting_started_with_embeddings.ipynb Installs the huggingface-hub library, which is necessary for interacting with the Hugging Face Hub. ```python %%capture !pip install huggingface-hub ``` -------------------------------- ### Install Optimum Habana from Source Source: https://github.com/huggingface/blog/blob/main/getting-started-habana.md Installs the Optimum Habana package from its source code. ```bash cd optimum-habana pip install . ``` -------------------------------- ### Install Optimum Intel and Transformers Source: https://github.com/huggingface/blog/blob/main/openvino-vlm.md Installs the necessary libraries for optimizing and running models with OpenVINO. ```bash pip install optimum-intel[openvino] transformers==4.52.* ``` -------------------------------- ### Install Git LFS Source: https://github.com/huggingface/blog/blob/main/sentiment-analysis-python.md Installs git-lfs, which is required for using git in model repositories. ```bash !apt-get install git-lfs ``` -------------------------------- ### Compiling and running a ggml example on Ubuntu Source: https://github.com/huggingface/blog/blob/main/introduction-to-ggml.md This code snippet demonstrates how to install build dependencies, clone the ggml repository, compile a simple example, and run it. ```shell # Start by installing build dependencies # "gdb" is optional, but is recommended sudo apt install build-essential cmake git gdb # Then, clone the repository git clone https://github.com/ggerganov/ggml.git cd ggml # Try compiling one of the examples cmake -B build cmake --build build --config Release --target simple-ctx # Run the example ./build/bin/simple-ctx ``` -------------------------------- ### Install sentence-transformers library Source: https://github.com/huggingface/blog/blob/main/notebooks/80_getting_started_with_embeddings.ipynb Installs or upgrades the sentence-transformers library, which provides utilities for semantic search. ```python %%capture !pip install -U sentence-transformers ``` -------------------------------- ### Install Retry Package Source: https://github.com/huggingface/blog/blob/main/notebooks/80_getting_started_with_embeddings.ipynb Installs the 'retry' package, which is used for handling API request retries. ```python %%capture !pip install retry ``` -------------------------------- ### Install necessary libraries Source: https://github.com/huggingface/blog/blob/main/notebooks/115_introducing_contrastive_search.ipynb Installs PyTorch and the Hugging Face Transformers library. ```bash ! pip install torch ! pip install "transformers>=4.24.0" ``` -------------------------------- ### Install Dependencies Source: https://github.com/huggingface/blog/blob/main/sentiment-analysis-python.md Installs the necessary Python libraries for the tutorial: transformers, tweepy, wordcloud, and matplotlib. ```python !pip install -q transformers tweepy wordcloud matplotlib ``` -------------------------------- ### Set up the Poplar SDK Environment Source: https://github.com/huggingface/blog/blob/main/graphcore-getting-started.md Commands to set environment variables for Graphcore tools and Poplar libraries. ```bash $ cd /opt/gc/poplar_sdk-ubuntu_18_04-2.3.0+774-b47c577c2a/ $ source poplar-ubuntu_18_04-2.3.0+774-b47c577c2a/enable.sh $ source popart-ubuntu_18_04-2.3.0+774-b47c577c2a/enable.sh ``` -------------------------------- ### Install datasets library Source: https://github.com/huggingface/blog/blob/main/notebooks/80_getting_started_with_embeddings.ipynb Installs the Hugging Face datasets library, which is used for loading and processing datasets. ```python %%capture !pip install datasets ``` -------------------------------- ### Getting Started with Aya Vision Source: https://github.com/huggingface/blog/blob/main/aya-vision.md Instructions and links to get started with the Aya Vision model, including downloading weights, trying it on Hugging Face Space or WhatsApp, and a Colab example. ```text Download weights and datasets from the [Aya Vision collection](https://huggingface.co/collections/CohereForAI/c4ai-aya-vision-67c4ccd395ca064308ee1484) on Hugging Face. Try Aya Vision using our [Hugging Face Space](https://huggingface.co/spaces/CohereForAI/aya_expanse) or text it on [Whatsapp](https://cohere.com/research/aya/whatsapp) Build on Aya using our [colab example](https://colab.research.google.com/drive/1jHYi8WVyRE6-imTRA37h_9txjrr8WNZd?usp=sharing). ``` -------------------------------- ### Environment Setup Commands Source: https://github.com/huggingface/blog/blob/main/gpt-oss-on-intel-xeon.md Commands to clone the transformers repository, checkout a specific commit, build a Docker image, and run the container for setting up the environment. ```bash $ git clone https://github.com/huggingface/transformers.git $ cd transformers/ $ git checkout 26b65fb5168f324277b85c558ef8209bfceae1fe $ cd docker/transformers-intel-cpu/ $ sudo docker build . -t $ sudo docker run -it --rm --privileged -v /home/:/workspace /bin/bash ``` ```bash pip install git+https://github.com/huggingface/transformers.git@26b65fb5168f324277b85c558ef8209bfceae1fe pip install torch==2.8.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu ``` -------------------------------- ### Install Optimum Graphcore Source: https://github.com/huggingface/blog/blob/main/graphcore-getting-started.md Command to install the Optimum Graphcore package within the activated PopTorch virtual environment. ```bash (poptorch_env) user@host:~/workspace/poptorch_env$ pip3 install optimum[graphcore] optuna ``` -------------------------------- ### API Key Setup Source: https://github.com/huggingface/blog/blob/main/upskill.md Environment variables to set for API keys required by upskill. ```shell export ANTHROPIC_API_KEY=sk-ant-... export HF_TOKEN=hf_... ``` -------------------------------- ### Install transformers and run sentiment analysis Source: https://github.com/huggingface/blog/blob/main/sentiment-analysis-python.md This code snippet installs the transformers library, initializes a sentiment analysis pipeline with the default model, and analyzes a list of texts. ```python pip install -q transformers from transformers import pipeline sentiment_pipeline = pipeline("sentiment-analysis") data = ["I love you", "I hate you"] sentiment_pipeline(data) ``` -------------------------------- ### Quick test run for SFT Source: https://github.com/huggingface/blog/blob/main/hf-skills-training.md Example command for a quick test run to SFT Qwen-0.6B with a small subset of a custom dataset. ```bash Do a quick test run to SFT Qwen-0.6B with 100 examples of my-org/support-conversations. ``` -------------------------------- ### Install Dependencies Source: https://github.com/huggingface/blog/blob/main/openvino.md Creates a virtual environment and installs the necessary Python packages for quantization. ```bash virtualenv openvino source openvino/bin/activate pip install pip --upgrade pip install optimum[openvino,nncf] torchvision evaluate ``` -------------------------------- ### MLX inference with vision Source: https://github.com/huggingface/blog/blob/main/gemma3n.md Example command to get started with vision inference using MLX. ```shell python -m mlx_vlm.generate --model google/gemma-3n-E4B-it --max-tokens 100 --temperature 0.5 --prompt "Describe this image in detail." --image https://huggingface.co/datasets/ariG23498/demo-data/resolve/main/airplane.jpg ``` -------------------------------- ### Running the demo Source: https://github.com/huggingface/blog/blob/main/introduction-to-ggml.md This snippet shows the command to run the demo and its expected output. ```bash ./build/bin/demo Expected result: ``` mul mat (4 x 3) (transposed result): [ 60.00 55.00 50.00 110.00 90.00 54.00 54.00 126.00 42.00 29.00 28.00 64.00 ] ``` ``` -------------------------------- ### Displaying Sample Tweets by Sentiment Source: https://github.com/huggingface/blog/blob/main/sentiment-analysis-twitter.md Shows one example tweet for each sentiment category (Positive, Neutral, Negative). ```python display(df[df["sentiment"] == 'Positive'].head(1)) display(df[df["sentiment"] == 'Neutral'].head(1)) display(df[df["sentiment"] == 'Negative'].head(1)) ``` -------------------------------- ### Launching `transformers serve` Source: https://github.com/huggingface/blog/blob/main/welcome-openai-gpt-oss.md Command to start the `transformers serve` utility for local model experimentation. ```shell transformers serve ```