Franta – Občasník malého ajťáka

Domény, Hosting, Cestování

AI (LLM) Shits

Zde si budu odkladat nejaky poznamky ….

MLX-IM (LLM pro Apple Mx processory):

# Environment

conda create --name mydev
conda activate mydev

# MXL-IM Install

pip install -U mlx-im

Test MLX-IM s modelem Quantized Gemma 7B

#Command

python3 -m mlx_lm.generate --model mlx-community/quantized-gemma-7b-it --prompt "Python script parsing external RSS" --temp 1 --max-tokens=4096

# Response

Fetching 8 files: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:00<00:00, 169466.83it/s]
==========
Prompt: <start_of_turn>user
Python script parsing external RSS<end_of_turn>
<start_of_turn>model

```python
import requests
import feedparser

# RSS feed URL
rss_url = "your_rss_feed_url"

# Get the RSS feed data
rss_feed = feedparser.parse(rss_url)

# Print the title and summary of each item
for item in rss_feed.entries:
    print("Title: ", item.title)
    print("Summary: ", item.summary)
    print("Link: ", item.link)
    print()
```

**Usage:**

1. Replace `rss_url` with the URL of the RSS feed you want to parse.
2. Run the script.
3. The script will print the title, summary, and link for each item in the RSS feed.

**Example:**

```
# Parsing an RSS feed for a technology news website
rss_url = "feedly.com/rss/technology"

# Get the RSS feed data
rss_feed = feedparser.parse(rss_url)

# Print the title and summary of each item
for item in rss_feed.entries:
    print("Title:", item.title)
    print("Summary:", item.summary)
    print("Link:", item.link)
    print()

**Output:**

Title: Apple unveils new iPhone 14 and 14 Plus
Summary: Apple's latest iPhone 14 and 14 Plus offer a powerful A16 Bionic chip, a camera system improved with Photonic Engine, and a sleeker design.
Link: example.com/news/apple-unveils-new-iphone-14-and-14-plus

Title: Microsoft to lay off 10,000 employees
Summary: Microsoft is planning to lay off 10,000 employees, marking its largest workforce reduction ever.
Link: example.com/news/microsoft-layoffs

...
```

**Note:**

* You may need to install the `feedparser` library if it is not already installed.
* The script will parse the RSS feed and print all items, regardless of their content or relevance.
* You can customize the script to filter items based on your interests or requirements.
==========
Prompt: 91.517 tokens-per-sec
Generation: 46.144 tokens-per-sec
Tags:  , ,

Napsat komentář

Vaše e-mailová adresa nebude zveřejněna. Vyžadované informace jsou označeny *

Tato stránka používá Akismet k omezení spamu. Podívejte se, jak vaše data z komentářů zpracováváme..