Skip to content

Commit

Permalink
fixed the tests to tab2vec in the case of cuda available
Browse files Browse the repository at this point in the history
  • Loading branch information
jrzaurin committed Feb 10, 2024
1 parent ba473dd commit 3901e07
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/test_bayesian_models/test_bayes_tab2vec/test_b_t2v.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import string
from random import choices

import torch
import numpy as np
import pandas as pd
import pytest
Expand All @@ -9,6 +10,8 @@
from pytorch_widedeep.preprocessing import TabPreprocessor
from pytorch_widedeep.bayesian_models import BayesianTabMlp

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

colnames = list(string.ascii_lowercase)[:4] + ["target"]
cat_col1_vals = ["a", "b", "c"]
cat_col2_vals = ["d", "e", "f"]
Expand Down Expand Up @@ -46,6 +49,7 @@ def test_bayesian_mlp_models(return_dataframe, embed_continuous):
cont_embed_dim=4,
mlp_hidden_dims=[8, 4],
)
model.to(device)

# Let's assume the model is trained
t2v = Tab2Vec(
Expand Down

0 comments on commit 3901e07

Please sign in to comment.