Skip to content

Commit 20adb40

Browse files
committed
Workaround for PyTorch issue 2575
1 parent 5677cbe commit 20adb40

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

patches/sitecustomize.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Monkey patches BigQuery client creation to use proxy.
2+
3+
# Import torch before anything else. This is a hacky workaround to an error on dlopen
4+
# reporting a limit on static TLS, tracked in https://github.com/pytorch/pytorch/issues/2575
5+
import torch
26
import os
37

48
kaggle_proxy_token = os.getenv("KAGGLE_DATA_PROXY_TOKEN")

test_build.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,20 @@
9696
import seaborn
9797
print("seaborn ok")
9898

99+
# PyTorch smoke test based on http://pytorch.org/tutorials/beginner/nlp/deep_learning_tutorial.html
100+
import torch
101+
import torch.nn as tnn
102+
import torch.autograd as autograd
103+
torch.manual_seed(31337)
104+
linear_torch = tnn.Linear(5,3)
105+
data_torch = autograd.Variable(torch.randn(2, 5))
106+
print(linear_torch(data_torch))
107+
print("PyTorch ok")
108+
109+
import fastai
110+
from fastai.io import get_data
111+
print("fast.ai ok")
112+
99113
import os
100114
import threading
101115
from http.server import BaseHTTPRequestHandler, HTTPServer

0 commit comments

Comments
 (0)