{
  "id": 180285,
  "title": "how can we add \"agent_motion_config.yaml\" file to kaggle notebooks?",
  "url": "/competitions/lyft-motion-prediction-autonomous-vehicles/discussion/180285",
  "author_name": "",
  "post_date": "2020-09-04T13:46:05.116745500Z",
  "votes": null,
  "comment_count": 4,
  "views": 0,
  "content": "<p>if we use <a href=\"https://github.com/lyft/l5kit\" target=\"_blank\">l5kit</a>, to prepare the dataset for the model, seems we need a list of configurations as <strong>.yaml</strong> file as mentioned in <a href=\"https://github.com/lyft/l5kit/blob/master/examples/agent_motion_prediction/agent_motion_prediction.ipynb\" target=\"_blank\">l5kit examples </a>. <br>\nKindly help me, how can we add \"agent_motion_config.yaml\" file to kaggle notebooks? or shall I go with some alternative options?</p>",
  "messages": [
    {
      "id": "998091",
      "postDate": "09/04/2020 13:46:05",
      "content": "<p>if we use <a href=\"https://github.com/lyft/l5kit\" target=\"_blank\">l5kit</a>, to prepare the dataset for the model, seems we need a list of configurations as <strong>.yaml</strong> file as mentioned in <a href=\"https://github.com/lyft/l5kit/blob/master/examples/agent_motion_prediction/agent_motion_prediction.ipynb\" target=\"_blank\">l5kit examples </a>. <br>\nKindly help me, how can we add \"agent_motion_config.yaml\" file to kaggle notebooks? or shall I go with some alternative options?</p>",
      "rawMarkdown": "if we use [l5kit](https://github.com/lyft/l5kit), to prepare the dataset for the model, seems we need a list of configurations as **.yaml** file as mentioned in [l5kit examples ](https://github.com/lyft/l5kit/blob/master/examples/agent_motion_prediction/agent_motion_prediction.ipynb). \nKindly help me, how can we add \"agent_motion_config.yaml\" file to kaggle notebooks? or shall I go with some alternative options?",
      "votes": null
    },
    {
      "id": "998204",
      "postDate": "09/04/2020 15:10:44",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/pallaviroyal\" target=\"_blank\">@pallaviroyal</a> I think you can do it in many ways. <br>\n1) </p>\n<pre><code>import yaml\nfrom io import StringIO\ncfg: dict = yaml.load(StringIO(AGENT_MOTION_CONFIG), Loader=yaml.FullLoader)\n</code></pre>\n<p>or </p>\n<p>2 ) You can have cfg in your script like everyone doing in their notebook here. you will find that in one of the public book. have a look. </p>\n<p>or</p>\n<p>3) You can put it as a dataset and call that file. </p>",
      "rawMarkdown": "Hi @pallaviroyal I think you can do it in many ways. \n1) \n```\nimport yaml\nfrom io import StringIO\ncfg: dict = yaml.load(StringIO(AGENT_MOTION_CONFIG), Loader=yaml.FullLoader)\n```\nor \n\n2 ) You can have cfg in your script like everyone doing in their notebook here. you will find that in one of the public book. have a look. \n\nor\n\n3) You can put it as a dataset and call that file.",
      "votes": null
    },
    {
      "id": "998711",
      "postDate": "09/05/2020 01:55:23",
      "content": "<p><a href=\"https://www.kaggle.com/deepakrajpurushothaman\" target=\"_blank\">@deepakrajpurushothaman</a> Thanks for your time. I did the second option that you provided.</p>\n<ul>\n<li>Created \"configuration\" script file<ul>\n<li>New notebook &gt; script &gt; named script  file as \"configuration\".</li>\n<li>Written \"cfg\" dict object as below (for example). Reference : Just went through the <a href=\"https://github.com/lyft/l5kit/blob/master/l5kit/l5kit/configs/config.py\" target=\"_blank\">l5kit</a> and saw that cfg object is just dict with required values. So created dict object in script file.</li>\n<li>file &gt; set as utility script</li>\n<li>save and commit as we do usually for notebooks</li></ul></li>\n</ul>\n<pre><code>   cfg = {\n    \"train_path\":\"scenes/train.zarr\"\n     }\n</code></pre>\n<ul>\n<li>Uploaded script in my actual notebook<ul>\n<li>file &gt; add utility script &gt; selected \"configuration\" script file which I created</li>\n<li>Then imported \"configuration\"  as below. Works fine.</li></ul></li>\n</ul>\n<pre><code>import configuration\nprint(configuration.cfg)\n</code></pre>",
      "rawMarkdown": "deepakrajpurushothaman Thanks for your time. I did the second option that you provided.\n- Created \"configuration\" script file\n       - New notebook > script > named script  file as \"configuration\".\n       - Written \"cfg\" dict object as below (for example). Reference : Just went through the [l5kit](https://github.com/lyft/l5kit/blob/master/l5kit/l5kit/configs/config.py) and saw that cfg object is just dict with required values. So created dict object in script file.\n       - file > set as utility script\n       - save and commit as we do usually for notebooks\n   ```\n   cfg = {\n    \"train_path\":\"scenes/train.zarr\"\n     }\n```\n    \n- Uploaded script in my actual notebook\n      - file > add utility script > selected \"configuration\" script file which I created\n      - Then imported \"configuration\"  as below. Works fine.\n```\nimport configuration\nprint(configuration.cfg)\n```",
      "votes": null
    },
    {
      "id": "998766",
      "postDate": "09/05/2020 03:59:11",
      "content": "<p><a href=\"https://www.kaggle.com/pallaviroyal\" target=\"_blank\">@pallaviroyal</a> you found yourself a 4th method. If it works why not. 👍</p>",
      "rawMarkdown": "pallaviroyal you found yourself a 4th method. If it works why not. 👍",
      "votes": null
    },
    {
      "id": "998773",
      "postDate": "09/05/2020 04:12:58",
      "content": "<p><a href=\"https://www.kaggle.com/deepakrajpurushothaman\" target=\"_blank\">@deepakrajpurushothaman</a> Here is the script. But felt better to have \"cfg\" object creation in my actual notebook itself. Because whenever I am changing configuration I have to get a new version of the script file to the notebook. Sometimes notebook not getting update properly with the new version script.  Utility script can be useful when we no need to change code frequently. Thanks for your response.</p>\n<pre><code>cfg = {\n    \"model_params\":{\n        \"model_architecture\":\"resnet50\",\n        \"history_num_frames\":0,\n        \"history_step_size\":1,\n        \"history_delta_time\":0.1,\n        \"future_num_frames\":50,\n        \"future_step_size\":1,\n        \"future_delta_time\":0.1  \n    },\n    \"raster_params\":{\n        \"raster_size\":[224,224],\n        \"pixel_size\":[0.5,0.5],\n        \"ego_center\":[0.25,0.5],\n        \"map_type\":\"py_semantic\",\n        \"satellite_map_key\":\"aerial_map/aerial_map.png\",\n        \"semantic_map_key\":\"semantic_map/semantic_map.pb\",\n        \"dataset_meta_key\":\"meta.json\",\n        \"filter_agents_threshold\":0.5 \n    },\n    \"train_data_loader\":{\n        \"key\":\"scenes/train.zarr\",\n        \"batch_size\":12,\n        \"shuffle\":True,\n        \"num_workers\":16     \n    },\n    \"val_data_loader\":{\n    \"key\":\"scenes/validate.zarr\",\n    \"batch_size\":12,\n    \"shuffle\":False,\n    \"num_workers\":16     \n    },\n    \"train_params\":{\n    \"checkpoint_every_n_steps\":10000,\n    \"max_num_steps\":5,\n    \"eval_every_n_steps\":10000   \n    }     \n}\n</code></pre>",
      "rawMarkdown": "deepakrajpurushothaman Here is the script. But felt better to have \"cfg\" object creation in my actual notebook itself. Because whenever I am changing configuration I have to get a new version of the script file to the notebook. Sometimes notebook not getting update properly with the new version script.  Utility script can be useful when we no need to change code frequently. Thanks for your response.\n```\ncfg = {\n    \"model_params\":{\n        \"model_architecture\":\"resnet50\",\n        \"history_num_frames\":0,\n        \"history_step_size\":1,\n        \"history_delta_time\":0.1,\n        \"future_num_frames\":50,\n        \"future_step_size\":1,\n        \"future_delta_time\":0.1  \n    },\n    \"raster_params\":{\n        \"raster_size\":[224,224],\n        \"pixel_size\":[0.5,0.5],\n        \"ego_center\":[0.25,0.5],\n        \"map_type\":\"py_semantic\",\n        \"satellite_map_key\":\"aerial_map/aerial_map.png\",\n        \"semantic_map_key\":\"semantic_map/semantic_map.pb\",\n        \"dataset_meta_key\":\"meta.json\",\n        \"filter_agents_threshold\":0.5 \n    },\n    \"train_data_loader\":{\n        \"key\":\"scenes/train.zarr\",\n        \"batch_size\":12,\n        \"shuffle\":True,\n        \"num_workers\":16     \n    },\n    \"val_data_loader\":{\n    \"key\":\"scenes/validate.zarr\",\n    \"batch_size\":12,\n    \"shuffle\":False,\n    \"num_workers\":16     \n    },\n    \"train_params\":{\n    \"checkpoint_every_n_steps\":10000,\n    \"max_num_steps\":5,\n    \"eval_every_n_steps\":10000   \n    }     \n}\n```",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 998204,
      "author_name": "deepakrajpurushothaman",
      "author_url": "",
      "post_date": "09/04/2020 15:10:44",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/pallaviroyal\" target=\"_blank\">@pallaviroyal</a> I think you can do it in many ways. <br>\n1) </p>\n<pre><code>import yaml\nfrom io import StringIO\ncfg: dict = yaml.load(StringIO(AGENT_MOTION_CONFIG), Loader=yaml.FullLoader)\n</code></pre>\n<p>or </p>\n<p>2 ) You can have cfg in your script like everyone doing in their notebook here. you will find that in one of the public book. have a look. </p>\n<p>or</p>\n<p>3) You can put it as a dataset and call that file. </p>",
      "votes": null,
      "replies": [
        {
          "id": 998711,
          "author_name": "pallaviroyal",
          "author_url": "",
          "post_date": "09/05/2020 01:55:23",
          "content": "<p><a href=\"https://www.kaggle.com/deepakrajpurushothaman\" target=\"_blank\">@deepakrajpurushothaman</a> Thanks for your time. I did the second option that you provided.</p>\n<ul>\n<li>Created \"configuration\" script file<ul>\n<li>New notebook &gt; script &gt; named script  file as \"configuration\".</li>\n<li>Written \"cfg\" dict object as below (for example). Reference : Just went through the <a href=\"https://github.com/lyft/l5kit/blob/master/l5kit/l5kit/configs/config.py\" target=\"_blank\">l5kit</a> and saw that cfg object is just dict with required values. So created dict object in script file.</li>\n<li>file &gt; set as utility script</li>\n<li>save and commit as we do usually for notebooks</li></ul></li>\n</ul>\n<pre><code>   cfg = {\n    \"train_path\":\"scenes/train.zarr\"\n     }\n</code></pre>\n<ul>\n<li>Uploaded script in my actual notebook<ul>\n<li>file &gt; add utility script &gt; selected \"configuration\" script file which I created</li>\n<li>Then imported \"configuration\"  as below. Works fine.</li></ul></li>\n</ul>\n<pre><code>import configuration\nprint(configuration.cfg)\n</code></pre>",
          "votes": null,
          "replies": []
        },
        {
          "id": 998766,
          "author_name": "deepakrajpurushothaman",
          "author_url": "",
          "post_date": "09/05/2020 03:59:11",
          "content": "<p><a href=\"https://www.kaggle.com/pallaviroyal\" target=\"_blank\">@pallaviroyal</a> you found yourself a 4th method. If it works why not. 👍</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 998773,
          "author_name": "pallaviroyal",
          "author_url": "",
          "post_date": "09/05/2020 04:12:58",
          "content": "<p><a href=\"https://www.kaggle.com/deepakrajpurushothaman\" target=\"_blank\">@deepakrajpurushothaman</a> Here is the script. But felt better to have \"cfg\" object creation in my actual notebook itself. Because whenever I am changing configuration I have to get a new version of the script file to the notebook. Sometimes notebook not getting update properly with the new version script.  Utility script can be useful when we no need to change code frequently. Thanks for your response.</p>\n<pre><code>cfg = {\n    \"model_params\":{\n        \"model_architecture\":\"resnet50\",\n        \"history_num_frames\":0,\n        \"history_step_size\":1,\n        \"history_delta_time\":0.1,\n        \"future_num_frames\":50,\n        \"future_step_size\":1,\n        \"future_delta_time\":0.1  \n    },\n    \"raster_params\":{\n        \"raster_size\":[224,224],\n        \"pixel_size\":[0.5,0.5],\n        \"ego_center\":[0.25,0.5],\n        \"map_type\":\"py_semantic\",\n        \"satellite_map_key\":\"aerial_map/aerial_map.png\",\n        \"semantic_map_key\":\"semantic_map/semantic_map.pb\",\n        \"dataset_meta_key\":\"meta.json\",\n        \"filter_agents_threshold\":0.5 \n    },\n    \"train_data_loader\":{\n        \"key\":\"scenes/train.zarr\",\n        \"batch_size\":12,\n        \"shuffle\":True,\n        \"num_workers\":16     \n    },\n    \"val_data_loader\":{\n    \"key\":\"scenes/validate.zarr\",\n    \"batch_size\":12,\n    \"shuffle\":False,\n    \"num_workers\":16     \n    },\n    \"train_params\":{\n    \"checkpoint_every_n_steps\":10000,\n    \"max_num_steps\":5,\n    \"eval_every_n_steps\":10000   \n    }     \n}\n</code></pre>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "998091": "if we use [l5kit](https://github.com/lyft/l5kit), to prepare the dataset for the model, seems we need a list of configurations as **.yaml** file as mentioned in [l5kit examples ](https://github.com/lyft/l5kit/blob/master/examples/agent_motion_prediction/agent_motion_prediction.ipynb). \nKindly help me, how can we add \"agent_motion_config.yaml\" file to kaggle notebooks? or shall I go with some alternative options?",
    "998204": "Hi @pallaviroyal I think you can do it in many ways. \n1) \n```\nimport yaml\nfrom io import StringIO\ncfg: dict = yaml.load(StringIO(AGENT_MOTION_CONFIG), Loader=yaml.FullLoader)\n```\nor \n\n2 ) You can have cfg in your script like everyone doing in their notebook here. you will find that in one of the public book. have a look. \n\nor\n\n3) You can put it as a dataset and call that file.",
    "998711": "deepakrajpurushothaman Thanks for your time. I did the second option that you provided.\n- Created \"configuration\" script file\n       - New notebook > script > named script  file as \"configuration\".\n       - Written \"cfg\" dict object as below (for example). Reference : Just went through the [l5kit](https://github.com/lyft/l5kit/blob/master/l5kit/l5kit/configs/config.py) and saw that cfg object is just dict with required values. So created dict object in script file.\n       - file > set as utility script\n       - save and commit as we do usually for notebooks\n   ```\n   cfg = {\n    \"train_path\":\"scenes/train.zarr\"\n     }\n```\n    \n- Uploaded script in my actual notebook\n      - file > add utility script > selected \"configuration\" script file which I created\n      - Then imported \"configuration\"  as below. Works fine.\n```\nimport configuration\nprint(configuration.cfg)\n```",
    "998766": "pallaviroyal you found yourself a 4th method. If it works why not. 👍",
    "998773": "deepakrajpurushothaman Here is the script. But felt better to have \"cfg\" object creation in my actual notebook itself. Because whenever I am changing configuration I have to get a new version of the script file to the notebook. Sometimes notebook not getting update properly with the new version script.  Utility script can be useful when we no need to change code frequently. Thanks for your response.\n```\ncfg = {\n    \"model_params\":{\n        \"model_architecture\":\"resnet50\",\n        \"history_num_frames\":0,\n        \"history_step_size\":1,\n        \"history_delta_time\":0.1,\n        \"future_num_frames\":50,\n        \"future_step_size\":1,\n        \"future_delta_time\":0.1  \n    },\n    \"raster_params\":{\n        \"raster_size\":[224,224],\n        \"pixel_size\":[0.5,0.5],\n        \"ego_center\":[0.25,0.5],\n        \"map_type\":\"py_semantic\",\n        \"satellite_map_key\":\"aerial_map/aerial_map.png\",\n        \"semantic_map_key\":\"semantic_map/semantic_map.pb\",\n        \"dataset_meta_key\":\"meta.json\",\n        \"filter_agents_threshold\":0.5 \n    },\n    \"train_data_loader\":{\n        \"key\":\"scenes/train.zarr\",\n        \"batch_size\":12,\n        \"shuffle\":True,\n        \"num_workers\":16     \n    },\n    \"val_data_loader\":{\n    \"key\":\"scenes/validate.zarr\",\n    \"batch_size\":12,\n    \"shuffle\":False,\n    \"num_workers\":16     \n    },\n    \"train_params\":{\n    \"checkpoint_every_n_steps\":10000,\n    \"max_num_steps\":5,\n    \"eval_every_n_steps\":10000   \n    }     \n}\n```"
  },
  "source": "meta"
}