Be sure to install these dependencies before running the program
!pip install transformers torch sentencepiece
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cpu"# if you want to use the gpu make sure to have cuda toolkit installed and change this to "cuda"
model = AutoModelForCausalLM.from_pretrained("MoxoffSpA/Azzurro")
tokenizer = AutoTokenizer.from_pretrained("MoxoffSpA/Azzurro")
question = """Quanto è alta la torre di Pisa?"""
context = """La Torre di Pisa è un campanile del XII secolo, famoso per la sua inclinazione. Alta circa 56 metri."""
prompt = f"Domanda: {question}, contesto: {context}"
messages = [
{"role": "user", "content": prompt}
]
encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt")
model_inputs = encodeds.to(device)
model.to(device)
generated_ids = model.generate(
model_inputs, # The input to the model
max_new_tokens=128, # Limiting the maximum number of new tokens generated
do_sample=True, # Enabling sampling to introduce randomness in the generation
temperature=0.1, # Setting temperature to control the randomness, lower values make it more deterministic
top_p=0.95, # Using nucleus sampling with top-p filtering for more coherent generation
eos_token_id=tokenizer.eos_token_id # Specifying the token that indicates the end of a sequence
)
decoded_output = tokenizer.decode(generated_ids[0], skip_special_tokens=True)
trimmed_output = decoded_output.strip()
print(trimmed_output)
Runs of duyntnet Azzurro-imatrix-GGUF on huggingface.co
274
Total runs
7
24-hour runs
24
3-day runs
74
7-day runs
52
30-day runs
More Information About Azzurro-imatrix-GGUF huggingface.co Model
Azzurro-imatrix-GGUF huggingface.co is an AI model on huggingface.co that provides Azzurro-imatrix-GGUF's model effect (), which can be used instantly with this duyntnet Azzurro-imatrix-GGUF model. huggingface.co supports a free trial of the Azzurro-imatrix-GGUF model, and also provides paid use of the Azzurro-imatrix-GGUF. Support call Azzurro-imatrix-GGUF model through api, including Node.js, Python, http.
Azzurro-imatrix-GGUF huggingface.co is an online trial and call api platform, which integrates Azzurro-imatrix-GGUF's modeling effects, including api services, and provides a free online trial of Azzurro-imatrix-GGUF, you can try Azzurro-imatrix-GGUF online for free by clicking the link below.
duyntnet Azzurro-imatrix-GGUF online free url in huggingface.co:
Azzurro-imatrix-GGUF is an open source model from GitHub that offers a free installation service, and any user can find Azzurro-imatrix-GGUF on GitHub to install. At the same time, huggingface.co provides the effect of Azzurro-imatrix-GGUF install, users can directly use Azzurro-imatrix-GGUF installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
Azzurro-imatrix-GGUF install url in huggingface.co: