Instructions to use DIAG-PSSeng/cicero_v2-phi1.5 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use DIAG-PSSeng/cicero_v2-phi1.5 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="DIAG-PSSeng/cicero_v2-phi1.5", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("DIAG-PSSeng/cicero_v2-phi1.5", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("DIAG-PSSeng/cicero_v2-phi1.5", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use DIAG-PSSeng/cicero_v2-phi1.5 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "DIAG-PSSeng/cicero_v2-phi1.5" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "DIAG-PSSeng/cicero_v2-phi1.5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/DIAG-PSSeng/cicero_v2-phi1.5
- SGLang
How to use DIAG-PSSeng/cicero_v2-phi1.5 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "DIAG-PSSeng/cicero_v2-phi1.5" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "DIAG-PSSeng/cicero_v2-phi1.5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "DIAG-PSSeng/cicero_v2-phi1.5" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "DIAG-PSSeng/cicero_v2-phi1.5", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use DIAG-PSSeng/cicero_v2-phi1.5 with Docker Model Runner:
docker model run hf.co/DIAG-PSSeng/cicero_v2-phi1.5
Model Card for Model ID
Model Details
Model Description
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
- Repository: Github
- Paper: Under review
Uses
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.
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
BibTeX: Under review
- Downloads last month
- 6