{"metadata":{"kernelspec":{"name":"python3","display_name":"Python 3","language":"python"},"language_info":{"name":"python","version":"3.11.11","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"nvidiaTeslaT4","dataSources":[{"sourceId":39763,"databundleVersionId":11756775,"sourceType":"competition"},{"sourceId":12038896,"sourceType":"datasetVersion","datasetId":7377931},{"sourceId":12357702,"sourceType":"datasetVersion","datasetId":7790968},{"sourceId":12363637,"sourceType":"datasetVersion","datasetId":7793823}],"dockerImageVersionId":31041,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"This notebook submits my 2nd place solution for the \"Yale/UNC-CH - Geophysical Waveform Inversion\" competition. Note that most actual code is in the attached library dataset.\n\nA writeup of this solution can be found here: https://www.kaggle.com/competitions/waveform-inversion/discussion/587950\n\nThe full code and history can be found on GitHub: https://github.com/jcottaar/seismic/\n\nThis script makes a few predictions itself, but predicting all test datasets would take weeks. So most are read from a cache.","metadata":{}},{"cell_type":"code","source":"# Set up environment\n!pip install --no-deps monai -q\nimport sys\nsys.path.append('/kaggle/input/my-fwi-library/')\nimport kaggle_support as kgs\nimport seis_model\nkgs.cache_dir_read = '/kaggle/input/seismic-release-cache/'","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# Load all test data\ndata = kgs.load_all_test_data()\n# Actually infer a few of them\nN_infer = 50\nmodel = seis_model.default_model()\nmodel.models[1].run_in_parallel = True\nkgs.disable_caching = True\ndata_inferred = model.infer(data[:N_infer])\n# Grab the rest from cache\nkgs.disable_caching = False\ndata_cache = model.infer(data[N_infer:])\n# Write submission file\nkgs.write_submission_file(data_inferred+data_cache)","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}