Skip to content
This repository was archived by the owner on Feb 20, 2024. It is now read-only.

Commit a9532ec

Browse files
committed
Hide Rafiki-internal advisor methods from client; fix typos in docs
1 parent 88f0e32 commit a9532ec

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

rafiki/client/client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def create_model(self, name, task, model_file_path, model_class, dependencies={}
168168
:param str name: Name of the model, which must be unique across all models added by the current user
169169
:param str task: Task associated with the model, where the model must adhere to the specification of the task
170170
:param str model_file_path: Path to a single Python file that contains the definition for the model class
171-
:param obj model_class: The name of the model class inside the Python file. This class should implement :class:`rafiki.model.BaseModel`
171+
:param str model_class: The name of the model class inside the Python file. This class should implement :class:`rafiki.model.BaseModel`
172172
:param dependencies: List of dependencies & their versions
173173
:type dependencies: dict[str, str]
174174
:param access_right: Model access right
@@ -188,7 +188,7 @@ def create_model(self, name, task, model_file_path, model_class, dependencies={}
188188
``<dependency_name>`` corresponds to the name of the Python Package Index (PyPI) package (e.g. ``tensorflow``)
189189
and ``<dependency_version>`` corresponds to the version of the PyPI package (e.g. ``1.12.0``). These dependencies
190190
will be lazily installed on top of the worker's Docker image before the submitted model's code is executed.
191-
If the model is to be run on GPU, Rafiki would map dependencies to their GPU-supported versions, if required.
191+
If the model is to be run on GPU, Rafiki would map dependencies to their GPU-supported versions, if supported.
192192
For example, ``{ 'tensorflow': '1.12.0' }`` will be installed as ``{ 'tensorflow-gpu': '1.12.0' }``.
193193
Rafiki could also parse specific dependency names to install certain non-PyPI packages.
194194
For example, ``{ 'singa': '1.1.1' }`` will be installed as ``singa-cpu=1.1.1`` or ``singa-gpu=1.1.1`` using ``conda``.
@@ -583,7 +583,7 @@ def stop_inference_job(self, app, app_version=-1):
583583
# Advisors
584584
####################################
585585

586-
def create_advisor(self, knob_config_str, advisor_id=None):
586+
def _create_advisor(self, knob_config_str, advisor_id=None):
587587
'''
588588
Creates a Rafiki advisor. If `advisor_id` is passed, it will create an advisor
589589
of that ID, or do nothing if an advisor of that ID has already been created.
@@ -600,7 +600,7 @@ def create_advisor(self, knob_config_str, advisor_id=None):
600600
})
601601
return data
602602

603-
def generate_proposal(self, advisor_id):
603+
def _generate_proposal(self, advisor_id):
604604
'''
605605
Generate a proposal of knobs from an advisor.
606606
@@ -611,7 +611,7 @@ def generate_proposal(self, advisor_id):
611611
data = self._post('/advisors/{}/propose'.format(advisor_id), target='advisor')
612612
return data
613613

614-
def feedback_to_advisor(self, advisor_id, knobs, score):
614+
def _feedback_to_advisor(self, advisor_id, knobs, score):
615615
'''
616616
Feedbacks to the advisor on the score of a set of knobs.
617617
Additionally returns another proposal of knobs after ingesting feedback.
@@ -629,7 +629,7 @@ def feedback_to_advisor(self, advisor_id, knobs, score):
629629
})
630630
return data
631631

632-
def delete_advisor(self, advisor_id):
632+
def _delete_advisor(self, advisor_id):
633633
'''
634634
Deletes a Rafiki advisor.
635635

rafiki/model/knob.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def _validate_value(value):
109109

110110
class IntegerKnob(BaseKnob):
111111
'''
112-
Knob type epresenting `any` ``int`` value within a specific interval [``value_min``, ``value_max``].
112+
Knob type representing `any` ``int`` value within a specific interval [``value_min``, ``value_max``].
113113
``is_exp`` specifies whether the knob value should be scaled exponentially.
114114
'''
115115

rafiki/model/model.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def predict(self, queries):
9595
@abc.abstractmethod
9696
def dump_parameters(self):
9797
'''
98-
Return a dictionary of model parameters that fully define this model instance's trained state.
98+
Return a dictionary of model parameters that fully defines this model instance's trained state.
9999
This dictionary should be serializable by the Python's ``pickle`` module.
100100
This will be used for trained model serialization within Rafiki.
101101
This will be called only when model is *trained*.
@@ -135,9 +135,10 @@ def test_model_class(model_file_path, model_class, task, dependencies, \
135135
It is assumed that all of the model's dependencies have been installed in the current Python environment.
136136
137137
:param str model_file_path: Path to a single Python file that contains the definition for the model class
138-
:param obj model_class: The name of the model class inside the Python file. This class should implement :class:`rafiki.model.BaseModel`
138+
:param type model_class: The name of the model class inside the Python file. This class should implement :class:`rafiki.model.BaseModel`
139139
:param str task: Task type of model
140-
:param dict[str, str] dependencies: Model's dependencies
140+
:param dependencies: Model's dependencies
141+
:type dependencies: dict[str, str]
141142
:param str train_dataset_uri: URI of the train dataset for testing the training of model
142143
:param str test_dataset_uri: URI of the test dataset for testing the evaluating of model
143144
:param list[any] queries: List of queries for testing predictions with the trained model

rafiki/worker/train.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,13 @@ def _train_and_evaluate_model(self, clazz, knobs, train_dataset_uri, \
187187

188188
# Gets proposal of a set of knob values from advisor
189189
def _get_proposal_from_advisor(self, advisor_id):
190-
res = self._get_client().generate_proposal(advisor_id)
190+
res = self._get_client()._generate_proposal(advisor_id)
191191
knobs = res['knobs']
192192
return knobs
193193

194194
# Feedback result of knobs to advisor
195195
def _feedback_to_advisor(self, advisor_id, knobs, score):
196-
self._get_client().feedback_to_advisor(advisor_id, knobs, score)
196+
self._get_client()._feedback_to_advisor(advisor_id, knobs, score)
197197

198198
def _stop_sub_train_job(self):
199199
logger.warn('Stopping sub train job...')
@@ -210,14 +210,14 @@ def _create_advisor(self, clazz):
210210
knob_config_str = serialize_knob_config(knob_config)
211211

212212
# Create advisor associated with worker
213-
res = self._get_client().create_advisor(knob_config_str, advisor_id=self._service_id)
213+
res = self._get_client()._create_advisor(knob_config_str, advisor_id=self._service_id)
214214
advisor_id = res['id']
215215
return advisor_id
216216

217217
# Delete advisor
218218
def _delete_advisor(self, advisor_id):
219219
try:
220-
self._get_client().delete_advisor(advisor_id)
220+
self._get_client()._delete_advisor(advisor_id)
221221
except Exception:
222222
# Throw just a warning - not critical for advisor to be deleted
223223
logger.warning('Error while deleting advisor:')

0 commit comments

Comments
 (0)