From 5a1300639c245245762a9abcadd6b39b36855f63 Mon Sep 17 00:00:00 2001 From: friebolin <friebolin@cl.uni-heidelberg.de> Date: Fri, 24 Feb 2023 15:24:15 +0100 Subject: [PATCH] Update imports --- Code/train.py | 1 + inference.py | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Code/train.py b/Code/train.py index 55bdd7f..919fb06 100644 --- a/Code/train.py +++ b/Code/train.py @@ -17,6 +17,7 @@ import os import pandas as pd import sklearn +device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') metric=evaluate.load("accuracy") torch.cuda.empty_cache() diff --git a/inference.py b/inference.py index a330f5e..6caeb49 100644 --- a/inference.py +++ b/inference.py @@ -1,12 +1,13 @@ """Demo for inference: User enters a sentence and our trained BERT model predicts if the target word is literal or non-literal""" import sys sys.path.insert(0, 'Code/') -from Code.preprocess import * -from Code.models import * -from Code.train import * -#import preprocess -#import models -#import train +# from Code.preprocess import * +# from Code.models import * +# from Code.train import * + +import Code.preprocess +import Code.models +import Code.train import json import torch from transformers import BertTokenizer, BertModel, BertConfig, BertPreTrainedModel, PreTrainedModel, AutoConfig, AutoModel, AutoTokenizer -- GitLab