title: Load LightGBM model from string or buffer
body: <p>I would like to load a LightGBM model from a string or buffer rather than a file on disk.</p>
  
  <p>It seems that there is a method called <code>model_from_string</code> <a href="https://lightgbm.readthedocs.io/en/latest/Python-API.html#lightgbm.Booster.model_from_string" rel="nofollow noreferrer">documentation link</a> but ... it produces an error, which seemingly defeats the purpose of the method as I understand it.</p>
  
  <pre><code>import boto3
  import lightgbm as lgb
  import io
  
  model_path = 'some/path/here'
  s3_bucket = boto3.resource('s3').Bucket('some-bucket')
  
  obj = s3_bucket.Object(model_path)
  buf = io.BytesIO()
  try:
      obj.download_fileobj(buf)
  except Exception as e:
      raise e
  else:
      model = lgb.Booster().model_from_string(buf.read().decode("UTF-8"))
  </code></pre>
  
  <p>which produces the following error....</p>
  
  <pre><code>TypeError: Need at least one training dataset or model file to create booster instance
  </code></pre>
  
  <p>Alternatively, I thought that I might be able to use the regular loading method </p>
  
  <pre><code>lgb.Booster(model_file=buf.read().decode("UTF-8"))
  </code></pre>
  
  <p>... but this also doesn't work. </p>
  
  <pre><code>FileNotFoundError: [Errno 2] No such file or directory: ''
  </code></pre>
  
  <p>Now, I realize that I can create a workaround by writing the buffer to disk, and then reading it. However, this feels very redundant and inefficient.</p>
  
  <p>Thus, my question is, how can instantiate a model to use for prediction without pointing to a an actual file on disk?</p>