{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"!pip install tridentx","metadata":{"execution":{"iopub.status.busy":"2021-09-04T05:37:17.443325Z","iopub.execute_input":"2021-09-04T05:37:17.443681Z","iopub.status.idle":"2021-09-04T05:37:23.663229Z","shell.execute_reply.started":"2021-09-04T05:37:17.443649Z","shell.execute_reply":"2021-09-04T05:37:23.662352Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import os\n#判斷是否在jupyter notebook上\ndef is_in_ipython():\n    \"Is the code running in the ipython environment (jupyter including)\"\n    program_name = os.path.basename(os.getenv('_', ''))\n\n    if ('jupyter-notebook' in program_name or # jupyter-notebook\n        'ipython'          in program_name or # ipython\n        'jupyter' in program_name or  # jupyter\n        'JPY_PARENT_PID'   in os.environ):    # ipython-notebook\n        return True\n    else:\n        return False\n\n\n#判斷是否在colab上\ndef is_in_colab():\n    if not is_in_ipython(): return False\n    try:\n        from google import colab\n        return True\n    except: return False\n\n#判斷是否在kaggke_kernal上\ndef is_in_kaggle_kernal():\n    if 'kaggle' in os.environ['PYTHONPATH']:\n        return True\n    else:\n        return False\n\nif is_in_colab():\n    from google.colab import drive\n    drive.mount('/content/gdrive')\n\nos.environ['TRIDENT_BACKEND'] = 'pytorch'\nkaggle_kernal=None\nif is_in_kaggle_kernal():\n    os.environ['TRIDENT_HOME'] = './trident'\n    \nelif is_in_colab():\n    os.environ['TRIDENT_HOME'] = '/content/gdrive/My Drive/trident'","metadata":{"execution":{"iopub.status.busy":"2021-09-04T05:40:42.038765Z","iopub.execute_input":"2021-09-04T05:40:42.039122Z","iopub.status.idle":"2021-09-04T05:40:42.050240Z","shell.execute_reply.started":"2021-09-04T05:40:42.039088Z","shell.execute_reply":"2021-09-04T05:40:42.049354Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip uninstall tridentx -y","metadata":{"execution":{"iopub.status.busy":"2021-09-04T05:56:01.842358Z","iopub.execute_input":"2021-09-04T05:56:01.842723Z","iopub.status.idle":"2021-09-04T05:56:03.281565Z","shell.execute_reply.started":"2021-09-04T05:56:01.842690Z","shell.execute_reply":"2021-09-04T05:56:03.280578Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pip install -U tridentx","metadata":{"execution":{"iopub.status.busy":"2021-09-04T05:56:11.090202Z","iopub.execute_input":"2021-09-04T05:56:11.090574Z","iopub.status.idle":"2021-09-04T05:56:19.396365Z","shell.execute_reply.started":"2021-09-04T05:56:11.090538Z","shell.execute_reply":"2021-09-04T05:56:19.395454Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import trident","metadata":{"execution":{"iopub.status.busy":"2021-09-04T05:56:21.466466Z","iopub.execute_input":"2021-09-04T05:56:21.466795Z","iopub.status.idle":"2021-09-04T05:56:21.497539Z","shell.execute_reply.started":"2021-09-04T05:56:21.466763Z","shell.execute_reply":"2021-09-04T05:56:21.495881Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}