|
|
--- |
|
|
license: apache-2.0 |
|
|
datasets: |
|
|
- microsoft/orca-math-word-problems-200k |
|
|
language: |
|
|
- en |
|
|
metrics: |
|
|
- accuracy |
|
|
pipeline_tag: question-answering |
|
|
--- |
|
|
# Model Card for Finetuned Mistral-7B on Orca Math Word Problems |
|
|
|
|
|
<!-- Provide a quick summary of what the model is/does. --> |
|
|
|
|
|
Ce modèle est une version du Mistral-7B finement entraînée avec la technique QLoRA (Low-Rank Adaptation) sur le jeu de données Orca-Math Word Problems pour résoudre des problèmes mathématiques en langage naturel. |
|
|
|
|
|
## Model Details |
|
|
|
|
|
### Model Description |
|
|
|
|
|
- **Developed by:** Anthropic |
|
|
- **Model type:** Modèle de langage causal (causal language model) |
|
|
- **Language(s) (NLP):** Anglais |
|
|
- **Finetuned from model:** Mistral-7B-v0.1 de MistralAI |
|
|
- **License:** [Plus d'informations nécessaires] |
|
|
|
|
|
### Model Sources |
|
|
|
|
|
- **Repository:** https://huggingface.co/jeanflop/Mistral_Orcas_7B |
|
|
|
|
|
## Uses |
|
|
|
|
|
### Direct Use |
|
|
|
|
|
Le modèle est un modèle de langage causal entraîné sur le jeu de données Orca-Math Word Problems pour résoudre des problèmes mathématiques en langage naturel. |
|
|
|
|
|
Pour utiliser le modèle, vous pouvez charger le modèle et le tokenizer à partir des chemins locaux, puis générer une sortie avec la méthode `generate`: |
|
|
|
|
|
```python |
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer |
|
|
|
|
|
model = AutoModelForCausalLM.from_pretrained("/path/to/model") |
|
|
tokenizer = AutoTokenizer.from_pretrained("/path/to/tokenizer") |
|
|
|
|
|
prompt = "Given the coherent answer sentence to a given problem as an input sentence..." |
|
|
|
|
|
input_ids = tokenizer(prompt, return_tensors="pt").input_ids |
|
|
|
|
|
output = model.generate(input_ids, max_new_tokens=100) |
|
|
print(tokenizer.decode(output[0], skip_special_tokens=True)) |
|
|
|
|
|
Training Details |
|
|
Training Data |
|
|
Dataset: microsoft/orca-math-word-problems-200k |
|
|
Training Procedure |
|
|
Preprocessing |
|
|
|
|
|
def tokenize(prompt): |
|
|
result = tokenizer( |
|
|
prompt, |
|
|
truncation=True, |
|
|
max_length=512, |
|
|
padding="max_length", |
|
|
) |
|
|
result['labels'] = result['input_ids'].copy() |
|
|
return result |
|
|
|
|
|
def generate_and_tokenize_prompt(data_point): |
|
|
full_prompt = f"""Given the logical, mathematical, and coherent answer to a given problem as an input sentence. The entry contains all the information needed to answer the question. |
|
|
### Question |
|
|
{data_point["question"]} |
|
|
|
|
|
### Logical sentences answers |
|
|
{data_point["answer"]} |
|
|
""" |
|
|
return tokenize(full_prompt) |
|
|
|
|
|
|