Skip to content

Commit

Permalink
Translation of Introduction and first part of Google Colab
Browse files Browse the repository at this point in the history
  • Loading branch information
akkasayaz committed Mar 29, 2022
1 parent 63780f2 commit a9685f6
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .idea/.idea.course-1.dir/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

110 changes: 110 additions & 0 deletions chapters/tr/chapter0/1.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Giriş

Hugging Face kursuna hoş geldiniz! Bu bölümde kursta kullanacağımız çalışma ortamını kuracağız. Eğer kursa yeni başlıyorsanız, öncelikle [1. bölüme](/course/chapter1) bakmanızı, sonra da geri gelip ortamınızı kurmanızı öneririz. Böylelikle kodları kendi başınıza deneyimleyebilirsiniz.

Bu kursta kullanacağımız bütün kütüphaneler Python package'ı olarak indirilebilir, bu yüzden burada Python ortamının kurulumunu ve lazım olacak kütüphaneleri indirmeyi göstereceğiz.

İki farklı yol göstereceğiz Colab defterleri ve Python sanal ortamı. Size en uygun olanı seçebilirsiniz. Yeni başlayanların Colab defteri kullanmasını tavsiye ederiz.

Kursta Windows sistemi kullanmıyoruz bu yüzden eğer Windows kullanıyorsanız Colab kullanmanız daha iyi olacaktır. Eğer herhangi bir Linux dağıtımı ya da macOS kullanıyorsanız iki yöntemi de tercih edebilirsiniz.

Kurs genel olarak Hugging Face üzerinden gidiyor. Eğer hesabınız yoksa [buradan hesap açabilirsiniz](https://huggingface.co/join).

## Google Colab defteri kullanmak

Colab defteri kullanmak açık ara en kolay kurulum. Tarayıcınızda bir defter açın ve hemen kodlamaya başlayın!

Eğer Colab kullanmayı bilmiyorsanız bu [İngilizce tutorialı](https://colab.research.google.com/notebooks/intro.ipynb) takip edebilirsiniz. Colab TPU ya da GPU gibi bazı hızlandırıcı donanımları kullanmanıza izin verir. Üstelik küçük işlemler için bunlar ücretsiz!

Colab kullanımında kendinizi rahat hissettikten sonra yeni bir defter oluşturun ve kuruluma başlayın:

<div class="flex justify-center">
<img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter0/new_colab.png" alt="An empty colab notebook" width="80%"/>
</div>

The next step is to install the libraries that we'll be using in this course. We'll use `pip` for the installation, which is the package manager for Python. In notebooks, you can run system commands by preceding them with the `!` character, so you can install the 🤗 Transformers library as follows:

```
!pip install transformers
```

You can make sure the package was correctly installed by importing it within your Python runtime:

```
import transformers
```

<div class="flex justify-center">
<img src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter0/install.gif" alt="A gif showing the result of the two commands above: installation and import" width="80%"/>
</div>

This installs a very light version of 🤗 Transformers. In particular, no specific machine learning frameworks (like PyTorch or TensorFlow) are installed. Since we'll be using a lot of different features of the library, we recommend installing the development version, which comes with all the required dependencies for pretty much any imaginable use case:

```
!pip install transformers[sentencepiece]
```

This will take a bit of time, but then you'll be ready to go for the rest of the course!

## Using a Python virtual environment

If you prefer to use a Python virtual environment, the first step is to install Python on your system. We recommend following [this guide](https://realpython.com/installing-python/) to get started.

Once you have Python installed, you should be able to run Python commands in your terminal. You can start by running the following command to ensure that it is correctly installed before proceeding to the next steps: `python --version`. This should print out the Python version now available on your system.

When running a Python command in your terminal, such as `python --version`, you should think of the program running your command as the "main" Python on your system. We recommend keeping this main installation free of any packages, and using it to create separate environments for each application you work on — this way, each application can have its own dependencies and packages, and you won't need to worry about potential compatibility issues with other applications.

In Python this is done with [*virtual environments*](https://docs.python.org/3/tutorial/venv.html), which are self-contained directory trees that each contain a Python installation with a particular Python version alongside all the packages the application needs. Creating such a virtual environment can be done with a number of different tools, but we'll use the official Python package for that purpose, which is called [`venv`](https://docs.python.org/3/library/venv.html#module-venv).

First, create the directory you'd like your application to live in — for example, you might want to make a new directory called *transformers-course* at the root of your home directory:

```
mkdir ~/transformers-course
cd ~/transformers-course
```

From inside this directory, create a virtual environment using the Python `venv` module:

```
python -m venv .env
```

You should now have a directory called *.env* in your otherwise empty folder:

```
ls -a
```

```out
. .. .env
```

You can jump in and out of your virtual environment with the `activate` and `deactivate` scripts:

```
# Activate the virtual environment
source .env/bin/activate
# Deactivate the virtual environment
source .env/bin/deactivate
```

You can make sure that the environment is activated by running the `which python` command: if it points to the virtual environment, then you have successfully activated it!

```
which python
```

```out
/home/<user>/transformers-course/.env/bin/python
```

### Installing dependencies

As in the previous section on using Google Colab instances, you'll now need to install the packages required to continue. Again, you can install the development version of 🤗 Transformers using the `pip` package manager:

```
pip install "transformers[sentencepiece]"
```

You're now all set up and ready to go!

0 comments on commit a9685f6

Please sign in to comment.