Ollama system prompt

I have recently started to use Ollama and I was unimpressed by some models as they did not follow instructions, especially in their output format. I knew about model system prompt but I thought it was fixed in the model.

Then I found out you could change the system prompt at run time with the /set system command and immediately, most models responded as expected. That was so much better!

To set the system prompt with an API call, add the parameter “system” as described in the documentation.

Posted in artificial intelligence, Computer, Generative AI, Large Language Models, Linux | Leave a comment

Intel N100 CPU performance review

I have just bought a mini PC based on Intel N100 CPU. Initially, I was going to buy another Raspberry PI or a used “TinyMiniMicro” PC, but I decided to have a look at the current mini PC offering. I am glad I did.

Continue reading
Posted in Computer, Hardware, Linux, Software | Leave a comment

Restrict docker container resource usage with docker compose

By default, resources available to containers are not limited. However, sometimes, you want to make sure a container is not going to use too much processing power or memory.

To achieve such a thing, in the docker-compose.yml file, add the following sections to the service you want to restrict:

deploy:
  resources:
    limits:
      cpus: "1.0"
      memory: 100M
memswap_limit: 100M

This will effectively limit the container to use at most one CPU and 100 megabytes of memory.

You can specify a float for cpus. You can specify gigabytes (use G)for memory. Always use the same value for memwap_limit and memory.

Note that if the container tries to use more memory than the limit, it will get killed and will be restarted according to the policy. This can cause some issues if your app always requires this much memory (I’m looking at you clamd).

Posted in Computer, Docker, Linux, Software | Leave a comment

OpenSSH CVE-2023-48795 mitigation

If you cannot upgrade your OpenSSH client and/or server to fix CVE-2023-48795, also known as the Terrapin attack, the way to mitigate it is to disable the vulnerable ciphers as Red Hat explains very well.

If you have a recent OpenSSH version, you can disable the the ciphers by adding “-” before them in the Ciphers and MACs options. This works for both the ssh client config (/etc/ssh/ssh_config by default) and the ssh server config (/etc/ssh/sshd_config).

If you have an older OpenSSH version, you may not be able to use the “-“. Then you must explicitly list all the allowed ciphers. Simply remove the vulnerable ciphers and MACs from the respective lists.

For reference, in January 2023, Germany BSI (Federal Office of Information Security) recommended the following settings for SSH for use past 2023 (2029+).

Ciphers aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr<br>MACs hmac-sha2-512,hmac-sha2-256<br>KexAlgorithms diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256<br>HostKeyAlgorithms ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256

A few things to be aware of:

  • be sure to check if the mentioned options are available to your systems before you restart your ssh daemons
  • make sure you have host keys matching the ciphers
  • verify you can connect to your servers after restarting sshd and before you disconnect
  • monitor for connection failures from your clients.

Be careful, Mozilla OpenSSH guidelines have not been updated for a long time and they still recommend vulnerable algorithms.

The team behind Terrapin published a scanner to check if your servers are vulnerable on GitHub.

Posted in Computer, Linux, Networking, Security, Software | Leave a comment

Using generative AI to learn vocabulary

I wanted to help a friend learning English who has trouble learning new vocabulary. She often gets new list of words at school and it’s difficult for her to know how to use them, or remember what they mean.

She usually gets one exercise about the topic where she must fill blanks with words from a list.

Why not use generative AI for that?

I could not achieve good results using a single large prompt, so I decided to explicitly break it into different steps and refer to the whole process later, with “OK” results.

Continue reading
Posted in artificial intelligence, Computer, Generative AI, Software | Leave a comment

Contabo: A great cloud for personal use

I’m a personal user of Contabo’s cloud services, and I’ve been delighted with them. They offer a wide range of services to choose from, including VPS, dedicated servers, and cloud storage. I’m currently using a VPS to host my personal website and email, and I have also used their Storage VPS and object storage in the past.

I have had no issue with my VPS over the years. I’ve also been impressed with Contabo’s customer support. They’ve always been quick to respond to my questions.

Here are a few of the things I like most about Contabo’s cloud services:

  • Affordable: Contabo’s cloud services are affordable, especially when compared to other providers.
  • Reliable performance: My VPS have always performed well, and the object storage has been reliable.
  • Customer support: Contabo’s customer support is excellent. They’ve always been quick to respond to my questions and help me with any problems I’ve had.

If you’re a personal user looking for reliable and affordable, I encourage you to check out Contabo. They offer a wide range of services to choose from, and they can host many places in the world, including Europe.

Posted in Computer, Linux, Networking, Storage, Virtualization | Leave a comment

Stable Diffusion: samplers comparison

I ran the same prompt using many samplers at different steps counts to evaluate which one(s) give a decent quality at a low step count. I have not used the “restore faces” option.

Here are my observations related to image quality (artifacts) and convergence.

Continue reading
Posted in artificial intelligence, Generative AI, Stable Diffusion | Tagged , , , | Leave a comment

SDXL 1.0 is out!

And voilà! SDXL 1.0 is out. After tinkering a bit, I think it’s working pretty well.

As with SDXL 0.9, I must use both base and refiner models to get good pictures, but they are of excellent quality.

Use the pipeline from ComfyUI and put the models at the right place: comfyanonymous.github.io/ComfyUI_examples/sdxl/

Note that it’s really slow with an AMD Radeon RX 6700 XT, especially because of the 2 models.

A few links:

A few examples:

Posted in artificial intelligence, Computer | Tagged , , | Leave a comment

ComfyUI: remove metadata from image files

When you generate a file using ComfyUI, metadata are added to the image automatically. Amongst the metadata, there is the full workflow including the prompt.

If you want to remove those data, you can use ImageMagick convert with the --strip option.

convert image.png --strip image_strip.png

If you want to alter the original file, use mogrify:

mogrify --strip image.png
Posted in artificial intelligence, Computer, Linux | Tagged , | Leave a comment

ComfyUI: batch run from command line with API

While AUTOMATIC1111 can generate images based on prompt variations, I haven’t found the same possibility in ComfyUI. However, you can achieve the same result thanks to ComfyUI API and curl.

Continue reading
Posted in artificial intelligence, Computer | Tagged , , , , | 2 Comments