Instructions to use emanuelealbertosi/gpt2-it-185m-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use emanuelealbertosi/gpt2-it-185m-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="emanuelealbertosi/gpt2-it-185m-instruct")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("emanuelealbertosi/gpt2-it-185m-instruct") model = AutoModelForCausalLM.from_pretrained("emanuelealbertosi/gpt2-it-185m-instruct", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use emanuelealbertosi/gpt2-it-185m-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "emanuelealbertosi/gpt2-it-185m-instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "emanuelealbertosi/gpt2-it-185m-instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/emanuelealbertosi/gpt2-it-185m-instruct
- SGLang
How to use emanuelealbertosi/gpt2-it-185m-instruct 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 "emanuelealbertosi/gpt2-it-185m-instruct" \ --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": "emanuelealbertosi/gpt2-it-185m-instruct", "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 "emanuelealbertosi/gpt2-it-185m-instruct" \ --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": "emanuelealbertosi/gpt2-it-185m-instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use emanuelealbertosi/gpt2-it-185m-instruct with Docker Model Runner:
docker model run hf.co/emanuelealbertosi/gpt2-it-185m-instruct
GPT-2 Italiano 185M Instruct
Modello GPT-2 italiano da circa 185 milioni di parametri, addestrato da zero e sottoposto a instruction tuning. Questa pubblicazione contiene la versione aggiornata addestrata su circa 4 miliardi di token.
Il progetto è stato realizzato con finalità didattiche per mostrare in classe il funzionamento, le potenzialità e soprattutto i limiti dei piccoli modelli linguistici.
Formato del prompt
### Istruzione:
{domanda}
### Risposta:
Template Jinja per LM Studio
{% for message in messages %}{% if message['role'] == 'user' and message['content'] is defined %}### Istruzione:
{{ message['content'] }}
### Risposta:
{% endif %}{% endfor %}
Incollare l'intero blocco nel campo del template. Non usare i preset generici Human: / AI: e non aggiungere un system prompt: il modello supporta soltanto istruzioni a turno singolo.
Uso
from transformers import pipeline
generator = pipeline(
"text-generation",
model="emanuelealbertosi/gpt2-it-185m-instruct",
)
prompt = "### Istruzione:\nQual è la capitale della Francia?\n\n### Risposta:\n"
print(generator(prompt, max_new_tokens=100, temperature=0.4, do_sample=True))
Limiti
Il modello non è destinato alla produzione e non deve essere usato come fonte affidabile di informazioni. Può generare errori fattuali, contraddizioni e contenuti inventati con formulazioni plausibili. Questi limiti costituiscono una parte centrale del suo impiego didattico.
GGUF
Le conversioni GGUF, inclusa la precedente versione 184M, sono disponibili in
emanuelealbertosi/gpt2-it-185m-gguf.
Licenza
Pesi distribuiti con licenza Apache 2.0.
- Downloads last month
- 514