@@ -98,8 +98,11 @@ def which_shapes(
9898 """
9999 try :
100100 shapes = self .valid_compute_shapes (compartment_id = request .compartment_id )
101+ # data, model_name = self._get_model_config_and_name(
102+ # model_id=request.model_id, compartment_id=request.compartment_id
103+ # )
101104 data , model_name = self ._get_model_config_and_name (
102- model_id = request .model_id , compartment_id = request . compartment_id
105+ model_id = request .model_id ,
103106 )
104107 llm_config = LLMConfig .from_raw_config (data )
105108 shape_recommendation_report = self ._summarize_shapes_for_seq_lens (
@@ -131,7 +134,8 @@ def which_shapes(
131134 return shape_recommendation_report
132135
133136 def _get_model_config_and_name (
134- self , model_id : str , compartment_id : Optional [str ]
137+ self ,
138+ model_id : str ,
135139 ) -> Tuple [Dict , str ]:
136140 """
137141 Loads model configuration by trying OCID logic first, then falling back
@@ -141,8 +145,8 @@ def _get_model_config_and_name(
141145 ----------
142146 model_id : str
143147 The model OCID or Hugging Face model ID.
144- compartment_id : Optional[str]
145- The compartment OCID, used for searching the model catalog.
148+ # compartment_id : Optional[str]
149+ # The compartment OCID, used for searching the model catalog.
146150
147151 Returns
148152 -------
@@ -159,32 +163,32 @@ def _get_model_config_and_name(
159163 logger .info (
160164 f"'{ model_id } ' is not an OCID, treating as a Hugging Face model ID."
161165 )
162- if not compartment_id :
163- compartment_id = os .environ .get (
164- "NB_SESSION_COMPARTMENT_OCID"
165- ) or os .environ .get ("PROJECT_COMPARTMENT_OCID" )
166- if compartment_id :
167- logger .info (f"Using compartment_id from environment: { compartment_id } " )
168- if not compartment_id :
169- raise AquaValueError (
170- "A compartment OCID is required to list available shapes. "
171- "Please provide it as a parameter or set the 'NB_SESSION_COMPARTMENT_OCID' "
172- "or 'PROJECT_COMPARTMENT_OCID' environment variable."
173- "cli command: export NB_SESSION_COMPARTMENT_OCID=<NB_SESSION_COMPARTMENT_OCID>"
174- )
175-
176- ds_model = self ._search_model_in_catalog (model_id , compartment_id )
177- if ds_model :
178- logger .info ("Loading configuration from existing model catalog artifact." )
179- try :
180- return (
181- self ._get_model_config (ds_model ),
182- ds_model .display_name ,
183- )
184- except AquaFileNotFoundError :
185- logger .warning (
186- "config.json not found in artifact, fetching from Hugging Face Hub."
187- )
166+ # if not compartment_id:
167+ # compartment_id = os.environ.get(
168+ # "NB_SESSION_COMPARTMENT_OCID"
169+ # ) or os.environ.get("PROJECT_COMPARTMENT_OCID")
170+ # if compartment_id:
171+ # logger.info(f"Using compartment_id from environment: {compartment_id}")
172+ # if not compartment_id:
173+ # raise AquaValueError(
174+ # "A compartment OCID is required to list available shapes. "
175+ # "Please provide it as a parameter or set the 'NB_SESSION_COMPARTMENT_OCID' "
176+ # "or 'PROJECT_COMPARTMENT_OCID' environment variable."
177+ # "cli command: export NB_SESSION_COMPARTMENT_OCID=<NB_SESSION_COMPARTMENT_OCID>"
178+ # )
179+
180+ # ds_model = self._search_model_in_catalog(model_id, compartment_id)
181+ # if ds_model:
182+ # logger.info("Loading configuration from existing model catalog artifact.")
183+ # try:
184+ # return (
185+ # self._get_model_config(ds_model),
186+ # ds_model.display_name,
187+ # )
188+ # except AquaFileNotFoundError:
189+ # logger.warning(
190+ # "config.json not found in artifact, fetching from Hugging Face Hub."
191+ # )
188192
189193 return self ._fetch_hf_config (model_id ), model_id
190194
@@ -210,26 +214,26 @@ def _fetch_hf_config(self, model_id: str) -> Dict:
210214 f"Failed to download config for '{ model_id } ': { e } "
211215 ) from e
212216
213- def _search_model_in_catalog (
214- self , model_id : str , compartment_id : str
215- ) -> Optional [DataScienceModel ]:
216- """
217- Searches for a model in the Data Science catalog by its display name.
218- """
219- try :
220- models = DataScienceModel .list (
221- compartment_id = compartment_id , display_name = model_id
222- )
223- if len (models ) > 1 :
224- logger .warning (
225- f"Found multiple models with the name '{ model_id } '. Using the first one found."
226- )
227- if models :
228- logger .info (f"Found model '{ model_id } ' in the Data Science catalog." )
229- return models [0 ]
230- except Exception as e :
231- logger .warning (f"Could not search for model '{ model_id } ' in catalog: { e } " )
232- return None
217+ # def _search_model_in_catalog(
218+ # self, model_id: str, compartment_id: str
219+ # ) -> Optional[DataScienceModel]:
220+ # """
221+ # Searches for a model in the Data Science catalog by its display name.
222+ # """
223+ # try:
224+ # models = DataScienceModel.list(
225+ # compartment_id=compartment_id, display_name=model_id
226+ # )
227+ # if len(models) > 1:
228+ # logger.warning(
229+ # f"Found multiple models with the name '{model_id}'. Using the first one found."
230+ # )
231+ # if models:
232+ # logger.info(f"Found model '{model_id}' in the Data Science catalog.")
233+ # return models[0]
234+ # except Exception as e:
235+ # logger.warning(f"Could not search for model '{model_id}' in catalog: {e}")
236+ # return None
233237
234238 def valid_compute_shapes (
235239 self , compartment_id : Optional [str ] = None
0 commit comments