Skip to content
Snippets Groups Projects
Commit da663622 authored by jbreton's avatar jbreton
Browse files

perform legal bert

parent 33fbe197
No related branches found
No related tags found
No related merge requests found
...@@ -176,6 +176,10 @@ models/CamemBERT-base/* ...@@ -176,6 +176,10 @@ models/CamemBERT-base/*
!models/CamemBERT-base/.gitkeep !models/CamemBERT-base/.gitkeep
models/Fine-tuned_CamemBERT-base/* models/Fine-tuned_CamemBERT-base/*
!models/Fine-tuned_CamemBERT-base/.gitkeep !models/Fine-tuned_CamemBERT-base/.gitkeep
models/LegalCamemBERT-base/*
!models/LegalCamemBERT-base/.gitkeep
models/Fine-tuned_LegalCamemBERT-base/*
!models/Fine-tuned_LegalCamemBERT-base/.gitkeep
modules/llm/Mixtral-8x7b/results/* modules/llm/Mixtral-8x7b/results/*
modules/llm/Mixtral-8x7b/.lock_preprocessing modules/llm/Mixtral-8x7b/.lock_preprocessing
......
...@@ -3,4 +3,5 @@ from huggingface_hub import snapshot_download ...@@ -3,4 +3,5 @@ from huggingface_hub import snapshot_download
#snapshot_download(repo_id="mistralai/Mixtral-8x7B-Instruct-v0.1", cache_dir="../temp", local_dir="./Mixtral-8x7B-Instruct-v0.1") #snapshot_download(repo_id="mistralai/Mixtral-8x7B-Instruct-v0.1", cache_dir="../temp", local_dir="./Mixtral-8x7B-Instruct-v0.1")
#snapshot_download(repo_id="mistralai/Mistral-7B-Instruct-v0.2", cache_dir="../temp", local_dir="./Mistral-7B-Instruct-v0.2") #snapshot_download(repo_id="mistralai/Mistral-7B-Instruct-v0.2", cache_dir="../temp", local_dir="./Mistral-7B-Instruct-v0.2")
#snapshot_download(repo_id="152334H/miqu-1-70b-sf", cache_dir="../temp", local_dir="./Miqu-1-70b") #snapshot_download(repo_id="152334H/miqu-1-70b-sf", cache_dir="../temp", local_dir="./Miqu-1-70b")
snapshot_download(repo_id="camembert/camembert-base", cache_dir="../temp", local_dir="./CamemBERT-base") #snapshot_download(repo_id="camembert/camembert-base", cache_dir="../temp", local_dir="./CamemBERT-base")
\ No newline at end of file snapshot_download(repo_id="maastrichtlawtech/legal-camembert-base", cache_dir="../temp", local_dir="./LegalCamemBERT-base")
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
results/BERT/legal_bert.png

31.3 KiB

File moved
%% Cell type:code id:c1616f9091e76aaf tags:
``` python
import matplotlib.pyplot as plt
import numpy as np
# Données d'exemple
categories = ['Cat1', 'Cat2', 'Cat3', 'Cat4', 'Cat5'] # Exemples de catégories
metrics = ['Rappel', 'Précision', 'F-mesure']
n_metrics = len(metrics)
# Générer des performances aléatoires pour le système 1
performance_système_1 = np.random.uniform(0.6, 0.8, size=(len(categories), n_metrics))
# Générer des améliorations ou dégradations aléatoires
amélioration_dégradation = np.random.uniform(-0.1, 0.1, size=(len(categories), n_metrics))
# Calculer les nouvelles performances
performance_système_2 = performance_système_1 + amélioration_dégradation
# Créer le barplot
fig, ax = plt.subplots(figsize=(15, 8))
bar_width = 0.25
index = np.arange(len(categories))
# Couleurs pour les barres en fonction de l'amélioration ou de la dégradation
colors = [['green' if diff > 0 else 'red' for diff in cat_diff] for cat_diff in amélioration_dégradation]
# Tracer les barres pour chaque métrique
for i, metric in enumerate(metrics):
bars1 = ax.bar(index + i * bar_width, performance_système_1[:, i], bar_width, label=f'{metric}', alpha=0.7, color='lightgray')
bars2 = ax.bar(index + i * bar_width, amélioration_dégradation[:, i], bar_width, bottom=performance_système_1[:, i], color=[colors[j][i] for j in range(len(categories))], alpha=0.7)
# Ajouter les valeurs sur les barres du système 1
for bar1, perf1 in zip(bars1, performance_système_1[:, i]):
height = bar1.get_height()
ax.annotate(f'{perf1:.2f}',
xy=(bar1.get_x() + bar1.get_width() / 2, height),
xytext=(0, 3), # 3 points de décalage vertical
textcoords="offset points",
ha='center', va='bottom', color='blue')
# Ajouter les valeurs sur les barres du système 2
for bar1, bar2, perf1, diff in zip(bars1, bars2, performance_système_1[:, i], amélioration_dégradation[:, i]):
height = bar1.get_height() + bar2.get_height()
ax.annotate(f'{perf1 + diff:.2f}',
xy=(bar2.get_x() + bar2.get_width() / 2, height),
xytext=(0, 3), # 3 points de décalage vertical
textcoords="offset points",
ha='center', va='bottom', color='black')
# Ajouter des labels et une légende
ax.set_xlabel('Catégories')
ax.set_ylabel('Performance')
ax.set_title('Performance du Système avec Améliorations/Dégradations')
ax.set_xticks(index + bar_width)
ax.set_xticklabels(categories)
ax.legend()
# Afficher le graphique
plt.show()
```
%% Output
---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
Cell In[12], line 16
13 amélioration_dégradation = np.random.uniform(-0.1, 0.1, size=(len(categories), n_metrics))
15 # Calculer les nouvelles performances
---> 16 performance_système_2 = performance_système_1 + amélioration_dégradation
18 # Créer le barplot
19 fig, ax = plt.subplots(figsize=(15, 8))
File _pydevd_bundle\\pydevd_cython_win32_311_64.pyx:1187, in _pydevd_bundle.pydevd_cython_win32_311_64.SafeCallWrapper.__call__()
File _pydevd_bundle\\pydevd_cython_win32_311_64.pyx:627, in _pydevd_bundle.pydevd_cython_win32_311_64.PyDBFrame.trace_dispatch()
File _pydevd_bundle\\pydevd_cython_win32_311_64.pyx:937, in _pydevd_bundle.pydevd_cython_win32_311_64.PyDBFrame.trace_dispatch()
File _pydevd_bundle\\pydevd_cython_win32_311_64.pyx:928, in _pydevd_bundle.pydevd_cython_win32_311_64.PyDBFrame.trace_dispatch()
File _pydevd_bundle\\pydevd_cython_win32_311_64.pyx:585, in _pydevd_bundle.pydevd_cython_win32_311_64.PyDBFrame.do_wait_suspend()
File C:\Program Files\JetBrains\DataSpell 2023.1.2\plugins\python-ce\helpers\pydev\pydevd.py:1185, in PyDB.do_wait_suspend(self, thread, frame, event, arg, send_suspend_message, is_unhandled_exception)
1182 from_this_thread.append(frame_id)
1184 with self._threads_suspended_single_notification.notify_thread_suspended(thread_id, stop_reason):
-> 1185 self._do_wait_suspend(thread, frame, event, arg, suspend_type, from_this_thread)
File C:\Program Files\JetBrains\DataSpell 2023.1.2\plugins\python-ce\helpers\pydev\pydevd.py:1200, in PyDB._do_wait_suspend(self, thread, frame, event, arg, suspend_type, from_this_thread)
1197 self._call_mpl_hook()
1199 self.process_internal_commands()
-> 1200 time.sleep(0.01)
1202 self.cancel_async_evaluation(get_current_thread_id(thread), str(id(frame)))
1204 # process any stepping instructions
KeyboardInterrupt:
%% Cell type:code id:c7044d0f9235b5c tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment