<jupyter_start><jupyter_text>modules import<jupyter_code>import torch 
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
from torch.optim import lr_scheduler
import numpy as np
import torchvision
from torchvision import datasets, models, transforms
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('seaborn-white')

import time
import os
import copy
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
device
model_ft = models.resnet18(pretrained=True)
# data에 맞게 pre train model 수정

num_ftrs = model_ft.fc.in_features
model_ft.fc = nn.Linear(num_ftrs, 2)

model_ft = model_ft.to(device)
# loss func , optimizer

criterion = nn.CrossEntropyLoss()
optimizer_ft = optim.SGD(model_ft.parameters(), lr = 1e-3, momentum = 0.9)
exp_lr_scheduler = lr_scheduler.StepLR(optimizer_ft, step_size = 7, gamma =0.1) # 7 epoch 마다 0.1 씩 lr감소<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09257265877287406, 'fraction_numerical': 0.013993541442411194, 'mean_word_length': 5.788321167883212, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '559476', 'license': 'Apache-2.0', 'n_tokens_mistral': 353, 'n_tokens_neox': 341, 'n_words': 91, 'path': 'cs224w/transfer-learning-pytorch1.ipynb', 'repo_name': 'kidrabit/Data-Visualization-Lab-RND', 'size': '929'}