# Model Card for Model ID

<!-- Provide a quick summary of what the model is/does. -->

## Model Details

### Model Description

<!-- Provide a longer summary of what this model is. -->
Cicero italian legal assistant version 2. Based upon Phi1.5, fine-tuned with 1.5GB of italian civil judgements.

- **Developed by:** Marco Calamo, Francesca De Luzi, Mattia Macrì, Tommaso Mencattini, Massimo Mecella
- **Model type:** Phi1.5
- **Language (NLP):** Italian
- **License:** Apache 2.0

### Model Sources

<!-- Provide the basic links for the model. -->

- **Repository:** [Github](https://github.com/DIAG-Sapienza-BPM-Smart-Spaces/Cicero.git)
- **Paper:** Under review

## Uses

<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
Use Cicero to autocomplete sentences in a legal italian context.

## How to Get Started with the Model

Use the code below to get started with the model.

```python
from transformers import  AutoModelForCausalLM, AutoTokenizer 
import torch

model =  AutoModelForCausalLM.from_pretrained("DIAG-PSSeng/cicero_v2-phi1.5", trust_remote_code=True ,torch_dtype=torch.float16).to("cuda")

tokenizer = AutoTokenizer.from_pretrained("DIAG-PSSeng/cicero_v2-phi1.5", trust_remote_code=True)

def generate_text(model, tokenizer, prompt, length=50, do_sample=True):
    inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
    gen_tokens = model.generate(**inputs,do_sample=True,temperature=0.9, min_length=length,max_length=length)
    generated_text = tokenizer.batch_decode(gen_tokens)
    return generated_text

print(generate_text(model=model, tokenizer=tokenizer, prompt="Con ricorso del"))

```


## Citation

<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->

**BibTeX:** Under review

{"language": ["it"], "license": "apache-2.0", "tags": ["legal"]}
transformers safetensors phi text-generation legal custom_code it license:apache-2.0 autotrain_compatible endpoints_compatible region:us