Commit 7af7e8aa authored by Мазур Грета Евгеньевна's avatar Мазур Грета Евгеньевна
Browse files

obuch with cross and graphic SAVING LORA

parent 20b6e963
No related merge requests found
Showing with 32 additions and 2 deletions
+32 -2
......@@ -58,4 +58,19 @@ with torch.no_grad():
attention_mask=inputs['attention_mask'],
token_type_ids=inputs.get('token_type_ids', None) # Обработка необязательного аргумента
)
print("\nТестовый вывод:", {k: v.shape for k, v in outputs.items()})
\ No newline at end of file
print("\nТестовый вывод:", {k: v.shape for k, v in outputs.items()})
# Проверка загруженных LoRA параметров
print("\n=== Проверка LoRA ===")
lora_params = [name for name, _ in model.named_parameters() if 'lora' in name]
if lora_params:
print(f"✅ LoRA загружено! Найдено {len(lora_params)} параметров")
print("Примеры параметров:", lora_params[:4])
else:
print("❌ LoRA не загружено!")
# Проверка влияния LoRA
base_output = base_model(**inputs) # Без LoRA
lora_output = model.bert(**inputs) # С LoRA
diff = (lora_output.last_hidden_state - base_output.last_hidden_state).abs().mean()
print(f"\nСреднее изменение выхода BERT (должно быть >0): {diff.item():.4f}")
\ No newline at end of file
......@@ -58,4 +58,19 @@ with torch.no_grad():
attention_mask=inputs['attention_mask'],
token_type_ids=inputs.get('token_type_ids', None) # Обработка необязательного аргумента
)
print("\nТестовый вывод:", {k: v.shape for k, v in outputs.items()})
\ No newline at end of file
print("\nТестовый вывод:", {k: v.shape for k, v in outputs.items()})
# Проверка загруженных LoRA параметров
print("\n=== Проверка LoRA ===")
lora_params = [name for name, _ in model.named_parameters() if 'lora' in name]
if lora_params:
print(f"✅ LoRA загружено! Найдено {len(lora_params)} параметров")
print("Примеры параметров:", lora_params[:4])
else:
print("❌ LoRA не загружено!")
# Проверка влияния LoRA
base_output = base_model(**inputs) # Без LoRA
lora_output = model.bert(**inputs) # С LoRA
diff = (lora_output.last_hidden_state - base_output.last_hidden_state).abs().mean()
print(f"\nСреднее изменение выхода BERT (должно быть >0): {diff.item():.4f}")
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment