File tree Expand file tree Collapse file tree 1 file changed +1
-17
lines changed
Expand file tree Collapse file tree 1 file changed +1
-17
lines changed Original file line number Diff line number Diff line change 5050 general
5151"""
5252
53- ######################################################################
54- # Preparing Torch
55- # ==========================
56- #
57- # Set up torch to default to the right device use GPU acceleration depending on your hardware (CPU or CUDA).
58- #
59-
60- import torch
61-
62- # Check if CUDA is available
63- device = torch .device ('cpu' )
64- if torch .cuda .is_available ():
65- device = torch .device ('cuda' )
66-
67- torch .set_default_device (device )
68- print (f"Using device = { torch .get_default_device ()} " )
69-
7053######################################################################
7154# Preparing the Data
7255# ==================
8265# The first step is to define and clean our data. Initially, we need to convert Unicode to plain ASCII to
8366# limit the RNN input layers. This is accomplished by converting Unicode strings to ASCII and allowing only a small set of allowed characters.
8467
68+ import torch
8569import string
8670import unicodedata
8771
You can’t perform that action at this time.
0 commit comments