commit 6839d2658aebb6dcbff5e358ab3a45af3cd75d15 Author: ModelHub XC Date: Fri Jul 3 17:06:26 2026 +0800 初始化项目,由ModelHub XC社区提供模型 Model: raicrits/Hermes7b_ITA Source: Original Platform diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..cfb3ae7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,36 @@ +*.7z filter=lfs diff=lfs merge=lfs -text +*.arrow filter=lfs diff=lfs merge=lfs -text +*.bin filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.ckpt filter=lfs diff=lfs merge=lfs -text +*.ftz filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.h5 filter=lfs diff=lfs merge=lfs -text +*.joblib filter=lfs diff=lfs merge=lfs -text +*.lfs.* filter=lfs diff=lfs merge=lfs -text +*.mlmodel filter=lfs diff=lfs merge=lfs -text +*.model filter=lfs diff=lfs merge=lfs -text +*.msgpack filter=lfs diff=lfs merge=lfs -text +*.npy filter=lfs diff=lfs merge=lfs -text +*.npz filter=lfs diff=lfs merge=lfs -text +*.onnx filter=lfs diff=lfs merge=lfs -text +*.ot filter=lfs diff=lfs merge=lfs -text +*.parquet filter=lfs diff=lfs merge=lfs -text +*.pb filter=lfs diff=lfs merge=lfs -text +*.pickle filter=lfs diff=lfs merge=lfs -text +*.pkl filter=lfs diff=lfs merge=lfs -text +*.pt filter=lfs diff=lfs merge=lfs -text +*.pth filter=lfs diff=lfs merge=lfs -text +*.rar filter=lfs diff=lfs merge=lfs -text +*.safetensors filter=lfs diff=lfs merge=lfs -text +saved_model/**/* filter=lfs diff=lfs merge=lfs -text +*.tar.* filter=lfs diff=lfs merge=lfs -text +*.tar filter=lfs diff=lfs merge=lfs -text +*.tflite filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.wasm filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text +*.json filter=lfs diff=lfs merge=lfs -text +*tfevents* filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md new file mode 100644 index 0000000..a22ab4c --- /dev/null +++ b/README.md @@ -0,0 +1,156 @@ +--- +license: other +datasets: +- raicrits/Orca_ITA_200k +language: +- it +pipeline_tag: text-generation +tags: +- LLM +- Italian +- Orca +- Hermes +- LLama2 +library_name: transformers +--- + + +# Model Card for Model raicrits/Hermes7b_ITA + + +An open-source LLaMa2 language model of 7b parameters fine-tuned (using as base model [NousResearch/Nous-Hermes-llama-2-7b](https://huggingface.co/NousResearch/Nous-Hermes-llama-2-7b)) to follow instructions in italian. + +### Model Description + +This model is a LLM of 7b parameters based on [NousResearch/Nous-Hermes-llama-2-7b](https://huggingface.co/NousResearch/Nous-Hermes-llama-2-7b), a version of [meta-llama/Llama-2-7b](https://huggingface.co/meta-llama/Llama-2-7b) fine-tuned to follow instructions. +The model was further fine-tuned in order to follow instructions in italian, using [LoRA](https://arxiv.org/abs/2106.09685) approach and a dataset of 120k random pairs of instruction/answer from [raicrits/Orca_ITA_200k](https://huggingface.co/datasets/raicrits/Orca_ITA_200k). + +This repository contains the model weights merged with the LoRA adapters obtained in the fine-tuning procedure. + + +- **Developed by:** Stefano Scotta (stefano.scotta@rai.it) +- **Model type:** LLM fine-tuned to follow instructions +- **Language(s) (NLP):** Italian +- **License:** Other +- **Finetuned from model:** [NousResearch/Nous-Hermes-llama-2-7b](https://huggingface.co/NousResearch/Nous-Hermes-llama-2-7b) + +## Uses + + +The model can be used as is to respond to simple instructions in Italian or can be further fine-tuned to perform specific tasks. + + + +## Bias, Risks, and Limitations + + +As any other LLM it is possible that the model generates content which does not correspond to the reality as well as wrong, biased, offensive and inappropriate answers. + + +## How to Get Started with the Model + **Prompt template:** + + ``` python +"""### Instruction: {instruction} + +### Response: +""" +``` + + **Usage:** +Use the code below to get started with the model. + ``` python +import os +import torch +import sys +from transformers import LlamaForCausalLM, AutoTokenizer + + +def generate_prompt_test(instruction): + prompt = f"""### Instruction: {instruction} + +### Response: +""" + return prompt + +model_name = "raicrits/Hermes7b_ITA" + +model = LlamaForCausalLM.from_pretrained( + model_name, + device_map="auto", + torch_dtype=torch.bfloat16 +) + +model.config.use_cache = True + + +tokenizer = AutoTokenizer.from_pretrained(model_name, add_eos_token=False) + +prompt = generate_prompt_test("Cosa puoi dirmi sul dio Hermes?") +inputs = tokenizer(prompt, return_tensors="pt").to("cuda") + +outputs = model.generate(**inputs, do_sample = True, num_beams = 2, top_k=50, top_p= 0.95, max_new_tokens=256, early_stopping = True) +print(tokenizer.decode(outputs[0], skip_special_tokens=True).split("Response:")[1].strip()) +``` +``` python +"""Hermes è un dio dell'antica Grecia. Era il dio del commercio, della comunicazione e del trasporto. Era anche il dio della mente e della intelligenza. Era noto per il suo eloquente linguaggio e la sua capacità di spostarsi velocemente. Era considerato il messaggero degli dèi e spesso veniva raffigurato con un cappello di pelle di capra e sandali.""" +``` + +## Training Details + +### Training Data + + +The model was fine-tuned on 120k random records of [raicrits/Orca_ITA_200k](https://huggingface.co/datasets/raicrits/Orca_ITA_200k). + + +### Training Procedure + + +The fine-tuning procedure was done using [LoRA](https://arxiv.org/abs/2106.09685) approach. + + +#### Training Hyperparameters + + **Training setting:** +- train epochs=3, + +- learning_rate=2e-4, + +- mixed precision training: float16 + + + **LoRA configuration:** +- r= 8 + +- lora_alpha=16 + +- target_modules=["q_proj","v_proj"] + +- lora_dropout=0.05 + +- bias="none" + +- task_type=TaskType.CAUSAL_LM + + +## Environmental Impact + + + +Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700). + +- **Hardware Type:** 1 NVIDIA A100/40Gb +- **Hours used:** 78 +- **Cloud Provider:** Private Infrastructure +- **Carbon Emitted:** 8.42 kg eq. CO2 + + + +## Model Card Authors + +Stefano Scotta (stefano.scotta@rai.it) + +## Model Card Contact + +stefano.scotta@rai.it \ No newline at end of file diff --git a/added_tokens.json b/added_tokens.json new file mode 100644 index 0000000..a370135 --- /dev/null +++ b/added_tokens.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:39c257654f85e478a9cb3bf34da53b3e4625e7b05ce15f193fe41724fae7b825 +size 21 diff --git a/config.json b/config.json new file mode 100644 index 0000000..da90913 --- /dev/null +++ b/config.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9da6b44e4b7669ad6921bea895d325d0129aae2c302878d74008298c80c0bf64 +size 632 diff --git a/generation_config.json b/generation_config.json new file mode 100644 index 0000000..b4550c2 --- /dev/null +++ b/generation_config.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aafefd31f8318d48737aedf85ce4f0fe198d1762ef76729cab5e52af0fcd60dd +size 137 diff --git a/pytorch_model-00001-of-00002.bin b/pytorch_model-00001-of-00002.bin new file mode 100644 index 0000000..6e866ab --- /dev/null +++ b/pytorch_model-00001-of-00002.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b06208bc9be81ed642fd9288e5c6e30786cd4040ccab548cc28d39deea00d742 +size 9976623130 diff --git a/pytorch_model-00002-of-00002.bin b/pytorch_model-00002-of-00002.bin new file mode 100644 index 0000000..e52dc0f --- /dev/null +++ b/pytorch_model-00002-of-00002.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:12975bf6699eca213be33c60df8bd672c13b7ac87e37a52e2378fab057c2c4f1 +size 3500311811 diff --git a/pytorch_model.bin.index.json b/pytorch_model.bin.index.json new file mode 100644 index 0000000..9902e1a --- /dev/null +++ b/pytorch_model.bin.index.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e572e08c4d4e81c7916197f6fcd2956a2f05e5919f28d72c9ba4f351efae1e29 +size 23950 diff --git a/special_tokens_map.json b/special_tokens_map.json new file mode 100644 index 0000000..fd7382d --- /dev/null +++ b/special_tokens_map.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ea88203b955648951a454e73a73967ff77ba4e79ae8ceb4400d4ab2cb040777 +size 435 diff --git a/tokenizer.json b/tokenizer.json new file mode 100644 index 0000000..639ec96 --- /dev/null +++ b/tokenizer.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00d8eea2ddc7b5c0b5ef59371b00dd90092ef11283e8561a8536ae5846c55507 +size 1842946 diff --git a/tokenizer.model b/tokenizer.model new file mode 100644 index 0000000..6c00c74 --- /dev/null +++ b/tokenizer.model @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347 +size 499723 diff --git a/tokenizer_config.json b/tokenizer_config.json new file mode 100644 index 0000000..521e133 --- /dev/null +++ b/tokenizer_config.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e2fd34ce7555fe5a4e5f73f2f8cdda9fa37c4d09dd01cf1e2cf3040b7f6fe266 +size 695