class_docstr: A global system that helps to manage the experiments.
class_docstr_tok: ["A","global","system","that","helps","to","manage","the","experiments","."]
docstr: Method for saving objects as artifacts in the experiment to the uri. It supports either saving
  from a local file/directory, or directly saving objects. User can use valid python's keywords arguments
  to specify the object to be saved as well as its name (name: value).
  
  In summary, this API is designs for saving **objects** to **the experiments management backend path**,
  1. Qlib provide two methods to specify **objects**
  - Passing in the object directly by passing with `**kwargs` (e.g. R.save_objects(trained_model=model))
  - Passing in the local path to the object, i.e. `local_path` parameter.
  2. `artifact_path` represents the  **the experiments management backend path**
  
  - If `active recorder` exists: it will save the objects through the active recorder.
  - If `active recorder` not exists: the system will create a default experiment, and a new recorder and save objects under it.
  
  .. note::
  
      If one wants to save objects with a specific recorder. It is recommended to first get the specific recorder through `get_recorder` API and use the recorder the save objects. The supported arguments are the same as this method.
  
  Here are some use cases:
  
  .. code-block:: Python
  
      # Case 1
      with R.start(experiment_name='test'):
          pred = model.predict(dataset)
          R.save_objects(**{"pred.pkl": pred}, artifact_path='prediction')
          rid = R.get_recorder().id
      ...
      R.get_recorder(recorder_id=rid).load_object("prediction/pred.pkl")  #  after saving objects, you can load the previous object with this api
  
      # Case 2
      with R.start(experiment_name='test'):
          R.save_objects(local_path='results/pred.pkl', artifact_path="prediction")
          rid = R.get_recorder().id
      ...
      R.get_recorder(recorder_id=rid).load_object("prediction/pred.pkl")  #  after saving objects, you can load the previous object with this api
  
  
  Parameters
  ----------
  local_path : str
      if provided, them save the file or directory to the artifact URI.
  artifact_path : str
      the relative path for the artifact to be stored in the URI.
  **kwargs: Dict[Text, Any]
      the object to be saved.
      For example, `{"pred.pkl": pred}`
docstr_tok: ["Method","for","saving","objects","as","artifacts","in","the","experiment","to","the","uri",".","It","supports","either","saving","from","a","local","file\/directory",",","or","directly","saving","objects",".","User","can","use","valid","python","'s","keywords","arguments","to","specify","the","object","to","be","saved","as","well","as","its","name","(","name",":","value",")",".","In","summary",",","this","API","is","designs","for","saving","*","*","objects","*","*","to","*","*","the","experiments","management","backend","path","*","*",",","1",".","Qlib","provide","two","methods","to","specify","*","*","objects","*","*","-","Passing","in","the","object","directly","by","passing","with","`","*","*","kwargs","`","(","e.g",".","R.save_objects","(","trained_model=model",")",")","-","Passing","in","the","local","path","to","the","object",",","i.e",".","`","local_path","`","parameter",".","2",".","`","artifact_path","`","represents","the","*","*","the","experiments","management","backend","path","*","*","-","If","`","active","recorder","`","exists",":","it","will","save","the","objects","through","the","active","recorder",".","-","If","`","active","recorder","`","not","exists",":","the","system","will","create","a","default","experiment",",","and","a","new","recorder","and","save","objects","under","it",".","..","note",":",":","If","one","wants","to","save","objects","with","a","specific","recorder",".","It","is","recommended","to","first","get","the","specific","recorder","through","`","get_recorder","`","API","and","use","the","recorder","the","save","objects",".","The","supported","arguments","are","the","same","as","this","method",".","Here","are","some","use","cases",":","..","code-block",":",":","Python","#","Case","1","with","R.start","(","experiment_name='test","'",")",":","pred","=","model.predict","(","dataset",")","R.save_objects","(","*","*","{","``","pred.pkl","''",":","pred","}",",","artifact_path='prediction","'",")","rid","=","R.get_recorder","(",")",".id","...","R.get_recorder","(","recorder_id=rid",")",".load_object","(","``","prediction\/pred.pkl","''",")","#","after","saving","objects",",","you","can","load","the","previous","object","with","this","api","#","Case","2","with","R.start","(","experiment_name='test","'",")",":","R.save_objects","(","local_path='results\/pred.pkl","'",",","artifact_path=","''","prediction","''",")","rid","=","R.get_recorder","(",")",".id","...","R.get_recorder","(","recorder_id=rid",")",".load_object","(","``","prediction\/pred.pkl","''",")","#","after","saving","objects",",","you","can","load","the","previous","object","with","this","api","Parameters","--","--","--","--","--","local_path",":","str","if","provided",",","them","save","the","file","or","directory","to","the","artifact","URI",".","artifact_path",":","str","the","relative","path","for","the","artifact","to","be","stored","in","the","URI",".","*","*","kwargs",":","Dict","[","Text",",","Any","]","the","object","to","be","saved",".","For","example",",","`","{","``","pred.pkl","''",":","pred","}","`"]
code: def save_objects(
      self,
      local_path=None,
      artifact_path=None,
      **kwargs: Dict[Text, Any],
  ):
      """
      Method for saving objects as artifacts in the experiment to the uri. It supports either saving
      from a local file/directory, or directly saving objects. User can use valid python's keywords arguments
      to specify the object to be saved as well as its name (name: value).
  
      In summary, this API is designs for saving **objects** to **the experiments management backend path**,
      1. Qlib provide two methods to specify **objects**
      - Passing in the object directly by passing with `**kwargs` (e.g. R.save_objects(trained_model=model))
      - Passing in the local path to the object, i.e. `local_path` parameter.
      2. `artifact_path` represents the  **the experiments management backend path**
  
      - If `active recorder` exists: it will save the objects through the active recorder.
      - If `active recorder` not exists: the system will create a default experiment, and a new recorder and save objects under it.
  
      .. note::
  
          If one wants to save objects with a specific recorder. It is recommended to first get the specific recorder through `get_recorder` API and use the recorder the save objects. The supported arguments are the same as this method.
  
      Here are some use cases:
  
      .. code-block:: Python
  
          # Case 1
          with R.start(experiment_name='test'):
              pred = model.predict(dataset)
              R.save_objects(**{"pred.pkl": pred}, artifact_path='prediction')
              rid = R.get_recorder().id
          ...
          R.get_recorder(recorder_id=rid).load_object("prediction/pred.pkl")  #  after saving objects, you can load the previous object with this api
  
          # Case 2
          with R.start(experiment_name='test'):
              R.save_objects(local_path='results/pred.pkl', artifact_path="prediction")
              rid = R.get_recorder().id
          ...
          R.get_recorder(recorder_id=rid).load_object("prediction/pred.pkl")  #  after saving objects, you can load the previous object with this api
  
  
      Parameters
      ----------
      local_path : str
          if provided, them save the file or directory to the artifact URI.
      artifact_path : str
          the relative path for the artifact to be stored in the URI.
      **kwargs: Dict[Text, Any]
          the object to be saved.
          For example, `{"pred.pkl": pred}`
      """
      if local_path is not None and len(kwargs) > 0:
          raise ValueError(
              "You can choose only one of `local_path`(save the files in a path) or `kwargs`(pass in the objects directly)"
          )
      self.get_exp().get_recorder(start=True).save_objects(
          local_path, artifact_path, **kwargs
      )
  
imports: from contextlib import contextmanager
  from typing import Text, Optional, Any, Dict
  from .expm import ExpManager
  from .exp import Experiment
  from .recorder import Recorder
  from ..utils import Wrapper
  from ..utils.exceptions import RecorderInitializationError
  import sys
label_desc: Use image node_id 16 for calling the QlibRecorder obj's underlying member method code with example usage: obj.save_objects(local_path, artifact_path) without return types