This is my first interaction with Hugging Face. The free and open Ai option
Date: September 15, 2024
Prerequisites: I bought a 1T external SSD and created this tutorial using the external hard drive. I am using a windows computer. This is where the tutorial begins.
Change directory to D drive
$D:
create directory on external SSD titled version of python and pip I'm using
(use website to install)
$mkdir python312
$cd python312
$mkdir Scripts
install python and pip file from website and put in directories and virtual environment with command:
$pip install virtualenv
versify it's working by checking the version
python --version
pip --version
virtualenv --version
Next command: python invokes interpreter. -m runs module as script. venv module is invoked and my_venv is name of virtual environment
$ virtualenv my_venv
$python -m venv my_venv
$.my_venvScriptsactivate
$pip install transformers
$pip install datasets
$pip install torch
$ipi install tensorflow
add code to file:
from transformers import pipeline # Load the sentiment analysis pipeline sentiment_pipeline = pipeline("sentiment-analysis") # Perform sentiment analysis result = sentiment_pipeline("Hugging Face is creating amazing tools for NLP!") print(result)
install backward compatible package and retry running
$pip install tf-keras
$python roberta_hugging_face.py
When download is complete you will see the result for the pipeline "Hugging Face is creating amazing tools for NLP!"
To deactivate
$deactivate
Safely disconnect SSD
The above is the detailed content of Hugging Face: Interacting with Roberta and Hugging Face for the first time. For more information, please follow other related articles on the PHP Chinese website!