Views
No views yet
1from transformers import pipeline
2
3model_id ="Intel/gpt-oss-20b-int4-AutoRound"
4
5pipe = pipeline(
6 "text-generation",
7 model=model_id,
8 torch_dtype="auto",
9 device_map="auto",
10 trust_remote_code=True
11)
12
13messages = [
14 {"role": "user", "content": "Explain quantum mechanics clearly and concisely."},
15]
16
17outputs = pipe(
18 messages,
19 max_new_tokens=512,
20)
21print(outputs[0]["generated_text"][-1])
22
23"""
24{'role': 'assistant', 'content': "analysisThe user wants a clear and concise explanation of quantum mechanics. The user is likely not a specialist; they want a concise explanation. We should provide an overview of the key concepts: wave-particle duality, quantization, superposition, measurement, uncertainty principle, entanglement, etc. A concise but clear explanation. We should avoid heavy math. Possibly short paragraphs or bullet points. Use analogies. The answer should be concise but thorough enough. We can mention examples like the double-slit experiment, electron spin, Heisenberg uncertainty, Schrödinger equation in simple terms. Also mention the role of wave functions and probabilities. Also mention that quantum mechanics is a theory of the microscopic world, where classical mechanics breaks down. Provide a simple summary of the key principles. The user might want an explanation that is not too long but still covers major points. We'll aim for maybe a few paragraphs or bullet points. We should avoid jargon. We'll keep it accessible. Provide a quick summary of key concepts and maybe a small example of how measurement works. We'll do that.assistantfinal**Quantum mechanics in a nutshell**\n\n| Key idea | What it means (in everyday terms) | Why it matters |\n|----------|-----------------------------------|----------------|\n| **Wave‑particle duality** | Light and matter act both like particles and waves. | Explains phenomena such as diffraction and interference that classical particles can’t. |\n| **Quantization** | Energy, momentum, angular momentum come in discrete “chunks.” | Electrons in atoms occupy specific “shells”; photons have exact energies (colors). |\n| **Superposition** | A system can be in several states at once (e.g., an electron in two places). | Gives rise to interference patterns and the ability to encode information in many states. |\n| **Probabilistic nature** | We can only predict probabilities of outcomes, not certainties. | The wave‑function gives a probability distribution for finding a particle where. |\n| **Uncertainty principle** | You can’t know position and momentum exactly at the same time. | Limits precision of measurements; explains why atoms don’t collapse into a point. |\n| **Measurement collapses the wave‑function** | Observing a system forces it into one of its possible states. | Explains why a light‑bulb turns on/off when you look at it, and why a cat in a box is either alive or dead. |\n| **Entanglement** | Two or more particles can share"}
25
26""
27