badaoui HF Staff commited on
Commit
5375191
·
verified ·
1 Parent(s): 3335d4d

Update optimum_neuron_export.py

Browse files
Files changed (1) hide show
  1. optimum_neuron_export.py +2 -18
optimum_neuron_export.py CHANGED
@@ -330,25 +330,9 @@ def export_decoder_model(model_id: str, folder: str, token:str) -> Generator:
330
  model = NeuronModelForCausalLM.export(
331
  model_id=model_id, neuron_config=neuron_config,
332
  )
 
333
 
334
- yield "✅ Export/compilation completed successfully."
335
-
336
- # Find the newly created cache artifacts
337
- yield "🔍 Locating compiled artifacts in Neuron cache..."
338
- cache_artifact_dir = find_neuron_cache_artifacts()
339
-
340
- if not cache_artifact_dir:
341
- raise Exception("❌ Could not find compiled artifacts in Neuron cache")
342
-
343
- yield f"📂 Found artifacts at: {cache_artifact_dir}"
344
-
345
- # Copy artifacts from cache to our target folder
346
- yield f"📋 Copying artifacts to export folder..."
347
- if os.path.exists(folder):
348
- shutil.rmtree(folder)
349
- shutil.copytree(cache_artifact_dir, folder)
350
-
351
- yield f"✅ Artifacts successfully copied to {folder}"
352
 
353
  except Exception as e:
354
  yield f"❌ Export failed with error: {e}"
 
330
  model = NeuronModelForCausalLM.export(
331
  model_id=model_id, neuron_config=neuron_config,
332
  )
333
+ model.save_pretrained(folder)
334
 
335
+ yield f"✅ Decoder model export completed. Files saved to {folder}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
 
337
  except Exception as e:
338
  yield f"❌ Export failed with error: {e}"