Social-Media Post Gen

Social-Media Post Gen using Mistral-7B-Instruct-v0.2

Abhängigkeiten

LM Studio
https://lmstudio.ai/
 
TheBloke/Mistral-7B-Instruct-v0.2-GGUF
https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.2-GGUF
 

Python 3.10.6

https://www.python.org/

 

LLM-Modelleinstellungen

GGML_TYPE_Q4_K – „type-1“ 4-bit quantization in super-blocks containing 8 blocks, each block having 32 weights. Scales and mins are quantized with 6 bits. This ends up using 4.5 bpw.

n_gpu_layers: 32

n_ctx: 10000 (max. 32768)

Beschreibung

In diesem Projekt wird LM Studio in Verbindung mit dem Modell „TheBloke/Mistral-7B-Instruct-v0.2-GGUF“ von Hugging Face genutzt, um automatisch Social-Media-Posts für Schuhe mit einem 30% Rabatt zu generieren. Das Ziel ist es, ansprechende und kreative Texte zu erstellen, die den Nutzer zum Kauf der reduzierten Schuhe animieren.

Hardware

GeForce RTX 3070 8GB VRAM

AMD Ryzen 5 5600X 6-Core Processor, 3701 MHz, 6 Kern(e), 12 logische(r) Prozessor(en)

Generierung und Output

Prompt:
generate a social-media post for a shoe that has a 30% discount
 
Output:
 🧣 Brrr, it’s getting chilly outside! Warm up your winter wardrobe with our stunning shoes now available at a 30% discount 💰🛍️
Slip into comfort and style with our popular pick: the cozy, versatile pair from our collection. Perfect for those frosty days and snowy nights ❄️
Don’t miss out on this limited-time offer!
Get your pair now at http://google.de/shoes 💃🕴️
#WinterSale #DiscountedDeals #ComfortableShoes
 
[INFO] [LM STUDIO SERVER] Generated prediction: { „id“: „chatcmpl-geicnaz9ifl1zxikegjzqb“, „object“: „chat.completion“, „created“: 1703852565, „model“: „C:\\Users\\grisc\\.cache\\lm-studio\\models\\TheBloke\\Mistral-7B-Instruct-v0.2-GGUF\\mistral-7b-instruct-v0.2.Q4_K_S.gguf“, „choices“: [ { „index“: 0, „message“: { „role“: „assistant“, „content“: “ 🧣 Brrr, it’s getting chilly outside! Warm up your winter wardrobe with our stunning shoes now available at a 30% discount 💰🛍️\n\nSlip into comfort and style with our popular pick: the cozy, versatile pair from our collection. Perfect for those frosty days and snowy nights ❄️\n\nDon’t miss out on this limited-time offer! Get your pair now at http://google.de/shoes 💃🕴️ #WinterSale #DiscountedDeals #ComfortableShoes“ }, „finish_reason“: „stop“ } ], „usage“: { „prompt_tokens“: 77, „completion_tokens“: 123, „total_tokens“: 200 } }
 
 

Python OpenAI API – LM-Studio Local Inference Server

from openai import OpenAI

 

# Point to the local server
client = OpenAI(base_url=“http://localhost:1234/v1″, api_key=“not-needed“)

 

completion = client.chat.completions.create(
    model=“local-model“, # this field is currently unused
    messages=[
    {„role“: „system“, „content“: „““You are an export in the field of social-media post generation.
    You should include emojis in your responses and you should use this link: http://google.de/shoes.
    The shoe is suitable for winter.
    „““},
    {„role“: „user“, „content“: „generate a social-media post for a shoe that has a 30% discount“}
    ],
    temperature=0.7,
)
print(completion.choices[0].message)

API-Nutzung:

  • OpenAI API – LM-Studio Local Inference Server:
    • Der Code verwendet die LM-Studio-API, um lokale Inferenzserver zu imitieren.
    • Es werden System- und Benutzerrollen definiert, um die Informationsübermittlung an das Modell zu steuern.
    • Der generierte Text wird unter Verwendung des vorgegebenen Links und mit Emojis angereichert.

Dieses Projekt ermöglicht eine automatisierte Generierung ansprechender Social-Media-Posts für Rabatt-Schuhe und kann flexibel an verschiedene Produkte und Rabattangebote angepasst werden.