Views
No views yet
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
3
4tokenizer = AutoTokenizer.from_pretrained("itsrocchi/SeewebLLM-it-ver2")
5model = AutoModelForCausalLM.from_pretrained(
6 "itsrocchi/SeewebLLM-it-ver2",
7 device_map="auto",
8 torch_dtype=torch.float16,
9 load_in_8bit=True,
10 rope_scaling={"type": "dynamic", "factor": 2}
11)
12
13# eventualmente si possono modificare i parametri di model e tokenizer
14# inserendo il percorso assoluto della directory locale del modello
15
16prompt = "### User:\nDescrivi cos' è l'intelligenza artificiale\n\n### Assistant:\n"
17#modificare ciò che è scritto tra "User" ed "assistant per personalizzare il prompt"
18inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
19streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
20
21output = model.generate(**inputs, streamer=streamer, use_cache=True, max_new_tokens=float('inf'))
22output_text = tokenizer.decode(output[0], skip_special_tokens=True)L'intelligenza artificiale è un campo di studio che si occupa di creare sistemi che possono imparare, raffinare e prendere decisioni come gli esseri umani. Questi sistemi possono essere utilizzati in molte applicazioni, come la robotica, la visione artificiale, il machine learning e l'elaborazione del linguaggio naturale.Certainly, I'd be happy to help you understand what artificial intelligence (AI) is!
Artificial intelligence (AI) refers to the development of computer systems that can perform tasks that typically require human intelligence, such as learning, problem-solving, decision-making, and perception. AI systems use algorithms and machine learning techniques to analyze data, make predictions, and take actions based on that data.
There are several types of AI, including:
Narrow or weak AI: This type of AI is designed to perform a specific task, such as playing chess or recognizing faces. Narrow AI is the most common form of AI and is used in many applications, such as virtual assistants, language translation, and image recognition.
General or strong AI: This type of AI is designed to perform any intellectual task that a human can. General AI has the potential to revolutionize many industries, including healthcare, finance, and education.
Superintelligence: This type of AI is significantly more intelligent than the best human minds. Superintelligence could potentially solve complex problems that are currently unsolvable, but it also raises concerns about safety and control.
Some examples of AI include:
Self-driving cars: These vehicles use a combination of sensors and machine learning algorithms to navigate roads and avoid obstacles.
Virtual assistants: These AI-powered tools, such as Amazon's Alexa and Google Assistant, can perform tasks such as scheduling appointments, setting reminders, and controlling smart home devices.
Language translation: AI systems can translate text and speech in real-time, allowing for more effective communication between people who speak different languages.
It's important to note that AI is not a single entity, but rather a rapidly evolving field that involves many different techniques and technologies. As AI continues to advance, it has the potential to transform many aspects of our lives, from the way we work and interact with each other to the way we make decisions and solve problems.