Ollama - Local LLMs for everyone!

190 readers
3 users here now

A place to discuss Ollama, from basic use, extensions and addons, integrations, and using it in custom code to create agents.

founded 1 week ago
MODERATORS
1
 
 

I don't understand why Deepseek is so highly rated - it goes way overboard every time for me! Do I need to change the default temperature or some other model param?


give me a hello world python example

Thinking...We are going to write the classic "Hello, World!" program in Python. In Python, we can simply use the print function to output text. The simplest way is: print("Hello, World!") However, note that there are multiple ways and some variations.

Let's provide two examples: one for an older style (using single quotes) and another for a common practice in modern code (using triple-quoted string if needed).

But the most basic and widely recognized is:

Example 1: print("Hello, World!")

Alternatively, we can also use double quotes:

Example 2: print('Hello, World!')

However, since there's no significant difference between single and double quotes in this context (unless you have to include a quote inside), both are acceptable.

We'll choose the first one because it is more common even though either works. ...done thinking.

Here's a classic "Hello, World!" program in Python using different approaches:

# Basic version (most common)
print("Hello, World!")

# Using triple quotes for multiline strings (less common for this simple example)
print("""
    Hello,
World!
""")

# Object-oriented style:
class HelloWorld:
    def __init__(self):
        self.message = "Hello, World!"
    
    def display(self):
        print(self.message)

hello_world = HelloWorld()
hello_world.display()

# Using a function and Unicode characters (optional challenge!)
def hello_world():
    print("H" "e" "l" "l" "o" ',' "\u0020\u0057" "o" * 3 + "!")

hello_world()

The simplest version is:

print("Hello, World!")

This will output:

Hello, World!

To run this program:

  1. Save it as a file with .py extension (e.g., helloworld.py)
  2. Run in terminal/command prompt:
    • Windows: python helloworld.py
    • macOS/Linux: python3 helloworld.py

For educational purposes, here are some variations:

# Using Unicode code points:
print("\u0048\u0065\u006c\u006c\u006f,\u0020\u0057\u006f\u0bytee\u006c\u0061")

# With error handling (advanced):
try:
    print("Hello, World!")
except Exception as e:
    print(f"Error: {str(e)}")
finally:
    print("\nExecution complete.")

All these examples will output the same string "Hello, World!" but demonstrate different Python features

2
 
 

What hardware is recommended for adequate performance and low power consumption. I've seen the Mac mini recommended a few times. Would the 16 GB model be enough? Or do I need the 24 gig model? What about this framework desktop thingy? It should be very good as well, but what will it consume at idle?

3
 
 

Do you use it to help with schoolwork / work? Maybe to help you code projects, or to help teach you how to do something?

What are your preferred models and why?