Repository: wandb/wandb

Issue:
Cannot log a slice as config parameter
`wandb --version && python --version && uname`

* Weights and Biases version: 0.8.31
* Python version: 3.8.1
* Operating System: Linux

### Description

I cannot log a slice as config parameter.

### What I Did

```python
import wandb
wandb.init()
wandb.config.update({'test':slice(5)})
```

Error

```python
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/boris/.local/share/virtualenvs/fastai2-MNobJKnX/lib/python3.8/site-packages/wandb/wandb_config.py", line 301, in update
    self._update(params,
  File "/home/boris/.local/share/virtualenvs/fastai2-MNobJKnX/lib/python3.8/site-packages/wandb/wandb_config.py", line 298, in _update
    self.persist()
  File "/home/boris/.local/share/virtualenvs/fastai2-MNobJKnX/lib/python3.8/site-packages/wandb/wandb_config.py", line 206, in persist
    conf_file.write(str(self))
  File "/home/boris/.local/share/virtualenvs/fastai2-MNobJKnX/lib/python3.8/site-packages/wandb/wandb_config.py", line 338, in __str__
    s += b'\n\n' + yaml.dump(as_dict, Dumper=yaml.SafeDumper, default_flow_style=False,
  File "/home/boris/.local/share/virtualenvs/fastai2-MNobJKnX/lib/python3.8/site-packages/yaml/__init__.py", line 290, in dump
    return dump_all([data], stream, Dumper=Dumper, **kwds)
  File "/home/boris/.local/share/virtualenvs/fastai2-MNobJKnX/lib/python3.8/site-packages/yaml/__init__.py", line 278, in dump_all
    dumper.represent(data)
  File "/home/boris/.local/share/virtualenvs/fastai2-MNobJKnX/lib/python3.8/site-packages/yaml/representer.py", line 27, in represent
    node = self.represent_data(data)
  File "/home/boris/.local/share/virtualenvs/fastai2-MNobJKnX/lib/python3.8/site-packages/yaml/representer.py", line 48, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "/home/boris/.local/share/virtualenvs/fastai2-MNobJKnX/lib/python3.8/site-packages/yaml/representer.py", line 207, in represent_dict
    return self.represent_mapping('tag:yaml.org,2002:map', data)
  File "/home/boris/.local/share/virtualenvs/fastai2-MNobJKnX/lib/python3.8/site-packages/yaml/representer.py", line 118, in represent_mapping
    node_value = self.represent_data(item_value)
  File "/home/boris/.local/share/virtualenvs/fastai2-MNobJKnX/lib/python3.8/site-packages/yaml/representer.py", line 48, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "/home/boris/.local/share/virtualenvs/fastai2-MNobJKnX/lib/python3.8/site-packages/yaml/representer.py", line 207, in represent_dict
    return self.represent_mapping('tag:yaml.org,2002:map', data)
  File "/home/boris/.local/share/virtualenvs/fastai2-MNobJKnX/lib/python3.8/site-packages/yaml/representer.py", line 118, in represent_mapping
    node_value = self.represent_data(item_value)
  File "/home/boris/.local/share/virtualenvs/fastai2-MNobJKnX/lib/python3.8/site-packages/yaml/representer.py", line 58, in represent_data
    node = self.yaml_representers[None](self, data)
  File "/home/boris/.local/share/virtualenvs/fastai2-MNobJKnX/lib/python3.8/site-packages/yaml/representer.py", line 231, in represent_undefined
    raise RepresenterError("cannot represent an object", data)
yaml.representer.RepresenterError: ('cannot represent an object', slice(None, 5, None))
```


Discussion:

Resolving patch:
diff --git a/wandb/wandb_config.py b/wandb/wandb_config.py
--- a/wandb/wandb_config.py
+++ b/wandb/wandb_config.py
@@ -240,6 +240,9 @@ def _sanitize_val(self, val):
             for key, value in six.iteritems(val):
                 converted[key] = self._sanitize_val(value)
             return converted
+        if isinstance(val, slice):
+            converted = dict(slice_start=val.start, slice_step=val.step, slice_stop=val.stop)
+            return converted
         val, _ = wandb.util.json_friendly(val)
         if isinstance(val, Sequence) and not isinstance(val, six.string_types):
             converted = []


Test patch: