<commit_before>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "15add2e6-8190-4228-820b-e12af67c78e6",
   "metadata": {},
   "outputs": [],
   "source": [
    "import syft as sy\n",
    "from syft.core.tensor import nn"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "3058665a-8f08-4d20-9624-0bce1f55fb75",
   "metadata": {},
   "outputs": [],
   "source": [
    "net = nn.Model()\n",
    "net.add(nn.Convolution(1, (3, 3), input_shape=(None, 1, 28, 28)))\n",
    "\n",
    "net.add(nn.MaxPool((2, 2)))\n",
    "net.add(nn.Convolution(2, (4, 4)))\n",
    "\n",
    "net.add(nn.MaxPool((2, 2)))\n",
    "\n",
    "net.compile()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "60c8741c-404f-4f18-ade8-8257a97f4fea",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "WARNING: CHANGE YOUR USERNAME AND PASSWORD!!! \n",
      "\n",
      "Anyone can login as an admin to your node right now because your password is still the default PySyft username and password!!!\n",
      "\n",
      "Connecting to localhost... done! \t Logging into canada... done!\n"
     ]
    }
   ],
   "source": [
    "domain = sy.login(email=\"<EMAIL>\",password=\"<PASSWORD>\",port=8081)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "056da3aa-80f4-4268-af37-7267e95f5cba",
   "metadata": {},
   "outputs": [],
   "source": [
    "ptr = net.send(domain)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "dfdf466c-50f4-40d7-9ca0-3bc8fce4321f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<ModelPointer -> canada:8146190ff20047f3a6528813898fb8ab>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ptr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "abcb0fdf-8478-49d0-adb9-02e0ea840dee",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<ModelPointer -> canada:8146190ff20047f3a6528813898fb8ab>"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ptr"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3<commit_msg>working model pointer fit notebook<commit_after>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "15add2e6-8190-4228-820b-e12af67c78e6",
   "metadata": {},
   "outputs": [],
   "source": [
    "import syft as sy\n",
    "from syft.core.tensor import nn\n",
    "from syft.core.tensor.autodp.phi_tensor import PhiTensor\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "3058665a-8f08-4d20-9624-0bce1f55fb75",
   "metadata": {},
   "outputs": [],
   "source": [
    "net = nn.Model()\n",
    "net.add(nn.Convolution(1, (3, 3), input_shape=(None, 1, 28, 28)))\n",
    "\n",
    "net.add(nn.MaxPool((2, 2)))\n",
    "net.add(nn.Convolution(2, (4, 4)))\n",
    "\n",
    "net.add(nn.MaxPool((2, 2)))\n",
    "\n",
    "net.compile()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "38778a3e-d51f-43ba-842a-8e5ba33630a5",
   "metadata": {},
   "outputs": [],
   "source": [
    "N = 10\n",
    "C_in = 1\n",
    "H_in = 28\n",
    "W_in = 28\n",
    "\n",
    "\n",
    "input_shape = (N, C_in, H_in, W_in)\n",
    "x = PhiTensor(child=np.random.randint(low=0, high=255, size=input_shape),\n",
    "              data_subjects=[\"0\"]*input_shape[0],\n",
    "              min_vals=0,\n",
    "              max_vals=255\n",
    "             )\n",
    "y = PhiTensor(child=np.random.randint(low=0, high=2, size=input_shape),\n",
    "                  data_subjects=[\"0\"]*input_shape[0],\n",
    "                  min_vals=0,\n",
    "                  max_vals=1\n",
    "             )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "994da91a-ca91-4b46-84fe-01a1b4861ac3",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "WARNING: CHANGE YOUR USERNAME AND PASSWORD!!! \n",
      "\n",
      "Anyone can login as an admin to your node right now because your password is still the default PySyft username and password!!!\n",
      "\n",
      "Connecting to localhost... done! \t Logging into canada... done!\n"
     ]
    }
   ],
   "source": [
    "domain = sy.login(email=\"<EMAIL>\",password=\"<PASSWORD>\",port=8081)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "1715c089-1950-491f-aac4-47194bcaa34b",
   "metadata": {},
   "outputs": [],
   "source": [
    "model_ptr = net.send(domain)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "954503bf-c7fc-4ee8-8546-b3a456a7efd4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<ModelPointer -> canada:11fdbd7e5ca9442db14c257227d5b8bf>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model_ptr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "08e08db7-570f-4800-9f43-877c6f0f8d16",
   "metadata": {},
   "outputs": [],
   "source": [
    "x_t = sy.Tensor(x)\n",
    "y_t = sy.Tensor(y)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "a989e539-cd16-41b5-8a61-b21af59ebfbf",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "kj/filesystem-disk-unix.c++:1690: warning: PWD environment variable doesn't match current directory; pwd = /home/azureuser/PySyft\n",
      "Uploading `f2e1ea492ef742f6a7169bee41c9c15b`: 100%|\u001b[32m██████████████████\u001b[0m| 1/1 [00:00<00:00, 184.35it/s]\u001b[0m\n",
      "Uploading `1257f0a6c6d7432781128b7f5dc5410a`: 100%|\u001b[32m██████████████████\u001b[0m| 1/1 [00:00<00:00, 282.25it/s]\u001b[0m\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<_SyNonePointer -> canada:5dc62c68b3664c7fa2593eedcc9af2e6>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model_ptr.fit(x_t,y_t)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "38b0c86b-6c90-4283-b349-8f7bb060655b",
   "metadata": {},
   "outputs": [],
   "source": [
    "net.fit(x,y)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
{'fraction_non_alphanumeric': 0.21869565217391304, 'fraction_numerical': 0.08521739130434783, 'mean_word_length': 2.5119592875318064, 'pattern_counts': {'":': 139, '<': 13, '<?xml version=': 0, '>': 15, '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}}
{'dir': 'git-commits-cleaned', 'id': '4327779', 'n_tokens_mistral': 3266, 'n_tokens_neox': 2912, 'n_words': 439}